Files
gxwebsoft d611a76ebd feat(checkout): 优化微信支付和线下付款流程
- 支付方式新增微信支付(payType=1),并设为默认,保留线下付款(payType=9)
- 微信支付时调用 Taro.requestPayment 发起支付流程,取消或失败给出明确提示
- 支付选项选中状态下微信支付显示绿色提示,线下付款显示橙色提示
- 提交按钮文案区分微信支付(提交并支付)与线下付款(提交订单)
- 后端支付配置缺失时提示“微信支付暂不可用:支付配置缺失”
- 确保编译构建通过,未引入新类型错误
2026-08-11 08:18:40 +08:00

17 lines
1.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 2026-08-10
## checkout 页面接入微信支付
文件:`src/pages/shop/checkout.tsx`
改动:
- 支付方式选项新增「微信支付」(`payType=1`),并设为默认;原「线下付款」(`payType=9`) 保留。
- `handleSubmit``createOrder(orderParams)` 后,若 `payType===1 && res``res` 为后端返回的 `WxPayResult`),调用 `Taro.requestPayment({timeStamp,nonceStr,package,signType,paySign})` 调起微信支付;取消/失败给明确提示,订单已创建故统一跳订单列表可重新支付。线下付款保持原「订单已提交」提示。
- 支付选项选中提示:微信支付显示绿色提示,线下付款橙色提示(原仅有线下提示)。
- 提交按钮文案:微信支付显示「提交并支付」,线下显示「提交订单」。
- 异常提示:微信/线下下单时若后端报「应用ID/appid 缺失」等支付配置错误,统一提示「微信支付暂不可用:支付配置缺失」。
验证:`npm run build:weapp` 编译通过(17.45sCompiled successfully)。`tsc --noEmit` 因 tsconfig 把 `@tarojs/taro` 列入 types(缺 @types 声明)预存报错,与本次改动无关。
模式说明:本项目微信支付标准流程为 `createOrder(payType=1)` 后端直接返回 `WxPayResult``Taro.requestPayment(...)`,与 `pages/order/detail.tsx``handlePay`(用 `prepayShopOrder` 重新支付)一致。