Skip to content

Commit efab41c

Browse files
authored
Merge pull request QuantumNous#3233 from KiGamji/round-remaining-balance
Round remaining balance
2 parents e4144d6 + 9fbb782 commit efab41c

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

web/src/components/table/channels/ChannelsColumnDefs.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,12 @@ export const getChannelsColumns = ({
537537
</Tag>
538538
</Tooltip>
539539
<Tooltip
540-
content={t('剩余额度$') + record.balance + t(',点击更新')}
540+
content={
541+
t('剩余额度') +
542+
': ' +
543+
renderQuotaWithAmount(record.balance) +
544+
t(',点击更新')
545+
}
541546
>
542547
<Tag
543548
color='white'

web/src/helpers/render.jsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,8 +1068,14 @@ export function renderQuotaWithAmount(amount) {
10681068
if (quotaDisplayType === 'TOKENS') {
10691069
return renderNumber(renderUnitWithQuota(amount));
10701070
}
1071+
1072+
const numericAmount = Number(amount);
1073+
const formattedAmount = Number.isFinite(numericAmount)
1074+
? numericAmount.toFixed(2)
1075+
: amount;
1076+
10711077
if (quotaDisplayType === 'CNY') {
1072-
return '¥' + amount;
1078+
return '¥' + formattedAmount;
10731079
} else if (quotaDisplayType === 'CUSTOM') {
10741080
const statusStr = localStorage.getItem('status');
10751081
let symbol = '¤';
@@ -1079,9 +1085,9 @@ export function renderQuotaWithAmount(amount) {
10791085
symbol = s?.custom_currency_symbol || symbol;
10801086
}
10811087
} catch (e) {}
1082-
return symbol + amount;
1088+
return symbol + formattedAmount;
10831089
}
1084-
return '$' + amount;
1090+
return '$' + formattedAmount;
10851091
}
10861092

10871093
/**

0 commit comments

Comments
 (0)