This commit is contained in:
2026-07-28 19:26:26 +08:00
parent 2e9da6c1ac
commit 05266703e8
5 changed files with 64 additions and 57 deletions

View File

@@ -22,7 +22,7 @@ function renderPurchasePanel(items) {
Object.keys(groups).sort().reverse().forEach(month => {
const monthItems = groups[month];
const monthTotal = monthItems.reduce((s, i) => s + (i.amount||0), 0);
html += '<details class="purchase-month-group" open><summary class="purchase-month-header"><span>' + month + '</span><span>¥' + monthTotal + '</span></summary>';
html += '<details class="purchase-month-group" open><summary class="purchase-month-header"><span>' + month + '</span><span style="display:flex;align-items:center;gap:6px;">¥' + monthTotal + '<svg class="month-arrow" viewBox="0 0 24 24"><polyline points="6 9 12 15 18 9"/></svg></span></summary>';
monthItems.forEach(item => {
const timeShort = item.created_at.split(' ')[1]?.substring(0,5) || '';
const dateShort = item.created_at.split(' ')[0]?.substring(5) || '';
@@ -79,16 +79,9 @@ async function openDetail(pid) {
document.getElementById('edit-history').innerHTML = historyHtml || '<li style="color:#888;">暂无操作记录</li>';
document.getElementById('edit-history-section').open = false;
// 删除按钮仅管理员可见
const isAdmin = localStorage.getItem('isAdmin') === 'true';
const delBtn = document.getElementById('delete-purchase-btn');
if (isAdmin) {
delBtn.style.display = '';
delBtn.style.marginLeft = '';
} else {
delBtn.style.display = 'none';
delBtn.style.marginLeft = '0';
}
// 删除按钮
document.getElementById('delete-purchase-btn').style.display = '';
document.getElementById('delete-purchase-btn').style.marginLeft = '';
// 折叠所有编辑组
document.querySelectorAll('.edit-group-detail').forEach(el => el.classList.add('hidden'));