From cdbc6b4ac2c839542600f7fc4fc6bfc2317d4fa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Mon, 5 Oct 2026 14:08:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D(=E5=85=85=E5=80=BC=E5=BC=B9?= =?UTF-8?q?=E5=B1=82):=20max=20=E6=A1=A3=E4=B8=8D=E5=86=8D=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E5=8F=AF=E8=A1=A5=E5=B7=AE=E5=8D=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 状态卡原先无条件显示「可同周期补差升档」,已是最高档时并无更高档位可升 - 父组件按启用目录计算 hasUpgradePath(存在 rank 更高的档位),无升级路径时只保留「周期切换需等到期后」 - 补 max 档与 plus 档的对照断言 --- .../index.test.tsx | 34 +++++++++++++++++++ .../PlatformProfileRechargeModal/index.tsx | 23 +++++++++++-- 2 files changed, 54 insertions(+), 3 deletions(-) diff --git a/packages/shared/src/components/PlatformProfileRechargeModal/index.test.tsx b/packages/shared/src/components/PlatformProfileRechargeModal/index.test.tsx index 0de7d8fd2..c1c5d6b41 100644 --- a/packages/shared/src/components/PlatformProfileRechargeModal/index.test.tsx +++ b/packages/shared/src/components/PlatformProfileRechargeModal/index.test.tsx @@ -291,6 +291,7 @@ describe('PlatformProfileRechargeModal', () => { screen.getByRole('button', { name: 'Plus 年付 当前套餐' }), ).toHaveProperty('disabled', true); expect(screen.getByText('当前 Plus · 年付')).toBeTruthy(); + expect(screen.getAllByText(/可同周期补差升档/).length).toBeGreaterThan(0); await user.click(screen.getByRole('button', { name: 'Max 年付 补差升级' })); @@ -307,6 +308,39 @@ describe('PlatformProfileRechargeModal', () => { expect(onSubmitMembershipCheckout).toHaveBeenCalledWith('max', 'yearly'); }); + test('已是最高的 max 档不再提示可补差升档', () => { + render( + , + ); + + expect(screen.getByText('当前 Max · 年付')).toBeTruthy(); + expect(screen.queryByText(/可同周期补差升档/)).toBeNull(); + expect(screen.getByText('周期切换需等到期后')).toBeTruthy(); + }); + test('keeps an active member as member when their current plan is disabled', async () => { const user = userEvent.setup(); const onRequestMembershipQuote = vi.fn(); diff --git a/packages/shared/src/components/PlatformProfileRechargeModal/index.tsx b/packages/shared/src/components/PlatformProfileRechargeModal/index.tsx index 10a92df03..9d2451282 100644 --- a/packages/shared/src/components/PlatformProfileRechargeModal/index.tsx +++ b/packages/shared/src/components/PlatformProfileRechargeModal/index.tsx @@ -594,9 +594,12 @@ function PlatformRechargeTabNav({ function PlatformMembershipStatusCard({ membership, currentPlan, + hasUpgradePath, }: { membership: ProfileMembership; currentPlan: ProfileMembershipPlanRecord | null; + /** 是否存在更高档位可补差升级;已是最高的 max 档时为 false。 */ + hasUpgradePath: boolean; }) { const planTitle = currentPlan?.title ?? '会员'; const cycleLabel = membership.cycleKind === 'yearly' ? '年付' : '月付'; @@ -620,9 +623,15 @@ function PlatformMembershipStatusCard({
- 可同周期补差升档 -
- 周期切换需等到期后 + {hasUpgradePath ? ( + <> + 可同周期补差升档 +
+ 周期切换需等到期后 + + ) : ( + '周期切换需等到期后' + )}
); @@ -1362,6 +1371,13 @@ export function PlatformProfileRechargeModal({ ) ?? null, [center?.membershipPlans, membership?.plan], ); + // 已是最高的 max 档时没有可升级目标,状态卡不应再提示「可同周期补差升档」。 + const hasUpgradePath = useMemo( + () => + currentPlanRecord !== null && + membershipPlans.some((plan) => plan.rank > currentPlanRecord.rank), + [currentPlanRecord, membershipPlans], + ); const [activeTab, setActiveTab] = useState('subscription'); const [cycleKind, setCycleKind] = @@ -1488,6 +1504,7 @@ export function PlatformProfileRechargeModal({ ) : null}