fix h5 recharge zero-decimal currency display

This commit is contained in:
local 2026-06-23 23:04:59 +08:00
parent b1bd8d8e9f
commit fdf64baed2

View File

@ -2420,7 +2420,7 @@
var amount = var amount =
Number.isFinite(rate) && rate > 0 ? usd * rate : usd; Number.isFinite(rate) && rate > 0 ? usd * rate : usd;
return ( return (
amount.toFixed(currency === 'USD' ? 2 : 2) + amount.toFixed(currencyFractionDigits(currency)) +
' ' + ' ' +
currency currency
); );
@ -2483,7 +2483,35 @@
function amountMinorText(value, currency) { function amountMinorText(value, currency) {
var minor = Number(value || 0); var minor = Number(value || 0);
if (!Number.isFinite(minor) || minor <= 0) return '-'; if (!Number.isFinite(minor) || minor <= 0) return '-';
return (minor / 100).toFixed(2) + ' ' + currency; return (
(minor / 100).toFixed(currencyFractionDigits(currency)) +
' ' +
currency
);
}
function currencyFractionDigits(currency) {
var normalized = String(currency || '').toUpperCase();
var zeroDecimal = {
BIF: true,
CLP: true,
DJF: true,
GNF: true,
IDR: true,
JPY: true,
KMF: true,
KRW: true,
MGA: true,
PYG: true,
RWF: true,
UGX: true,
VND: true,
VUV: true,
XAF: true,
XOF: true,
XPF: true,
};
return zeroDecimal[normalized] ? 0 : 2;
} }
function shortOrderID(value) { function shortOrderID(value) {