fix(*): 全量 UI 审查与 undefined 展示异常修复
分析模块:补齐看板、排行、趋势及报表数值兜底 企业与用户中心:修复统计、成员、技能及资金字段展示 充值与交易:修复充值、发票、订单、订阅及支付字段拼接 平台页面:修复渠道、模型、服务监控与状态空值展示 通用能力:新增安全展示工具,补齐九语言文案与回归测试 文档记录:更新修复范围、影响及回滚说明
This commit is contained in:
@@ -16,7 +16,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
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 || (
|
||||
<span className='text-gray-400'>
|
||||
{t('用户 #{{id}}', { id: record.user_id })}
|
||||
{formatUserReference(null, record.user_id)}
|
||||
</span>
|
||||
)
|
||||
);
|
||||
@@ -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 = () => {
|
||||
<div>
|
||||
<Text className='text-gray-400 text-sm'>{t('开票金额')}</Text>
|
||||
<div className='font-bold text-amber-600'>
|
||||
¥{Number(detailData.amount).toFixed(2)}
|
||||
{formatCurrency(detailData.amount)}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
@@ -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',
|
||||
),
|
||||
}}
|
||||
/>
|
||||
</Text>
|
||||
@@ -629,7 +640,7 @@ const AdminInvoice = () => {
|
||||
title: t('金额'),
|
||||
dataIndex: 'money',
|
||||
width: 90,
|
||||
render: (v) => `¥${Number(v).toFixed(2)}`,
|
||||
render: (v) => formatCurrency(v),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
@@ -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('支付方式'),
|
||||
|
||||
@@ -1094,7 +1094,7 @@ export default function PartnerPortal({
|
||||
<b>
|
||||
{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)}`}
|
||||
</b>
|
||||
),
|
||||
},
|
||||
@@ -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 && (
|
||||
<Text type='secondary'>
|
||||
{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}
|
||||
|
||||
@@ -16,7 +16,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
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) => (
|
||||
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description={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('生效时间'),
|
||||
|
||||
@@ -16,6 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
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}` : ''}`;
|
||||
}
|
||||
|
||||
@@ -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)})`,
|
||||
}))}
|
||||
/>
|
||||
</Field>
|
||||
@@ -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)}
|
||||
<Alert
|
||||
@@ -1148,7 +1154,7 @@ export function BillingColumns(t, money, date) {
|
||||
{
|
||||
title: t('比例'),
|
||||
dataIndex: 'rate_bps',
|
||||
render: (value) => `${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({
|
||||
<Descriptions
|
||||
row
|
||||
data={[
|
||||
{ key: t('账单编号'), value: `#${statement.id}` },
|
||||
{ key: t('账单编号'), value: formatIdReference(statement.id) },
|
||||
{ key: t('账期'), value: statement.statement_month || '—' },
|
||||
{
|
||||
key: t('应付金额'),
|
||||
value: `¥${(Number(statement.payable_uyuan || 0) / 1e6).toFixed(2)}`,
|
||||
value: formatCurrency(
|
||||
(toFiniteNumber(statement.payable_uyuan) ?? 0) / 1e6,
|
||||
'¥',
|
||||
2,
|
||||
'¥0.00',
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
@@ -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)}`,
|
||||
}))}
|
||||
/>
|
||||
</Field>
|
||||
|
||||
@@ -16,7 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
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 = () => {
|
||||
</strong>
|
||||
<small>
|
||||
{row.success
|
||||
? `${t('通过')} · ${Number(row.time || 0).toFixed(2)}s`
|
||||
? `${t('通过')} · ${formatNumber(row.time, 2, '0.00')}s`
|
||||
: row.message || t('失败')}
|
||||
</small>
|
||||
</div>
|
||||
|
||||
@@ -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,
|
||||
}))}
|
||||
/>
|
||||
|
||||
@@ -16,8 +16,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
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 }) => {
|
||||
</Tag>
|
||||
</div>
|
||||
<span>
|
||||
{t('评分')}: {Number(row.score).toFixed(1)}
|
||||
{t('评分')}: {formatNumber(row.score, 1)}
|
||||
</span>
|
||||
<span>
|
||||
{t('样本')}: {row.sample_count}
|
||||
@@ -496,7 +499,7 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
|
||||
{
|
||||
title: t('评分'),
|
||||
dataIndex: 'score',
|
||||
render: (score) => Number(score).toFixed(1),
|
||||
render: (score) => formatNumber(score, 1),
|
||||
},
|
||||
{ title: t('样本'), dataIndex: 'sample_count' },
|
||||
{
|
||||
@@ -564,7 +567,7 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
|
||||
<span>
|
||||
{t('平均成本')}:{' '}
|
||||
{row.data_sufficient
|
||||
? Number(row.average_quota).toFixed(1)
|
||||
? formatNumber(row.average_quota, 1)
|
||||
: t('数据不足')}
|
||||
</span>
|
||||
</article>
|
||||
@@ -598,7 +601,7 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
|
||||
title: t('平均成本'),
|
||||
render: (_, row) =>
|
||||
row.data_sufficient
|
||||
? Number(row.average_quota).toFixed(1)
|
||||
? formatNumber(row.average_quota, 1)
|
||||
: t('数据不足'),
|
||||
},
|
||||
]}
|
||||
|
||||
@@ -16,8 +16,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { formatIdReference } from '../../helpers/safeDisplay';
|
||||
import { formatPercent } from '../../helpers/safeDisplay';
|
||||
import {
|
||||
formatIdReference,
|
||||
formatPercent,
|
||||
toFiniteNumber,
|
||||
} from '../../helpers/safeDisplay';
|
||||
|
||||
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
|
||||
import {
|
||||
@@ -100,9 +103,10 @@ const uploadContentType = (file) => {
|
||||
};
|
||||
|
||||
const formatBytes = (bytes, t) => {
|
||||
if (!bytes) return `0 ${t('字节')}`;
|
||||
const numericBytes = toFiniteNumber(bytes);
|
||||
if (numericBytes === null || numericBytes <= 0) return `0 ${t('字节')}`;
|
||||
const units = [t('字节'), 'KiB', 'MiB', 'GiB'];
|
||||
let value = Number(bytes);
|
||||
let value = numericBytes;
|
||||
let unit = 0;
|
||||
while (value >= 1024 && unit < units.length - 1) {
|
||||
value /= 1024;
|
||||
|
||||
@@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
|
||||
import { formatNumber } from '../../helpers/safeDisplay';
|
||||
import { Check as ActionCheck } from '@/components/common/icons/ActionIcons';
|
||||
import React, { useEffect, useState, useCallback, useMemo } from 'react';
|
||||
import { timestamp2string } from '../../helpers/utils';
|
||||
@@ -467,7 +468,7 @@ const OrgRecharge = ({ orgId }) => {
|
||||
}
|
||||
if (effectiveAmountYuan <= 0) return '';
|
||||
const pay = effectiveAmountYuan * effectiveDiscount;
|
||||
return `${pay.toFixed(2)} ${t('元')}`;
|
||||
return `${formatNumber(pay, 2, '0.00')} ${t('元')}`;
|
||||
};
|
||||
|
||||
// 充值记录状态渲染
|
||||
@@ -508,7 +509,7 @@ const OrgRecharge = ({ orgId }) => {
|
||||
title: t('金额'),
|
||||
dataIndex: 'money',
|
||||
width: 140,
|
||||
render: (v) => `¥${Number(v).toFixed(2)}`,
|
||||
render: (v) => `¥${formatNumber(v, 2, '0.00')}`,
|
||||
},
|
||||
{
|
||||
title: t('获得额度'),
|
||||
@@ -776,7 +777,14 @@ const OrgRecharge = ({ orgId }) => {
|
||||
</div>
|
||||
<div>
|
||||
<dt>{t('优惠金额')}</dt>
|
||||
<dd>¥{(effectiveAmountYuan - payableYuan).toFixed(2)}</dd>
|
||||
<dd>
|
||||
¥
|
||||
{formatNumber(
|
||||
effectiveAmountYuan - payableYuan,
|
||||
2,
|
||||
'0.00',
|
||||
)}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{t('支付方式')}</dt>
|
||||
|
||||
@@ -25,6 +25,7 @@ import { Table, Button, Tag, Toast, Input, Popconfirm } from '@/components/ui';
|
||||
import { API } from '../../helpers/api';
|
||||
import { showError, collectPagedItems } from '../../helpers';
|
||||
import { renderQuota } from '../../helpers/render';
|
||||
import { formatIdReference } from '../../helpers/safeDisplay';
|
||||
import OrgPageHeader from './components/OrgPageHeader';
|
||||
import { OrgListCard, OrgRowActions } from './components/OrgListCard';
|
||||
import OrgModal from './components/OrgModal';
|
||||
@@ -158,7 +159,7 @@ const OrgRequests = ({ orgId, orgRole, featureFlags }) => {
|
||||
// 后端已富化 subject_name;主体被删除等极端情况回退为 #ID
|
||||
return r.subject_name
|
||||
? `${label} · ${r.subject_name}`
|
||||
: `${label} #${r.subject_id}`;
|
||||
: `${label} ${formatIdReference(r.subject_id, t('未知主体'))}`;
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { formatUserReference } from '../../helpers/safeDisplay';
|
||||
import { formatCurrency, formatUserReference } from '../../helpers/safeDisplay';
|
||||
|
||||
import {
|
||||
RefreshCw as ActionRefreshCw,
|
||||
@@ -654,7 +654,12 @@ const OrgSettings = ({ orgId, orgRole }) => {
|
||||
extra={
|
||||
Number(alertYuan) >= 0.005
|
||||
? t('当企业剩余额度低于 {{amount}} 时触发预警', {
|
||||
amount: `${getCurrencySymbol()}${Number(alertYuan).toFixed(2)}`,
|
||||
amount: formatCurrency(
|
||||
alertYuan,
|
||||
getCurrencySymbol(),
|
||||
2,
|
||||
getCurrencySymbol() + '0.00',
|
||||
),
|
||||
})
|
||||
: t('当前为 0:已关闭余额预警')
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import {
|
||||
} from '@/components/ui';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { API } from '../../helpers';
|
||||
import { formatIdReference } from '../../helpers/safeDisplay';
|
||||
import {
|
||||
ActivationModeTag,
|
||||
AssignmentModeTag,
|
||||
@@ -354,7 +355,7 @@ const OrgSkillAssignments = ({ orgId, orgRole = '' }) => {
|
||||
>
|
||||
{library.map((item) => (
|
||||
<Select.Option key={item.skill_id} value={item.skill_id}>
|
||||
Skill #{item.skill_id}
|
||||
Skill {formatIdReference(item.skill_id)}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
|
||||
@@ -42,6 +42,7 @@ import { Search } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { API } from '../../helpers';
|
||||
import { formatIdReference } from '../../helpers/safeDisplay';
|
||||
import {
|
||||
LicenseBadge,
|
||||
RiskBadge,
|
||||
@@ -164,8 +165,8 @@ const OrgSkillLibrary = ({ orgId, orgRole, canAssignSkills = false }) => {
|
||||
item?.locales?.find((locale) => locale.locale === 'zh')?.name ||
|
||||
item?.locales?.[0]?.name ||
|
||||
item?.definition?.canonical_id ||
|
||||
`Skill #${item?.definition?.id}`,
|
||||
[],
|
||||
`Skill ${formatIdReference(item?.definition?.id, t('未知技能'))}`,
|
||||
[t],
|
||||
);
|
||||
const importCandidates = useMemo(() => {
|
||||
const keyword = importKeyword.trim().toLowerCase();
|
||||
@@ -516,7 +517,7 @@ const OrgSkillLibrary = ({ orgId, orgRole, canAssignSkills = false }) => {
|
||||
catalog
|
||||
.get(policy.skill_id)
|
||||
?.locales?.find((item) => item.locale === 'zh')?.name ||
|
||||
`Skill #${policy.skill_id}`
|
||||
`Skill ${formatIdReference(policy.skill_id, t('未知技能'))}`
|
||||
}
|
||||
actions={
|
||||
<SkillStatusTag
|
||||
|
||||
@@ -16,7 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { formatPercent } from '../../../helpers/safeDisplay';
|
||||
import { formatIdReference, formatPercent } from '../../../helpers/safeDisplay';
|
||||
import { RefreshCw as ActionRefreshCw } from '@/components/common/icons/ActionIcons';
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@@ -142,9 +142,9 @@ const localizeAnalyticsRows = (rows, dimension, t) =>
|
||||
}[dimension];
|
||||
if (zeroName) name = zeroName;
|
||||
} else if (dimension === 'member' && name === `成员#${row.key}`) {
|
||||
name = `${t('成员')}#${row.key}`;
|
||||
name = `${t('成员')}${formatIdReference(row.key, t('未知成员'))}`;
|
||||
} else if (dimension === 'token' && name === `\u4ee4\u724c#${row.key}`) {
|
||||
name = `${t('密钥')}#${row.key}`;
|
||||
name = `${t('密钥')}${formatIdReference(row.key, t('未知密钥'))}`;
|
||||
}
|
||||
return name === row.name ? row : { ...row, name };
|
||||
});
|
||||
|
||||
@@ -17,6 +17,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { formatIdReference } from '../../../helpers/safeDisplay';
|
||||
|
||||
// 与后端 model/org_fund.go 常量一一对应
|
||||
export const FUND_STATE = { NEVER: 0, ON: 1, OFF: 2 };
|
||||
export const FUND_ACCOUNT_TYPE = { POOL: 0, UNALLOCATED: 1, DEPT: 2 };
|
||||
@@ -62,7 +64,7 @@ export const fundAccountDisplay = (t, accountType, deptName) => {
|
||||
export const fundDeptDisplay = (t, deptId, deptName) => {
|
||||
if (deptId === null || deptId === undefined) return '—';
|
||||
if (!deptId) return t('未归属部门');
|
||||
return deptName || `#${deptId}`;
|
||||
return deptName || formatIdReference(deptId);
|
||||
};
|
||||
|
||||
// 一次分配/回收的幂等键:打开弹窗时生成,重试沿用(F-12)。
|
||||
|
||||
@@ -49,12 +49,16 @@ import {
|
||||
} from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { API, copy, showError, showSuccess } from '../../helpers';
|
||||
import {
|
||||
formatNumber,
|
||||
formatPercent,
|
||||
toFiniteNumber,
|
||||
} from '../../helpers/safeDisplay';
|
||||
|
||||
const { Text, Title } = Typography;
|
||||
|
||||
const fmtDate = (ts) => (ts ? new Date(ts * 1000).toLocaleDateString() : '-');
|
||||
const fmtYuan = (v) =>
|
||||
v === undefined || v === null ? '-' : Number(v).toFixed(2);
|
||||
const fmtYuan = (v) => formatNumber(v, 2, '-');
|
||||
|
||||
const LEAD_STATUS = {
|
||||
pending: ['orange', '待审核'],
|
||||
@@ -845,12 +849,15 @@ function Bills({ t, readOnly }) {
|
||||
{ title: t('毛利(元)'), dataIndex: 'gross_profit_yuan', render: fmtYuan },
|
||||
{
|
||||
title: t('返佣(元)'),
|
||||
render: (r) => fmtYuan((r.l1_yuan || 0) + (r.l2_yuan || 0)),
|
||||
render: (r) =>
|
||||
fmtYuan(
|
||||
(toFiniteNumber(r.l1_yuan) ?? 0) + (toFiniteNumber(r.l2_yuan) ?? 0),
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t('应发(元)'),
|
||||
dataIndex: 'payable_yuan',
|
||||
render: (v) => Number(v ?? 0).toFixed(2),
|
||||
render: (v) => formatNumber(v, 2, '0.00'),
|
||||
},
|
||||
{
|
||||
title: '',
|
||||
@@ -965,7 +972,7 @@ function Bills({ t, readOnly }) {
|
||||
data={[
|
||||
{
|
||||
key: t('定档'),
|
||||
value: `${t('第 {{tier}} 档', { tier: detail.bill.tier })} · ${(detail.bill.tier_rate * 100).toFixed(0)}%`,
|
||||
value: `${t('第 {{tier}} 档', { tier: detail.bill.tier })} · ${formatPercent(Number(detail.bill.tier_rate) * 100, 0)}`,
|
||||
},
|
||||
{ key: t('一层(元)'), value: fmtYuan(detail.bill.l1_yuan) },
|
||||
{ key: t('二层(元)'), value: fmtYuan(detail.bill.l2_yuan) },
|
||||
@@ -980,7 +987,7 @@ function Bills({ t, readOnly }) {
|
||||
},
|
||||
{
|
||||
key: t('应发(元)'),
|
||||
value: Number(detail.bill.payable_yuan ?? 0).toFixed(2),
|
||||
value: formatNumber(detail.bill.payable_yuan, 2, '0.00'),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
@@ -27,16 +27,23 @@ import {
|
||||
PayPalBrandIcon,
|
||||
} from '../../components/common/icons/BrandIcons';
|
||||
import { getCurrencyConfig } from '../../helpers/render';
|
||||
import { formatNumber, toFiniteNumber } from '../../helpers/safeDisplay';
|
||||
import { CUSTOMER_SERVICE_OPEN_EVENT } from '../../components/customer-service';
|
||||
import { showInfo } from '../../helpers';
|
||||
import AmountCard from './AmountCard';
|
||||
import { useMinimumLoadingTime } from '../../hooks/common/useMinimumLoadingTime';
|
||||
|
||||
const formatCny = (value) =>
|
||||
`¥${Number(value || 0).toLocaleString('en-US', {
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2,
|
||||
})}`;
|
||||
const formatCny = (value) => {
|
||||
const number = toFiniteNumber(value);
|
||||
if (number === null) return '-';
|
||||
return (
|
||||
'¥' +
|
||||
number.toLocaleString('en-US', {
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2,
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
// 需要发票时的联系提示(原型:充值订单按钮下方)
|
||||
export const InvoiceNote = ({ t }) => (
|
||||
@@ -126,19 +133,21 @@ const RechargePanel = ({
|
||||
// ---- 充值订单:仅由已选档位、金额与支付方式派生展示 ----
|
||||
const { symbol } = getCurrencyConfig();
|
||||
const preset = selectedPreset !== null ? selectedPresetObj : null;
|
||||
const presetValue = toFiniteNumber(preset?.value) ?? 0;
|
||||
const discount =
|
||||
preset?.discount || topupInfo?.discount?.[preset?.value] || 1.0;
|
||||
toFiniteNumber(preset?.discount ?? topupInfo?.discount?.[preset?.value]) ??
|
||||
1.0;
|
||||
const isNewVersion = preset?.id !== undefined;
|
||||
const originalPrice = preset
|
||||
? isNewVersion
|
||||
? preset.value
|
||||
: preset.value * priceRatio
|
||||
? presetValue
|
||||
: presetValue * (toFiniteNumber(priceRatio) ?? 0)
|
||||
: 0;
|
||||
const arrivalText = preset
|
||||
? preset.label ||
|
||||
(isNewVersion
|
||||
? formatCny(preset.value)
|
||||
: `${symbol}${Number(preset.value).toLocaleString('en-US')}`)
|
||||
: `${symbol}${presetValue.toLocaleString('en-US')}`)
|
||||
: '-';
|
||||
const selectedMethod = payMethods?.find((method) => method.type === payWay);
|
||||
const payPalQuoted = payWay === 'paypal' && payPalQuote;
|
||||
@@ -149,7 +158,7 @@ const RechargePanel = ({
|
||||
? payPalQuoted
|
||||
? {
|
||||
symbol: '$',
|
||||
value: Number(payPalQuote.payAmount).toFixed(2),
|
||||
value: formatNumber(payPalQuote.payAmount, 2, '0.00'),
|
||||
unit: 'USD',
|
||||
}
|
||||
: null
|
||||
@@ -300,7 +309,7 @@ const RechargePanel = ({
|
||||
{payPalQuoted && (
|
||||
<div>
|
||||
<dt>{t('支付服务费')}</dt>
|
||||
<dd>{`$${Number(payPalQuote.serviceFee).toFixed(2)} USD`}</dd>
|
||||
<dd>{`$${formatNumber(payPalQuote.serviceFee, 2, '0.00')} USD`}</dd>
|
||||
</div>
|
||||
)}
|
||||
</dl>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -16,7 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { formatPercent } from '../../helpers/safeDisplay';
|
||||
import { formatPercent, toFiniteNumber } from '../../helpers/safeDisplay';
|
||||
|
||||
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
|
||||
import {
|
||||
@@ -97,7 +97,7 @@ const StatusBars = ({ dataPoints = [], loading = false, t }) => {
|
||||
<div className='text-xs p-1'>
|
||||
<div style={{ color: bgColor }} className='font-semibold'>
|
||||
{isHealthy ? t('正常') : t('异常')} (
|
||||
{point.uptime_percent?.toFixed(1)}
|
||||
{formatPercent(point.uptime_percent, 1).replace('%', '')}
|
||||
{I18N_TECHNICAL_TEXT.PERCENT_CLOSE}
|
||||
</div>
|
||||
<div className='text-gray-400 mt-1'>
|
||||
@@ -352,25 +352,28 @@ const GroupMonitor = () => {
|
||||
title: t('可用率'),
|
||||
dataIndex: 'uptime_percent',
|
||||
key: 'uptime_percent',
|
||||
render: (value) => (
|
||||
<div className='flex items-center gap-2'>
|
||||
<div className='w-16 h-1.5 bg-gray-100 dark:bg-gray-700 rounded-full overflow-hidden'>
|
||||
<div
|
||||
className='h-full rounded-full'
|
||||
style={{
|
||||
width: `${Math.min(100, value || 0)}%`,
|
||||
backgroundColor: getUptimeColor(value),
|
||||
}}
|
||||
/>
|
||||
render: (value) => {
|
||||
const uptime = Math.max(0, Math.min(100, toFiniteNumber(value) ?? 0));
|
||||
return (
|
||||
<div className='flex items-center gap-2'>
|
||||
<div className='w-16 h-1.5 bg-gray-100 dark:bg-gray-700 rounded-full overflow-hidden'>
|
||||
<div
|
||||
className='h-full rounded-full'
|
||||
style={{
|
||||
width: `${uptime}%`,
|
||||
backgroundColor: getUptimeColor(uptime),
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<span
|
||||
className='text-sm font-medium'
|
||||
style={{ color: getUptimeColor(uptime) }}
|
||||
>
|
||||
{formatPercent(uptime, 1)}
|
||||
</span>
|
||||
</div>
|
||||
<span
|
||||
className='text-sm font-medium'
|
||||
style={{ color: getUptimeColor(value) }}
|
||||
>
|
||||
{formatPercent(value || 0, 1)}
|
||||
</span>
|
||||
</div>
|
||||
),
|
||||
);
|
||||
},
|
||||
sorter: (a, b) => (a.uptime_percent || 0) - (b.uptime_percent || 0),
|
||||
},
|
||||
{
|
||||
|
||||
@@ -47,6 +47,7 @@ import {
|
||||
showSuccess,
|
||||
} from '../../../helpers';
|
||||
import { mergePayPalFeePolicyFormValues } from '../../../helpers/paypalPayment';
|
||||
import { formatPercent } from '../../../helpers/safeDisplay';
|
||||
|
||||
const { Text } = Typography;
|
||||
const SECRET_PLACEHOLDER = '***ALREADY_SET***';
|
||||
@@ -563,7 +564,7 @@ export default function SettingsPaymentGatewayPayPal(props) {
|
||||
{
|
||||
title: t('费率'),
|
||||
dataIndex: 'new_rate_bps',
|
||||
render: (value) => `${(Number(value) / 100).toFixed(2)}%`,
|
||||
render: (value) => formatPercent(Number(value) / 100, 2),
|
||||
},
|
||||
{
|
||||
title: t('操作人'),
|
||||
|
||||
@@ -251,7 +251,11 @@ function AccessGroupSelect({ id, value, onChange, groupOptions, placeholder }) {
|
||||
);
|
||||
}
|
||||
|
||||
const orgOptionLabel = (org) => `${org.name || ''} (#${org.id})`;
|
||||
const orgOptionLabel = (org) => {
|
||||
const name = org?.name?.trim();
|
||||
const reference = formatIdReference(org?.id);
|
||||
return name ? `${name} (${reference})` : reference;
|
||||
};
|
||||
|
||||
// 开放企业多选:远程搜索管理端企业列表(名称 / 代码 / 联系人),值只存企业 ID。
|
||||
// 已保存的企业由父组件按 ID 批量回填名称(orgLabels),已删除的企业回显为
|
||||
|
||||
@@ -354,7 +354,7 @@ const SettingsWeyAiContent = () => {
|
||||
style={{ minWidth: 260 }}
|
||||
optionList={(overview?.slots || []).map((s) => ({
|
||||
value: s.id,
|
||||
label: `${t(s.name)}(${s.item_count})`,
|
||||
label: `${t(s.name)}(${s.item_count ?? 0})`,
|
||||
}))}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -36,6 +36,7 @@ import {
|
||||
import { IconPlus, IconRefresh, IconSearch } from '@/components/ui/icons';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { API } from '../../helpers';
|
||||
import { formatNumber } from '../../helpers/safeDisplay';
|
||||
import { skillTagLabel } from '../../constants/skillCategories';
|
||||
import {
|
||||
CapabilityTags,
|
||||
@@ -740,7 +741,7 @@ const SkillPlatform = () => {
|
||||
{ value: '', label: t('全部分类') },
|
||||
...tagFacets.map((facet) => ({
|
||||
value: facet.tag,
|
||||
label: `${skillTagLabel(facet.tag, tagLanguage)}(${facet.count})`,
|
||||
label: `${skillTagLabel(facet.tag, tagLanguage)}(${facet.count ?? 0})`,
|
||||
})),
|
||||
]}
|
||||
/>
|
||||
@@ -1337,7 +1338,8 @@ const SkillPlatform = () => {
|
||||
{modelTestResult.ok ? t('测试成功') : t('测试失败')}
|
||||
</Text>
|
||||
<Text type='tertiary' size='small'>
|
||||
{t('耗时')} {modelTestResult.elapsed.toFixed(2)}s
|
||||
{t('耗时')} {formatNumber(modelTestResult.elapsed, 2, '0.00')}
|
||||
s
|
||||
{modelTestResult.usage?.total_tokens
|
||||
? ` · ${modelTestResult.usage.total_tokens} tokens`
|
||||
: ''}
|
||||
|
||||
@@ -30,6 +30,7 @@ import {
|
||||
import { Iconbolt, IconActivity } from '@/components/ui/icons';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { API, showError } from '../../helpers';
|
||||
import { formatPercent } from '../../helpers/safeDisplay';
|
||||
|
||||
const { Content } = Layout;
|
||||
const { Text, Title } = Typography;
|
||||
@@ -84,7 +85,7 @@ const Status = () => {
|
||||
size='small'
|
||||
style={{ height: 8 }}
|
||||
showInfo={true}
|
||||
format={(per) => `${per}%`}
|
||||
format={(per) => formatPercent(per, 0)}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -16,7 +16,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { formatUserReference } from '../../helpers/safeDisplay';
|
||||
import {
|
||||
formatIdReference,
|
||||
formatUserReference,
|
||||
} from '../../helpers/safeDisplay';
|
||||
|
||||
import { Trans } from 'react-i18next';
|
||||
import {
|
||||
@@ -39,6 +42,7 @@ import { Button as AntButton } from 'antd';
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useEffectEvent } from '../../hooks/common/useEffectEvent';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { formatCurrency } from '../../helpers/safeDisplay';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { CreditCard, Search, History } from 'lucide-react';
|
||||
import {
|
||||
@@ -423,7 +427,7 @@ const Subscription = () => {
|
||||
title: t('支付金额'),
|
||||
dataIndex: 'price_paid',
|
||||
width: 100,
|
||||
render: (v) => (v != null ? `¥${Number(v).toFixed(2)}` : '-'),
|
||||
render: (v) => (v != null ? formatCurrency(v) : '-'),
|
||||
},
|
||||
{
|
||||
title: t('操作'),
|
||||
@@ -1440,7 +1444,7 @@ const DetailDrawer = ({ visible, row, loading, auditLogs, onClose, t }) => {
|
||||
</div>
|
||||
<div className='flex justify-between'>
|
||||
<span className='text-gray-500'>{t('支付金额')}</span>
|
||||
<span>¥{Number(row.price_paid || 0).toFixed(2)}</span>
|
||||
<span>{formatCurrency(row.price_paid, '¥', 2, '¥0.00')}</span>
|
||||
</div>
|
||||
<div className='flex justify-between'>
|
||||
<span className='text-gray-500'>{t('支付方式')}</span>
|
||||
@@ -1503,7 +1507,9 @@ const DetailDrawer = ({ visible, row, loading, auditLogs, onClose, t }) => {
|
||||
<span className='ml-2 text-gray-700 dark:text-gray-200'>
|
||||
{log.admin_display_name ||
|
||||
log.admin_username ||
|
||||
`Admin#${log.admin_id}`}
|
||||
(log.admin_id == null
|
||||
? t('未知管理员')
|
||||
: `Admin${formatIdReference(log.admin_id)}`)}
|
||||
</span>
|
||||
</div>
|
||||
{log.reason && (
|
||||
|
||||
@@ -50,6 +50,11 @@ import {
|
||||
INVOICE_STATUS_COLOR,
|
||||
} from '../../constants';
|
||||
import { StatusContext } from '../../context/Status';
|
||||
import {
|
||||
formatCurrency,
|
||||
formatNumber,
|
||||
toFiniteNumber,
|
||||
} from '../../helpers/safeDisplay';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
@@ -150,7 +155,7 @@ const Invoice = () => {
|
||||
// 计算选中记录的金额合计
|
||||
const selectedAmount = availableTopups
|
||||
.filter((t) => selectedTopupIds.includes(t.id))
|
||||
.reduce((sum, t) => sum + (t.money || 0), 0);
|
||||
.reduce((sum, t) => sum + (toFiniteNumber(t.money) ?? 0), 0);
|
||||
|
||||
// 选择常用开票信息
|
||||
const handleSelectTitle = (titleId) => {
|
||||
@@ -315,7 +320,7 @@ const Invoice = () => {
|
||||
title: t('支付金额'),
|
||||
dataIndex: 'money',
|
||||
width: 100,
|
||||
render: (v) => (v ? `¥${Number(v).toFixed(2)}` : '-'),
|
||||
render: (v) => formatCurrency(v),
|
||||
},
|
||||
{
|
||||
title: t('订单号'),
|
||||
@@ -343,7 +348,7 @@ const Invoice = () => {
|
||||
title: t('开票金额'),
|
||||
dataIndex: 'amount',
|
||||
width: 100,
|
||||
render: (v) => `¥${Number(v).toFixed(2)}`,
|
||||
render: (v) => formatCurrency(v),
|
||||
},
|
||||
{
|
||||
title: t('状态'),
|
||||
@@ -449,7 +454,7 @@ const Invoice = () => {
|
||||
<span className='text-lg font-bold text-amber-600 dark:text-amber-400'>
|
||||
{t('合计')}
|
||||
{I18N_TECHNICAL_TEXT.CNY_TOTAL_SEPARATOR}
|
||||
{selectedAmount.toFixed(2)}
|
||||
{formatNumber(selectedAmount, 2, '0.00')}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
@@ -584,7 +589,7 @@ const Invoice = () => {
|
||||
<div className='flex justify-between'>
|
||||
<Text>{t('开票金额')}</Text>
|
||||
<Text strong className='text-amber-600'>
|
||||
¥{Number(detailData.amount).toFixed(2)}
|
||||
{formatCurrency(detailData.amount)}
|
||||
</Text>
|
||||
</div>
|
||||
<div className='flex justify-between'>
|
||||
@@ -640,7 +645,7 @@ const Invoice = () => {
|
||||
)}
|
||||
</span>
|
||||
<span className='font-medium'>
|
||||
¥{Number(topup.money).toFixed(2)}
|
||||
{formatCurrency(topup.money)}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user