group buy 8.8

This commit is contained in:
2020-08-08 12:07:50 +08:00
parent 1ee0dd4b25
commit 02702bc447
16 changed files with 110 additions and 93 deletions

View File

@@ -1,19 +1,20 @@
<template>
<view class="order">
<view>
<u-tabs-swiper ref="tabs" :list="list" active-color="#FF780F" :current="current" font-size="26" @change="tabsChange" height="88" :gutter="30"></u-tabs-swiper>
<!-- <u-tabs-swiper ref="tabs" :list="list" active-color="#FF780F" :current="current" font-size="26" @change="tabsChange" height="88" :gutter="30"></u-tabs-swiper> -->
<u-tabs :list="list" name="gc_name" :is-scroll="true" :current="current" @change="tabsChange" active-color="#FF780F" :show-bar="false" height="88" font-size="26" :gutter="20" inactive-color="#333333"></u-tabs>
</view>
<swiper :current="swiperCurrent" @animationfinish="animationfinish" :style="{ height: swiperHeight }">
<swiper-item class="swiper-item" v-for="(item, index) in list" :key="index">
<scroll-view scroll-y style="height: 100%;" @scrolltolower="reachBottom" class="order-scroll">
<view>
<view class="item-container" v-for="order in orderList" :key="order.order_id">
<view v-if="orderList[index]">
<view class="item-container" v-for="order in orderList[index]" :key="order.order_id">
<OrderItem :order="order" @refreshOrderList="refreshOrderList" v-if="current != 4"></OrderItem>
<TryOrderItem :order="order" @refreshOrderList="refreshOrderList" v-else></TryOrderItem>
</view>
</view>
<u-empty text="暂无订单" mode="order" color="#000000" v-if="!orderList.length"></u-empty>
<u-loadmore :status="loadStatus[index]" bgColor="#ECECEC" margin-bottom="20" v-if="current != 4 && orderList.length>3" class="order-loadmore"></u-loadmore>
<u-empty text="暂无订单" mode="order" color="#000000" v-if="!orderList[index] || !orderList[index].length"></u-empty>
<u-loadmore :status="loadStatus[index]" bgColor="#ECECEC" margin-bottom="20" v-if="current != 4 && (!orderList[index] || orderList[index].length>3)" class="order-loadmore"></u-loadmore>
</scroll-view>
</swiper-item>
</swiper>
@@ -57,9 +58,7 @@ export default {
},
watch: {
current(value, origin) {
if((origin == 4 && value != 4) || (value == 4 && origin != 4)) {
this.orderList = [];
}
// this.orderList = [];
this.page = 0;
// reload 重新请求列表 loadmore 往列表里添加
if(value == 4) {
@@ -69,6 +68,9 @@ export default {
}
},
},
onShow() {
this.refreshOrderList();
},
onLoad(option) {
const current = option.current ? Number(option.current) : 0;
this.current = current;
@@ -131,23 +133,25 @@ export default {
this.timer = true;
uni.stopPullDownRefresh(); // 结束刷新
if(res.errCode == 0) {
if(load == 'reload') this.orderList = res.data;
else if(load == 'loadmore') this.orderList.push(...res.data);
}
return res.data.length;
},
// 售后
async getAfterSaleList({ load = 'loadmore' } = {}) {
const res = await this.$u.api.getAfterSaleList({
page: this.page,
})
this.timer = true;
if(res.errCode == 0) {
if(load == 'reload') this.orderList = res.data;
else if(load == 'loadmore') this.orderList.push(...res.data);
if(load == 'reload') this.orderList[this.current] = res.data;
else if(load == 'loadmore') this.orderList[this.current].push(...res.data);
}
this.$forceUpdate();
// console.log(this.orderList);
return res.data.length;
},
// 售后 废弃
// async getAfterSaleList({ load = 'loadmore' } = {}) {
// const res = await this.$u.api.getAfterSaleList({
// page: this.page,
// })
// this.timer = true;
// if(res.errCode == 0) {
// if(load == 'reload') this.orderList[this.current] = res.data;
// else if(load == 'loadmore') this.orderList[this.current].push(...res.data);
// }
// return res.data.length;
// },
// 试穿
async goodsTryOrderList({ load = 'loadmore' } = {}) {
const res = await this.$u.api.goodsTryOrderList({
@@ -156,9 +160,10 @@ export default {
uni.stopPullDownRefresh(); // 结束刷新
this.timer = true;
if(res.errCode == 0) {
if(load == 'reload') this.orderList = res.data.list;
else if(load == 'loadmore') this.orderList.push(...res.data.list);
if(load == 'reload') this.orderList[this.current] = res.data.list;
else if(load == 'loadmore') this.orderList[this.current].push(...res.data.list);
}
this.$forceUpdate();
return res.data.list.length;
},
reachBottom() {