From 5174c517999e0440ff26a4d1df00c5d0a5e49e6a Mon Sep 17 00:00:00 2001 From: liuji Date: Sat, 10 Oct 2026 16:42:48 +0800 Subject: [PATCH] Fix dashboard KPI currency totals --- index.html | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 1f86d01..ce239b4 100755 --- a/index.html +++ b/index.html @@ -135,7 +135,8 @@
数据更新时间—
记录数—
LinkName 数—
-
币种—
+
Total Commission—
+
Total GMV—
@@ -192,7 +193,8 @@ updatedAt: document.getElementById('updated-at'), recordCount: document.getElementById('record-count'), linkCount: document.getElementById('link-count'), - currencyCount: document.getElementById('currency-count'), + totalCommission: document.getElementById('total-commission'), + totalGmv: document.getElementById('total-gmv'), empty: document.getElementById('empty-state'), error: document.getElementById('error-state'), charts: document.getElementById('charts'), @@ -406,12 +408,19 @@ function updateSummary(records) { var links = new Set(records.map(function (record) { return record.linkName; })); + var totalCommission = records.reduce(function (total, record) { + return total + (record.commission === null ? 0 : record.commission); + }, 0); + var totalGmv = records.reduce(function (total, record) { + return total + (record.gmv === null ? 0 : record.gmv); + }, 0); elements.title.textContent = 'TTSHOP 销售看板 · ' + state.selectedCurrency; elements.subtitle.textContent = 'Commission 与 GMV 趋势(当前加载时间:' + dateFormatter.format(new Date()) + ')'; elements.updatedAt.textContent = dateFormatter.format(new Date()); elements.recordCount.textContent = formatNumber(records.length); elements.linkCount.textContent = formatNumber(links.size); - elements.currencyCount.textContent = state.sourceCurrencies.join('、') || '—'; + elements.totalCommission.textContent = state.selectedCurrency + ' ' + formatNumber(totalCommission); + elements.totalGmv.textContent = state.selectedCurrency + ' ' + formatNumber(totalGmv); } function aggregate(records) {