From 86f7506422883c908c5588fce28e5c738aca857d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Sun, 8 Mar 2026 10:41:00 +0800 Subject: [PATCH] =?UTF-8?q?fix(order):=20=E8=A7=A3=E5=86=B3=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E5=8F=96=E6=B6=88=E5=90=8E=E5=8A=A0=E8=BD=BD=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=9C=AA=E6=AD=A3=E7=A1=AE=E9=87=8D=E7=BD=AE=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在支付流程中添加 skipFinallyResetPayLoading 标志来控制加载状态 - 检测用户取消支付情况并跳转到待付款订单列表页面 - 优化支付取消后的页面导航逻辑,支持 redirectTo 和 navigateTo 两种方式 - 修改订单列表中的按钮文案"取消订单"为"取消" - 修改订单列表中的按钮文案"立即支付"为"继续支付" --- src/shop/orderConfirm/index.tsx | 28 ++++++++++++++++++++++++- src/user/order/components/OrderList.tsx | 4 ++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/shop/orderConfirm/index.tsx b/src/shop/orderConfirm/index.tsx index 7364dac..c6765b0 100644 --- a/src/shop/orderConfirm/index.tsx +++ b/src/shop/orderConfirm/index.tsx @@ -430,6 +430,7 @@ const OrderConfirm = () => { * 统一支付入口 */ const onPay = async (goods: ShopGoods) => { + let skipFinallyResetPayLoading = false try { setPayLoading(true) @@ -603,6 +604,29 @@ const OrderConfirm = () => { // }) } catch (error: any) { const message = String(error?.message || '') + const isUserCancelPay = + message.includes('用户取消支付') || + message.includes('取消支付') || + message.toLowerCase().includes('requestpayment:fail cancel') || + message.toLowerCase().includes('cancel') + + // 用户取消支付:跳转到待付款列表,方便继续支付 + if (isUserCancelPay) { + skipFinallyResetPayLoading = true + setPayLoading(false) + const url = '/user/order/order?statusFilter=0' + try { + await Taro.redirectTo({ url }) + } catch (_e) { + try { + await Taro.navigateTo({ url }) + } catch (_e2) { + // ignore + } + } + return + } + const isOutOfDeliveryRange = message.includes('不在配送范围') || message.includes('配送范围') || @@ -632,7 +656,9 @@ const OrderConfirm = () => { Taro.showToast({ title: message || '支付失败,请重试', icon: 'none' }) } } finally { - setPayLoading(false) + if (!skipFinallyResetPayLoading) { + setPayLoading(false) + } } }; diff --git a/src/user/order/components/OrderList.tsx b/src/user/order/components/OrderList.tsx index 2962b65..29f8cd8 100644 --- a/src/user/order/components/OrderList.tsx +++ b/src/user/order/components/OrderList.tsx @@ -820,12 +820,12 @@ function OrderList(props: OrderListProps) { + }}>取消 {(!item.createTime || !isPaymentExpired(item.createTime, 24)) && ( + }}>继续支付 )} )}