平台汇总改为仅展示平台金额 #533
@ -1563,7 +1563,6 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">平台</th>
|
||||
<th scope="col">账单名称</th>
|
||||
<th scope="col" class="is-number">总金额(万元)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -1614,7 +1613,7 @@
|
||||
</section>
|
||||
</div>
|
||||
<div class="receipt-metric-dialog__foot">
|
||||
<span data-receipt-metric-count>共 0 条平台账单汇总</span>
|
||||
<span data-receipt-metric-count>共 0 条平台汇总</span>
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
@ -2378,13 +2377,13 @@
|
||||
platformEmptyEl.hidden = false;
|
||||
summaryEmptyEl.hidden = false;
|
||||
detailEmptyEl.hidden = true;
|
||||
platformEmptyEl.textContent = '正在按平台汇总账单名称…';
|
||||
platformEmptyEl.textContent = '正在按平台汇总金额…';
|
||||
summaryEmptyEl.textContent = '正在汇总账单名称…';
|
||||
detailEmptyEl.textContent = '正在汇总平台店铺明细…';
|
||||
title.textContent = label + ' · 明细汇总';
|
||||
subtitle.textContent = '按平台、店铺和账单名称汇总';
|
||||
currentTotalEl.textContent = '…';
|
||||
countEl.textContent = '正在读取平台账单汇总';
|
||||
countEl.textContent = '正在读取平台汇总';
|
||||
dialog.setAttribute('aria-busy', 'true');
|
||||
}
|
||||
|
||||
@ -2436,7 +2435,18 @@
|
||||
}
|
||||
|
||||
function renderPlatformRows(rows) {
|
||||
renderPlatformBillRows(platformRowsEl, rows);
|
||||
platformRowsEl.replaceChildren();
|
||||
rows.forEach(function (row) {
|
||||
var tr = document.createElement('tr');
|
||||
var platform = document.createElement('td');
|
||||
platform.textContent = row.platform || '—';
|
||||
tr.appendChild(platform);
|
||||
var amount = document.createElement('td');
|
||||
amount.className = 'is-number';
|
||||
amount.textContent = wan(row.amount);
|
||||
tr.appendChild(amount);
|
||||
platformRowsEl.appendChild(tr);
|
||||
});
|
||||
}
|
||||
|
||||
function renderSummaryRows(rows) {
|
||||
@ -2462,7 +2472,7 @@
|
||||
|
||||
function updateFooterCount() {
|
||||
if (activeTab === 'platform') {
|
||||
countEl.textContent = '共 ' + platformCount.toLocaleString('zh-CN') + ' 条平台账单汇总';
|
||||
countEl.textContent = '共 ' + platformCount.toLocaleString('zh-CN') + ' 条平台汇总';
|
||||
} else if (activeTab === 'summary') {
|
||||
countEl.textContent = '共 ' + summaryCount.toLocaleString('zh-CN') + ' 条账单名称汇总';
|
||||
} else {
|
||||
@ -2490,10 +2500,18 @@
|
||||
&& (!store || row.store_name === store)
|
||||
&& (!billItem || row.bill_item === billItem);
|
||||
});
|
||||
var totalsByPlatform = {};
|
||||
var totalsByPlatformBillItem = {};
|
||||
rows.forEach(function (row) {
|
||||
var platform = row.platform || '—';
|
||||
var name = row.bill_item || '未命名账单项目';
|
||||
if (!totalsByPlatform[platform]) {
|
||||
totalsByPlatform[platform] = {
|
||||
platform: platform,
|
||||
amount: 0
|
||||
};
|
||||
}
|
||||
totalsByPlatform[platform].amount += Number(row.amount || 0);
|
||||
var key = JSON.stringify([platform, name]);
|
||||
if (!totalsByPlatformBillItem[key]) {
|
||||
totalsByPlatformBillItem[key] = {
|
||||
@ -2504,20 +2522,20 @@
|
||||
}
|
||||
totalsByPlatformBillItem[key].amount += Number(row.amount || 0);
|
||||
});
|
||||
var platformRows = Object.keys(totalsByPlatform).map(function (key) {
|
||||
return totalsByPlatform[key];
|
||||
}).sort(function (left, right) {
|
||||
return left.platform.localeCompare(right.platform, 'zh-CN');
|
||||
});
|
||||
var platformBillRows = Object.keys(totalsByPlatformBillItem).map(function (key) {
|
||||
return totalsByPlatformBillItem[key];
|
||||
});
|
||||
var platformRows = platformBillRows.slice().sort(function (left, right) {
|
||||
return left.platform.localeCompare(right.platform, 'zh-CN')
|
||||
|| Math.abs(right.amount) - Math.abs(left.amount)
|
||||
|| left.bill_item.localeCompare(right.bill_item, 'zh-CN');
|
||||
});
|
||||
var summaryRows = platformBillRows.slice().sort(function (left, right) {
|
||||
return Math.abs(right.amount) - Math.abs(left.amount)
|
||||
|| left.platform.localeCompare(right.platform, 'zh-CN')
|
||||
|| left.bill_item.localeCompare(right.bill_item, 'zh-CN');
|
||||
});
|
||||
var filteredTotal = summaryRows.reduce(function (sum, row) {
|
||||
var filteredTotal = platformRows.reduce(function (sum, row) {
|
||||
return sum + Number(row.amount || 0);
|
||||
}, 0);
|
||||
platformCount = platformRows.length;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user