fix(order): 服务端分页后状态变更同步当前 tab,取消/支付/验收/退款后不在本 tab 的订单立即移除
- 避免分页+服务端筛选后,已取消/已完成订单仍停留在原 tab 的回归
这个提交包含在:
@@ -545,6 +545,15 @@ const getStatusText = (status, order) => {
|
|||||||
return map[status] || status;
|
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) => {
|
const cancelOrder = (id) => {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
@@ -559,9 +568,7 @@ const cancelOrder = (id) => {
|
|||||||
loadLiveOrders();
|
loadLiveOrders();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const o = orders.value.find(item => item.id === id);
|
applyOrderStatus(orders.value.find(item => item.id === id), 'CANCELLED');
|
||||||
if (o) o.status = 'CANCELLED';
|
|
||||||
else orders.value = orders.value.filter(o => o.id !== id);
|
|
||||||
uni.showToast({ title: '订单已取消', icon: 'none' });
|
uni.showToast({ title: '订单已取消', icon: 'none' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -589,10 +596,8 @@ const payOrder = async (id) => {
|
|||||||
buyerId: uid
|
buyerId: uid
|
||||||
});
|
});
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
if (o) {
|
applyOrderStatus(o, 'IN_SERVICE');
|
||||||
o.status = 'IN_SERVICE';
|
if (o) o.rawStatus = '履约中';
|
||||||
o.rawStatus = '履约中';
|
|
||||||
}
|
|
||||||
uni.showToast({ title: '支付成功,服务已开始', icon: 'success' });
|
uni.showToast({ title: '支付成功,服务已开始', icon: 'success' });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
@@ -711,8 +716,7 @@ const submitRefundTicket = async () => {
|
|||||||
description: refundForm.value.description.trim(),
|
description: refundForm.value.description.trim(),
|
||||||
evidence: refundForm.value.evidence
|
evidence: refundForm.value.evidence
|
||||||
});
|
});
|
||||||
const o = orders.value.find(item => item.id === oId);
|
applyOrderStatus(orders.value.find(item => item.id === oId), 'REFUNDING');
|
||||||
if (o) o.status = 'REFUNDING';
|
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
closeRefundModal();
|
closeRefundModal();
|
||||||
uni.showToast({ title: '退款申诉已受理,进入争议仲裁流程', icon: 'success' });
|
uni.showToast({ title: '退款申诉已受理,进入争议仲裁流程', icon: 'success' });
|
||||||
@@ -839,8 +843,7 @@ const confirmComplete = (id) => {
|
|||||||
loadLiveOrders();
|
loadLiveOrders();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const o = orders.value.find(item => item.id === id);
|
applyOrderStatus(orders.value.find(item => item.id === id), 'COMPLETED');
|
||||||
if (o) o.status = 'COMPLETED';
|
|
||||||
uni.showToast({ title: '已确认验收,感谢您的支持!', icon: 'success' });
|
uni.showToast({ title: '已确认验收,感谢您的支持!', icon: 'success' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
在新工单中引用
屏蔽一个用户