chore(admin-dashboard): enrich trend bar tooltip with avg paid

This commit is contained in:
萝卜
2026-03-16 13:42:51 +08:00
parent ca05122c2c
commit 0f07fe7c8b
2 changed files with 40 additions and 2 deletions

View File

@@ -144,8 +144,12 @@
bar.style.height = h + 'px';
var date = (p && p.date) ? String(p.date) : '';
var count = (p && p.count != null) ? String(p.count) : '0';
bar.title = date + '' + count + ' 单,已付 ¥' + formatMoney(paid);
var countNum = Number(p && p.count != null ? p.count : 0);
if (!isFinite(countNum) || countNum < 0) {
countNum = 0;
}
var avg = countNum > 0 ? (paid / countNum) : 0;
bar.title = date + '|订单 ' + String(countNum) + ' 单|已付 ¥' + formatMoney(paid) + '|单均 ¥' + formatMoney(avg);
el.appendChild(bar);
});