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

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