From e6cf9c082cc836cc5d44c9abe450791b05f108eb Mon Sep 17 00:00:00 2001 From: linxi <957440651@qq.com> Date: Tue, 14 Jul 2026 10:01:13 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A5454=20=E3=80=90=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E3=80=91=E8=B4=AD=E4=B9=B0=E5=95=86?= =?UTF-8?q?=E5=93=81=EF=BC=8C=E5=BE=AE=E4=BF=A1=E6=94=AF=E4=BB=98=E4=B8=8B?= =?UTF-8?q?=E5=8D=95=E5=90=8E=E6=9C=AA=E6=94=AF=E4=BB=98=EF=BC=8C=E5=BE=85?= =?UTF-8?q?=E4=BB=98=E6=AC=BE=E5=88=97=E8=A1=A8=E6=98=BE=E7=A4=BA=E4=B8=A4?= =?UTF-8?q?=E6=9D=A1=E7=9B=B8=E5=90=8C=E8=AE=A2=E5=8D=95=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit ea44413ac1e7984e8d35d95b3a3ace60850e9cde) --- pages/order/MyOrder/index.vue | 45 +++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/pages/order/MyOrder/index.vue b/pages/order/MyOrder/index.vue index 8345232..9993449 100644 --- a/pages/order/MyOrder/index.vue +++ b/pages/order/MyOrder/index.vue @@ -54,7 +54,7 @@ { - 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() });