| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <template>
- <mescroll :up="up" :down="down" @up="upFn" :fixed="false" @down="downFn" @init="initMeScroll">
- <card :list="list" ></card>
- </mescroll>
- </template>
- <script>
- import mescroll from '@/components/mescroll-body/mescroll-uni.vue'
- import card from './card.vue'
- export default {
- components:{
- mescroll,card
- },
- props: {
- type: Number,
- i: Number,
- item:Object,
- refresh:Boolean
- },
- data() {
- return {
- isInit: false, // 是否初始化
- list: [], // 列表数据
- mescroll: null, // mescroll 对象
- // 上拉配置参数
- up: {
- noMoreSize: 5,
- auto: false,
- },
- // 下拉配置参数
- down: {
- use: false,
- auto: false
- }
- }
- },
- watch:{
- type(val) {
- if(!this.isInit && val === this.i) {
- this.mescroll.resetUpScroll()
- }
- },
- refresh(){
- this.mescroll.resetUpScroll()
- }
- },
- mounted() {
- if(!this.isInit && this.i === 0) {
- this.mescroll.resetUpScroll()
- }
- },
- methods: {
- initMeScroll(mescroll) {
- this.mescroll = mescroll
- },
- //上拉刷新
- upFn(mescroll) {
- let params={
- current:mescroll.num,
- size:mescroll.size,
- mallId:this.vuex_mallId,
- launchType:this.$global.sponsorType.shop,//审核商户的活动
- auditStatus:this.item.value
- }
- try{
- this.$api.activity.list(params).then(res=>{
- let data=res.data.records
- let length=data.length
- let total=res.data.total
- mescroll.endBySize(length, total);
- if(mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
- this.list=this.list.concat(data); //追加新数据
- })
- }catch(e){
- mescroll.endErr();
- }
- },
- //下拉加载
- downFn(mescroll) {
- setTimeout(()=>{
- this.$u.toast('刷新成功')
- this.mescroll.resetUpScroll()
- },1500)
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- view{
- box-sizing: border-box;
- }
- </style>
|