diff --git a/src/app/pay/page.tsx b/src/app/pay/page.tsx index a7b4184..b1e29e7 100644 --- a/src/app/pay/page.tsx +++ b/src/app/pay/page.tsx @@ -684,27 +684,6 @@ function PayContent() { /> )} - {/* 用户已有订阅 */} - {userSubscriptions.length > 0 && ( -
-

- {pickLocaleText(locale, '我的订阅', 'My Subscriptions')} -

- { - const plan = plans.find((p) => p.groupId === groupId); - if (plan) { - setSelectedPlan(plan); - setMainTab('subscribe'); - } - }} - isDark={isDark} - locale={locale} - /> -
- )} - {renderHelpSection()} )} @@ -723,28 +702,31 @@ function PayContent() { ))} - {/* 用户已有订阅 */} - {userSubscriptions.length > 0 && ( -
-

- {pickLocaleText(locale, '我的订阅', 'My Subscriptions')} -

- { - const plan = plans.find((p) => p.groupId === groupId); - if (plan) setSelectedPlan(plan); - }} - isDark={isDark} - locale={locale} - /> -
- )} - {renderHelpSection()} )} + {/* 用户已有订阅 — 所有 tab 共用 */} + {userSubscriptions.length > 0 && ( +
+

+ {pickLocaleText(locale, '我的订阅', 'My Subscriptions')} +

+ { + const plan = plans.find((p) => p.groupId === groupId); + if (plan) { + setSelectedPlan(plan); + setMainTab('subscribe'); + } + }} + isDark={isDark} + locale={locale} + /> +
+ )} + )} diff --git a/src/components/SubscriptionConfirm.tsx b/src/components/SubscriptionConfirm.tsx index 0acc781..abb15a6 100644 --- a/src/components/SubscriptionConfirm.tsx +++ b/src/components/SubscriptionConfirm.tsx @@ -7,6 +7,7 @@ import { pickLocaleText } from '@/lib/locale'; import { getPaymentTypeLabel, getPaymentIconSrc } from '@/lib/pay-utils'; import type { PlanInfo } from '@/components/SubscriptionPlanCard'; import { formatValidityLabel } from '@/lib/subscription-utils'; +import { PlatformBadge } from '@/lib/platform-style'; interface SubscriptionConfirmProps { plan: PlanInfo; @@ -31,6 +32,14 @@ export default function SubscriptionConfirm({ const periodLabel = formatValidityLabel(plan.validityDays, plan.validityUnit ?? 'day', locale); + const hasLimits = plan.limits && ( + plan.limits.daily_limit_usd !== null || + plan.limits.weekly_limit_usd !== null || + plan.limits.monthly_limit_usd !== null + ); + + const isOpenAI = plan.platform?.toLowerCase() === 'openai'; + const handleSubmit = () => { if (selectedPayment && !loading) { onSubmit(selectedPayment); @@ -59,73 +68,148 @@ export default function SubscriptionConfirm({ {pickLocaleText(locale, '确认订单', 'Confirm Order')} - {/* Plan info card */} + {/* Plan detail card */}
-
-
- - {plan.name} - - - {periodLabel} - -
+ {/* Header: Platform badge + Name + Period */} +
+ {plan.platform && } + + {plan.name} + + + {periodLabel} +
- {/* Platform & Rate tags */} - {(plan.platform || plan.rateMultiplier != null) && ( -
- {plan.platform && ( - - {pickLocaleText(locale, '平台', 'Platform')}: {plan.platform} - - )} + {/* Price */} +
+ {plan.originalPrice !== null && ( + + ¥{plan.originalPrice} + + )} + ¥{plan.price} +
+ + {/* Description */} + {plan.description && ( +

+ {plan.description} +

+ )} + + {/* Rate + Limits grid */} + {(plan.rateMultiplier != null || hasLimits) && ( +
{plan.rateMultiplier != null && ( - - {pickLocaleText(locale, '倍率', 'Rate')}: {plan.rateMultiplier}x - +
+ + {pickLocaleText(locale, '倍率', 'Rate')} + +
+ 1 + : + {plan.rateMultiplier} +
+
)} + {plan.limits?.daily_limit_usd != null && ( +
+ + {pickLocaleText(locale, '日限额', 'Daily Limit')} + +
+ ${plan.limits.daily_limit_usd} +
+
+ )} + {plan.limits?.weekly_limit_usd != null && ( +
+ + {pickLocaleText(locale, '周限额', 'Weekly Limit')} + +
+ ${plan.limits.weekly_limit_usd} +
+
+ )} + {plan.limits?.monthly_limit_usd != null && ( +
+ + {pickLocaleText(locale, '月限额', 'Monthly Limit')} + +
+ ${plan.limits.monthly_limit_usd} +
+
+ )} +
+ )} + + {/* OpenAI specific: messages dispatch + default model */} + {isOpenAI && ( +
+
+
+ + {pickLocaleText(locale, '/v1/messages 调度', '/v1/messages Dispatch')} + + + {plan.allowMessagesDispatch + ? pickLocaleText(locale, '已启用', 'Enabled') + : pickLocaleText(locale, '未启用', 'Disabled')} + +
+ {plan.defaultMappedModel && ( +
+ + {pickLocaleText(locale, '默认模型', 'Default Model')} + + + {plan.defaultMappedModel} + +
+ )} +
)} {/* Features */} {plan.features.length > 0 && ( -
    - {plan.features.map((feature) => ( -
  • - - - - {feature} -
  • - ))} -
- )} - - {/* Usage limits */} - {plan.limits && (plan.limits.daily_limit_usd != null || plan.limits.weekly_limit_usd != null || plan.limits.monthly_limit_usd != null) && ( -
-

{pickLocaleText(locale, '用量限制', 'Usage Limits')}

-
- {plan.limits.daily_limit_usd != null && ( -

{pickLocaleText(locale, `每日: $${plan.limits.daily_limit_usd}`, `Daily: $${plan.limits.daily_limit_usd}`)}

- )} - {plan.limits.weekly_limit_usd != null && ( -

{pickLocaleText(locale, `每周: $${plan.limits.weekly_limit_usd}`, `Weekly: $${plan.limits.weekly_limit_usd}`)}

- )} - {plan.limits.monthly_limit_usd != null && ( -

{pickLocaleText(locale, `每月: $${plan.limits.monthly_limit_usd}`, `Monthly: $${plan.limits.monthly_limit_usd}`)}

- )} +
+

+ {pickLocaleText(locale, '功能特性', 'Features')} +

+
+ {plan.features.map((feature) => ( + + {feature} + + ))}
)} diff --git a/src/lib/subscription-utils.ts b/src/lib/subscription-utils.ts index 874b402..b8ae324 100644 --- a/src/lib/subscription-utils.ts +++ b/src/lib/subscription-utils.ts @@ -39,8 +39,7 @@ export function formatValidityLabel( return locale === 'zh' ? `包${value}周` : `${value} Weeks`; } // day - if (value === 30) return locale === 'zh' ? '包月' : 'Monthly'; - return locale === 'zh' ? `包${value}天` : `${value} Days`; + return locale === 'zh' ? `${value}天` : `${value} Days`; } /** @@ -48,8 +47,7 @@ export function formatValidityLabel( * - unit=month, value=1 → /月 / /mo * - unit=month, value=3 → /3月 / /3mo * - unit=week, value=2 → /2周 / /2wk - * - unit=day, value=30 → /月 / /mo - * - unit=day, value=90 → /90天 / /90d + * - unit=day, value=30 → /30天 / /30d */ export function formatValiditySuffix( value: number, @@ -65,7 +63,6 @@ export function formatValiditySuffix( return locale === 'zh' ? `/${value}周` : `/${value}wk`; } // day - if (value === 30) return locale === 'zh' ? '/月' : '/mo'; return locale === 'zh' ? `/${value}天` : `/${value}d`; }