|
|
<template>
|
|
|
<div style="height: 100%;">
|
|
|
<div class="head"></div>
|
|
|
<ClassicTabs ref="tabs" v-model="selectLabel" :data="tabLabels" @on-filter-change="onFilterChange"></ClassicTabs>
|
|
|
|
|
|
<div class="tab-slide-container">
|
...
|
...
|
@@ -14,31 +13,29 @@ |
|
|
@scroll="scroll"
|
|
|
@change="changePage"
|
|
|
>
|
|
|
<SlideItem style="background-color: #f0f0f0;">
|
|
|
<ExchangeBox v-model="inputCouponCode" @click="onSubmitCode"></ExchangeBox>
|
|
|
|
|
|
<SlideItem>
|
|
|
<div class="filter-wrapper" v-if="showFilter">
|
|
|
<div class="filter-mask" @click="onMaskClick"></div>
|
|
|
<FilterBar :list="filterList" v-model="selectFilterId" class="filter"></FilterBar>
|
|
|
</div>
|
|
|
|
|
|
<div class="head"></div>
|
|
|
<ExchangeBox v-model="inputCouponCode" @click="onSubmitCode"></ExchangeBox>
|
|
|
|
|
|
<ScrollView ref="notuse" :data="getNotUseList" :options="scrollOptions" v-if="getNotUseList.length" :reach-bottom="reachBottom">
|
|
|
<ScrollView class="scroll-view1" ref="notuse" :data="getNotUseList" :options="scrollOptions" v-if="getNotUseList.length" :reach-bottom="reachBottom">
|
|
|
<CouponItem :item="item" v-for="(item, index) in getNotUseList" :key="index"></CouponItem>
|
|
|
</ScrollView>
|
|
|
<Empty v-else></Empty>
|
|
|
</SlideItem>
|
|
|
|
|
|
<SlideItem style="background-color: #f0f0f0;">
|
|
|
<ScrollView ref="use" :data="getUseList" :options="scrollOptions" v-if="getUseList.length" :reach-bottom="reachBottom">
|
|
|
<SlideItem>
|
|
|
<ScrollView class="scroll-view2" ref="use" :data="getUseList" :options="scrollOptions" v-if="getUseList.length" :reach-bottom="reachBottom">
|
|
|
<CouponItem :item="item" v-for="(item, index) in getUseList" :key="index"></CouponItem>
|
|
|
</ScrollView>
|
|
|
<Empty v-else></Empty>
|
|
|
</SlideItem>
|
|
|
|
|
|
<SlideItem style="background-color: #f0f0f0;">
|
|
|
<ScrollView ref="overtime" :data="getOvertimeList" options="scrollOptions" v-if="getOvertimeList.length" :reach-bottom="reachBottom">
|
|
|
<SlideItem>
|
|
|
<ScrollView class="scroll-view2" ref="overtime" :data="getOvertimeList" :options="scrollOptions" v-if="getOvertimeList.length" :reach-bottom="reachBottom">
|
|
|
<CouponItem :item="item" v-for="(item, index) in getOvertimeList" :key="index"></CouponItem>
|
|
|
</ScrollView>
|
|
|
<Empty v-else></Empty>
|
...
|
...
|
@@ -69,18 +66,22 @@ export default { |
|
|
asyncData({store}) {
|
|
|
return Promise.all([
|
|
|
store.dispatch('coupon/yoho/fetchYohoList', {
|
|
|
type: TYPE.notuse,
|
|
|
}),
|
|
|
type: TYPE.notuse,
|
|
|
refresh: true
|
|
|
}),
|
|
|
store.dispatch('coupon/yoho/fetchYohoList', {
|
|
|
type: TYPE.use,
|
|
|
}),
|
|
|
type: TYPE.use,
|
|
|
refresh: true
|
|
|
}),
|
|
|
store.dispatch('coupon/yoho/fetchYohoList', {
|
|
|
type: TYPE.overtime,
|
|
|
})
|
|
|
type: TYPE.overtime,
|
|
|
refresh: true
|
|
|
})
|
|
|
]);
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
selectIndex: 0,
|
|
|
selectLabel: '未使用',
|
|
|
selectType: TYPE.notuse,
|
|
|
showFilter: false,
|
...
|
...
|
@@ -112,7 +113,8 @@ export default { |
|
|
more: '加载更多',
|
|
|
noMore: '以上是最新的内容'
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
bounce: true
|
|
|
},
|
|
|
slideOptions: {
|
|
|
listenScroll: true,
|
...
|
...
|
@@ -140,6 +142,7 @@ export default { |
|
|
methods: {
|
|
|
...mapActions(['getCouponCode', 'fetchYohoList', 'fetchYohoNum']),
|
|
|
changePage(current) {
|
|
|
this.selectIndex = current;
|
|
|
this.selectLabel = this.tabLabels[current].label;
|
|
|
this.selectType = this.tabLabels[current].type;
|
|
|
},
|
...
|
...
|
@@ -169,15 +172,22 @@ export default { |
|
|
}
|
|
|
});
|
|
|
},
|
|
|
reachBottom() {
|
|
|
this.fetchYohoList({type: this.selectType});
|
|
|
reachBottom(refresh = false) {
|
|
|
this.fetchYohoList({
|
|
|
type: this.selectType,
|
|
|
filter: this.tabLabels[this.selectIndex].selectFilterId,
|
|
|
refresh
|
|
|
}).then(() => {
|
|
|
this.$refs[this.selectType].forceUpdate();
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
selectFilterId(val) {
|
|
|
this.tabLabels[0].selectFilterId = val;
|
|
|
this.$refs.notuse.scrollTo(0, 0);
|
|
|
this.onMaskClick();
|
|
|
return this.changePage(0);
|
|
|
this.reachBottom(true);
|
|
|
}
|
|
|
},
|
|
|
components: {
|
...
|
...
|
@@ -194,8 +204,9 @@ export default { |
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
.head {
|
|
|
height: 90px;
|
|
|
|
|
|
.page-wrapper {
|
|
|
height: calc(100% - 90px);
|
|
|
}
|
|
|
|
|
|
.tab-slide-container {
|
...
|
...
|
@@ -205,7 +216,8 @@ export default { |
|
|
.filter-wrapper {
|
|
|
width: calc(100% / 3);
|
|
|
height: 100%;
|
|
|
position: fixed;
|
|
|
position: absolute;
|
|
|
top: 0;
|
|
|
z-index: 4;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -218,4 +230,12 @@ export default { |
|
|
height: 100%;
|
|
|
background-color: rgba(0, 0, 0, 0.4);
|
|
|
}
|
|
|
|
|
|
.scroll-view1 {
|
|
|
height: calc(100% - 270px);
|
|
|
}
|
|
|
|
|
|
.scroll-view2 {
|
|
|
height: calc(100% - 180px);
|
|
|
}
|
|
|
</style> |
...
|
...
|
|