fix(*): 全量 UI 审查与 undefined 展示异常修复
This commit is contained in:
@@ -34,6 +34,11 @@ import {
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { UserContext } from '../../context/User';
|
||||
import { API, showError, showSuccess, renderQuota } from '../../helpers';
|
||||
import {
|
||||
formatCurrency,
|
||||
formatNumber,
|
||||
toFiniteNumber,
|
||||
} from '../../helpers/safeDisplay';
|
||||
import WechatQRModal from '../../components/topup/modals/WechatQRModal';
|
||||
import './RechargeV2.css';
|
||||
|
||||
@@ -263,7 +268,11 @@ const RechargeV2 = () => {
|
||||
}}
|
||||
>
|
||||
{t('{{rate}}折优惠', {
|
||||
rate: (option.discount * 10).toFixed(1),
|
||||
rate: formatNumber(
|
||||
(toFiniteNumber(option.discount) ?? 1) * 10,
|
||||
1,
|
||||
'10.0',
|
||||
),
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
@@ -288,13 +297,17 @@ const RechargeV2 = () => {
|
||||
<Space vertical align='start' spacing='medium'>
|
||||
<div>
|
||||
<Text type='secondary'>{t('原价:')}</Text>
|
||||
<Text delete>¥{payInfo.original_money.toFixed(2)}</Text>
|
||||
<Text delete>{formatCurrency(payInfo.original_money)}</Text>
|
||||
</div>
|
||||
<div>
|
||||
<Text type='secondary'>{t('折扣:')}</Text>
|
||||
<Text strong>
|
||||
{t('{{rate}}折', {
|
||||
rate: (payInfo.discount_rate * 10).toFixed(1),
|
||||
rate: formatNumber(
|
||||
(toFiniteNumber(payInfo.discount_rate) ?? 1) * 10,
|
||||
1,
|
||||
'10.0',
|
||||
),
|
||||
})}
|
||||
</Text>
|
||||
</div>
|
||||
@@ -304,18 +317,18 @@ const RechargeV2 = () => {
|
||||
style={{ fontSize: 24, color: 'var(--ui-color-danger)' }}
|
||||
strong
|
||||
>
|
||||
¥{payInfo.pay_money.toFixed(2)}
|
||||
{formatCurrency(payInfo.pay_money)}
|
||||
</Text>
|
||||
</div>
|
||||
<div>
|
||||
<Text type='secondary'>{t('获得额度:')}</Text>
|
||||
<Text strong>{renderQuota(payInfo.quota)}</Text>
|
||||
</div>
|
||||
{payInfo.save_money > 0 && (
|
||||
{(toFiniteNumber(payInfo.save_money) ?? 0) > 0 && (
|
||||
<div>
|
||||
<Text type='secondary'>{t('节省:')}</Text>
|
||||
<Text style={{ color: 'var(--ui-color-success)' }}>
|
||||
¥{payInfo.save_money.toFixed(2)}
|
||||
{formatCurrency(payInfo.save_money)}
|
||||
</Text>
|
||||
</div>
|
||||
)}
|
||||
@@ -390,7 +403,7 @@ const RechargeV2 = () => {
|
||||
? t('处理中...')
|
||||
: calculating
|
||||
? t('计算中...')
|
||||
: `${t('支付')} ¥${payInfo?.pay_money?.toFixed(2) || '0.00'}`}
|
||||
: `${t('支付')} ${formatCurrency(payInfo?.pay_money, '¥', 2, '¥0.00')}`}
|
||||
</Button>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
Reference in New Issue
Block a user