From fdf64baed281170bc75e1f9c7ae77973128421aa Mon Sep 17 00:00:00 2001 From: local Date: Tue, 23 Jun 2026 23:04:59 +0800 Subject: [PATCH] fix h5 recharge zero-decimal currency display --- recharge/index.html | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/recharge/index.html b/recharge/index.html index b96584d..7c656bb 100644 --- a/recharge/index.html +++ b/recharge/index.html @@ -2420,7 +2420,7 @@ var amount = Number.isFinite(rate) && rate > 0 ? usd * rate : usd; return ( - amount.toFixed(currency === 'USD' ? 2 : 2) + + amount.toFixed(currencyFractionDigits(currency)) + ' ' + currency ); @@ -2483,7 +2483,35 @@ function amountMinorText(value, currency) { var minor = Number(value || 0); 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) {