重构(会员弹层):档位卡按钮文案去掉嵌套三元
- 用 if/else 预计算 actionButtonLabel,明确 禁用/提交中/默认 的优先级
This commit is contained in:
@@ -679,6 +679,13 @@ function PlatformMembershipPlanCard({
|
||||
const savingCents = annual
|
||||
? Math.max(0, plan.monthPriceCents * 12 - plan.yearPriceCents)
|
||||
: 0;
|
||||
// 按钮文案优先级:不可购买时展示业务文案,其次「处理中」,最后默认「选择并确认」。
|
||||
let actionButtonLabel = '选择并确认';
|
||||
if (disabled) {
|
||||
actionButtonLabel = actionLabel;
|
||||
} else if (submitting) {
|
||||
actionButtonLabel = '处理中';
|
||||
}
|
||||
|
||||
return (
|
||||
<article
|
||||
@@ -736,7 +743,7 @@ function PlatformMembershipPlanCard({
|
||||
disabled={disabled || submitting}
|
||||
onClick={onCheckout}
|
||||
>
|
||||
{disabled ? actionLabel : submitting ? '处理中' : '选择并确认'}
|
||||
{actionButtonLabel}
|
||||
</PlatformRechargeActionButton>
|
||||
</article>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user