Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion web/classic/src/components/topup/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
showSuccess,
renderQuota,
renderQuotaWithAmount,
getCurrencyConfig,
copy,
getQuotaPerUnit,
} from '../../helpers';
Expand Down Expand Up @@ -800,8 +801,17 @@ const TopUp = () => {
}
}, [statusState?.status]);

const formatPaymentAmount = (value) => {
const { symbol } = getCurrencyConfig();
const numericValue = Number(value);
const displayValue = Number.isFinite(numericValue)
? numericValue.toFixed(2)
: value;
return `${symbol}${displayValue}`;
};

const renderAmount = () => {
return amount + ' ' + t('元');
return formatPaymentAmount(amount);
};

const getAmount = async (value) => {
Expand Down Expand Up @@ -928,6 +938,7 @@ const TopUp = () => {
renderQuotaWithAmount={renderQuotaWithAmount}
amountLoading={amountLoading}
renderAmount={renderAmount}
formatPaymentAmount={formatPaymentAmount}
payWay={payWay}
payMethods={confirmPayMethods}
amountNumber={amount}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const PaymentConfirmModal = ({
renderQuotaWithAmount,
amountLoading,
renderAmount,
formatPaymentAmount,
payWay,
payMethods,
// 新增:用于显示折扣明细
Expand Down Expand Up @@ -97,15 +98,15 @@ const PaymentConfirmModal = ({
{t('原价')}:
</Text>
<Text delete className='text-slate-500 dark:text-slate-400'>
{`${originalAmount.toFixed(2)} ${t('元')}`}
{formatPaymentAmount(originalAmount)}
</Text>
</div>
<div className='flex justify-between items-center'>
<Text className='text-slate-500 dark:text-slate-400'>
{t('优惠')}:
</Text>
<Text className='text-emerald-600 dark:text-emerald-400'>
{`- ${discountAmount.toFixed(2)} ${t('元')}`}
{`- ${formatPaymentAmount(discountAmount)}`}
</Text>
</div>
</>
Expand Down