Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion web/src/components/table/channels/ChannelsColumnDefs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,12 @@ export const getChannelsColumns = ({
</Tag>
</Tooltip>
<Tooltip
content={t('剩余额度$') + record.balance + t(',点击更新')}
content={
t('剩余额度') +
': ' +
renderQuotaWithAmount(record.balance) +
t(',点击更新')
}
>
<Tag
color='white'
Expand Down
12 changes: 9 additions & 3 deletions web/src/helpers/render.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1066,8 +1066,14 @@ export function renderQuotaWithAmount(amount) {
if (quotaDisplayType === 'TOKENS') {
return renderNumber(renderUnitWithQuota(amount));
}

const numericAmount = Number(amount);
const formattedAmount = Number.isFinite(numericAmount)
? numericAmount.toFixed(2)
: amount;

if (quotaDisplayType === 'CNY') {
return '¥' + amount;
return '¥' + formattedAmount;
} else if (quotaDisplayType === 'CUSTOM') {
const statusStr = localStorage.getItem('status');
let symbol = '¤';
Expand All @@ -1077,9 +1083,9 @@ export function renderQuotaWithAmount(amount) {
symbol = s?.custom_currency_symbol || symbol;
}
} catch (e) {}
return symbol + amount;
return symbol + formattedAmount;
}
return '$' + amount;
return '$' + formattedAmount;
}

/**
Expand Down