This commit is contained in:
2020-08-09 18:39:35 +08:00
parent 9631e9f827
commit 9b93b6a5a9
20 changed files with 148 additions and 66 deletions

View File

@@ -7,11 +7,11 @@
<swiper :current="swiperCouponCurrent" @animationfinish="couponAnimationFinish" :style="{ height: swiperHeight }">
<swiper-item class="swiper-coupon-item" v-for="(_, i) in couponGroupList" :key="i">
<scroll-view scroll-y style="height: 100%;" @scrolltolower="onreachBottom" class="coupon-scroll">
<view v-for="(coupon, index) in couponList" :key="index" class="coupon-item">
<view v-for="(coupon, index) in couponList[i]" :key="index" class="coupon-item">
<Coupon :couponInfo="coupon" :status='0' :type="0" @exchange="exchangeCoupon($event)"></Coupon>
</view>
<u-loadmore :status="loadStatus" bgColor="#FFF" margin-top="20" margin-bottom="20" v-if="couponList.length>=pageSize" @loadmore="onreachBottom"></u-loadmore>
<u-empty text="暂无优惠券" mode="coupon" color="#000" v-if="!couponList.length"></u-empty>
<u-empty text="暂无优惠券" mode="coupon" color="#000" v-if="!couponList[i] || !couponList[i].length"></u-empty>
<u-loadmore :status="loadStatus" bgColor="#FFF" margin-bottom="60" v-if="!couponList[i] || couponList[i].length>=pageSize" @loadmore="onreachBottom"></u-loadmore>
</scroll-view>
</swiper-item>
</swiper>
@@ -49,7 +49,7 @@ export default {
},
watch: {
couponCurrent(index) {
this.couponList = [];
// this.couponList = [];
const id = this.couponGroupList[index].gc_id;
this.getCouponList({ gc_id: id, load: 'reload' });
},
@@ -89,9 +89,10 @@ export default {
})
this.timer = true;
if(res.errCode == 0) {
if(load == 'reload') this.couponList = res.data;
else if(load == 'loadmore') this.couponList.push(...res.data);
if(load == 'reload') this.couponList[this.couponCurrent] = res.data;
else if(load == 'loadmore') this.couponList[this.couponCurrent].push(...res.data);
}
this.$forceUpdate();
return res.data.length;
},
exchangeCoupon(id) {
@@ -109,7 +110,7 @@ export default {
},
setViewHeight() {
const res = uni.getSystemInfoSync();
this.swiperHeight = res.windowHeight - ((88 + 10 + 88) / 2) + 'px';
this.swiperHeight = res.windowHeight - ((88 + 10 + 88) * (res.windowWidth / 750)) + 'px';
},
},
};