From 91d355b7f118a2302bd115d97d502330dd7196b9 Mon Sep 17 00:00:00 2001 From: zhx Date: Tue, 2 Jun 2026 23:37:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B8=81=E5=95=86=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- h5/hyapp/recharge-center/index.html | 4 ++-- h5/hyapp/recharge-center/script.js | 36 +++++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/h5/hyapp/recharge-center/index.html b/h5/hyapp/recharge-center/index.html index 68f5209..16e50f6 100644 --- a/h5/hyapp/recharge-center/index.html +++ b/h5/hyapp/recharge-center/index.html @@ -4,7 +4,7 @@ Recharge Center - +
@@ -238,6 +238,6 @@
- + diff --git a/h5/hyapp/recharge-center/script.js b/h5/hyapp/recharge-center/script.js index ff1176b..9e22017 100644 --- a/h5/hyapp/recharge-center/script.js +++ b/h5/hyapp/recharge-center/script.js @@ -643,6 +643,36 @@ }).format(number); } + function numberValue(value) { + const number = Number(String(value ?? "").replace(/,/g, "")); + return Number.isFinite(number) ? number : null; + } + + function pickRecordUSDAmount(record) { + const directCandidates = [ + record?.usdQuantity, + record?.usdAmount, + record?.amountUsd, + record?.amountUSDT, + record?.amountUsdt, + record?.usdtAmount, + record?.transferAmountUsdt, + record?.transferAmountUSD, + record?.dollarAmount + ]; + for (const candidate of directCandidates) { + const number = numberValue(candidate); + if (number && number > 0) return number; + } + + const rechargeType = String(record?.rechargeType || record?.currency || "").toUpperCase(); + if (rechargeType.includes("USD")) { + const fallback = numberValue(record?.orderAmount ?? record?.amount); + if (fallback && fallback > 0) return fallback; + } + return null; + } + function pickCoinAmount(body) { if (typeof body === "number" || typeof body === "string") return body; if (body && typeof body === "object") { @@ -989,11 +1019,13 @@ const amount = document.createElement("div"); const isIncome = Number(record?.type) === 0; amount.className = `history-record-amount ${isIncome ? "is-income" : "is-expense"}`; - amount.textContent = `${isIncome ? "+" : "-"}${formatCoins(record?.quantity)} ${message("coins")}`; + const usdAmount = isIncome ? pickRecordUSDAmount(record) : null; + amount.textContent = `${isIncome ? "+" : "-"}${formatCoins(record?.quantity)} ${message("coins")}${usdAmount !== null ? ` ≈ $${formatMoney(usdAmount)}` : ""}`; const time = document.createElement("div"); time.className = "history-record-time"; time.textContent = formatRecordTime(record?.createTime); - side.append(amount, time); + side.appendChild(amount); + side.appendChild(time); item.append(userWrap, side); return item;