|
@@ -6,7 +6,7 @@
|
|
|
</view>
|
|
|
<swiper style="height: calc(100% - 40px);" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish">
|
|
|
<swiper-item class="swiper-item" v-for="(item, index) in tabsList" :key="index">
|
|
|
- <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="onreachBottom">
|
|
|
+ <scroll-view scroll-y style="height: 100%;width: 100%;">
|
|
|
<couponTpl :list="couponList"></couponTpl>
|
|
|
<u-empty :text="noDataText" img-width="120" v-if="couponList.length==0 && status!='loading'" mode="list"></u-empty>
|
|
|
<view style="padding: 20upx;">
|
|
@@ -28,13 +28,16 @@
|
|
|
data() {
|
|
|
return {
|
|
|
noDataText: '暂无数据',
|
|
|
- status: 'loadmore',
|
|
|
+ status: 'loading',
|
|
|
tabsList: [{
|
|
|
- name: '未使用'
|
|
|
+ name: '未使用',
|
|
|
+ status: 0
|
|
|
}, {
|
|
|
- name: '已使用'
|
|
|
+ name: '已使用',
|
|
|
+ status: 1
|
|
|
}, {
|
|
|
- name: '已过期'
|
|
|
+ name: '已过期',
|
|
|
+ status: -1
|
|
|
}],
|
|
|
couponList: [{
|
|
|
id: 23432445,
|
|
@@ -85,10 +88,19 @@
|
|
|
count:0
|
|
|
};
|
|
|
},
|
|
|
+ onLoad() {
|
|
|
+ this.pageInit()
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ pageInit () {
|
|
|
+ this.current = 0 // tabs组件的current值,表示当前活动的tab选项
|
|
|
+ this.swiperCurrent = 0
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
// tabs通知swiper切换
|
|
|
tabsChange(index) {
|
|
|
this.swiperCurrent = index;
|
|
|
+ this.getList()
|
|
|
},
|
|
|
// swiper-item左右移动,通知tabs的滑块跟随移动
|
|
|
transition(e) {
|
|
@@ -102,14 +114,20 @@
|
|
|
this.$refs.uTabs.setFinishCurrent(current);
|
|
|
this.swiperCurrent = current;
|
|
|
this.current = current;
|
|
|
- },
|
|
|
- // scroll-view到底部加载更多
|
|
|
- onreachBottom() {
|
|
|
-
|
|
|
+ this.getList()
|
|
|
},
|
|
|
// 获取优惠卷列表
|
|
|
getList(){
|
|
|
-
|
|
|
+ this.status = 'loading'
|
|
|
+ let item = this.tabsList[this.swiperCurrent]
|
|
|
+ couponListFind({status:item.status}).then(res=>{
|
|
|
+ this.status = 'loadmore'
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.couponList = res.data
|
|
|
+ } else {
|
|
|
+ this.couponList = []
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
};
|