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)) && ( + }}>继续支付 )} )}