fix(*): 全量 UI 审查与 undefined 展示异常修复
分析模块:补齐看板、排行、趋势及报表数值兜底 企业与用户中心:修复统计、成员、技能及资金字段展示 充值与交易:修复充值、发票、订单、订阅及支付字段拼接 平台页面:修复渠道、模型、服务监控与状态空值展示 通用能力:新增安全展示工具,补齐九语言文案与回归测试 文档记录:更新修复范围、影响及回滚说明
This commit is contained in:
@@ -39,6 +39,7 @@ import {
|
||||
import { IconGift } from '@/components/ui/icons';
|
||||
import { useMinimumLoadingTime } from '../../hooks/common/useMinimumLoadingTime';
|
||||
import { getCurrencyConfig } from '../../helpers/render';
|
||||
import { formatNumber, toFiniteNumber } from '../../helpers/safeDisplay';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
@@ -300,7 +301,7 @@ const RechargeCard = ({
|
||||
return (
|
||||
<span className='text-xs font-normal px-2 py-0.5 bg-gray-100 dark:bg-gray-700 rounded-full text-gray-500'>
|
||||
{I18N_TECHNICAL_TEXT.USD_EXCHANGE_PREFIX}{' '}
|
||||
{rate.toFixed(2)} {symbol}
|
||||
{formatNumber(rate, 2, '1.00')} {symbol}
|
||||
</span>
|
||||
);
|
||||
})()}
|
||||
@@ -309,11 +310,14 @@ const RechargeCard = ({
|
||||
>
|
||||
<div className='grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4'>
|
||||
{presetAmounts.map((preset, index) => {
|
||||
const presetValue = toFiniteNumber(preset.value) ?? 0;
|
||||
const discount =
|
||||
preset.discount ||
|
||||
topupInfo?.discount?.[preset.value] ||
|
||||
1.0;
|
||||
const originalPrice = preset.value * priceRatio;
|
||||
toFiniteNumber(
|
||||
preset.discount ??
|
||||
topupInfo?.discount?.[preset.value],
|
||||
) ?? 1.0;
|
||||
const originalPrice =
|
||||
presetValue * (toFiniteNumber(priceRatio) ?? 0);
|
||||
const discountedPrice = originalPrice * discount;
|
||||
const hasDiscount = discount < 1.0;
|
||||
const actualPay = discountedPrice;
|
||||
@@ -326,15 +330,17 @@ const RechargeCard = ({
|
||||
if (statusStr) {
|
||||
const s = JSON.parse(statusStr);
|
||||
// 注意:如果设置了汇率值(包括1),使用设置值;只有未设置(undefined/null)时才用默认值1
|
||||
const parsedRate = toFiniteNumber(
|
||||
s?.usd_exchange_rate,
|
||||
);
|
||||
usdRate =
|
||||
s?.usd_exchange_rate !== undefined &&
|
||||
s?.usd_exchange_rate !== null
|
||||
? s.usd_exchange_rate
|
||||
parsedRate !== null && parsedRate > 0
|
||||
? parsedRate
|
||||
: 1;
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
let displayValue = preset.value;
|
||||
let displayValue = presetValue;
|
||||
let displayActualPay = actualPay;
|
||||
let displaySave = save;
|
||||
|
||||
@@ -393,7 +399,7 @@ const RechargeCard = ({
|
||||
{hasDiscount && (
|
||||
<div className='text-xs font-semibold px-2 py-0.5 bg-green-100 text-green-700 rounded-full mb-2'>
|
||||
{t('省')} {symbol}
|
||||
{displaySave.toFixed(0)}
|
||||
{formatNumber(displaySave, 0, '0')}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -403,7 +409,7 @@ const RechargeCard = ({
|
||||
className={`font-bold ${isSelected ? 'text-blue-600' : 'text-gray-900 dark:text-gray-100'}`}
|
||||
>
|
||||
{symbol}
|
||||
{displayActualPay.toFixed(2)}
|
||||
{formatNumber(displayActualPay, 2, '0.00')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user