coupon
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="coupon-swiper">
|
||||
<u-tabs-swiper ref="coupon" :list="couponGroupList" :is-scroll="true" active-color="#FF780F" :current="couponCurrent" font-size="24" :show-bar="false" @change="couponTabsChange" height="88" ></u-tabs-swiper>
|
||||
<u-tabs-swiper ref="coupon" :list="couponGroupList" name="gc_name" :is-scroll="true" active-color="#FF780F" :current="couponCurrent" font-size="24" :show-bar="false" @change="couponTabsChange" height="88" ></u-tabs-swiper>
|
||||
<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%;">
|
||||
@@ -31,43 +31,9 @@ export default {
|
||||
swiperHeight: '',
|
||||
couponCurrent: 0,
|
||||
swiperCouponCurrent: 0,
|
||||
couponGroupList: [
|
||||
{
|
||||
name: '平台'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}
|
||||
],
|
||||
couponList: [
|
||||
{
|
||||
index: 0
|
||||
},
|
||||
{
|
||||
index: 1
|
||||
},
|
||||
],
|
||||
couponGroupList: [],
|
||||
couponList: [],
|
||||
page: 0,
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@@ -75,8 +41,35 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.setViewHeight();
|
||||
this.getGoodsClass();
|
||||
},
|
||||
watch: {
|
||||
couponCurrent(index) {
|
||||
const id = this.couponGroupList[index].gc_id;
|
||||
this.getCouponList({ gc_id: id });
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getGoodsClass() {
|
||||
this.$u.api.getGoodsClass().then(res => {
|
||||
if(res.errCode == 0) {
|
||||
this.couponGroupList = res.data;
|
||||
this.getCouponList(this.couponGroupList[0].gc_id);
|
||||
}
|
||||
})
|
||||
},
|
||||
getCouponList({ gc_id }) {
|
||||
this.$u.api.getCouponList({
|
||||
page: this.page,
|
||||
gc_id: gc_id,
|
||||
}).then(res => {
|
||||
if(res.errCode == 0) {
|
||||
this.couponList = res.data;
|
||||
} else {
|
||||
this.couponList = [];
|
||||
}
|
||||
})
|
||||
},
|
||||
exchangeCoupon(id) {
|
||||
console.log(id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user