Merge pull request '修复了订单重复' (#341) from xbx into master

Reviewed-on: http://git.luyuan.tk/luyuan/deming/pulls/341
This commit is contained in:
luyuan 2020-09-05 16:12:17 +08:00
commit 72bfc5fa18
2 changed files with 28 additions and 6 deletions

View File

@ -8,7 +8,7 @@
<view class="order-status">{{ state }}</view> <view class="order-status">{{ state }}</view>
</view> </view>
<view class="goods-info"> <view class="goods-info">
<view class="goods-item" @click="toOtherPage('Details')" v-for="goods in order.extend_order_goods" :key="goods.goods_id"> <view class="goods-item" @click="toOtherPage('Details')" v-for="(goods,index) in order.extend_order_goods" :key="index">
<image :src="goods.goods_image"></image> <image :src="goods.goods_image"></image>
<view class="goods-text"> <view class="goods-text">
<view class="goods-name u-line-2">{{ goods.goods_name }}</view> <view class="goods-name u-line-2">{{ goods.goods_name }}</view>

View File

@ -7,7 +7,7 @@
<swiper-item class="swiper-item" v-for="(item, index) in list" :key="index"> <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"> <scroll-view scroll-y style="height: 100%;" @scrolltolower="reachBottom" class="order-scroll">
<view v-if="orderList[index]"> <view v-if="orderList[index]">
<view class="item-container" v-for="order in orderList[index]" :key="order.order_id"> <view class="item-container" v-for="(order,index) in orderList[index]" :key="index">
<OrderItem :order="order" @refreshOrderList="refreshOrderList" v-if="current != 4"></OrderItem> <OrderItem :order="order" @refreshOrderList="refreshOrderList" v-if="current != 4"></OrderItem>
<TryOrderItem :order="order" @refreshOrderList="refreshOrderList" v-else></TryOrderItem> <TryOrderItem :order="order" @refreshOrderList="refreshOrderList" v-else></TryOrderItem>
</view> </view>
@ -129,13 +129,30 @@ export default {
page: this.page, page: this.page,
type: type, type: type,
}) })
console.log(load)
res.data.forEach(element => {
element.extend_order_goods.forEach(i=>{
console.log(i)
})
});
this.timer = true; this.timer = true;
uni.stopPullDownRefresh(); // uni.stopPullDownRefresh(); //
if(res.errCode == 0) { if(res.errCode == 0) {
if(load == 'reload') this.orderList[this.current] = res.data; if(load == 'reload'){
else if(load == 'loadmore') this.orderList[this.current].push(...res.data); this.orderList[this.current] = []
this.orderList[this.current] = res.data;
}else if(load == 'loadmore'){
this.orderList[this.current].push(...res.data);
}
} }
this.orderList[this.current].forEach(element => {
element.extend_order_goods.forEach(i=>{
console.log(i)
})
});
this.$forceUpdate(); this.$forceUpdate();
// console.log(this.orderList); // console.log(this.orderList);
return res.data.length; return res.data.length;
}, },
@ -156,11 +173,16 @@ export default {
const res = await this.$u.api.goodsTryOrderList({ const res = await this.$u.api.goodsTryOrderList({
page: this.page, page: this.page,
}) })
console.log(res)
uni.stopPullDownRefresh(); // uni.stopPullDownRefresh(); //
this.timer = true; this.timer = true;
if(res.errCode == 0) { if(res.errCode == 0) {
if(load == 'reload') this.orderList[this.current] = res.data.list; if(load == 'reload') {
else if(load == 'loadmore') this.orderList[this.current].push(...res.data.list); this.orderList[this.current] = []
this.orderList[this.current] = res.data.list;
}else if(load == 'loadmore'){
this.orderList[this.current].push(...res.data.list);
}
} }
this.$forceUpdate(); this.$forceUpdate();
return res.data.list.length; return res.data.list.length;