Fix:5454 【商城小程序】购买商品,微信支付下单后未支付,待付款列表显示两条相同订单记录

This commit is contained in:
linxi
2026-07-14 10:01:13 +08:00
parent 13a9b7a2f6
commit ea44413ac1
+32 -13
View File
@@ -54,7 +54,7 @@
<view class="list v12-ma-0" style="padding: 0rpx 0 30rpx;"> <view class="list v12-ma-0" style="padding: 0rpx 0 30rpx;">
<view <view
v-for="(order, orderListIndex) in orderList" v-for="(order, orderListIndex) in orderList"
:key="orderListIndex" :key="order.orderId || orderListIndex"
class="item" class="item"
> >
<view <view
@@ -725,7 +725,8 @@ export default {
showDatePicker: false, showDatePicker: false,
dateRange: [], dateRange: [],
userLatitude: null, userLatitude: null,
userLongitude: null userLongitude: null,
orderListRequestId: 0
} }
}, },
components: { components: {
@@ -984,9 +985,7 @@ export default {
}, },
delOrder(order) { delOrder(order) {
delOrderHandle(order.orderId).then(() => { delOrderHandle(order.orderId).then(() => {
this.page = 1 this.changeType()
this.orderList = [];
this.getOrderListReq()
}) })
}, },
goStore(order) { goStore(order) {
@@ -1260,6 +1259,23 @@ export default {
reload() { reload() {
this.changeType(this.type) this.changeType(this.type)
}, },
normalizeOrderList(list = []) {
const orderKeySet = new Set()
return list.reduce((result, item) => {
const orderKey = item && (item.orderId || item.id)
if (orderKey && orderKeySet.has(orderKey)) {
return result
}
if (orderKey) {
orderKeySet.add(orderKey)
}
result.push({
...item,
showMore: false
})
return result
}, [])
},
tabChange(item) { tabChange(item) {
this.type = item.index this.type = item.index
this.$yroute.query.type = this.type this.$yroute.query.type = this.type
@@ -1300,6 +1316,7 @@ export default {
}) })
}, },
changeType() { changeType() {
this.orderListRequestId += 1
this.orderList = [] this.orderList = []
this.page = 1 this.page = 1
this.loaded = false this.loaded = false
@@ -1308,7 +1325,8 @@ export default {
}, },
getOrderListReq() { getOrderListReq() {
if (this.loading || this.loaded) return if (this.loading || this.loaded) return
// this.loading = true this.loading = true
const currentRequestId = this.orderListRequestId
uni.showLoading({ uni.showLoading({
mask: true, mask: true,
}) })
@@ -1335,17 +1353,18 @@ export default {
keyword, keyword,
orderType orderType
}).then(res => { }).then(res => {
this.orderList = this.orderList.concat(res.data) if (currentRequestId !== this.orderListRequestId) {
if (this.orderList.length > 0) { return
this.orderList.forEach(item => {
item.showMore = false;
})
} }
const nextOrderList = page === 1 ? res.data : this.orderList.concat(res.data)
this.orderList = this.normalizeOrderList(nextOrderList)
this.updateOrderDistances() this.updateOrderDistances()
this.page++; this.page = page + 1
this.loaded = res.data.length < this.limit this.loaded = res.data.length < this.limit
this.loading = false
}).finally(() => { }).finally(() => {
if (currentRequestId !== this.orderListRequestId) {
return
}
this.loading = false this.loading = false
uni.hideLoading() uni.hideLoading()
}); });