fix: show payment records on separate lines

This commit is contained in:
Codex
2026-06-16 04:28:19 +08:00
parent 0efb2acf89
commit a1a8466f6b
2 changed files with 12 additions and 2 deletions
+8 -2
View File
@@ -63,6 +63,10 @@ function metric(label, value) {
return `<div class="metric"><span>${escapeHtml(label)}</span><strong>${escapeHtml(value)}</strong></div>`; return `<div class="metric"><span>${escapeHtml(label)}</span><strong>${escapeHtml(value)}</strong></div>`;
} }
function metricHtml(label, valueHtml) {
return `<div class="metric"><span>${escapeHtml(label)}</span><strong>${valueHtml}</strong></div>`;
}
function makeRecordKey(row, index) { function makeRecordKey(row, index) {
return row.record_id || JSON.stringify([index, row.date, row.time, row.student, row.duration, row.teacher, row.subject]); return row.record_id || JSON.stringify([index, row.date, row.time, row.student, row.duration, row.teacher, row.subject]);
} }
@@ -257,7 +261,9 @@ function statusClass(status) {
function renderPayments(payments) { function renderPayments(payments) {
if (!payments.length) return "暂无缴费记录"; if (!payments.length) return "暂无缴费记录";
return payments.map((item) => `${item.date}${fmtHours(item.hours)} 小时`).join(""); return payments
.map((item) => `<span class="payment-line">${escapeHtml(item.date)}${fmtHours(item.hours)} 小时</span>`)
.join("");
} }
function renderInlineAccount(account) { function renderInlineAccount(account) {
@@ -272,7 +278,7 @@ function renderInlineAccount(account) {
<div class="inline-account-grid"> <div class="inline-account-grid">
${metric("剩余课时", fmtHours(account.remaining))} ${metric("剩余课时", fmtHours(account.remaining))}
${metric("缴费次数", account.payments_count)} ${metric("缴费次数", account.payments_count)}
${metric("缴费记录", renderPayments(account.payments))} ${metricHtml("缴费记录", renderPayments(account.payments))}
${metric("备注", account.note || "无")} ${metric("备注", account.note || "无")}
</div>`; </div>`;
} }
+4
View File
@@ -293,6 +293,10 @@ select:focus {
line-height: 1.2; line-height: 1.2;
} }
.payment-line {
display: block;
}
.inline-account { .inline-account {
padding: 14px 16px; padding: 14px 16px;
border-bottom: 1px solid var(--line); border-bottom: 1px solid var(--line);