diff --git a/core/frontend/src/routes/account.tsx b/core/frontend/src/routes/account.tsx index 492c125..1d0e6ec 100644 --- a/core/frontend/src/routes/account.tsx +++ b/core/frontend/src/routes/account.tsx @@ -20,6 +20,7 @@ const RANGE_META: Record(null); + // 弹窗退场动画期间仍会保留在 DOM 中;打开时冻结本次支付快照,避免清空自定义金额后回显为预选套餐。 + const [topupQuote, setTopupQuote] = useState(null); // 趋势(day,首屏)+ 团队成员(成员/限额 tab)本页懒加载 const [trend, setTrend] = useState(null); @@ -192,16 +195,17 @@ export function AccountPage({ billing, projects, team, onRecharge, onNotify }: { function openTopup(channel: "wechat" | "alipay") { if (!validateCustomAmount()) return; + setTopupQuote({ amount: effectiveAmount, bonus: effectiveBonus, channel }); setTopupChannel(channel); } async function submitRecharge() { - if (!validateCustomAmount()) { + if (!topupQuote || topupQuote.amount < MIN_RECHARGE_AMOUNT) { + onNotify("error", `最小充值金额为 ${MIN_RECHARGE_AMOUNT} 元`); setTopupChannel(null); return; } - if (effectiveAmount <= 0) return; - await onRecharge(effectiveAmount, effectiveBonus); // 父级 action 成功后弹全局「充值成功」toast + await onRecharge(topupQuote.amount, topupQuote.bonus); // 父级 action 成功后弹全局「充值成功」toast setTopupChannel(null); setCustomAmt(""); setBillPage(1); @@ -610,9 +614,9 @@ export function AccountPage({ billing, projects, team, onRecharge, onNotify }: { setTopupChannel(null)} onDone={submitRecharge} />