微信小程序支付功能打通

This commit is contained in:
2026-07-13 00:07:17 +08:00
parent f2cdc0222d
commit 450dc44d0e
14 changed files with 73 additions and 28 deletions
+3 -1
View File
@@ -49,7 +49,9 @@ export async function payOrder(orderId: string): Promise<'paid' | 'pending'> {
});
if (result.mode === 'jsapi' && result.prepay) {
await invokeWechatPay(result.prepay as WechatJsapiPrepayParams);
await invokeWechatPay(result.prepay as WechatJsapiPrepayParams, {
platform: isMiniWechatEnv() ? 'mini' : undefined,
});
const paid = await waitOrderPaid(orderId);
return paid ? 'paid' : 'pending';
}
+4
View File
@@ -100,6 +100,10 @@ export default function PayPage() {
return;
}
const message = e instanceof Error ? e.message : '支付失败';
if (message.includes('取消')) {
setMsg('已取消支付');
return;
}
setMsg(message);
toast(message);
} finally {