Skip to content

Commit bb90a1a

Browse files
committed
show addon fee in renewal title
1 parent a01b437 commit bb90a1a

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

src/pages/user.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,19 +249,26 @@ function PurchaseActionPopover({
249249
hint,
250250
loading,
251251
title,
252+
titleNote,
252253
options,
253254
}: {
254255
buttonLabel: string;
255256
emptyText?: string;
256257
hint: string;
257258
loading: boolean;
258259
title?: string;
260+
titleNote?: string;
259261
options: PurchaseMenuOption[];
260262
}) {
261263
const content = (
262264
<div className="max-h-[70vh] w-[340px] max-w-[calc(100vw-32px)] overflow-y-auto pr-1">
263265
{title && (
264-
<div className="px-2 font-semibold text-slate-900 text-sm">{title}</div>
266+
<div className="px-2">
267+
<div className="font-semibold text-slate-900 text-sm">{title}</div>
268+
{titleNote && (
269+
<div className="mt-0.5 text-slate-500 text-xs">{titleNote}</div>
270+
)}
271+
</div>
265272
)}
266273
<div className="px-2 pt-1 pb-2 text-slate-500 text-xs leading-relaxed">
267274
{hint}
@@ -432,6 +439,14 @@ const RenewalPurchaseButton = ({
432439
const [loadingPlan, setLoadingPlan] = useState<string | null>(null);
433440
const billingConfig = useOrderBillingConfig();
434441
const prices = getRenewalPrices({ billingConfig, quota, tier });
442+
const addonUnits =
443+
typeof quota?.checkUpdateAddonUnits === 'number' &&
444+
quota.checkUpdateAddonUnits > 0
445+
? quota.checkUpdateAddonUnits
446+
: 0;
447+
const addonMonthlyPrice = roundMoneyValue(
448+
addonUnits * (billingConfig.checkUpdateAddon?.monthlyUnitPrice ?? 100),
449+
);
435450

436451
if (tier === 'free') {
437452
return null;
@@ -518,6 +533,11 @@ const RenewalPurchaseButton = ({
518533
hint="选择续费时长;月付累计达到年付价后直接选择年付。"
519534
loading={loadingPlan !== null}
520535
title="续费"
536+
titleNote={
537+
addonUnits > 0
538+
? `当前价格含加购费用每月 ${formatMoney(addonMonthlyPrice)}`
539+
: undefined
540+
}
521541
options={renewalOptions}
522542
/>
523543
);

0 commit comments

Comments
 (0)