diff --git a/src/helpers/render.jsx b/src/helpers/render.jsx
index 7c470983..dece4a39 100644
--- a/src/helpers/render.jsx
+++ b/src/helpers/render.jsx
@@ -56,6 +56,7 @@ import { Lock, Bot as FastGPT, Image as Jimeng } from 'lucide-react';
import { Modal, Tag, Typography } from '@/components/ui';
import { copy, getCurrencySymbol, showSuccess } from './utils';
import { visit } from 'unist-util-visit';
+import { toFiniteNumber } from './safeDisplay';
// Full Avatar/Text/Combine variants are loaded only when configured icons render.
const LobeHubIcon = lazy(() => import('../components/common/LobeHubIcon'));
@@ -783,35 +784,30 @@ export function renderNumber(num) {
}
export function getQuotaPerUnit() {
- let quotaPerUnit = localStorage.getItem('quota_per_unit');
- quotaPerUnit = parseFloat(quotaPerUnit);
- return quotaPerUnit;
+ const quotaPerUnit = toFiniteNumber(localStorage.getItem('quota_per_unit'));
+ return quotaPerUnit !== null && quotaPerUnit > 0 ? quotaPerUnit : 500000;
}
export function renderUnitWithQuota(quota) {
- let quotaPerUnit = localStorage.getItem('quota_per_unit');
- quotaPerUnit = parseFloat(quotaPerUnit);
- quota = parseFloat(quota);
- return quotaPerUnit * quota;
+ return getQuotaPerUnit() * (toFiniteNumber(quota) ?? 0);
}
export function getQuotaWithUnit(quota, digits = 6) {
- let quotaPerUnit = localStorage.getItem('quota_per_unit');
- quotaPerUnit = parseFloat(quotaPerUnit);
- return (quota / quotaPerUnit).toFixed(digits);
+ return ((toFiniteNumber(quota) ?? 0) / getQuotaPerUnit()).toFixed(digits);
}
export function renderQuotaWithAmount(amount) {
+ const normalizedAmount = toFiniteNumber(amount) ?? 0;
const quotaDisplayType = localStorage.getItem('quota_display_type') || 'USD';
if (quotaDisplayType === 'TOKENS') {
- return renderNumber(renderUnitWithQuota(amount));
+ return renderNumber(renderUnitWithQuota(normalizedAmount));
}
if (quotaDisplayType === 'CNY') {
- return getCurrencySymbol('CNY') + amount;
+ return getCurrencySymbol('CNY') + normalizedAmount;
} else if (quotaDisplayType === 'CUSTOM') {
- return getCurrencySymbol('CUSTOM') + amount;
+ return getCurrencySymbol('CUSTOM') + normalizedAmount;
}
- return getCurrencySymbol('USD') + amount;
+ return getCurrencySymbol('USD') + normalizedAmount;
}
/**
@@ -830,11 +826,8 @@ export function getCurrencyConfig() {
try {
if (statusStr) {
const s = JSON.parse(statusStr);
- // 注意:如果设置了汇率值(包括1),使用设置值;只有未设置(undefined/null)时才用默认值1
- rate =
- s?.usd_exchange_rate !== undefined && s?.usd_exchange_rate !== null
- ? s.usd_exchange_rate
- : 1;
+ const parsedRate = toFiniteNumber(s?.usd_exchange_rate);
+ rate = parsedRate !== null && parsedRate > 0 ? parsedRate : 1;
}
} catch (e) {}
} else if (quotaDisplayType === 'CUSTOM') {
@@ -842,7 +835,8 @@ export function getCurrencyConfig() {
if (statusStr) {
const s = JSON.parse(statusStr);
symbol = getCurrencySymbol('CUSTOM', s?.custom_currency_symbol);
- rate = s?.custom_currency_exchange_rate || 1;
+ const parsedRate = toFiniteNumber(s?.custom_currency_exchange_rate);
+ rate = parsedRate !== null && parsedRate > 0 ? parsedRate : 1;
}
} catch (e) {
symbol = getCurrencySymbol('CUSTOM');
@@ -860,18 +854,18 @@ export function getCurrencyConfig() {
*/
export function convertUSDToCurrency(usdAmount, digits = 2) {
const { symbol, rate } = getCurrencyConfig();
- const convertedAmount = usdAmount * rate;
+ const convertedAmount = (toFiniteNumber(usdAmount) ?? 0) * rate;
return symbol + convertedAmount.toFixed(digits);
}
export function renderQuota(quota, digits = 2) {
- let quotaPerUnit = localStorage.getItem('quota_per_unit');
+ const normalizedQuota = toFiniteNumber(quota) ?? 0;
const quotaDisplayType = localStorage.getItem('quota_display_type') || 'USD';
- quotaPerUnit = parseFloat(quotaPerUnit);
+ const quotaPerUnit = getQuotaPerUnit();
if (quotaDisplayType === 'TOKENS') {
- return renderNumber(quota);
+ return renderNumber(normalizedQuota);
}
- const resultUSD = quota / quotaPerUnit;
+ const resultUSD = normalizedQuota / quotaPerUnit;
let symbol = getCurrencySymbol('USD');
let value = resultUSD;
if (quotaDisplayType === 'CNY') {
@@ -880,7 +874,8 @@ export function renderQuota(quota, digits = 2) {
try {
if (statusStr) {
const s = JSON.parse(statusStr);
- usdRate = s?.usd_exchange_rate || 1;
+ const parsedRate = toFiniteNumber(s?.usd_exchange_rate);
+ usdRate = parsedRate !== null && parsedRate > 0 ? parsedRate : 1;
}
} catch (e) {}
value = resultUSD * usdRate;
@@ -893,14 +888,15 @@ export function renderQuota(quota, digits = 2) {
if (statusStr) {
const s = JSON.parse(statusStr);
symbolCustom = getCurrencySymbol('CUSTOM', s?.custom_currency_symbol);
- rate = s?.custom_currency_exchange_rate || rate;
+ const parsedRate = toFiniteNumber(s?.custom_currency_exchange_rate);
+ rate = parsedRate !== null && parsedRate > 0 ? parsedRate : 1;
}
} catch (e) {}
value = resultUSD * rate;
symbol = symbolCustom;
}
const fixedResult = value.toFixed(digits);
- if (parseFloat(fixedResult) === 0 && quota > 0 && value > 0) {
+ if (parseFloat(fixedResult) === 0 && normalizedQuota > 0 && value > 0) {
const minValue = Math.pow(10, -digits);
return symbol + minValue.toFixed(digits);
}
@@ -947,7 +943,10 @@ export function renderExportQuota(quota, digits = 6) {
if (!Number.isFinite(quotaPerUnit) || quotaPerUnit <= 0) {
quotaPerUnit = 500000;
}
- return getCurrencySymbol() + (quota / quotaPerUnit).toFixed(digits);
+ return (
+ getCurrencySymbol() +
+ ((toFiniteNumber(quota) ?? 0) / quotaPerUnit).toFixed(digits)
+ );
}
function isValidGroupRatio(ratio) {
diff --git a/src/helpers/safeDisplay.js b/src/helpers/safeDisplay.js
index 75a6dc1d..bd97d992 100644
--- a/src/helpers/safeDisplay.js
+++ b/src/helpers/safeDisplay.js
@@ -18,7 +18,8 @@ For commercial licensing, please contact support@quantumnous.com
*/
export const toFiniteNumber = (value) => {
- if (value === null || value === undefined || value === '') return null;
+ if (value === null || value === undefined) return null;
+ if (typeof value === 'string' && value.trim() === '') return null;
const number = Number(value);
return Number.isFinite(number) ? number : null;
};
@@ -28,6 +29,21 @@ export const formatPercent = (value, digits = 1, fallback = '-') => {
return number === null ? fallback : `${number.toFixed(digits)}%`;
};
+export const formatNumber = (value, digits = 2, fallback = '-') => {
+ const number = toFiniteNumber(value);
+ return number === null ? fallback : number.toFixed(digits);
+};
+
+export const formatCurrency = (
+ value,
+ symbol = '¥',
+ digits = 2,
+ fallback = '-',
+) => {
+ const formatted = formatNumber(value, digits, null);
+ return formatted === null ? fallback : symbol + formatted;
+};
+
export const formatRatioPercent = (part, total, digits = 1, fallback = '-') => {
const numerator = toFiniteNumber(part);
const denominator = toFiniteNumber(total);
diff --git a/src/hooks/model-pricing/useModelPricingData.jsx b/src/hooks/model-pricing/useModelPricingData.jsx
index 9059090f..4118f442 100644
--- a/src/hooks/model-pricing/useModelPricingData.jsx
+++ b/src/hooks/model-pricing/useModelPricingData.jsx
@@ -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 = (
diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json
index 48832b65..a84f2089 100644
--- a/src/i18n/locales/en.json
+++ b/src/i18n/locales/en.json
@@ -6118,6 +6118,7 @@
"未找到匹配会话": "No matching conversations",
"未找到视频URL": "Video URL not found",
"未知": "Unknown",
+ "未知档位": "Unknown tier",
"未知错误": "Unknown error",
"未知供应商": "Unknown",
"未知计费类型,暂不支持配置官方价": "Unknown billing type; official price cannot be configured",
diff --git a/src/i18n/locales/fr.json b/src/i18n/locales/fr.json
index 03ee4dc9..aaabbadc 100644
--- a/src/i18n/locales/fr.json
+++ b/src/i18n/locales/fr.json
@@ -5868,6 +5868,7 @@
"未找到匹配会话": "Aucune session match trouvée",
"未找到视频URL": "Vidéo introuvable URL",
"未知": "Inconnu",
+ "未知档位": "Niveau inconnu",
"未知错误": "Erreur inconnue",
"未知供应商": "Inconnu",
"未知计费类型,暂不支持配置官方价": "Type de facturation inconnu, configuration du prix officiel non prise en charge temporairement",
diff --git a/src/i18n/locales/ja.json b/src/i18n/locales/ja.json
index ae3600e0..292ea889 100644
--- a/src/i18n/locales/ja.json
+++ b/src/i18n/locales/ja.json
@@ -6118,6 +6118,7 @@
"未找到匹配会话": "一致する会話が見つかりません",
"未找到视频URL": "動画URLが見つかりません",
"未知": "不明",
+ "未知档位": "不明なティア",
"未知错误": "不明なエラー",
"未知供应商": "不明なプロバイダー",
"未知计费类型,暂不支持配置官方价": "不明な課金タイプのため、公式価格は設定できません",
diff --git a/src/i18n/locales/ko.json b/src/i18n/locales/ko.json
index ba72a2af..1bb7cd7f 100644
--- a/src/i18n/locales/ko.json
+++ b/src/i18n/locales/ko.json
@@ -6118,6 +6118,7 @@
"未找到匹配会话": "일치하는 대화가 없습니다",
"未找到视频URL": "동영상 URL을 찾을 수 없습니다",
"未知": "알 수 없음",
+ "未知档位": "알 수 없는 등급",
"未知错误": "알 수 없는 오류",
"未知供应商": "알 수 없음",
"未知计费类型,暂不支持配置官方价": "알 수 없는 과금 유형이라 아직 정가를 설정할 수 없습니다",
diff --git a/src/i18n/locales/ru.json b/src/i18n/locales/ru.json
index b280593a..48de1189 100644
--- a/src/i18n/locales/ru.json
+++ b/src/i18n/locales/ru.json
@@ -5905,6 +5905,7 @@
"未找到匹配会话": "Нет совпадений разговоров",
"未找到视频URL": "Видео URL не найден",
"未知": "Неизвестно",
+ "未知档位": "Неизвестный уровень",
"未知错误": "Неизвестная ошибка",
"未知供应商": "Неизвестный поставщик",
"未知计费类型,暂不支持配置官方价": "Неизвестный тип выставления счетов; официальная цена не может быть настроена",
diff --git a/src/i18n/locales/th.json b/src/i18n/locales/th.json
index 5d1cfeef..90ee0ae7 100644
--- a/src/i18n/locales/th.json
+++ b/src/i18n/locales/th.json
@@ -6118,6 +6118,7 @@
"未找到匹配会话": "ไม่พบบทสนทนาที่ตรงกัน",
"未找到视频URL": "ไม่พบ URL ของวิดีโอ",
"未知": "ไม่ทราบ",
+ "未知档位": "ระดับที่ไม่รู้จัก",
"未知错误": "ข้อผิดพลาดที่ไม่ทราบสาเหตุ",
"未知供应商": "ไม่ทราบ",
"未知计费类型,暂不支持配置官方价": "ประเภทการคิดค่าบริการที่ไม่รู้จัก ยังไม่รองรับการตั้งราคาทางการ",
diff --git a/src/i18n/locales/vi.json b/src/i18n/locales/vi.json
index 0779f8a6..9cbc6746 100644
--- a/src/i18n/locales/vi.json
+++ b/src/i18n/locales/vi.json
@@ -6118,6 +6118,7 @@
"未找到匹配会话": "Không tìm thấy hội thoại phù hợp",
"未找到视频URL": "Không tìm thấy URL video",
"未知": "không xác định",
+ "未知档位": "Bậc không xác định",
"未知错误": "Lỗi không xác định",
"未知供应商": "Không xác định",
"未知计费类型,暂不支持配置官方价": "Loại tính phí không xác định, tạm không hỗ trợ cấu hình giá chính thức",
diff --git a/src/i18n/locales/zh-TW.json b/src/i18n/locales/zh-TW.json
index e728d6bc..984233e7 100644
--- a/src/i18n/locales/zh-TW.json
+++ b/src/i18n/locales/zh-TW.json
@@ -6118,6 +6118,7 @@
"未找到匹配会话": "未找到匹配會話",
"未找到视频URL": "未找到影片URL",
"未知": "未知",
+ "未知档位": "未知檔位",
"未知错误": "未知錯誤",
"未知供应商": "未知供應商",
"未知计费类型,暂不支持配置官方价": "未知計費類型,暫不支援配置官方價",
diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json
index 41e99aa4..5e19ef1e 100644
--- a/src/i18n/locales/zh.json
+++ b/src/i18n/locales/zh.json
@@ -6057,6 +6057,7 @@
"未找到匹配会话": "未找到匹配会话",
"未找到视频URL": "未找到视频URL",
"未知": "未知",
+ "未知档位": "未知档位",
"未知错误": "未知错误",
"未知供应商": "未知供应商",
"未知计费类型,暂不支持配置官方价": "未知计费类型,暂不支持配置官方价",
diff --git a/src/pages/AdminInvoice/index.jsx b/src/pages/AdminInvoice/index.jsx
index 605ce9a0..83c7287d 100644
--- a/src/pages/AdminInvoice/index.jsx
+++ b/src/pages/AdminInvoice/index.jsx
@@ -16,7 +16,12 @@ along with this program. If not, see
.
For commercial licensing, please contact support@quantumnous.com
*/
-import { formatUserReference } from '../../helpers/safeDisplay';
+import {
+ formatCurrency,
+ formatNumber,
+ formatUserReference,
+ toFiniteNumber,
+} from '../../helpers/safeDisplay';
import { Trans } from 'react-i18next';
import {
@@ -269,7 +274,7 @@ const AdminInvoice = () => {
displayName ||
username || (
- {t('用户 #{{id}}', { id: record.user_id })}
+ {formatUserReference(null, record.user_id)}
)
);
@@ -292,7 +297,7 @@ const AdminInvoice = () => {
title: t('金额'),
dataIndex: 'amount',
width: 90,
- render: (v) => `¥${Number(v).toFixed(2)}`,
+ render: (v) => formatCurrency(v),
},
{
title: t('状态'),
@@ -542,7 +547,7 @@ const AdminInvoice = () => {
{t('开票金额')}
- ¥{Number(detailData.amount).toFixed(2)}
+ {formatCurrency(detailData.amount)}
@@ -600,9 +605,15 @@ const AdminInvoice = () => {
i18nKey='关联充值记录 ({{length}} 笔,合计 ¥{{value}})'
values={{
length: detailData.topup_list.length,
- value: detailData.topup_list
- .reduce((s, item) => s + (item.money || 0), 0)
- .toFixed(2),
+ value: formatNumber(
+ detailData.topup_list.reduce(
+ (sum, item) =>
+ sum + (toFiniteNumber(item.money) ?? 0),
+ 0,
+ ),
+ 2,
+ '0.00',
+ ),
}}
/>
@@ -629,7 +640,7 @@ const AdminInvoice = () => {
title: t('金额'),
dataIndex: 'money',
width: 90,
- render: (v) => `¥${Number(v).toFixed(2)}`,
+ render: (v) => formatCurrency(v),
},
]}
/>
diff --git a/src/pages/AdminOrder/index.jsx b/src/pages/AdminOrder/index.jsx
index af8f3b2d..0c726e70 100644
--- a/src/pages/AdminOrder/index.jsx
+++ b/src/pages/AdminOrder/index.jsx
@@ -43,6 +43,7 @@ import {
import { API } from '../../helpers/api';
import { showError, copy } from '../../helpers';
import { renderQuota } from '../../helpers/render';
+import { formatCurrency, toFiniteNumber } from '../../helpers/safeDisplay';
const paymentMethodMap = {
wechat: '微信',
@@ -72,8 +73,8 @@ const payPalSettlementStateMap = {
};
const formatUSDMinor = (value) => {
- if (value === null || value === undefined) return '-';
- return `$${(Number(value) / 100).toFixed(2)}`;
+ const minor = toFiniteNumber(value);
+ return minor === null ? '-' : formatCurrency(minor / 100, '$');
};
import { Descriptions } from 'antd';
@@ -298,7 +299,7 @@ const AdminOrder = () => {
title: t('支付金额'),
dataIndex: 'money',
width: 90,
- render: (v) => (v ? `¥${Number(v).toFixed(2)}` : '-'),
+ render: (v) => (v ? formatCurrency(v) : '-'),
},
{
title: t('支付方式'),
diff --git a/src/pages/CommissionV2/PartnerPortal.jsx b/src/pages/CommissionV2/PartnerPortal.jsx
index 3f95c5ae..679d9d71 100644
--- a/src/pages/CommissionV2/PartnerPortal.jsx
+++ b/src/pages/CommissionV2/PartnerPortal.jsx
@@ -1094,7 +1094,7 @@ export default function PartnerPortal({
{row.customer_name ||
row.subject_name ||
- `${commissionLabel(t, 'subjectType', row.subject_type)} #${row.subject_id}`}
+ `${commissionLabel(t, 'subjectType', row.subject_type)} ${formatIdReference(row.subject_id)}`}
),
},
@@ -1357,7 +1357,7 @@ export default function PartnerPortal({
title={t(pageTitle)}
subtitle={
selected ? (
- `${t('账单号')} #${selected.id} · ${selected.statement_month}`
+ `${t('账单号')} ${formatIdReference(selected.id)} · ${selected.statement_month}`
) : (
<>
{t(subtitles[active])}
@@ -1375,7 +1375,7 @@ export default function PartnerPortal({
{!embedded && (
{selected
- ? `${t('账单号')} #${selected.id} · ${selected.statement_month}`
+ ? `${t('账单号')} ${formatIdReference(selected.id)} · ${selected.statement_month}`
: t(subtitles[active])}
{!selected &&
['overview', 'estimate'].includes(active) &&
@@ -1462,7 +1462,7 @@ export default function PartnerPortal({
style={themeStyle}
className='commission-modal partner-portal-modal'
visible={!!action}
- title={`${t(action === 'reject' ? '驳回账单' : '确认账单')} · #${selected?.id || ''}`}
+ title={`${t(action === 'reject' ? '驳回账单' : '确认账单')} · ${formatIdReference(selected?.id)}`}
confirmLoading={mutationLoading}
closeOnEsc={!mutationLoading}
maskClosable={!mutationLoading}
diff --git a/src/pages/CommissionV2/index.jsx b/src/pages/CommissionV2/index.jsx
index 3fe544f7..584737af 100644
--- a/src/pages/CommissionV2/index.jsx
+++ b/src/pages/CommissionV2/index.jsx
@@ -16,7 +16,12 @@ along with this program. If not, see .
For commercial licensing, please contact support@quantumnous.com
*/
-import { formatIdReference } from '../../helpers/safeDisplay';
+import {
+ formatCurrency,
+ formatIdReference,
+ formatPercent,
+ toFiniteNumber,
+} from '../../helpers/safeDisplay';
import React, {
useCallback,
@@ -89,7 +94,8 @@ const { Title, Text } = Typography;
const emptyState = (description) => (
);
-const money = (value) => `¥${(Number(value || 0) / 1e6).toFixed(2)}`;
+const money = (value) =>
+ formatCurrency((toFiniteNumber(value) ?? 0) / 1e6, '¥', 2, '¥0.00');
const protectionUntil = (row) =>
Number(row.extended_until || row.protected_until || 0);
const date = (value) =>
@@ -222,7 +228,7 @@ function TierSummary({ items }) {
{
title: t('比例'),
dataIndex: 'rate_bps',
- render: (value) => `${Number(value || 0) / 100}%`,
+ render: (value) => formatPercent(Number(value || 0) / 100, 2),
},
{ title: t('调用笔数'), dataIndex: 'count' },
{ title: t('有效销售额'), dataIndex: 'sales', render: money },
@@ -1076,7 +1082,7 @@ function AdminPage() {
? t('企业组织')
: t('个人用户'))
}
- reference={`${commissionLabel(t, 'subjectType', row.subject_type)} #${row.subject_id}`}
+ reference={`${commissionLabel(t, 'subjectType', row.subject_type)} ${formatIdReference(row.subject_id)}`}
/>
),
},
@@ -1282,7 +1288,7 @@ function AdminPage() {
{
title: t('比例'),
dataIndex: 'rate_bps',
- render: (v) => `${(Number(v || 0) / 100).toFixed(2)}%`,
+ render: (v) => formatPercent(Number(v) / 100, 2),
},
{
title: t('生效时间'),
diff --git a/src/pages/CommissionV2/latestTiers.js b/src/pages/CommissionV2/latestTiers.js
index 41a6cd50..b7c9c465 100644
--- a/src/pages/CommissionV2/latestTiers.js
+++ b/src/pages/CommissionV2/latestTiers.js
@@ -16,6 +16,8 @@ along with this program. If not, see .
For commercial licensing, please contact support@quantumnous.com
*/
+import { formatIdReference } from '../../helpers/safeDisplay.js';
+
export function latestTierURL(filters = {}, page = 1, snapshot = {}) {
const params = new URLSearchParams({
view: 'latest',
@@ -83,5 +85,5 @@ export function identityOptionLabel(item) {
const name =
item.name || item.display_name || item.username || item.code || '';
const identifier = item.name ? item.code : item.username;
- return `${name}${identifier && identifier !== name ? ` · ${identifier}` : ''} (#${item.id})${item.disabled_reason ? ` · ${item.disabled_reason}` : ''}`;
+ return `${name}${identifier && identifier !== name ? ` · ${identifier}` : ''} (${formatIdReference(item.id)})${item.disabled_reason ? ` · ${item.disabled_reason}` : ''}`;
}
diff --git a/src/pages/CommissionV2/operations.jsx b/src/pages/CommissionV2/operations.jsx
index 8514e65e..bd039152 100644
--- a/src/pages/CommissionV2/operations.jsx
+++ b/src/pages/CommissionV2/operations.jsx
@@ -51,6 +51,12 @@ import {
} from './operationForm';
import { pickerEpoch } from './datePicker';
import { API } from '../../helpers';
+import {
+ formatCurrency,
+ formatIdReference,
+ formatPercent,
+ toFiniteNumber,
+} from '../../helpers/safeDisplay';
import RemoteIdentitySelect from './RemoteIdentitySelect';
import { fetchAllLatestTiers } from './latestTiers';
import './formSections.css';
@@ -340,7 +346,7 @@ export function OperationsDialog({
style={{ width: '100%' }}
optionList={rows.map((item) => ({
value: item.id,
- label: `${name(item)} (#${item.id})`,
+ label: `${name(item)} (${formatIdReference(item.id)})`,
}))}
/>
@@ -848,7 +854,7 @@ export function OperationsDialog({
channel.id,
{
value: channel.id,
- label: `${channel.name} (#${channel.id})`,
+ label: `${channel.name || t('未知渠道')} (${formatIdReference(channel.id)})`,
},
]),
]).values(),
@@ -944,7 +950,7 @@ export function OperationsDialog({
'等级档位',
bindingConfigs.map((item) => ({ ...item, id: item.config_id })),
(item) =>
- `${item.name || item.tier_key} · 配置 #${item.config_id}`,
+ `${item.name || item.tier_key || t('未知档位')} · 配置 ${formatIdReference(item.config_id)}`,
)}
{dateField('effective_from', '绑定生效时间', true)}
`${Number(value || 0) / 100}%`,
+ render: (value) => formatPercent(Number(value || 0) / 100, 2),
},
{ title: t('提成金额'), dataIndex: 'commission_uyuan', render: money },
];
@@ -1358,11 +1364,16 @@ export function SettlementDialog({
@@ -1449,7 +1460,7 @@ export function SettlementDialog({
onChange={(value) => set('detail_id', value)}
optionList={items.map((item) => ({
value: item.detail_id,
- label: `${item.billing_record_id} · ${item.model_name || ''} · ${Number(item.rate_bps || 0) / 100}%`,
+ label: `${formatIdReference(item.billing_record_id)} · ${item.model_name || t('未知模型')} · ${formatPercent(Number(item.rate_bps) / 100, 2)}`,
}))}
/>
diff --git a/src/pages/ExpertPlatform/index.jsx b/src/pages/ExpertPlatform/index.jsx
index c0b686dc..f033f576 100644
--- a/src/pages/ExpertPlatform/index.jsx
+++ b/src/pages/ExpertPlatform/index.jsx
@@ -16,7 +16,7 @@ along with this program. If not, see .
For commercial licensing, please contact support@quantumnous.com
*/
-import { formatIdReference } from '../../helpers/safeDisplay';
+import { formatIdReference, formatNumber } from '../../helpers/safeDisplay';
import { Trans } from 'react-i18next';
import {
@@ -2346,7 +2346,7 @@ const ExpertPlatform = () => {
{row.success
- ? `${t('通过')} · ${Number(row.time || 0).toFixed(2)}s`
+ ? `${t('通过')} · ${formatNumber(row.time, 2, '0.00')}s`
: row.message || t('失败')}
diff --git a/src/pages/Organization/OrgDeptManage.jsx b/src/pages/Organization/OrgDeptManage.jsx
index ffab25ed..cac8f239 100644
--- a/src/pages/Organization/OrgDeptManage.jsx
+++ b/src/pages/Organization/OrgDeptManage.jsx
@@ -327,7 +327,7 @@ const OrgDeptManage = ({ orgId, featureFlags }) => {
placeholder={t('选择部门')}
style={{ width: 180 }}
optionList={departments.map((d) => ({
- label: `${d.name}(${d.member_count})`,
+ label: `${d.name || t('未命名部门')}(${d.member_count ?? 0})`,
value: d.id,
}))}
/>
diff --git a/src/pages/Organization/OrgEffectiveness.jsx b/src/pages/Organization/OrgEffectiveness.jsx
index 0fc4b9c7..1e9dede2 100644
--- a/src/pages/Organization/OrgEffectiveness.jsx
+++ b/src/pages/Organization/OrgEffectiveness.jsx
@@ -16,8 +16,11 @@ along with this program. If not, see
.
For commercial licensing, please contact support@quantumnous.com
*/
-import { formatIdReference } from '../../helpers/safeDisplay';
-import { formatPercent } from '../../helpers/safeDisplay';
+import {
+ formatIdReference,
+ formatNumber,
+ formatPercent,
+} from '../../helpers/safeDisplay';
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import { RefreshCw as ActionRefreshCw } from '@/components/common/icons/ActionIcons';
@@ -271,7 +274,7 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
{
label: t('质量评分'),
value: metric.has('quality.score')
- ? value('quality.score', true).toFixed(1)
+ ? formatNumber(value('quality.score', true), 1, t('数据不足'))
: t('数据不足'),
detail: `${Math.round(value('quality.feedback_count'))} ${t('反馈样本')}`,
icon: FlaskConical,
@@ -475,7 +478,7 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {