From cce108a666437718cbd0e97a43d4783814cdd83c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Mon, 22 Sep 2025 13:41:55 +0800 Subject: [PATCH] =?UTF-8?q?```=20feat(shop/orderConfirm):=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=BC=98=E6=83=A0=E5=88=B8=E4=BD=BF=E7=94=A8=E5=90=8E?= =?UTF-8?q?=E7=9A=84=E6=94=AF=E4=BB=98=E9=80=BB=E8=BE=91=E5=BD=93=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E9=80=89=E6=8B=A9=E4=BD=BF=E7=94=A8=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E6=97=B6=EF=BC=8C=E7=8E=B0=E5=9C=A8?= =?UTF-8?q?=E4=BC=9A=E9=87=8D=E6=96=B0=E6=9E=84=E5=BB=BA=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=B9=B6=E9=80=92=E5=BD=92=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=87=BD=E6=95=B0=EF=BC=8C=20=E7=A1=AE?= =?UTF-8?q?=E4=BF=9D=E4=BC=A0=E9=80=92=E6=9C=80=E6=96=B0=E7=9A=84=E4=BC=98?= =?UTF-8?q?=E6=83=A0=E5=88=B8=E4=BF=A1=E6=81=AF=E3=80=82=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=97=A5=E5=BF=97=E4=BB=A5=E4=BE=BF?= =?UTF-8?q?=E8=B0=83=E8=AF=95=EF=BC=8C=E5=B9=B6=E6=8F=90=E5=89=8D=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E4=BB=A5=E9=81=BF=E5=85=8D=E9=87=8D=E5=A4=8D=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E6=94=AF=E4=BB=98=E9=80=BB=E8=BE=91=E3=80=82```?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/shop/orderConfirm/index.tsx | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/shop/orderConfirm/index.tsx b/src/shop/orderConfirm/index.tsx index 05a9753..58fe1c1 100644 --- a/src/shop/orderConfirm/index.tsx +++ b/src/shop/orderConfirm/index.tsx @@ -404,8 +404,26 @@ const OrderConfirm = () => { if (confirmResult) { setSelectedCoupon(bestCoupon) - // 使用优惠券后重新计算价格,然后继续支付 - // 注意:这里不直接return,让代码继续执行支付逻辑 + // 🔄 使用优惠券后需要重新构建订单数据,这里直接递归调用支付函数 + // 但要确保传递最新的优惠券信息 + const currentPaymentType = payment.type === 0 ? PaymentType.BALANCE : PaymentType.WECHAT; + const updatedOrderData = buildSingleGoodsOrder( + goods.goodsId!, + quantity, + address.id, + { + comments: goods.name, + deliveryType: 0, + buyerRemarks: orderRemark, + couponId: parseInt(String(bestCoupon.id), 10) + } + ); + + console.log('🎯 使用推荐优惠券的订单数据:', updatedOrderData); + + // 执行支付 + await PaymentHandler.pay(updatedOrderData, currentPaymentType); + return; // 提前返回,避免重复执行支付 } else { // 用户选择不使用优惠券,继续支付 }