From a9d2fc2abe4d149f1e6c5641246c1b957598359f Mon Sep 17 00:00:00 2001 From: xiezhouwei Date: Tue, 23 Jun 2026 11:49:21 +0800 Subject: [PATCH] fix: billing total display now consistently uses 2 decimals, floor 0.01 for tiny positive amounts\n\n- Previous 6-decimal fallback caused visual inconsistency with list (shows 0.01)\n- Now: raw>0 and toFixed(2)>0 -> normal 2-decimal display\n- Now: raw>0 but toFixed(2)==0 -> floor to 0.01 (minimum visible unit)\n- Matches list column display format, no more '= 0.000125' in detail --- web/src/helpers/render.jsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/web/src/helpers/render.jsx b/web/src/helpers/render.jsx index a304802..4673722 100644 --- a/web/src/helpers/render.jsx +++ b/web/src/helpers/render.jsx @@ -1504,16 +1504,14 @@ function formatBillingDisplayPrice(usdAmount, rate, digits = 2) { } /** - * 计费过程总额专用格式化:正常金额保持 2 位小数;极小金额(< 0.005)自动提升至 6 位小数, - * 避免因 toFixed(2) 归零导致「计费过程」显示为 0。 + * 计费过程总额专用格式化:始终保留 2 位小数与列表显示一致; + * 正数金额经 toFixed(2) 归零时保底为 0.01,避免「= $0」但列表却有花费的不一致。 */ function formatBillingTotalDisplay(usdAmount, rate) { const raw = usdAmount * rate; if (raw <= 0) return 0; const fixed2 = Number(raw.toFixed(2)); - if (fixed2 > 0) return fixed2; - const fixed6 = Number(raw.toFixed(6)); - return fixed6 > 0 ? fixed6 : 0; + return fixed2 > 0 ? fixed2 : 0.01; } function buildBillingText(key, vars) {