调整优惠券部分
This commit is contained in:
@@ -13,6 +13,7 @@ Page({
|
||||
data: {
|
||||
currentList: [],
|
||||
canGetList: [],
|
||||
active: 0,
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -21,7 +22,17 @@ Page({
|
||||
onLoad(options) {
|
||||
|
||||
},
|
||||
|
||||
onChange(e) {
|
||||
console.log('e', e)
|
||||
this.setData({
|
||||
active: e.detail.index,
|
||||
}, () => {
|
||||
const { active } = this.data;
|
||||
this.init(active);
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
@@ -33,8 +44,20 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
const { active } = this.data;
|
||||
this.init(active);
|
||||
},
|
||||
init(active) {
|
||||
switch(active) {
|
||||
case 0:
|
||||
this.getCurrent()
|
||||
break;
|
||||
case 1:
|
||||
this.getCanGet();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
async getCurrent() {
|
||||
const that = this;
|
||||
loadingFunc(async() => {
|
||||
|
@@ -2,7 +2,8 @@
|
||||
"usingComponents": {
|
||||
"navigator": "/components/navigator/index",
|
||||
"van-tab": "@vant/weapp/tab/index",
|
||||
"van-tabs": "@vant/weapp/tabs/index"
|
||||
"van-tabs": "@vant/weapp/tabs/index",
|
||||
"discount-coupon": "/components/discountCoupon/index"
|
||||
},
|
||||
"navigationStyle": "custom"
|
||||
}
|
@@ -3,13 +3,17 @@
|
||||
<van-tabs active="{{ active }}" bind:change="onChange">
|
||||
<van-tab title="我的优惠券">
|
||||
<view wx:if="{{currentList.length}}">
|
||||
|
||||
<view wx:for="{{currentList}}" wx:key="id">
|
||||
<discount-coupon data="{{item}}" type="{{3}}" />
|
||||
</view>
|
||||
</view>
|
||||
<empty bind:refresh="getCurrent" />
|
||||
</van-tab>
|
||||
<van-tab title="领券中心">
|
||||
<view wx:if="{{canGetList.length}}">
|
||||
|
||||
<view wx:for="{{canGetList}}" wx:key="id">
|
||||
<discount-coupon data="{{item}}" type="{{1}}" bind:get="getCanGet" />
|
||||
</view>
|
||||
</view>
|
||||
<empty bind:refresh="getCanGet" />
|
||||
</van-tab>
|
||||
|
Reference in New Issue
Block a user