fix(payment): wire balance wallet end-to-end when pay_balance_s is on
Opening 余额功能 alone now enables cash-wallet pay (unless 余额支付 is explicitly off). Drop points-as-balance fallback, stop fake method injection, expose real wallet in cashiers, and honor auto_to_balance on recharge fulfill.
This commit is contained in:
1 parent
c85774f9a0
commit
3267bee71e
12 files changed
+109
-105
No files matched your search
@@ -12,7 +12,7 @@ export const gatewaySchema = {
|
||||
payment_wechat_enabled: false,
|
||||
payment_alipay_enabled: false,
|
||||
payment_paypal_enabled: false,
|
||||
payment_balance_enabled: false,
|
||||
payment_balance_enabled: true,
|
||||
payment_card_pass_enabled: false,
|
||||
payment_xunhupay_enabled: false,
|
||||
payment_xhpay_enabled: false,
|
||||
@@ -73,7 +73,7 @@ export const gatewaySchema = {
|
||||
{ key: 'payment_alipay_enabled', label: '支付宝', type: 'switch', default: false },
|
||||
{ key: 'payment_paypal_enabled', label: 'PayPal', type: 'switch', default: false },
|
||||
{ key: 'payment_stripe_enabled', label: 'Stripe', type: 'switch', default: false },
|
||||
{ key: 'payment_balance_enabled', label: '余额支付', type: 'switch', default: false },
|
||||
{ key: 'payment_balance_enabled', label: '余额支付', type: 'switch', default: true, help: '需同时在「余额充值」启用余额功能。关闭后用户中心仍可有钱包,但结账不可用余额支付。' },
|
||||
{ key: 'payment_card_pass_enabled', label: '卡密充值', type: 'switch', default: false },
|
||||
{ key: 'payment_xunhupay_enabled', label: '虎皮椒', type: 'switch', default: false },
|
||||
{ key: 'payment_xhpay_enabled', label: '小火付', type: 'switch', default: false },
|
||||
|
||||
@@ -32,9 +32,9 @@ export const rechargeSchema = {
|
||||
title: '充值开关',
|
||||
icon: 'fas fa-wallet',
|
||||
fields: [
|
||||
{ key: 'pay_balance_s', label: '启用余额功能', type: 'switch', default: true },
|
||||
{ key: 'pay_balance_s', label: '启用余额功能', type: 'switch', default: true, help: '开启后用户中心显示现金钱包,并默认允许余额支付(可在收款接口单独关闭)。充值需另配支付宝/微信等外部网关。' },
|
||||
{ key: 'pay_balance_desc', label: '充值说明', type: 'textarea', default: '', dependsOn: { key: 'pay_balance_s', value: true } },
|
||||
{ key: 'pay_auto_to_balance', label: '自动到账到余额', type: 'switch', default: true, dependsOn: { key: 'pay_balance_s', value: true } },
|
||||
{ key: 'pay_auto_to_balance', label: '自动到账到余额', type: 'switch', default: true, dependsOn: { key: 'pay_balance_s', value: true }, help: '充值订单支付成功后自动入账钱包(卡密/管理员调整不受此开关限制)。' },
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
+29
-12
@@ -548,18 +548,35 @@
|
||||
}
|
||||
body += '</div>';
|
||||
}
|
||||
let methodHtml = '';
|
||||
methods.forEach(function (m, idx) {
|
||||
const id = escapeAttr(m.id || '');
|
||||
const name = escapeHtml(m.name || id);
|
||||
methodHtml += '<label class="aksrt-cashier__method"><input type="radio" name="aksrt_pay_method" value="' + id + '"' + (idx === 0 ? ' checked' : '') + '> <span>' + name + '</span></label>';
|
||||
});
|
||||
if (methodHtml) {
|
||||
body += '<div class="aksrt-cashier__methods"><div class="aksrt-cashier__methods-title">' + tt('pay_method', '支付方式') + '</div>' + methodHtml + '</div>';
|
||||
}
|
||||
body += '<div class="aksrt-dl-modal__actions">';
|
||||
body += '<button type="button" class="btn-primary aksrt-dl-modal__download" data-aksrt-pay-submit data-mode="cash" data-price-type="' + escapeAttr(priceType) + '">' + tt('pay_now', '立即支付') + ' ' + amountLabel + '</button>';
|
||||
body += '</div>';
|
||||
const walletBal = typeof preview.wallet_balance === 'number'
|
||||
? preview.wallet_balance
|
||||
: (typeof preview.balance === 'number' ? preview.balance : 0);
|
||||
const hasBalanceMethod = methods.some(function (m) { return (m && m.id) === 'balance'; });
|
||||
if (hasBalanceMethod) {
|
||||
body += '<div class="aksrt-cashier__box"><div class="aksrt-cashier__row"><span>' + tt('my_wallet', '我的余额') + '</span><b class="is-ok">¥' + Number(walletBal).toFixed(2) + '</b></div></div>';
|
||||
if (preview.balance_enough === false) {
|
||||
body += '<div class="aksrt-cashier__warn">' + tt('wallet_short', '余额不足,请先充值或选择其他支付方式') + '</div>';
|
||||
if (preview.credits_url) {
|
||||
body += '<div class="aksrt-dl-modal__actions"><a class="btn-sm" href="' + escapeAttr(preview.credits_url) + '">' + tt('go_recharge', '去充值') + '</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
let methodHtml = '';
|
||||
methods.forEach(function (m, idx) {
|
||||
const id = escapeAttr(m.id || '');
|
||||
const name = escapeHtml(m.name || id);
|
||||
methodHtml += '<label class="aksrt-cashier__method"><input type="radio" name="aksrt_pay_method" value="' + id + '"' + (idx === 0 ? ' checked' : '') + '> <span>' + name + '</span></label>';
|
||||
});
|
||||
if (methodHtml) {
|
||||
body += '<div class="aksrt-cashier__methods"><div class="aksrt-cashier__methods-title">' + tt('pay_method', '支付方式') + '</div>' + methodHtml + '</div>';
|
||||
} else {
|
||||
body += '<div class="aksrt-cashier__warn">' + tt('no_pay_method', '暂无可用支付方式,请联系站长配置收款接口') + '</div>';
|
||||
}
|
||||
body += '<div class="aksrt-dl-modal__actions">';
|
||||
if (methodHtml) {
|
||||
body += '<button type="button" class="btn-primary aksrt-dl-modal__download" data-aksrt-pay-submit data-mode="cash" data-price-type="' + escapeAttr(priceType) + '">' + tt('pay_now', '立即支付') + ' ' + amountLabel + '</button>';
|
||||
}
|
||||
body += '</div>';
|
||||
}
|
||||
|
||||
open('<h3 class="aksrt-dl-modal__title">' + tt('confirm_buy', '确认购买') + '</h3>' + body, returnFocusEl);
|
||||
|
||||
Reference in new issue
Block a user