feat(pay): 统一收银台四种模式(站内二维码/当前页跳转/表单提交/JSAPI)
- PaymentOrchestrator 统一返回 mode + code_url/payment_url/form_html/jsapi_params
- 支付宝:当面付二维码 / 电脑网站支付 / H5;微信:Native / H5 / JSAPI(WechatOpenid 静默授权)
- 易支付:PC mapi 二维码,移动端自动提交表单
- 删除旧键 alipay_payment_type / wechat_payment_type / epay_device 与 redirect/qr_content 字段
- 新增 pay-cashier.js,移除 window.open,订单状态接口改为 /pay/order/{n}
- 拆分 credits.js(affiliate / withdraw-history)至 1000 行以内
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b340b77d5a
commit
1df2822f01
28 files changed
+1255
-836
No files matched your search
@@ -386,6 +386,23 @@
|
||||
return loadView(state);
|
||||
}
|
||||
|
||||
function pollOrder(state, number) {
|
||||
var coordinator = window.AksrtVipPurchaseCoordinator;
|
||||
if (!coordinator || typeof coordinator.poll !== "function") return null;
|
||||
return coordinator.poll(number, {
|
||||
tags: ["orders"],
|
||||
onTerminal: function (result) {
|
||||
if (window.AksrtPayCashier) window.AksrtPayCashier.close();
|
||||
notyf(result.success ? "支付成功" : "支付未完成,请重试", result.success ? "success" : "danger");
|
||||
invalidateOrder(number, null);
|
||||
if (activeDetail(state, number)) openDetail(state, number);
|
||||
},
|
||||
onTimeout: function () {
|
||||
notyf("支付状态暂未确认,请稍后刷新订单", "danger");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function startPayment(state, button) {
|
||||
var number = button.getAttribute("data-aksrt-order-pay") || "";
|
||||
var method = button.getAttribute("data-aksrt-order-method") || "";
|
||||
@@ -397,8 +414,15 @@
|
||||
delete state.operationKeys[actionKey];
|
||||
var data = result.data || {};
|
||||
invalidateOrder(number, data.order);
|
||||
if (data.redirect && data.payment_url) {
|
||||
window.location.assign(data.payment_url);
|
||||
if (data.mode) {
|
||||
button.disabled = false;
|
||||
if (!window.AksrtPayCashier) return;
|
||||
var handled = window.AksrtPayCashier.handle(data, {
|
||||
onClose: function () { if (poll) poll.abort(); }
|
||||
});
|
||||
var poll = handled === "qrcode" || handled === "jsapi"
|
||||
? pollOrder(state, number)
|
||||
: null;
|
||||
return;
|
||||
}
|
||||
notyf(data.message || "支付成功", "success");
|
||||
|
||||
Reference in new issue
Block a user