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