From ef61a7638a0a1c7de941b561aa52639cc22df151 Mon Sep 17 00:00:00 2001 From: xcbyy <2578898740@qq.com> Date: Thu, 22 Oct 2026 11:29:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(order):=20=E6=9C=8D=E5=8A=A1=E7=AB=AF?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E5=90=8E=E7=8A=B6=E6=80=81=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=BD=93=E5=89=8D=20tab=EF=BC=8C=E5=8F=96?= =?UTF-8?q?=E6=B6=88/=E6=94=AF=E4=BB=98/=E9=AA=8C=E6=94=B6/=E9=80=80?= =?UTF-8?q?=E6=AC=BE=E5=90=8E=E4=B8=8D=E5=9C=A8=E6=9C=AC=20tab=20=E7=9A=84?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=AB=8B=E5=8D=B3=E7=A7=BB=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 避免分页+服务端筛选后,已取消/已完成订单仍停留在原 tab 的回归 --- pwuniapp/pages/order/list.vue | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/pwuniapp/pages/order/list.vue b/pwuniapp/pages/order/list.vue index 256025b..a9fc36c 100644 --- a/pwuniapp/pages/order/list.vue +++ b/pwuniapp/pages/order/list.vue @@ -545,6 +545,15 @@ const getStatusText = (status, order) => { return map[status] || status; }; +// 服务端分页后,状态变化需要同步当前 tab:不在本 tab 的订单立即移除 +const applyOrderStatus = (order, status) => { + if (!order) return; + order.status = status; + if (currentTab.value !== 'ALL' && currentTab.value !== status) { + orders.value = orders.value.filter(o => o.id !== order.id); + } +}; + const cancelOrder = (id) => { uni.showModal({ title: '提示', @@ -559,9 +568,7 @@ const cancelOrder = (id) => { loadLiveOrders(); return; } - const o = orders.value.find(item => item.id === id); - if (o) o.status = 'CANCELLED'; - else orders.value = orders.value.filter(o => o.id !== id); + applyOrderStatus(orders.value.find(item => item.id === id), 'CANCELLED'); uni.showToast({ title: '订单已取消', icon: 'none' }); } } @@ -589,10 +596,8 @@ const payOrder = async (id) => { buyerId: uid }); uni.hideLoading(); - if (o) { - o.status = 'IN_SERVICE'; - o.rawStatus = '履约中'; - } + applyOrderStatus(o, 'IN_SERVICE'); + if (o) o.rawStatus = '履约中'; uni.showToast({ title: '支付成功,服务已开始', icon: 'success' }); } catch (err) { uni.hideLoading(); @@ -711,8 +716,7 @@ const submitRefundTicket = async () => { description: refundForm.value.description.trim(), evidence: refundForm.value.evidence }); - const o = orders.value.find(item => item.id === oId); - if (o) o.status = 'REFUNDING'; + applyOrderStatus(orders.value.find(item => item.id === oId), 'REFUNDING'); uni.hideLoading(); closeRefundModal(); uni.showToast({ title: '退款申诉已受理,进入争议仲裁流程', icon: 'success' }); @@ -839,8 +843,7 @@ const confirmComplete = (id) => { loadLiveOrders(); return; } - const o = orders.value.find(item => item.id === id); - if (o) o.status = 'COMPLETED'; + applyOrderStatus(orders.value.find(item => item.id === id), 'COMPLETED'); uni.showToast({ title: '已确认验收,感谢您的支持!', icon: 'success' }); } }