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

This commit is contained in:
xiezhouwei 2026-06-23 11:49:21 +08:00
parent 4d5dd30668
commit a9d2fc2abe
1 changed files with 3 additions and 5 deletions

View File

@ -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) {