deming/pageE/order/Index.vue

166 lines
4.7 KiB
Vue
Raw Normal View History

2020-06-08 15:23:23 +08:00
<template>
<view class="order">
<view>
<u-tabs-swiper ref="tabs" :list="list" :is-scroll="false" active-color="#FF780F" :current="current" font-size="26" @change="tabsChange" height="88" :gutter="30"></u-tabs-swiper>
</view>
<swiper :current="swiperCurrent" @animationfinish="animationfinish">
<swiper-item class="swiper-item">
2020-06-19 18:07:11 +08:00
<scroll-view scroll-y style="height: 100%;" @scrolltolower="reachBottom">
<view>
<view class="item-container" v-for="(item, index) in orderList" :key="index">
<OrderItem :current="current"></OrderItem>
</view>
<u-loadmore :status="loadStatus[5]" bgColor="#ECECEC" margin-bottom="20"></u-loadmore>
2020-06-08 15:23:23 +08:00
</view>
</scroll-view>
</swiper-item>
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;">
2020-06-19 18:07:11 +08:00
<view>
<view class="item-container" v-for="(item, index) in orderList" :key="index">
<OrderItem :current="current"></OrderItem>
</view>
<u-loadmore :status="loadStatus[5]" bgColor="#ECECEC" margin-bottom="20"></u-loadmore>
2020-06-08 15:23:23 +08:00
</view>
</scroll-view>
</swiper-item>
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;">
2020-06-19 18:07:11 +08:00
<view>
<view class="item-container" v-for="(item, index) in orderList" :key="index">
<OrderItem :current="current"></OrderItem>
</view>
<u-loadmore :status="loadStatus[5]" bgColor="#ECECEC" margin-bottom="20"></u-loadmore>
2020-06-08 15:23:23 +08:00
</view>
</scroll-view>
</swiper-item>
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;">
2020-06-19 18:07:11 +08:00
<view>
<view class="item-container" v-for="(item, index) in orderList" :key="index">
<OrderItem :current="current"></OrderItem>
</view>
<u-loadmore :status="loadStatus[5]" bgColor="#ECECEC" margin-bottom="20"></u-loadmore>
2020-06-08 15:23:23 +08:00
</view>
</scroll-view>
</swiper-item>
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;">
2020-06-19 18:07:11 +08:00
<view>
<view class="item-container" v-for="(item, index) in orderList" :key="index">
<OrderItem :current="current"></OrderItem>
</view>
<u-loadmore :status="loadStatus[5]" bgColor="#ECECEC" margin-bottom="20"></u-loadmore>
2020-06-08 15:23:23 +08:00
</view>
</scroll-view>
</swiper-item>
<swiper-item class="swiper-item">
2020-06-19 18:07:11 +08:00
<scroll-view scroll-y style="height: 100%;" @scrolltolower="reachBottom">
<view>
<view class="item-container" v-for="(item, index) in orderList" :key="index">
<OrderItem :current="current"></OrderItem>
</view>
<u-loadmore :status="loadStatus[5]" bgColor="#ECECEC" margin-bottom="20"></u-loadmore>
2020-06-08 15:23:23 +08:00
</view>
</scroll-view>
</swiper-item>
<swiper-item class="swiper-item">
2020-06-19 18:07:11 +08:00
<scroll-view scroll-y style="height: 100%;" @scrolltolower="reachBottom">
<view>
<view class="item-container" v-for="(item, index) in orderList" :key="index">
<OrderItem :current="current"></OrderItem>
</view>
<u-loadmore :status="loadStatus[6]" bgColor="#ECECEC" margin-bottom="20"></u-loadmore>
2020-06-08 15:23:23 +08:00
</view>
</scroll-view>
</swiper-item>
</swiper>
</view>
</template>
<script>
import OrderItem from '@/components/mine/order-item/index'
export default {
data() {
return {
list: [{
name: '全部'
}, {
name: '待支付'
}, {
name: '已取消'
}, {
name: '待收货'
}, {
name: '试穿试送'
}, {
name: '待评价'
}, {
name: '售后'
}],
2020-06-19 18:07:11 +08:00
orderList: 5,
loadStatus: ['loadmore','loadmore','loadmore','loadmore','loadmore','loadmore','loadmore'],
page: 0,
2020-06-08 15:23:23 +08:00
current: 0,
2020-06-19 18:07:11 +08:00
swiperCurrent: 0,
2020-06-08 15:23:23 +08:00
}
},
components: {
OrderItem
},
onLoad(option) {
if(option.current) {
this.current = Number(option.current);
this.swiperCurrent = this.current;
}
2020-06-30 18:06:50 +08:00
this.getOrderList();
2020-06-08 15:23:23 +08:00
},
methods: {
2020-06-30 18:06:50 +08:00
getOrderList() {
this.$u.api.getOrderList({
page: this.page,
}).then(res => {
if(res.errCode == 0) {
}
})
},
2020-06-19 18:07:11 +08:00
reachBottom() {
// console.log(this.page);
if(this.page >= 3) return;
// 修改当前的 loadStatus
console.log(this.loadStatus);
this.loadStatus.splice(this.current, 1, "loading");
this.page++;
setTimeout(() => {
this.orderList += 5;
this.loadStatus.splice(this.current, 1, "nomore");
}, 1200);
},
2020-06-08 15:23:23 +08:00
tabsChange(index) {
2020-06-19 18:07:11 +08:00
this.current = Number(index);
2020-06-08 15:23:23 +08:00
this.swiperCurrent = Number(index);
},
animationfinish(e) {
let current = Number(e.detail.current);
this.swiperCurrent = current;
this.current = current;
}
}
};
</script>
<style lang="scss" scoped>
.order {
min-height: calc(100vh - var(--window-top));
background-color: #ECECEC;
display: flex;
flex-direction: column;
> uni-swiper {
flex: 1;
}
.swiper-item {
.item-container {
padding: 20rpx 30rpx;
}
}
}
</style>