This commit is contained in:
2020-07-17 17:34:42 +08:00
parent 5a4e302899
commit 7b9479d56c
10 changed files with 308 additions and 291 deletions

View File

@@ -4,7 +4,7 @@
<swiper :current="swiperCurrent" @animationfinish="animationfinish" :style="{ height: swiperHeight }">
<swiper-item class="swiper-item" v-for="(_, index) in list" :key="index">
<scroll-view scroll-y class="scroll-coupon">
<view class="coupon-item" v-for="(coupon, c_index) in test" :key="c_index">
<view class="coupon-item" v-for="(coupon, c_index) in couponList" :key="c_index">
<Coupon :couponInfo="coupon" :status='index' :type="1" @use="useCoupon($event)"></Coupon>
</view>
</scroll-view>
@@ -24,35 +24,10 @@ export default {
}, {
name: '已过期'
}],
current: 0,
current: Number,
swiperCurrent: 0,
swiperHeight: '',
test: [
{
index: 0
},
{
index: 1
},
{
index: 2
},
{
index: 3
},
{
index: 4
},
{
index: 5
},
{
index: 6
},
{
index: 7
}
]
couponList: []
}
},
components: {
@@ -61,7 +36,25 @@ export default {
onLoad() {
this.setViewHeight();
},
onShow() {
this.current = 0;
},
watch: {
current(value) {
let status = value + 1;
this.getMemberCouponList(status);
}
},
methods: {
getMemberCouponList(current) {
this.$u.api.getMemberCouponList({
status: current
}).then(res => {
if(res.errCode == 0) {
this.couponList = res.data;
}
})
},
useCoupon(id) {
console.log(id);
},