fix(*): 全量 UI 审查与 undefined 展示异常修复
This commit is contained in:
@@ -31,6 +31,7 @@ import {
|
||||
import { Modal } from '@/components/ui';
|
||||
import { UserContext } from '../../context/User';
|
||||
import { StatusContext } from '../../context/Status';
|
||||
import { formatNumber, toFiniteNumber } from '../../helpers/safeDisplay';
|
||||
|
||||
export const useModelPricingData = () => {
|
||||
const { t } = useTranslation();
|
||||
@@ -189,17 +190,27 @@ export const useModelPricingData = () => {
|
||||
);
|
||||
|
||||
const displayPrice = (usdPrice) => {
|
||||
let priceInUSD = usdPrice;
|
||||
const basePrice = toFiniteNumber(usdPrice) ?? 0;
|
||||
const rechargeRate = toFiniteNumber(priceRate) ?? 1;
|
||||
const exchangeRate = toFiniteNumber(usdExchangeRate) ?? 1;
|
||||
const customRate = toFiniteNumber(customExchangeRate) ?? 1;
|
||||
let priceInUSD = basePrice;
|
||||
if (showWithRecharge) {
|
||||
priceInUSD = (usdPrice * priceRate) / usdExchangeRate;
|
||||
priceInUSD = (basePrice * rechargeRate) / exchangeRate;
|
||||
}
|
||||
|
||||
if (currency === 'CNY') {
|
||||
return `${getCurrencySymbol('CNY')}${(priceInUSD * usdExchangeRate).toFixed(3)}`;
|
||||
return (
|
||||
getCurrencySymbol('CNY') +
|
||||
formatNumber(priceInUSD * exchangeRate, 3, '0.000')
|
||||
);
|
||||
} else if (currency === 'CUSTOM') {
|
||||
return `${getCurrencySymbol('CUSTOM', customCurrencySymbol)}${(priceInUSD * customExchangeRate).toFixed(3)}`;
|
||||
return (
|
||||
getCurrencySymbol('CUSTOM', customCurrencySymbol) +
|
||||
formatNumber(priceInUSD * customRate, 3, '0.000')
|
||||
);
|
||||
}
|
||||
return `${getCurrencySymbol('USD')}${priceInUSD.toFixed(3)}`;
|
||||
return getCurrencySymbol('USD') + formatNumber(priceInUSD, 3, '0.000');
|
||||
};
|
||||
|
||||
const setModelsFormat = (
|
||||
|
||||
Reference in New Issue
Block a user