|
|
<template>
|
|
|
<div style="height: 100%;">
|
|
|
<ClassicTabs ref="tabs" v-model="selectLabel" :data="tabLabels" @on-filter-change="onFilterChange"></ClassicTabs>
|
|
|
<ClassicTabs ref="tabs" v-model="selectLabel" :data="tabLabels" :filterId.sync="selectFilterId"></ClassicTabs>
|
|
|
|
|
|
<div class="tab-slide-container">
|
|
|
<Slide
|
...
|
...
|
@@ -14,11 +14,6 @@ |
|
|
@change="changePage"
|
|
|
>
|
|
|
<SlideItem style="background-color: #f0f0f0;">
|
|
|
<div class="filter-wrapper" v-if="showFilter">
|
|
|
<div class="filter-mask" @click="onMaskClick"></div>
|
|
|
<FilterBar :list="filterList" v-model="selectFilterId" class="filter"></FilterBar>
|
|
|
</div>
|
|
|
|
|
|
<ExchangeBox v-model="inputCouponCode" @click="onSubmitCode"></ExchangeBox>
|
|
|
|
|
|
<ScrollView class="scroll-view1" ref="notuse" :data="getNotUseList" :options="scrollOptions" v-if="getNotUseList.length" :reach-bottom="reachBottom">
|
...
|
...
|
@@ -63,28 +58,11 @@ const TYPE = {notuse: 'notuse', use: 'use', overtime: 'overtime'}; |
|
|
|
|
|
export default {
|
|
|
name: 'YohoCouponListPage',
|
|
|
asyncData({store}) {
|
|
|
return Promise.all([
|
|
|
store.dispatch('coupon/yoho/fetchYohoList', {
|
|
|
type: TYPE.notuse,
|
|
|
refresh: true
|
|
|
}),
|
|
|
store.dispatch('coupon/yoho/fetchYohoList', {
|
|
|
type: TYPE.use,
|
|
|
refresh: true
|
|
|
}),
|
|
|
store.dispatch('coupon/yoho/fetchYohoList', {
|
|
|
type: TYPE.overtime,
|
|
|
refresh: true
|
|
|
})
|
|
|
]);
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
selectIndex: 0,
|
|
|
selectLabel: '未使用',
|
|
|
selectType: TYPE.notuse,
|
|
|
showFilter: false,
|
|
|
selectFilterId: 0,
|
|
|
inputCouponCode: '',
|
|
|
tabLabels: [
|
...
|
...
|
@@ -118,8 +96,8 @@ export default { |
|
|
},
|
|
|
slideOptions: {
|
|
|
listenScroll: true,
|
|
|
click: false,
|
|
|
probeType: 3,
|
|
|
click: false,
|
|
|
directionLockThreshold: 0
|
|
|
},
|
|
|
};
|
...
|
...
|
@@ -134,10 +112,18 @@ export default { |
|
|
return index;
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
},
|
|
|
mounted() {
|
|
|
this.fetchYohoNum();
|
|
|
|
|
|
this.$store.dispatch('coupon/yoho/fetchYohoList', {
|
|
|
type: TYPE.use,
|
|
|
refresh: true
|
|
|
});
|
|
|
|
|
|
this.$store.dispatch('coupon/yoho/fetchYohoList', {
|
|
|
type: TYPE.overtime,
|
|
|
refresh: true
|
|
|
});
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions(['getCouponCode', 'fetchYohoList', 'fetchYohoNum']),
|
...
|
...
|
@@ -149,25 +135,22 @@ export default { |
|
|
scroll() {
|
|
|
|
|
|
},
|
|
|
onFilterChange(show) {
|
|
|
this.showFilter = show;
|
|
|
},
|
|
|
onMaskClick() {
|
|
|
this.showFilter = false;
|
|
|
this.$refs.tabs.showFilter = false;
|
|
|
},
|
|
|
onSubmitCode() {
|
|
|
this.getCouponCode({code: this.inputCouponCode}).then(result => {
|
|
|
if (result.code === 200) {
|
|
|
this.inputCouponCode = '';
|
|
|
this.$createToast({
|
|
|
txt: result.message,
|
|
|
type: 'correct'
|
|
|
type: 'txt',
|
|
|
mask: true,
|
|
|
time: 1000
|
|
|
}).show();
|
|
|
} else {
|
|
|
this.$createToast({
|
|
|
txt: result.message,
|
|
|
type: 'error'
|
|
|
type: 'txt',
|
|
|
mask: true,
|
|
|
time: 1000
|
|
|
}).show();
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -178,7 +161,7 @@ export default { |
|
|
filter: this.tabLabels[this.selectIndex].selectFilterId,
|
|
|
refresh
|
|
|
}).then(() => {
|
|
|
this.$refs[this.selectType].forceUpdate();
|
|
|
this.$refs[this.selectType] && this.$refs[this.selectType].forceUpdate();
|
|
|
});
|
|
|
}
|
|
|
},
|
...
|
...
|
@@ -186,7 +169,6 @@ export default { |
|
|
selectFilterId(val) {
|
|
|
this.tabLabels[0].selectFilterId = val;
|
|
|
this.$refs.notuse && this.$refs.notuse.scrollTo(0, 0);
|
|
|
this.onMaskClick();
|
|
|
this.reachBottom(true);
|
|
|
}
|
|
|
},
|
...
|
...
|
@@ -213,24 +195,6 @@ export default { |
|
|
height: 100%;
|
|
|
}
|
|
|
|
|
|
.filter-wrapper {
|
|
|
width: calc(100% / 3);
|
|
|
height: 100%;
|
|
|
position: absolute;
|
|
|
top: 0;
|
|
|
z-index: 4;
|
|
|
}
|
|
|
|
|
|
.filter {
|
|
|
position: absolute;
|
|
|
top: 0;
|
|
|
}
|
|
|
|
|
|
.filter-mask {
|
|
|
height: 100%;
|
|
|
background-color: rgba(0, 0, 0, 0.4);
|
|
|
}
|
|
|
|
|
|
.scroll-view1 {
|
|
|
height: calc(100% - 270px);
|
|
|
}
|
...
|
...
|
|