refactor(充值弹窗): 摊平套餐卡片里的嵌套三元价格行

- 原年付实付文案在模板字符串里再嵌一层 savingCents 三元,属于嵌套三元
- 把年付价格行提升为 annualPriceLine 常量,JSX 只保留 annual 单层分支,文案不变
This commit is contained in:
2026-10-04 15:52:29 +08:00
parent 349af04034
commit 9e13b83171
@@ -701,6 +701,9 @@ function PlatformMembershipPlanCard({
const savingCents = annual
? Math.max(0, plan.monthPriceCents * 12 - plan.yearPriceCents)
: 0;
const annualPriceLine = `年实付 ${formatRechargePrice(plan.yearPriceCents)}${
savingCents > 0 ? ` · 省 ${formatRechargePrice(savingCents)}` : ''
}`;
// 按钮文案优先级:不可购买时展示业务文案,其次「处理中」,最后默认「选择并确认」。
let actionButtonLabel = '选择并确认';
if (disabled) {
@@ -739,9 +742,7 @@ function PlatformMembershipPlanCard({
</div>
<div className="text-[10px] text-[var(--platform-text-soft)]">
{annual
? `年实付 ${formatRechargePrice(plan.yearPriceCents)}${
savingCents > 0 ? ` · 省 ${formatRechargePrice(savingCents)}` : ''
}`
? annualPriceLine
: `每次支付 ${formatRechargePrice(listPriceCents)},有效期 1 个月`}
</div>
<div className="rounded-[0.85rem] border border-[rgba(194,145,111,0.28)] bg-white/35 px-3 py-2">