fix: restore legacy admin page styling

dev
admin 2 months ago
parent 18e22dacee
commit 73afe9db50

@ -1,570 +0,0 @@
/* Unified administrator billing views. Kept page-scoped to avoid changing legacy tables. */
.admin-billing,
.billing-dialog {
--billing-ink: #172033;
--billing-muted: #667085;
--billing-line: #e4eaf1;
--billing-soft: #f6f8fb;
--billing-brand: #147d68;
--billing-brand-soft: #e9f7f2;
--billing-warning: #9a6700;
--billing-warning-soft: #fff6d8;
--billing-danger: #b42318;
--billing-danger-soft: #fff0ee;
--billing-info: #175cd3;
--billing-info-soft: #eef4ff;
}
.admin-billing {
max-width: 1540px;
margin: 0 auto;
padding: 22px 0 32px;
color: var(--billing-ink);
}
.admin-billing *,
.admin-billing *::before,
.admin-billing *::after,
.billing-dialog *,
.billing-dialog *::before,
.billing-dialog *::after {
box-sizing: border-box;
}
.billing-page-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 24px;
margin-bottom: 16px;
}
.billing-page-header > div { min-width: 0; }
.billing-page-header h1 {
margin: 0 0 6px;
color: #00081a;
font-size: 22px;
font-weight: 800;
line-height: 1.3;
}
.billing-page-header p:last-child {
max-width: 820px;
margin: 0;
color: var(--billing-muted);
line-height: 1.65;
}
.billing-refresh,
.billing-filter-actions .btn,
.billing-pagination .btn {
min-height: 44px;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 7px;
white-space: nowrap;
touch-action: manipulation;
}
.billing-notice {
min-height: 44px;
display: flex;
align-items: center;
margin: 0 0 14px;
padding: 10px 14px;
border: 1px solid #bfd2f8;
border-radius: 9px;
color: #1849a9;
background: var(--billing-info-soft);
font-weight: 700;
line-height: 1.45;
overflow-wrap: anywhere;
}
.billing-notice.is-success { border-color: #a6e0d0; color: #08785b; background: var(--billing-brand-soft); }
.billing-notice.is-error { border-color: #f5b8b2; color: var(--billing-danger); background: var(--billing-danger-soft); }
.billing-tabs {
display: flex;
gap: 6px;
max-width: 100%;
margin-bottom: 18px;
padding: 5px;
border: 1px solid var(--billing-line);
border-radius: 10px;
background: #fff;
box-shadow: 0 5px 18px rgba(15, 23, 42, .04);
}
.billing-tabs a {
min-height: 44px;
min-width: 0;
flex: 1 1 0;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 9px 16px;
border-radius: 7px;
color: #475467;
font-weight: 800;
text-align: center;
text-decoration: none;
touch-action: manipulation;
transition: color .16s ease, background-color .16s ease, box-shadow .16s ease;
}
.billing-tabs a:hover { color: var(--billing-brand); background: #f2faf7; }
.billing-tabs a[aria-disabled="true"] { cursor: wait; opacity: .68; }
.billing-tabs a[aria-current="page"] {
color: #075f4c;
background: var(--billing-brand-soft);
box-shadow: inset 0 0 0 1px #bee8dc;
}
.billing-summary {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 12px;
margin-bottom: 18px;
}
.billing-summary article {
min-width: 0;
padding: 15px 17px;
border: 1px solid var(--billing-line);
border-left: 3px solid #9bb7b0;
border-radius: 9px;
background: #fff;
box-shadow: 0 7px 22px rgba(15, 23, 42, .035);
}
.billing-summary span {
display: block;
margin-bottom: 5px;
color: var(--billing-muted);
font-size: 12px;
font-weight: 800;
letter-spacing: .02em;
}
.billing-summary strong {
display: block;
color: var(--billing-ink);
font-size: 20px;
line-height: 1.3;
overflow-wrap: anywhere;
}
.admin-billing .card {
border: 1px solid var(--billing-line);
border-radius: 10px;
box-shadow: 0 8px 28px rgba(15, 23, 42, .045);
}
.admin-billing .card-body { padding: 20px; }
.billing-filter-card { margin-bottom: 18px; }
.billing-section-heading {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 18px;
margin-bottom: 16px;
}
.billing-section-heading > div { min-width: 0; }
.billing-section-heading h2 {
margin: 0 0 4px;
color: var(--billing-ink);
font-size: 16px;
font-weight: 800;
}
.billing-section-heading p {
margin: 0;
color: var(--billing-muted);
line-height: 1.55;
}
.billing-result-count {
min-height: 32px;
display: inline-flex;
align-items: center;
flex: 0 0 auto;
padding: 5px 10px;
border-radius: 999px;
color: #475467;
background: var(--billing-soft);
font-size: 12px;
font-weight: 800;
}
.billing-filter-grid {
display: grid;
grid-template-columns: repeat(6, minmax(128px, 1fr));
gap: 14px;
align-items: end;
}
.billing-field {
min-width: 0;
display: grid;
gap: 7px;
margin: 0;
}
.billing-field-wide { grid-column: span 2; }
.billing-field[hidden] { display: none; }
.billing-field > span {
color: #344054;
font-size: 12px;
font-weight: 800;
}
.billing-field .form-control,
.billing-field .form-select {
width: 100%;
min-height: 44px;
color: var(--billing-ink);
border-color: #cfd8e3;
border-radius: 8px;
background-color: #fff;
}
.billing-field .form-control::placeholder { color: #667085; }
.billing-filter-actions {
display: flex;
gap: 8px;
justify-content: flex-end;
}
.billing-filter-actions .btn { flex: 1 1 auto; }
.billing-table-card { overflow: hidden; }
.billing-table-wrap {
width: 100%;
max-width: 100%;
overflow-x: auto;
border: 1px solid var(--billing-line);
border-radius: 9px;
}
.billing-table {
width: 100%;
min-width: 1000px;
margin: 0;
color: var(--billing-ink);
}
.billing-table thead th {
padding: 11px 12px;
border-bottom: 1px solid #dbe3ec;
color: #475467;
background: var(--billing-soft);
font-size: 11px;
font-weight: 900;
letter-spacing: .035em;
text-transform: uppercase;
white-space: nowrap;
}
.billing-table tbody td {
padding: 13px 12px;
border-color: #edf1f5;
vertical-align: middle;
font-size: 13px;
line-height: 1.45;
overflow-wrap: anywhere;
}
.billing-table tbody tr:last-child td { border-bottom: 0; }
.billing-table tbody tr:hover td { background: #fbfcfd; }
.billing-cell-stack { display: grid; gap: 3px; }
.billing-cell-stack strong { color: #182230; font-weight: 800; }
.billing-cell-stack small { color: var(--billing-muted); font-size: 11px; }
.billing-cell-mono { font-variant-numeric: tabular-nums; }
.billing-row-action {
min-height: 44px;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 8px 12px;
border: 1px solid #b8d9d0;
border-radius: 7px;
color: #086c56;
background: #f3fbf8;
font-weight: 800;
white-space: nowrap;
cursor: pointer;
touch-action: manipulation;
}
.billing-row-action:hover { color: #064e3b; background: #e5f7f1; }
.billing-row-action:active { background: #d9f1e9; }
.billing-status {
display: inline-flex;
align-items: center;
gap: 7px;
max-width: 100%;
padding: 6px 9px;
border: 1px solid transparent;
border-radius: 999px;
color: #475467;
background: #f2f4f7;
font-size: 11px;
font-weight: 850;
line-height: 1.3;
white-space: nowrap;
}
.billing-status::before {
width: 7px;
height: 7px;
flex: 0 0 auto;
border-radius: 50%;
background: currentColor;
content: "";
}
.billing-status.is-success { color: #08785b; border-color: #b7e4d8; background: var(--billing-brand-soft); }
.billing-status.is-warning { color: var(--billing-warning); border-color: #f0d588; background: var(--billing-warning-soft); }
.billing-status.is-danger { color: var(--billing-danger); border-color: #f3c1bc; background: var(--billing-danger-soft); }
.billing-status.is-info { color: var(--billing-info); border-color: #c7d7fe; background: var(--billing-info-soft); }
.billing-state-row td {
height: 116px;
color: var(--billing-muted);
text-align: center;
}
.billing-state-content {
max-width: 540px;
display: grid;
justify-items: center;
gap: 9px;
margin: 0 auto;
padding: 12px;
}
.billing-state-content strong { color: var(--billing-ink); }
.billing-state-content .btn { min-height: 44px; }
.billing-loader {
width: 24px;
height: 24px;
border: 3px solid #d8e4e1;
border-top-color: var(--billing-brand);
border-radius: 50%;
animation: billing-spin .75s linear infinite;
}
@keyframes billing-spin { to { transform: rotate(360deg); } }
.billing-pagination {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 12px;
margin-top: 16px;
}
.billing-pagination[hidden] { display: none; }
.billing-pagination > span {
min-width: 190px;
color: var(--billing-muted);
font-size: 12px;
font-weight: 800;
text-align: center;
}
.billing-pagination button:disabled { cursor: not-allowed; opacity: .55; }
.admin-billing :where(a, button, input, select):focus-visible,
.billing-dialog :where(button, a):focus-visible {
outline: 2px solid #176fbd;
outline-offset: 2px;
}
.billing-dialog {
width: min(680px, calc(100vw - 24px));
max-width: none;
height: 100dvh;
max-height: 100dvh;
margin: 0 0 0 auto;
padding: 0;
border: 0;
color: var(--billing-ink, #172033);
background: #fff;
box-shadow: -18px 0 48px rgba(15, 23, 42, .18);
}
body.billing-detail-open { overflow: hidden; }
.billing-dialog:not([open]) { display: none; }
.billing-dialog::backdrop { background: rgba(15, 23, 42, .56); }
.billing-dialog-shell {
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
}
.billing-dialog header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16px;
padding: 20px 22px;
border-bottom: 1px solid #e4eaf1;
}
.billing-dialog header h2 { margin: 0; color: #101828; font-size: 20px; font-weight: 850; }
.billing-dialog-close {
width: 44px;
height: 44px;
display: inline-flex;
align-items: center;
justify-content: center;
flex: 0 0 auto;
padding: 0;
border: 1px solid #d5dce5;
border-radius: 8px;
color: #344054;
background: #fff;
font-size: 23px;
}
.billing-dialog-close:hover { background: #f4f6f8; }
.billing-detail-state {
margin: 14px 22px 0;
padding: 10px 12px;
border-radius: 8px;
color: #1849a9;
background: #eef4ff;
font-weight: 750;
}
.billing-detail-state.is-error { color: #b42318; background: #fff0ee; }
.billing-detail-state[hidden] { display: none; }
.billing-detail-body {
min-height: 0;
flex: 1 1 auto;
overflow-y: auto;
overscroll-behavior: contain;
padding: 18px 22px 34px;
}
.billing-detail-section {
margin-bottom: 16px;
padding: 16px;
border: 1px solid #e4eaf1;
border-radius: 9px;
background: #fff;
}
.billing-detail-section h3 {
margin: 0 0 13px;
color: #344054;
font-size: 13px;
font-weight: 900;
letter-spacing: .025em;
}
.billing-detail-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 13px 18px;
margin: 0;
}
.billing-detail-grid > div { min-width: 0; }
.billing-detail-grid dt {
margin: 0 0 3px;
color: #667085;
font-size: 11px;
font-weight: 800;
}
.billing-detail-grid dd {
margin: 0;
color: #182230;
font-size: 13px;
font-weight: 750;
line-height: 1.45;
overflow-wrap: anywhere;
}
.billing-attempt-list { display: grid; gap: 9px; }
.billing-attempt-note {
margin: 0;
padding: 10px 12px;
border-radius: 8px;
color: #475467;
background: #f2f4f7;
font-size: 12px;
line-height: 1.5;
}
.billing-attempt {
padding: 12px;
border: 1px solid #e4eaf1;
border-radius: 8px;
background: #f8fafc;
}
.billing-attempt strong { display: block; margin-bottom: 4px; color: #182230; }
.billing-attempt span { display: block; color: #667085; font-size: 12px; line-height: 1.5; }
@media (max-width: 1199px) {
.billing-filter-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.billing-filter-actions { grid-column: span 2; }
}
@media (max-width: 767px) {
.admin-billing { padding-top: 16px; }
.billing-page-header { flex-direction: column; gap: 14px; }
.billing-refresh { width: 100%; }
.billing-tabs { flex-direction: column; padding: 4px; }
.billing-tabs a { width: 100%; flex-basis: auto; justify-content: flex-start; }
.billing-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-billing .card-body { padding: 16px; }
.billing-section-heading { flex-direction: column; gap: 10px; }
.billing-result-count { align-self: flex-start; }
.billing-filter-grid { grid-template-columns: minmax(0, 1fr); }
.billing-field-wide,
.billing-filter-actions { grid-column: auto; }
.billing-field .form-control,
.billing-field .form-select { font-size: 16px; }
.billing-filter-actions { flex-direction: column; }
.billing-filter-actions .btn { width: 100%; }
.billing-table-wrap { overflow: visible; border: 0; }
.billing-table { min-width: 0; display: block; }
.billing-table thead {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
.billing-table tbody { display: grid; gap: 12px; }
.billing-table tbody tr {
min-width: 0;
display: block;
overflow: hidden;
border: 1px solid #dde5ed;
border-radius: 9px;
background: #fff;
}
.billing-table tbody tr:hover td { background: transparent; }
.billing-table tbody td {
min-width: 0;
display: grid;
grid-template-columns: minmax(88px, .7fr) minmax(0, 1.3fr);
gap: 12px;
align-items: start;
padding: 11px 12px;
border-bottom: 1px solid #edf1f5;
text-align: left;
}
.billing-table tbody td::before {
color: #667085;
content: attr(data-label);
font-size: 11px;
font-weight: 900;
line-height: 1.45;
}
.billing-table tbody td:last-child { border-bottom: 0; }
.billing-table tbody td > * { min-width: 0; }
.billing-table .billing-state-row td {
min-height: 126px;
display: flex;
align-items: center;
justify-content: center;
}
.billing-table .billing-state-row td::before { content: none; }
.billing-row-action { width: 100%; }
.billing-status { white-space: normal; }
.billing-pagination { justify-content: space-between; gap: 7px; }
.billing-pagination > span { min-width: 0; flex: 1 1 auto; }
.billing-pagination .btn { min-width: 44px; padding-inline: 10px; }
.billing-pagination .btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.billing-dialog { width: 100vw; max-width: 100vw; }
.billing-dialog header { padding: 16px; }
.billing-detail-state { margin: 12px 16px 0; }
.billing-detail-body { padding: 14px 16px 28px; }
.billing-detail-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 390px) {
.billing-summary { grid-template-columns: minmax(0, 1fr); }
.billing-table tbody td { grid-template-columns: minmax(78px, .65fr) minmax(0, 1.35fr); gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
.billing-tabs a { transition: none; }
.billing-loader { animation: none; opacity: .72; }
}

@ -143,13 +143,20 @@ function statusInfo(kind, value) {
function statusBadge(kind, value) {
const [label, tone] = statusInfo(kind, value);
return element('span', `billing-status is-${tone}`, label);
const badgeTone = {
success: 'bg-success-subtle text-success-emphasis',
warning: 'bg-warning-subtle text-warning-emphasis',
danger: 'bg-danger-subtle text-danger-emphasis',
info: 'bg-info-subtle text-info-emphasis',
neutral: 'bg-light text-dark',
}[tone] || 'bg-light text-dark';
return element('span', `badge rounded-pill fs-12 px-2 py-1 ${badgeTone}`, label);
}
function stack(primary, secondary = '') {
const node = element('span', 'billing-cell-stack');
const node = element('span', 'admin-checkout-user text-break');
node.append(element('strong', '', firstText(primary, '—')));
if (firstText(secondary)) node.append(element('small', '', secondary));
if (firstText(secondary)) node.append(element('span', '', secondary));
return node;
}
@ -161,7 +168,7 @@ function accountCell(item) {
function detailButton(invoiceId, label = '查看账单') {
if (!invoiceId) return element('span', 'text-muted', '—');
const button = element('button', 'billing-row-action', label);
const button = element('button', 'btn btn-primary btn-sm', label);
button.type = 'button';
button.dataset.invoiceId = String(invoiceId);
button.setAttribute('aria-label', `查看账单 ${invoiceId} 详情`);
@ -172,7 +179,7 @@ function invoiceCells(item) {
return [
stack(`#${item.id}`, purposeLabel(item.purpose)), accountCell(item),
stack(firstText(item.subject_name, item.plan_name, '账单项目'), item.plan_id ? `套餐 #${item.plan_id}` : ''),
element('span', 'billing-cell-mono', formatUsd(item.amount)), statusBadge('financial', item.financial_status),
element('span', 'admin-mono', formatUsd(item.amount)), statusBadge('financial', item.financial_status),
statusBadge('fulfillment', item.fulfillment_status), providerLabel(item.payment_method),
stack(formatDate(item.created_at), item.due_at ? `到期 ${formatDate(item.due_at)}` : ''), detailButton(item.id, '账单详情'),
];
@ -183,7 +190,7 @@ function orderCells(item) {
return [
stack(`#${item.id}`, taskDetails), accountCell(item),
stack(firstText(item.plan_name, item.plan_id ? `套餐 #${item.plan_id}` : '套餐未记录'), item.host_id ? `宿主机 #${item.host_id}` : ''),
element('span', 'billing-cell-mono', formatUsd(item.amount)), statusBadge('financial', item.financial_status),
element('span', 'admin-mono', formatUsd(item.amount)), statusBadge('financial', item.financial_status),
statusBadge('fulfillment', firstText(item.fulfillment_status, item.status, item.job_status)),
stack(item.instance_id ? `实例 #${item.instance_id}` : '实例 —', item.job_id ? `任务 #${item.job_id} · ${statusInfo('fulfillment', item.job_status)[0]}` : '引擎任务 —'),
stack(formatDate(firstText(item.updated_at, item.created_at)), firstText(item.error)), detailButton(item.invoice_id),
@ -193,7 +200,7 @@ function orderCells(item) {
function paymentCells(item) {
return [
stack(`#${item.id}`, item.invoice_id ? `账单 #${item.invoice_id}` : '未关联账单'), accountCell(item),
providerLabel(item.provider), element('span', 'billing-cell-mono', formatUsd(item.amount)),
providerLabel(item.provider), element('span', 'admin-mono', formatUsd(item.amount)),
statusBadge('payment', item.payment_status), statusBadge('financial', item.invoice_financial_status),
purposeLabel(item.purpose), stack(formatDate(item.created_at), item.updated_at ? `更新 ${formatDate(item.updated_at)}` : ''),
detailButton(item.invoice_id),
@ -204,7 +211,7 @@ function setNotice(message, tone = '') {
const notice = byId('billing-notice');
if (!notice) return;
notice.textContent = message;
notice.className = `billing-notice${tone ? ` is-${tone}` : ''}`;
notice.className = `admin-config-status ${tone === 'error' ? 'is-error' : tone === 'success' ? 'is-success' : 'is-loading'}`;
notice.setAttribute('role', tone === 'error' ? 'alert' : 'status');
}
@ -267,7 +274,9 @@ function configureView() {
byId('billing-query').placeholder = config.queryPlaceholder;
byId('billing-table-caption').textContent = config.caption;
document.querySelectorAll('[data-billing-view]').forEach(link => {
if (link.dataset.billingView === state.view) link.setAttribute('aria-current', 'page');
const active = link.dataset.billingView === state.view;
link.classList.toggle('active', active);
if (active) link.setAttribute('aria-current', 'page');
else link.removeAttribute('aria-current');
});
configureFilter('status-primary', config.primary);
@ -288,10 +297,14 @@ function renderTableHead() {
}
function renderState(title, message, retry = false) {
const cell = element('td');
const cell = element('td', 'text-center text-muted py-4');
cell.colSpan = VIEWS[state.view].columns.length;
const content = element('div', 'billing-state-content');
if (state.loading) content.append(element('span', 'billing-loader'));
const content = element('div', 'd-grid justify-content-center gap-2');
if (state.loading) {
const loader = element('span', 'spinner-border spinner-border-sm text-primary mx-auto');
loader.setAttribute('aria-hidden', 'true');
content.append(loader);
}
content.append(element('strong', '', title));
if (message) content.append(element('span', '', message));
if (retry) {
@ -301,7 +314,7 @@ function renderState(title, message, retry = false) {
content.append(button);
}
cell.append(content);
const row = element('tr', 'billing-state-row');
const row = element('tr');
row.append(cell);
byId('billing-table-body').replaceChildren(row);
}
@ -556,12 +569,12 @@ function changeView(view, push = true) {
}
function definitionList(pairs) {
const list = element('dl', 'billing-detail-grid');
const list = element('dl', 'row g-3 mb-0');
for (const [label, value] of pairs) {
if (value === null || value === undefined || value === '') continue;
const item = element('div');
item.append(element('dt', '', label));
const description = element('dd');
const item = element('div', 'col-sm-6');
item.append(element('dt', 'text-muted fs-13 mb-1', label));
const description = element('dd', 'fw-semibold mb-0 text-break');
if (value instanceof Node) description.append(value);
else description.textContent = String(value);
item.append(description);
@ -571,8 +584,8 @@ function definitionList(pairs) {
}
function detailSection(title, pairs) {
const section = element('section', 'billing-detail-section');
section.append(element('h3', '', title), definitionList(pairs));
const section = element('section', 'admin-report-card mb-3');
section.append(element('h3', 'fs-14 fw-semibold mb-3', title), definitionList(pairs));
return section;
}
@ -628,19 +641,19 @@ function renderDetail(payload) {
['到期时间', formatDate(instance.expires_at)],
]));
const attempts = Array.isArray(payload?.payment_attempts) ? payload.payment_attempts : [];
const attemptsSection = element('section', 'billing-detail-section');
const attemptsSection = element('section', 'admin-report-card');
const attemptsTruncated = payload?.payment_attempts_truncated === true;
attemptsSection.append(element('h3', '', `支付尝试 (${attempts.length}${attemptsTruncated ? '+' : ''})`));
const attemptsList = element('div', 'billing-attempt-list');
attemptsSection.append(element('h3', 'fs-14 fw-semibold mb-3', `支付尝试 (${attempts.length}${attemptsTruncated ? '+' : ''})`));
const attemptsList = element('div', 'd-grid gap-2');
if (attemptsTruncated) {
attemptsList.append(element('p', 'billing-attempt-note', '仅显示最近 100 条;完整记录请在“支付流水”中筛选此账单。'));
attemptsList.append(element('p', 'alert alert-light mb-0', '仅显示最近 100 条;完整记录请在“支付流水”中筛选此账单。'));
}
if (!attempts.length) attemptsList.append(element('p', 'text-muted mb-0', '暂无支付尝试记录。'));
for (const attempt of attempts) {
const item = element('article', 'billing-attempt');
item.append(element('strong', '', `${providerLabel(attempt.provider || attempt.method)} · ${formatUsd(attempt.amount)}`));
const item = element('article', 'admin-report-card');
item.append(element('strong', 'd-block mb-1', `${providerLabel(attempt.provider || attempt.method)} · ${formatUsd(attempt.amount)}`));
item.append(statusBadge('payment', firstText(attempt.payment_status, attempt.status)));
item.append(element('span', '', `创建 ${formatDate(attempt.created_at)}${attempt.updated_at ? ` · 更新 ${formatDate(attempt.updated_at)}` : ''}`));
item.append(element('span', 'd-block text-muted fs-13 mt-2', `创建 ${formatDate(attempt.created_at)}${attempt.updated_at ? ` · 更新 ${formatDate(attempt.updated_at)}` : ''}`));
attemptsList.append(item);
}
attemptsSection.append(attemptsList);
@ -674,7 +687,7 @@ async function openDetail(invoiceId, opener) {
byId('billing-detail-body').replaceChildren();
const detailState = byId('billing-detail-state');
detailState.hidden = false;
detailState.className = 'billing-detail-state';
detailState.className = 'alert alert-info mb-3';
detailState.setAttribute('role', 'status');
detailState.textContent = '正在读取账单详情…';
if (!dialog.open) {
@ -691,7 +704,7 @@ async function openDetail(invoiceId, opener) {
} catch (error) {
if (error?.name === 'AbortError') return;
detailState.hidden = false;
detailState.className = 'billing-detail-state is-error';
detailState.className = 'alert alert-danger mb-3';
detailState.setAttribute('role', 'alert');
detailState.textContent = error?.message || '账单详情加载失败。';
} finally {

@ -1,961 +0,0 @@
.admin-overview {
--vo-ink: #10243d;
--vo-muted: #5c6f83;
--vo-soft: #f5f8fb;
--vo-line: #dce5ee;
--vo-brand: #0a8f78;
--vo-brand-soft: #e7f7f2;
--vo-warning: #a96108;
--vo-warning-soft: #fff4df;
--vo-danger: #bd3847;
--vo-danger-soft: #fdecef;
display: grid;
gap: 16px;
width: 100%;
max-width: 1540px;
min-width: 0;
margin-inline: auto;
padding: 20px 0 32px;
color: var(--vo-ink);
}
.admin-overview *,
.admin-overview *::before,
.admin-overview *::after {
box-sizing: border-box;
}
.vo-page-head {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 24px;
padding: 4px 0 6px;
}
.vo-page-head > div:first-child {
min-width: 0;
}
.vo-page-head h1 {
margin: 0;
color: var(--vo-ink);
font-size: clamp(25px, 2.2vw, 32px);
font-weight: 850;
letter-spacing: -0.035em;
line-height: 1.15;
}
.vo-page-head p {
max-width: 680px;
margin: 8px 0 0;
color: var(--vo-muted);
font-size: 14px;
line-height: 1.6;
}
.vo-page-actions {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 10px;
flex: 0 0 auto;
}
.vo-snapshot {
min-height: 44px;
display: inline-flex;
align-items: center;
gap: 8px;
padding: 0 14px;
border: 1px solid var(--vo-line);
border-radius: 8px;
color: #52677d;
background: #fff;
font-size: 12px;
font-weight: 750;
white-space: nowrap;
}
.vo-snapshot i {
color: var(--vo-brand);
font-size: 18px;
}
.vo-snapshot.is-error {
border-color: #f1cbd0;
color: #8f2b38;
background: #fff8f9;
}
.vo-snapshot.is-error i {
color: var(--vo-danger);
}
.vo-refresh {
min-height: 44px;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 7px;
border-color: var(--vo-line);
color: #314a64;
font-weight: 750;
}
.vo-alert {
min-height: 48px;
display: flex;
align-items: center;
gap: 10px;
padding: 12px 14px;
border: 1px solid #f0c7cd;
border-radius: 8px;
color: #8d2936;
background: #fff7f8;
font-size: 14px;
font-weight: 700;
}
.vo-alert i {
flex: 0 0 auto;
font-size: 20px;
}
.vo-kpi-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 12px;
}
.vo-kpi {
position: relative;
min-width: 0;
min-height: 184px;
display: flex;
flex-direction: column;
padding: 19px 20px 16px;
overflow: hidden;
border: 1px solid var(--vo-line);
border-radius: 8px;
background: #fff;
}
.vo-kpi::before {
position: absolute;
inset: 0 0 auto;
height: 3px;
content: "";
background: var(--vo-brand);
}
.vo-kpi.has-warning::before {
background: #dfa145;
}
.vo-kpi-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
color: var(--vo-muted);
font-size: 13px;
font-weight: 800;
}
.vo-kpi-head h2 {
margin: 0;
color: inherit;
font: inherit;
letter-spacing: inherit;
}
.vo-kpi-head i {
width: 38px;
height: 38px;
display: inline-flex;
align-items: center;
justify-content: center;
flex: 0 0 auto;
border-radius: 8px;
color: #087460;
background: var(--vo-brand-soft);
font-size: 21px;
}
.vo-kpi.has-warning .vo-kpi-head i {
color: var(--vo-warning);
background: var(--vo-warning-soft);
}
.vo-kpi > strong {
display: block;
margin-top: 10px;
color: var(--vo-ink);
font-size: clamp(29px, 2.4vw, 36px);
font-weight: 850;
font-variant-numeric: tabular-nums;
letter-spacing: -0.04em;
line-height: 1.08;
}
.vo-kpi > strong small {
margin-right: 2px;
color: #476078;
font-size: 17px;
font-weight: 800;
}
.vo-kpi > p {
min-height: 39px;
margin: 8px 0 10px;
color: var(--vo-muted);
font-size: 12px;
font-weight: 650;
line-height: 1.55;
}
.vo-kpi > a {
min-height: 44px;
display: inline-flex;
align-items: center;
justify-content: space-between;
gap: 8px;
margin: auto -8px -8px;
padding: 0 8px;
border-radius: 6px;
color: #087460;
font-size: 13px;
font-weight: 800;
text-decoration: none;
}
.vo-kpi > a i {
font-size: 19px;
}
.vo-primary-grid,
.vo-secondary-grid {
display: grid;
gap: 16px;
min-width: 0;
}
.vo-primary-grid {
grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.8fr);
}
.vo-secondary-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.vo-panel {
min-width: 0;
padding: 20px;
border: 1px solid var(--vo-line);
border-radius: 8px;
background: #fff;
}
.vo-panel-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16px;
margin-bottom: 18px;
}
.vo-panel-head > div:first-child {
min-width: 0;
}
.vo-panel-head h2 {
margin: 0;
color: var(--vo-ink);
font-size: 18px;
font-weight: 850;
letter-spacing: -0.02em;
}
.vo-panel-head p {
margin: 5px 0 0;
color: var(--vo-muted);
font-size: 12px;
font-weight: 600;
line-height: 1.55;
}
.vo-panel-summary {
flex: 0 0 auto;
text-align: right;
}
.vo-panel-summary strong {
display: block;
color: var(--vo-ink);
font-size: 21px;
font-weight: 850;
font-variant-numeric: tabular-nums;
}
.vo-panel-summary span {
display: block;
margin-top: 2px;
color: var(--vo-muted);
font-size: 12px;
font-weight: 700;
}
.vo-trend {
display: grid;
gap: 12px;
}
.vo-trend-row {
display: grid;
grid-template-columns: 74px minmax(90px, 1fr) 112px;
align-items: center;
gap: 14px;
min-width: 0;
}
.vo-trend-date,
.vo-trend-value {
min-width: 0;
}
.vo-trend-date strong,
.vo-trend-value strong {
display: block;
color: #27415c;
font-size: 12px;
font-weight: 800;
line-height: 1.25;
}
.vo-trend-date span,
.vo-trend-value span {
display: block;
margin-top: 2px;
color: var(--vo-muted);
font-size: 12px;
font-weight: 650;
line-height: 1.25;
}
.vo-trend-value {
overflow-wrap: anywhere;
text-align: right;
font-variant-numeric: tabular-nums;
}
.vo-trend-track {
height: 9px;
overflow: hidden;
border-radius: 999px;
background: #eaf0f5;
}
.vo-trend-track span {
width: calc(var(--value) * 1%);
min-width: calc(min(var(--value), 1) * 5px);
height: 100%;
display: block;
border-radius: inherit;
background: #27a98d;
}
.vo-panel-foot {
min-height: 44px;
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 14px;
margin-top: 12px;
padding-top: 12px;
border-top: 1px solid #e8eef4;
color: var(--vo-muted);
font-size: 12px;
font-weight: 700;
}
.vo-panel-foot a,
.vo-head-link {
min-height: 44px;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0 6px;
border-radius: 6px;
color: #087460;
font-size: 12px;
font-weight: 800;
text-decoration: none;
}
.vo-attention-count {
min-width: 38px;
height: 38px;
display: inline-flex;
align-items: center;
justify-content: center;
flex: 0 0 auto;
border-radius: 999px;
color: #547086;
background: #edf2f6;
font-size: 14px;
font-weight: 850;
font-variant-numeric: tabular-nums;
}
.vo-attention-count.has-items {
color: #9a3420;
background: #ffeadf;
}
.vo-attention-list {
display: grid;
gap: 7px;
}
.vo-attention-list a {
min-height: 66px;
display: grid;
grid-template-columns: 38px minmax(0, 1fr) auto;
align-items: center;
gap: 11px;
padding: 9px 10px;
border: 1px solid transparent;
border-radius: 7px;
color: inherit;
background: #f8fafc;
text-decoration: none;
}
.vo-attention-list > a > i {
width: 38px;
height: 38px;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 7px;
color: #36708e;
background: #e8f2f7;
font-size: 20px;
}
.vo-attention-list > a > i.is-warning {
color: var(--vo-warning);
background: var(--vo-warning-soft);
}
.vo-attention-list > a > i.is-danger {
color: var(--vo-danger);
background: var(--vo-danger-soft);
}
.vo-attention-list span,
.vo-shortcuts span {
min-width: 0;
}
.vo-attention-list strong,
.vo-attention-list small {
display: block;
}
.vo-attention-list strong {
color: #213b55;
font-size: 12px;
font-weight: 800;
}
.vo-attention-list small {
margin-top: 2px;
color: var(--vo-muted);
font-size: 12px;
font-weight: 600;
line-height: 1.35;
}
.vo-attention-list em {
min-width: 29px;
color: var(--vo-ink);
font-size: 15px;
font-style: normal;
font-weight: 850;
font-variant-numeric: tabular-nums;
text-align: right;
}
.vo-health-list {
display: grid;
gap: 19px;
}
.vo-health-item > div {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
margin-bottom: 8px;
color: #536b82;
font-size: 12px;
font-weight: 750;
}
.vo-health-item strong {
color: var(--vo-ink);
font-size: 13px;
font-weight: 850;
font-variant-numeric: tabular-nums;
}
.vo-health-track {
height: 8px;
display: block;
overflow: hidden;
border-radius: 999px;
background: #e9eff4;
}
.vo-health-track i {
width: calc(var(--value) * 1%);
height: 100%;
display: block;
border-radius: inherit;
background: #28a98d;
}
.vo-definition {
display: grid;
grid-template-columns: 24px minmax(0, 1fr);
gap: 8px;
margin-top: 20px;
padding: 11px 12px;
border-radius: 7px;
color: #526b80;
background: #f1f6f8;
font-size: 12px;
font-weight: 650;
line-height: 1.5;
}
.vo-definition i {
color: #25866f;
font-size: 18px;
}
.vo-flow-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 10px;
}
.vo-flow-grid > div {
min-width: 0;
padding: 15px 16px;
border: 1px solid #e5ecf2;
border-radius: 7px;
background: #f8fafc;
}
.vo-flow-grid span,
.vo-flow-grid strong,
.vo-flow-grid small {
display: block;
}
.vo-flow-grid span {
color: var(--vo-muted);
font-size: 12px;
font-weight: 750;
}
.vo-flow-grid strong {
margin-top: 5px;
color: var(--vo-ink);
font-size: 25px;
font-weight: 850;
font-variant-numeric: tabular-nums;
letter-spacing: -0.03em;
}
.vo-flow-grid small {
margin-top: 5px;
color: var(--vo-muted);
font-size: 12px;
font-weight: 650;
line-height: 1.4;
}
.vo-plan-list {
display: grid;
}
.vo-plan-row {
min-height: 48px;
display: grid;
grid-template-columns: 30px minmax(0, 1fr) 58px 92px;
align-items: center;
gap: 10px;
border-bottom: 1px solid #e8eef4;
color: var(--vo-muted);
font-size: 12px;
font-weight: 700;
}
.vo-plan-row:last-child {
border-bottom: 0;
}
.vo-plan-rank {
width: 26px;
height: 26px;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 6px;
color: #087460;
background: var(--vo-brand-soft);
font-size: 12px;
font-weight: 850;
}
.vo-plan-row strong {
min-width: 0;
color: #263f58;
font-size: 13px;
font-weight: 800;
line-height: 1.4;
overflow-wrap: anywhere;
}
.vo-plan-count,
.vo-plan-amount {
min-width: 0;
}
.vo-plan-row em {
color: var(--vo-ink);
font-style: normal;
font-weight: 850;
font-variant-numeric: tabular-nums;
text-align: right;
overflow-wrap: anywhere;
}
.vo-empty {
min-height: 154px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
gap: 8px;
color: var(--vo-muted);
font-size: 12px;
font-weight: 700;
text-align: center;
}
.vo-empty i {
color: #9eb0bf;
font-size: 28px;
}
.vo-shortcuts {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 10px;
}
.vo-shortcuts a {
min-height: 72px;
display: grid;
grid-template-columns: 38px minmax(0, 1fr);
align-items: center;
gap: 11px;
padding: 12px;
border: 1px solid #e3eaf1;
border-radius: 7px;
color: inherit;
background: #f8fafc;
text-decoration: none;
}
.vo-shortcuts > a > i {
width: 38px;
height: 38px;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 7px;
color: #087460;
background: var(--vo-brand-soft);
font-size: 20px;
}
.vo-shortcuts strong,
.vo-shortcuts small {
display: block;
}
.vo-shortcuts strong {
color: #253e57;
font-size: 12px;
font-weight: 800;
}
.vo-shortcuts small {
margin-top: 3px;
color: var(--vo-muted);
font-size: 12px;
font-weight: 650;
line-height: 1.35;
}
.vo-method-note {
min-width: 0;
display: grid;
grid-template-columns: 34px minmax(0, 1fr);
gap: 11px;
padding: 14px 16px;
border: 1px solid #d9e7e3;
border-radius: 8px;
color: #49657a;
background: #f2f8f6;
}
.vo-method-note > i {
width: 34px;
height: 34px;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 7px;
color: #087460;
background: #dff2ec;
font-size: 19px;
}
.vo-method-note p,
.vo-method-note strong,
.vo-method-note span {
display: block;
margin: 0;
}
.vo-method-note strong {
color: #274c46;
font-size: 12px;
font-weight: 850;
}
.vo-method-note span {
margin-top: 3px;
font-size: 12px;
font-weight: 650;
line-height: 1.55;
}
.admin-overview a {
transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}
.admin-overview a:hover {
color: #056955;
}
.vo-kpi > a:hover,
.vo-panel-foot a:hover,
.vo-head-link:hover {
background: #eff8f5;
}
.vo-attention-list a:hover,
.vo-shortcuts a:hover {
border-color: #b9ddd3;
background: #f1f8f6;
}
.vo-attention-list a:active,
.vo-shortcuts a:active,
.vo-kpi > a:active,
.vo-panel-foot a:active,
.vo-head-link:active {
background: #e5f3ef;
}
.admin-overview a:focus-visible {
outline: 2px solid #0a7865;
outline-offset: 2px;
}
@media (max-width: 1260px) {
.vo-kpi-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.vo-primary-grid {
grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.8fr);
}
}
@media (max-width: 991px) {
.admin-overview {
padding-top: 16px;
}
.vo-primary-grid,
.vo-secondary-grid {
grid-template-columns: 1fr;
}
}
@media (max-width: 720px) {
.vo-page-head {
align-items: stretch;
flex-direction: column;
gap: 14px;
}
.vo-page-actions {
width: 100%;
align-items: stretch;
}
.vo-snapshot {
min-width: 0;
flex: 1 1 auto;
white-space: normal;
}
.vo-refresh {
flex: 0 0 auto;
}
.vo-kpi-grid {
grid-template-columns: 1fr;
}
.vo-kpi {
min-height: 0;
}
.vo-panel-head {
gap: 10px;
}
.vo-trend-row {
grid-template-columns: 60px minmax(52px, 1fr) minmax(84px, auto);
gap: 9px;
}
.vo-trend-value strong {
font-size: 12px;
}
.vo-flow-grid,
.vo-shortcuts {
grid-template-columns: 1fr 1fr;
}
}
@media (max-width: 480px) {
.admin-overview {
gap: 12px;
}
.vo-page-actions {
flex-direction: column;
}
.vo-snapshot,
.vo-refresh {
width: 100%;
justify-content: center;
}
.vo-kpi,
.vo-panel {
padding: 16px;
}
.vo-panel-head {
align-items: flex-start;
flex-direction: column;
}
.vo-panel-summary {
text-align: left;
}
.vo-attention-panel .vo-panel-head {
flex-direction: row;
}
.vo-trend-row {
grid-template-columns: 52px minmax(42px, 1fr) minmax(78px, 96px);
gap: 8px;
}
.vo-trend-date strong {
font-size: 12px;
}
.vo-panel-foot {
align-items: flex-start;
flex-direction: column;
gap: 0;
}
.vo-attention-list a {
grid-template-columns: 34px minmax(0, 1fr) auto;
padding-inline: 7px;
}
.vo-attention-list > a > i {
width: 34px;
height: 34px;
}
.vo-flow-grid,
.vo-shortcuts {
grid-template-columns: 1fr;
}
.vo-plan-row {
grid-template-columns: 28px minmax(0, 1fr) minmax(72px, auto);
grid-template-rows: auto auto;
padding: 8px 0;
}
.vo-plan-rank {
grid-column: 1;
grid-row: 1 / 3;
}
.vo-plan-row strong {
grid-column: 2;
grid-row: 1;
}
.vo-plan-count {
grid-column: 2;
grid-row: 2;
}
.vo-plan-amount {
grid-column: 3;
grid-row: 1 / 3;
}
}
@media (prefers-reduced-motion: reduce) {
.admin-overview *,
.admin-overview *::before,
.admin-overview *::after {
scroll-behavior: auto !important;
transition-duration: 0.01ms !important;
}
}

@ -659,6 +659,46 @@
margin-top: 24px;
}
.admin-billing-dialog {
width: min(584px, calc(100vw - 24px));
max-width: none;
max-height: calc(100dvh - 24px);
margin: auto;
padding: 0;
overflow: visible;
border: 0;
border-radius: 10px;
background: transparent;
}
.admin-billing-dialog::backdrop {
background: rgba(0, 8, 26, 0.46);
}
.admin-billing-dialog-panel {
width: 100%;
max-height: calc(100dvh - 24px);
display: flex;
flex-direction: column;
overflow: hidden;
}
.admin-billing-dialog-body {
min-width: 0;
min-height: 0;
overflow-y: auto;
overflow-wrap: anywhere;
}
.admin-billing-dialog .admin-modal-close {
width: 44px;
height: 44px;
}
body.billing-detail-open {
overflow: hidden;
}
.admin-toast {
position: fixed;
right: 24px;
@ -752,22 +792,34 @@
background: #f8fafc;
}
.admin-ticket-tabs button {
.admin-ticket-tabs button,
.admin-ticket-tabs a {
min-height: 36px;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0 14px;
border: 0;
border-radius: 6px;
color: #6c7c8f;
background: transparent;
font-weight: 800;
text-decoration: none;
white-space: nowrap;
}
.admin-ticket-tabs button.active {
.admin-ticket-tabs button.active,
.admin-ticket-tabs a.active,
.admin-ticket-tabs a[aria-current="page"] {
color: #08785b;
background: rgba(93, 216, 158, 0.18);
}
.admin-ticket-tabs a[aria-disabled="true"] {
cursor: wait;
opacity: 0.68;
}
.admin-ticket-title {
max-width: 520px;
color: #00081a;
@ -1319,7 +1371,16 @@
font-weight: 900;
}
.admin-billing-table {
min-width: 1000px;
}
.admin-user-pagination[hidden] {
display: none;
}
.admin-checkout-user {
min-width: 0;
display: grid;
gap: 3px;
}
@ -1335,6 +1396,11 @@
font-weight: 800;
}
.admin-checkout-user strong,
.admin-checkout-user span {
overflow-wrap: anywhere;
}
.admin-checkout-money {
color: #08785b;
font-weight: 900;
@ -2002,6 +2068,17 @@
@media (max-width: 575.98px) {
[data-admin-billing] .form-control,
[data-admin-billing] .form-select {
min-height: 44px;
font-size: 16px;
}
[data-admin-billing] .btn,
.admin-ticket-tabs a {
min-height: 44px;
}
.admin-summary-grid,
.admin-live-grid,
.admin-shortcuts {
@ -2026,6 +2103,7 @@
}
.admin-ticket-tabs button,
.admin-ticket-tabs a,
.admin-ticket-reply-actions .btn {
flex: 1 1 0;
}
@ -2200,6 +2278,10 @@
width: 100%;
}
.admin-billing-table {
min-width: 0;
}
.admin-checkout-confirm {
grid-template-columns: 1fr;
}

@ -2,89 +2,114 @@
{assign var=admin_active value='billing'}
{include file='admin/static_header.tpl'}
<link rel="stylesheet" href="/cloud/admin-billing.css?v={$venix_asset_version}">
<main class="admin-billing" data-admin-billing>
<header class="billing-page-header">
<div>
<p class="admin-eyebrow mb-1">Billing operations</p>
<h1>账单系统</h1>
<p>统一查看账单、实例开通任务与支付流水,财务和履约状态互不混用。</p>
<main data-admin-billing>
<div class="py-3 d-flex align-items-sm-center flex-sm-row flex-column gap-3">
<div class="flex-grow-1">
<h1 class="fs-20 fw-semibold mb-1">账单系统</h1>
<p class="text-muted mb-0">统一查看账单、实例开通任务与支付流水,财务和履约状态互不混用。</p>
</div>
<button class="btn btn-light billing-refresh" id="billing-refresh" type="button">
<i class="mdi mdi-refresh" aria-hidden="true"></i><span>刷新当前视图</span>
</button>
</header>
<p class="billing-notice" id="billing-notice" role="status" aria-live="polite">正在读取账单数据…</p>
<div class="text-sm-end mt-2 mt-sm-0 admin-checkout-actions">
<span class="admin-config-status is-loading" id="billing-notice" role="status" aria-live="polite">正在读取账单数据…</span>
<button class="btn btn-light" id="billing-refresh" type="button">
<i class="mdi mdi-refresh me-1" aria-hidden="true"></i>刷新当前视图
</button>
</div>
</div>
<nav class="billing-tabs" aria-label="账单视图">
<nav class="admin-ticket-tabs mb-3" aria-label="账单视图">
<a href="/admin/billing" data-billing-view="invoices" aria-current="page">全部账单</a>
<a href="/admin/billing?view=orders" data-billing-view="orders">开通任务</a>
<a href="/admin/billing?view=payments" data-billing-view="payments">支付流水</a>
</nav>
<section class="billing-summary" id="billing-summary" aria-label="当前视图摘要" aria-busy="true">
<article><span>记录总数</span><strong id="billing-summary-total">—</strong></article>
<article><span id="billing-summary-amount-label">总金额</span><strong id="billing-summary-amount">—</strong></article>
<article><span id="billing-summary-focus-label">待处理</span><strong id="billing-summary-focus">—</strong></article>
<article><span id="billing-summary-result-label">已完成</span><strong id="billing-summary-result">—</strong></article>
<section class="row g-3 mb-3" id="billing-summary" aria-label="当前视图摘要" aria-busy="true">
<div class="col-md-6 col-xxl-3">
<article class="card admin-ticket-stat h-100">
<div class="card-body">
<span class="admin-ticket-stat-icon"><i class="mdi mdi-file-document-multiple-outline" aria-hidden="true"></i></span>
<div><p class="text-muted mb-1">记录总数</p><strong class="d-block fs-24" id="billing-summary-total">—</strong></div>
</div>
</article>
</div>
<div class="col-md-6 col-xxl-3">
<article class="card admin-ticket-stat h-100">
<div class="card-body">
<span class="admin-ticket-stat-icon"><i class="mdi mdi-currency-usd" aria-hidden="true"></i></span>
<div><p class="text-muted mb-1" id="billing-summary-amount-label">总金额</p><strong class="d-block fs-24" id="billing-summary-amount">—</strong></div>
</div>
</article>
</div>
<div class="col-md-6 col-xxl-3">
<article class="card admin-ticket-stat h-100">
<div class="card-body">
<span class="admin-ticket-stat-icon is-open"><i class="mdi mdi-alert-circle-outline" aria-hidden="true"></i></span>
<div><p class="text-muted mb-1" id="billing-summary-focus-label">待处理</p><strong class="d-block fs-24" id="billing-summary-focus">—</strong></div>
</div>
</article>
</div>
<div class="col-md-6 col-xxl-3">
<article class="card admin-ticket-stat h-100">
<div class="card-body">
<span class="admin-ticket-stat-icon is-closed"><i class="mdi mdi-check-circle-outline" aria-hidden="true"></i></span>
<div><p class="text-muted mb-1" id="billing-summary-result-label">已完成</p><strong class="d-block fs-24" id="billing-summary-result">—</strong></div>
</div>
</article>
</div>
</section>
<section class="card billing-filter-card" aria-labelledby="billing-filter-title">
<section class="card mb-3" aria-labelledby="billing-filter-title">
<div class="card-header">
<h2 class="h5 card-title mb-1" id="billing-filter-title">筛选条件</h2>
<span class="text-muted fs-13">缩小数据范围后再对账;清空条件可恢复默认列表。</span>
</div>
<div class="card-body">
<div class="billing-section-heading">
<div>
<h2 id="billing-filter-title">筛选条件</h2>
<p>缩小数据范围后再对账;清空条件可恢复默认列表。</p>
</div>
</div>
<form id="billing-filter-form" class="billing-filter-grid">
<label class="billing-field billing-field-wide" for="billing-query">
<span>关键词</span>
<form id="billing-filter-form" class="row g-3 align-items-end">
<label class="col-xl-4 col-lg-6" for="billing-query">
<span class="form-label d-block">关键词</span>
<input class="form-control" id="billing-query" name="q" type="search" maxlength="80"
placeholder="账单 / 订单 / 套餐 / 用户 ID">
</label>
<label class="billing-field" for="billing-user-id">
<span>用户 ID</span>
<label class="col-xl-2 col-lg-3 col-md-6" for="billing-user-id">
<span class="form-label d-block">用户 ID</span>
<input class="form-control" id="billing-user-id" name="user_id" type="text"
inputmode="numeric" pattern="[1-9][0-9]*" maxlength="20" placeholder="全部用户">
</label>
<label class="billing-field" for="billing-status-primary" id="billing-status-primary-field">
<span id="billing-status-primary-label">财务状态</span>
<label class="col-xl-2 col-lg-3 col-md-6" for="billing-status-primary" id="billing-status-primary-field">
<span class="form-label d-block" id="billing-status-primary-label">财务状态</span>
<select class="form-select" id="billing-status-primary"></select>
</label>
<label class="billing-field" for="billing-status-secondary" id="billing-status-secondary-field">
<span id="billing-status-secondary-label">履约状态</span>
<label class="col-xl-2 col-lg-3 col-md-6" for="billing-status-secondary" id="billing-status-secondary-field">
<span class="form-label d-block" id="billing-status-secondary-label">履约状态</span>
<select class="form-select" id="billing-status-secondary"></select>
</label>
<label class="billing-field" for="billing-category" id="billing-category-field">
<span id="billing-category-label">账单类型</span>
<label class="col-xl-2 col-lg-3 col-md-6" for="billing-category" id="billing-category-field">
<span class="form-label d-block" id="billing-category-label">账单类型</span>
<select class="form-select" id="billing-category"></select>
</label>
<label class="billing-field" for="billing-reference-select" id="billing-reference-field">
<span id="billing-reference-label">支付渠道</span>
<label class="col-xl-2 col-lg-3 col-md-6" for="billing-reference-select" id="billing-reference-field">
<span class="form-label d-block" id="billing-reference-label">支付渠道</span>
<select class="form-select" id="billing-reference-select"></select>
<input class="form-control" id="billing-reference-input" type="text"
inputmode="numeric" pattern="[1-9][0-9]*" maxlength="20"
placeholder="全部账单" hidden disabled>
</label>
<label class="billing-field" for="billing-created-from">
<span>开始日期</span>
<label class="col-xl-2 col-lg-3 col-md-6" for="billing-created-from">
<span class="form-label d-block">开始日期</span>
<input class="form-control" id="billing-created-from" name="created_from" type="date">
</label>
<label class="billing-field" for="billing-created-to">
<span>结束日期</span>
<label class="col-xl-2 col-lg-3 col-md-6" for="billing-created-to">
<span class="form-label d-block">结束日期</span>
<input class="form-control" id="billing-created-to" name="created_to" type="date">
</label>
<label class="billing-field" for="billing-per-page">
<span>每页条数</span>
<label class="col-xl-2 col-lg-3 col-md-6" for="billing-per-page">
<span class="form-label d-block">每页条数</span>
<select class="form-select" id="billing-per-page" name="per_page">
<option value="30">30 条</option>
<option value="50">50 条</option>
<option value="100">100 条</option>
</select>
</label>
<div class="billing-filter-actions">
<div class="col-12 admin-form-actions mt-0">
<button class="btn btn-primary" id="billing-apply" type="submit">应用筛选</button>
<button class="btn btn-light" id="billing-reset" type="button">清空条件</button>
</div>
@ -92,52 +117,52 @@
</div>
</section>
<section class="card billing-table-card" id="billing-panel" aria-labelledby="billing-view-heading">
<div class="card-body">
<div class="billing-section-heading billing-list-heading">
<div>
<h2 id="billing-view-heading">全部账单</h2>
<p id="billing-view-description">按财务状态与履约状态核对每一笔账单。</p>
</div>
<span class="billing-result-count" id="billing-result-count" aria-live="polite">读取中</span>
<section class="card" id="billing-panel" aria-labelledby="billing-view-heading">
<div class="card-header d-flex align-items-center justify-content-between flex-wrap gap-2">
<div>
<h2 class="h5 card-title mb-1" id="billing-view-heading">全部账单</h2>
<span class="text-muted fs-13" id="billing-view-description">按财务状态与履约状态核对每一笔账单。</span>
</div>
<div class="billing-table-wrap">
<table class="table align-middle billing-table" id="billing-table">
<span class="badge text-bg-light" id="billing-result-count" aria-live="polite">读取中</span>
</div>
<div class="card-body">
<div class="table-responsive admin-checkout-table-wrap">
<table class="table table-hover align-middle mb-0 admin-checkout-table admin-billing-table" id="billing-table">
<caption class="visually-hidden" id="billing-table-caption">管理员账单列表</caption>
<thead id="billing-table-head"></thead>
<tbody id="billing-table-body">
<tr class="billing-state-row"><td>正在加载…</td></tr>
<tr><td class="text-center text-muted py-4">正在加载…</td></tr>
</tbody>
</table>
</div>
<nav class="billing-pagination" id="billing-pagination" aria-label="账单列表分页" hidden>
<nav class="admin-user-pagination" id="billing-pagination" aria-label="账单列表分页" hidden>
<button class="btn btn-light" id="billing-previous" type="button">
<i class="mdi mdi-chevron-left" aria-hidden="true"></i><span>上一页</span>
<i class="mdi mdi-chevron-left me-1" aria-hidden="true"></i>上一页
</button>
<span id="billing-page-label">第 1 / 1 页</span>
<button class="btn btn-light" id="billing-next" type="button">
<span>下一页</span><i class="mdi mdi-chevron-right" aria-hidden="true"></i>
下一页<i class="mdi mdi-chevron-right ms-1" aria-hidden="true"></i>
</button>
</nav>
</div>
</section>
<noscript><p class="alert alert-warning">此页需要 JavaScript 才能读取账单数据。</p></noscript>
<noscript><p class="alert alert-warning mt-3">此页需要 JavaScript 才能读取账单数据。</p></noscript>
</main>
<dialog class="billing-dialog" id="billing-detail-dialog" aria-labelledby="billing-detail-title">
<div class="billing-dialog-shell">
<header>
<dialog class="admin-billing-dialog" id="billing-detail-dialog" aria-labelledby="billing-detail-title">
<div class="admin-modal-panel admin-billing-dialog-panel">
<header class="d-flex align-items-start justify-content-between gap-3 pb-3">
<div>
<p class="admin-eyebrow mb-1">Invoice detail</p>
<h2 id="billing-detail-title">账单详情</h2>
<h2 class="h3 fw-bold text-dark mb-0" id="billing-detail-title">账单详情</h2>
</div>
<button class="billing-dialog-close" id="billing-detail-close" type="button" aria-label="关闭账单详情">
<button class="admin-modal-close position-static flex-shrink-0" id="billing-detail-close" type="button" aria-label="关闭账单详情">
<i class="mdi mdi-close" aria-hidden="true"></i>
</button>
</header>
<p class="billing-detail-state" id="billing-detail-state" role="status" aria-live="polite">正在读取账单详情…</p>
<div class="billing-detail-body" id="billing-detail-body"></div>
<p class="alert alert-info mb-3" id="billing-detail-state" role="status" aria-live="polite">正在读取账单详情…</p>
<div class="admin-billing-dialog-body" id="billing-detail-body"></div>
</div>
</dialog>

@ -1,238 +1,272 @@
{assign var=admin_title value='系统概览'}
{assign var=admin_active value='index'}
{assign var=admin_extra_css_href value='/cloud/admin-overview.css'}
{include file='admin/static_header.tpl'}
<main class="admin-overview">
<header class="vo-page-head">
<div>
<h1>系统概览</h1>
<p>集中查看实例交付、账单实收和需要人工介入的运营事项。</p>
</div>
<div class="vo-page-actions">
<span class="vo-snapshot {if $overview.available}is-ready{else}is-error{/if}">
<i class="mdi {if $overview.available}mdi-database-check-outline{else}mdi-database-alert-outline{/if}" aria-hidden="true"></i>
<span>{if $overview.available}数据库快照{else}快照不可用{/if} · {$overview.generated_at|escape:'html'}</span>
</span>
<a class="btn btn-light vo-refresh" href="/admin">
<i class="mdi mdi-refresh" aria-hidden="true"></i><span>刷新数据</span>
</a>
</div>
</header>
{if $overview_error != ''}
<div class="vo-alert" role="alert">
<i class="mdi mdi-alert-circle-outline" aria-hidden="true"></i>
<span>{$overview_error|escape:'html'}</span>
<div class="py-3 d-flex align-items-sm-center flex-sm-row flex-column">
<div class="flex-grow-1">
<h1 class="fs-20 fw-semibold mb-1">系统概览</h1>
<p class="text-muted mb-0">集中查看实例交付、账单实收和需要人工介入的运营事项。</p>
</div>
{/if}
<section class="vo-kpi-grid" aria-label="关键运营指标">
<article class="vo-kpi">
<div class="vo-kpi-head">
<h2>在管实例</h2>
<i class="mdi mdi-server-network" aria-hidden="true"></i>
</div>
<strong>{$overview.instances.managed}</strong>
<p>服务状态正常 {$overview.instances.service_normal} 台 · 覆盖 {$overview.instances.customer_count} 位客户</p>
<a href="/admin/cloud/instances">查看实例目录<i class="mdi mdi-chevron-right" aria-hidden="true"></i></a>
</article>
<article class="vo-kpi">
<div class="vo-kpi-head">
<h2>本月有效实收</h2>
<i class="mdi mdi-receipt-text-check-outline" aria-hidden="true"></i>
</div>
<strong><small>$</small>{$overview.revenue.month|escape:'html'}</strong>
<p>今日 ${$overview.revenue.today|escape:'html'} · {$overview.revenue.today_count} 笔当前有效账单</p>
<a href="/admin/billing">进入账单系统<i class="mdi mdi-chevron-right" aria-hidden="true"></i></a>
</article>
<article class="vo-kpi {if $overview.jobs.uncertain > 0 || $overview.jobs.failed_24h > 0}has-warning{/if}">
<div class="vo-kpi-head">
<h2>开通中任务</h2>
<i class="mdi mdi-progress-clock" aria-hidden="true"></i>
</div>
<strong>{$overview.jobs.active}</strong>
<p>待核对开通 {$overview.jobs.uncertain} 项 · 近 24 小时开通失败 {$overview.jobs.failed_24h} 项</p>
<a href="/admin/billing?view=orders">查看开通任务<i class="mdi mdi-chevron-right" aria-hidden="true"></i></a>
</article>
<div class="text-sm-end mt-3 mt-sm-0 admin-log-table-actions">
<span class="admin-config-status {if $overview.available}is-success{else}is-error{/if}">
<i class="mdi {if $overview.available}mdi-database-check-outline{else}mdi-database-alert-outline{/if} me-1" aria-hidden="true"></i>
{if $overview.available}数据库快照{else}快照不可用{/if} · {$overview.generated_at|escape:'html'}
</span>
<a class="btn btn-light" href="/admin">
<i class="mdi mdi-refresh me-1" aria-hidden="true"></i>刷新数据
</a>
</div>
</div>
<article class="vo-kpi {if $overview.instances.expiring_7d > 0 || $overview.instances.grace > 0}has-warning{/if}">
<div class="vo-kpi-head">
<h2>7 天内到期</h2>
<i class="mdi mdi-calendar-clock-outline" aria-hidden="true"></i>
</div>
<strong>{$overview.instances.expiring_7d}</strong>
<p>已到期或宽限期 {$overview.instances.grace} 台 · 待收续费账单 {$overview.receivables.renewal_count} 张</p>
<a href="/admin/cloud/instances">处理实例续期<i class="mdi mdi-chevron-right" aria-hidden="true"></i></a>
</article>
</section>
{if $overview_error != ''}
<div class="alert alert-danger d-flex align-items-center gap-2" role="alert">
<i class="mdi mdi-alert-circle-outline fs-20" aria-hidden="true"></i>
<span>{$overview_error|escape:'html'}</span>
</div>
{/if}
<div class="vo-primary-grid">
<section class="vo-panel vo-trend-panel" aria-labelledby="overview-revenue-title">
<header class="vo-panel-head">
<div>
<h2 id="overview-revenue-title">近 7 日有效实收</h2>
<p>只统计当前仍为已支付状态的账单,按实际支付时间归入日期。</p>
</div>
<div class="vo-panel-summary">
<strong>${$overview.revenue.trend_total|escape:'html'}</strong>
<span>{$overview.revenue.trend_count} 笔账单</span>
</div>
</header>
<div class="vo-trend" role="list" aria-label="近七日有效已支付账单金额和笔数">
{foreach $overview.revenue.trend as $day}
<div class="vo-trend-row" role="listitem">
<div class="vo-trend-date">
<strong>{$day.weekday|escape:'html'}</strong>
<span>{$day.label|escape:'html'}</span>
<div class="row g-3">
<div class="col-md-6 col-xxl-3">
<div class="card overflow-hidden admin-stat-card h-100">
<div class="card-body">
<div class="d-flex align-items-center justify-content-between gap-3">
<div>
<h2 class="text-muted fs-14 fw-normal mb-1">在管实例</h2>
<strong class="h3 d-block fw-bold mb-0">{$overview.instances.managed}</strong>
</div>
<div class="vo-trend-track" aria-hidden="true">
<span style="--value:{$day.percent}"></span>
<span class="admin-stat-icon text-primary"><i class="mdi mdi-server-network" aria-hidden="true"></i></span>
</div>
</div>
<div class="card-footer bg-muted-color border-top py-2 d-flex align-items-center justify-content-between flex-wrap gap-2">
<span class="text-muted">服务正常 {$overview.instances.service_normal} 台 · {$overview.instances.customer_count} 位客户</span>
<a class="link-primary fw-medium" href="/admin/cloud/instances">查看实例</a>
</div>
</div>
</div>
<div class="col-md-6 col-xxl-3">
<div class="card overflow-hidden admin-stat-card h-100">
<div class="card-body">
<div class="d-flex align-items-center justify-content-between gap-3">
<div>
<h2 class="text-muted fs-14 fw-normal mb-1">本月有效实收</h2>
<strong class="h3 d-block fw-bold mb-0">${$overview.revenue.month|escape:'html'}</strong>
</div>
<span class="admin-stat-icon text-success"><i class="mdi mdi-receipt-text-check-outline" aria-hidden="true"></i></span>
</div>
</div>
<div class="card-footer bg-muted-color border-top py-2 d-flex align-items-center justify-content-between flex-wrap gap-2">
<span class="text-muted">今日 ${$overview.revenue.today|escape:'html'} · {$overview.revenue.today_count} 笔</span>
<a class="link-primary fw-medium" href="/admin/billing">进入账单</a>
</div>
</div>
</div>
<div class="col-md-6 col-xxl-3">
<div class="card overflow-hidden admin-stat-card h-100">
<div class="card-body">
<div class="d-flex align-items-center justify-content-between gap-3">
<div>
<h2 class="text-muted fs-14 fw-normal mb-1">开通中任务</h2>
<strong class="h3 d-block fw-bold mb-0">{$overview.jobs.active}</strong>
</div>
<div class="vo-trend-value">
<strong>${$day.amount|escape:'html'}</strong>
<span>{$day.count} 笔</span>
<span class="admin-stat-icon text-warning"><i class="mdi mdi-progress-clock" aria-hidden="true"></i></span>
</div>
</div>
<div class="card-footer bg-muted-color border-top py-2 d-flex align-items-center justify-content-between flex-wrap gap-2">
<span class="text-muted">待核对 {$overview.jobs.uncertain} 项 · 近 24 小时失败 {$overview.jobs.failed_24h} 项</span>
<a class="link-primary fw-medium" href="/admin/billing?view=orders">查看任务</a>
</div>
</div>
</div>
<div class="col-md-6 col-xxl-3">
<div class="card overflow-hidden admin-stat-card h-100">
<div class="card-body">
<div class="d-flex align-items-center justify-content-between gap-3">
<div>
<h2 class="text-muted fs-14 fw-normal mb-1">7 天内到期</h2>
<strong class="h3 d-block fw-bold mb-0">{$overview.instances.expiring_7d}</strong>
</div>
<span class="admin-stat-icon text-danger"><i class="mdi mdi-calendar-clock-outline" aria-hidden="true"></i></span>
</div>
{/foreach}
</div>
<footer class="vo-panel-foot">
<span>昨日 ${$overview.revenue.yesterday|escape:'html'}</span>
<a href="/admin/billing?financial_status=paid">核对已支付账单</a>
</footer>
</section>
<div class="card-footer bg-muted-color border-top py-2 d-flex align-items-center justify-content-between flex-wrap gap-2">
<span class="text-muted">到期或宽限期 {$overview.instances.grace} 台 · 待收续费 {$overview.receivables.renewal_count} 张</span>
<a class="link-primary fw-medium" href="/admin/cloud/instances">处理续期</a>
</div>
</div>
</div>
</div>
<section class="vo-panel vo-attention-panel" aria-labelledby="overview-attention-title">
<header class="vo-panel-head">
<div class="row g-3 mt-1">
<div class="col-xl-8">
<div class="card h-100">
<div class="card-header d-flex align-items-center justify-content-between flex-wrap gap-2">
<div>
<h2 id="overview-attention-title">需要处理</h2>
<p>优先展示会影响交付、网络或回款的事项。</p>
</div>
<span class="vo-attention-count {if $overview.attention_total > 0}has-items{/if}">{$overview.attention_total}</span>
</header>
<div class="vo-attention-list">
<a href="/admin/billing?view=orders&amp;status=uncertain">
<i class="mdi mdi-help-rhombus-outline is-danger" aria-hidden="true"></i>
<span><strong>待人工核对开通</strong><small>引擎结果不明确,不能自动重放</small></span>
<em>{$overview.jobs.uncertain}</em>
</a>
<a href="/admin/billing?view=orders&amp;status=failed">
<i class="mdi mdi-alert-octagon-outline is-warning" aria-hidden="true"></i>
<span><strong>近 24 小时开通失败</strong><small>打开失败开通列表(包含历史记录)</small></span>
<em>{$overview.jobs.failed_24h}</em>
</a>
<a href="/admin/billing?financial_status=overdue">
<i class="mdi mdi-receipt-clock-outline is-warning" aria-hidden="true"></i>
<span><strong>逾期待支付账单</strong><small>${$overview.receivables.overdue_amount|escape:'html'} 尚待处理</small></span>
<em>{$overview.receivables.overdue_count}</em>
</a>
<a href="/admin/cloud/instances">
<i class="mdi mdi-lan-disconnect is-info" aria-hidden="true"></i>
<span><strong>网络非正常状态</strong><small>包括流量限制、到期限制和处理中</small></span>
<em>{$overview.instances.network_attention}</em>
</a>
<a href="/admin/ticket">
<i class="mdi mdi-message-question-outline is-info" aria-hidden="true"></i>
<span><strong>开启中的工单</strong><small>等待管理员继续跟进</small></span>
<em>{$overview.tickets.open}</em>
</a>
</div>
</section>
<h2 class="h5 card-title mb-0">近 7 日有效实收</h2>
<span class="text-muted fs-13">只统计当前仍为已支付状态的账单,按实际支付时间归入日期。</span>
</div>
<span class="badge text-bg-light px-3 py-2">${$overview.revenue.trend_total|escape:'html'} · {$overview.revenue.trend_count} 笔</span>
</div>
<div class="card-body">
<div class="admin-progress-list">
{foreach $overview.revenue.trend as $day}
<div>
<div>
<span>{$day.weekday|escape:'html'} · {$day.label|escape:'html'}</span>
<strong>${$day.amount|escape:'html'} · {$day.count} 笔</strong>
</div>
<em style="--value:{$day.percent};"></em>
</div>
{/foreach}
</div>
</div>
<div class="card-footer bg-muted-color border-top py-2 d-flex align-items-center justify-content-between flex-wrap gap-2">
<span class="text-muted">昨日 ${$overview.revenue.yesterday|escape:'html'}</span>
<a class="link-primary fw-medium" href="/admin/billing?financial_status=paid">核对已支付账单</a>
</div>
</div>
</div>
<div class="vo-secondary-grid">
<section class="vo-panel" aria-labelledby="overview-health-title">
<header class="vo-panel-head">
<div class="col-xl-4">
<div class="card h-100">
<div class="card-header d-flex align-items-center justify-content-between">
<div>
<h2 id="overview-health-title">资源状态</h2>
<p>基于业务库中的配置与生命周期状态,不推断真实开关机状态。</p>
</div>
<a class="vo-head-link" href="/admin/hosts">宿主机设置</a>
</header>
<div class="vo-health-list">
<div class="vo-health-item">
<div><span>已启用宿主机配置</span><strong>{$overview.hosts.enabled} / {$overview.hosts.total}</strong></div>
<span class="vo-health-track"><i style="--value:{$overview.health.hosts_percent}"></i></span>
<h2 class="h5 card-title mb-0">需要处理</h2>
<span class="text-muted fs-13">优先展示影响交付、网络或回款的事项。</span>
</div>
<div class="vo-health-item">
<div><span>实例服务状态正常</span><strong>{$overview.instances.service_normal} / {$overview.instances.managed}</strong></div>
<span class="vo-health-track"><i style="--value:{$overview.health.service_percent}"></i></span>
<span class="badge fs-12 px-2 py-1 {if $overview.attention_total > 0}bg-danger-subtle text-danger-emphasis{else}bg-light text-dark{/if}">{$overview.attention_total}</span>
</div>
<div class="card-body">
<div class="admin-log-links">
<a href="/admin/billing?view=orders&amp;status=uncertain">
<span><strong class="d-block">待人工核对开通</strong><small class="text-muted">引擎结果不明确,不能自动重放</small></span>
<span class="badge fs-12 bg-danger-subtle text-danger-emphasis">{$overview.jobs.uncertain}</span>
</a>
<a href="/admin/billing?view=orders&amp;status=failed">
<span><strong class="d-block">近 24 小时开通失败</strong><small class="text-muted">打开失败开通列表(包含历史记录)</small></span>
<span class="badge fs-12 bg-warning-subtle text-warning-emphasis">{$overview.jobs.failed_24h}</span>
</a>
<a href="/admin/billing?financial_status=overdue">
<span><strong class="d-block">逾期待支付账单</strong><small class="text-muted">${$overview.receivables.overdue_amount|escape:'html'} 尚待处理</small></span>
<span class="badge fs-12 bg-warning-subtle text-warning-emphasis">{$overview.receivables.overdue_count}</span>
</a>
<a href="/admin/cloud/instances">
<span><strong class="d-block">网络非正常状态</strong><small class="text-muted">包括流量限制、到期限制和处理中</small></span>
<span class="badge fs-12 bg-light text-dark">{$overview.instances.network_attention}</span>
</a>
<a href="/admin/ticket">
<span><strong class="d-block">开启中的工单</strong><small class="text-muted">等待管理员继续跟进</small></span>
<span class="badge fs-12 bg-light text-dark">{$overview.tickets.open}</span>
</a>
</div>
<div class="vo-health-item">
<div><span>实例网络状态正常</span><strong>{$overview.instances.network_normal} / {$overview.instances.managed}</strong></div>
<span class="vo-health-track"><i style="--value:{$overview.health.network_percent}"></i></span>
</div>
</div>
</div>
</div>
<div class="row g-3 mt-1">
<div class="col-xl-6">
<div class="card h-100">
<div class="card-header d-flex align-items-center justify-content-between flex-wrap gap-2">
<div>
<h2 class="h5 card-title mb-0">资源状态</h2>
<span class="text-muted fs-13">基于业务库中的配置与生命周期状态,不推断真实开关机状态。</span>
</div>
<a class="link-primary fw-medium" href="/admin/hosts">宿主机设置</a>
</div>
<div class="vo-definition">
<i class="mdi mdi-information-outline" aria-hidden="true"></i>
<span>“已启用”仅表示宿主机配置允许调度;真实连通性仍以宿主机管理页和任务结果为准。</span>
<div class="card-body">
<div class="admin-progress-list">
<div>
<div><span>已启用宿主机配置</span><strong>{$overview.hosts.enabled} / {$overview.hosts.total}</strong></div>
<em style="--value:{$overview.health.hosts_percent};"></em>
</div>
<div>
<div><span>实例服务状态正常</span><strong>{$overview.instances.service_normal} / {$overview.instances.managed}</strong></div>
<em style="--value:{$overview.health.service_percent};"></em>
</div>
<div>
<div><span>实例网络状态正常</span><strong>{$overview.instances.network_normal} / {$overview.instances.managed}</strong></div>
<em style="--value:{$overview.health.network_percent};"></em>
</div>
</div>
<div class="alert alert-light border d-flex align-items-start gap-2 mb-0 mt-4">
<i class="mdi mdi-information-outline fs-20 text-primary" aria-hidden="true"></i>
<span>“已启用”仅表示宿主机配置允许调度;真实连通性仍以宿主机管理页和任务结果为准。</span>
</div>
</div>
</section>
</div>
</div>
<section class="vo-panel" aria-labelledby="overview-flow-title">
<header class="vo-panel-head">
<div class="col-xl-6">
<div class="card h-100">
<div class="card-header d-flex align-items-center justify-content-between flex-wrap gap-2">
<div>
<h2 id="overview-flow-title">今日业务流转</h2>
<p>注册、支付、实例交付和待收账单分开统计。</p>
</div>
<a class="vo-head-link" href="/admin/billing">查看账单</a>
</header>
<div class="vo-flow-grid">
<div><span>新增客户</span><strong>{$overview.users.new_today}</strong><small>客户总数 {$overview.users.total}</small></div>
<div><span>完成开通</span><strong>{$overview.jobs.today_succeeded}</strong><small>今日创建任务 {$overview.jobs.today_total}</small></div>
<div><span>有效支付</span><strong>{$overview.revenue.today_count}</strong><small>${$overview.revenue.today|escape:'html'}</small></div>
<div><span>待收账单</span><strong>{$overview.receivables.count}</strong><small>${$overview.receivables.amount|escape:'html'}</small></div>
</div>
</section>
<h2 class="h5 card-title mb-0">今日业务流转</h2>
<span class="text-muted fs-13">注册、支付、实例交付和待收账单分开统计。</span>
</div>
<a class="link-primary fw-medium" href="/admin/billing">查看账单</a>
</div>
<div class="card-body">
<div class="admin-live-grid mb-0">
<div><span>新增客户</span><strong>{$overview.users.new_today}</strong><small>客户总数 {$overview.users.total}</small></div>
<div><span>完成开通</span><strong>{$overview.jobs.today_succeeded}</strong><small>今日创建任务 {$overview.jobs.today_total}</small></div>
<div><span>有效支付</span><strong>{$overview.revenue.today_count}</strong><small>${$overview.revenue.today|escape:'html'}</small></div>
<div><span>待收账单</span><strong>{$overview.receivables.count}</strong><small>${$overview.receivables.amount|escape:'html'}</small></div>
</div>
</div>
</div>
</div>
</div>
<div class="vo-secondary-grid vo-last-grid">
<section class="vo-panel" aria-labelledby="overview-plans-title">
<header class="vo-panel-head">
<div class="row g-3 mt-1">
<div class="col-xl-7">
<div class="card h-100">
<div class="card-header d-flex align-items-center justify-content-between flex-wrap gap-2">
<div>
<h2 id="overview-plans-title">本月开通套餐</h2>
<p>按当前有效的已支付开通账单排序。</p>
</div>
<a class="vo-head-link" href="/admin/shop">套餐管理</a>
</header>
<div class="vo-plan-list">
{foreach $overview.top_plans as $plan}
<div class="vo-plan-row">
<span class="vo-plan-rank">{$plan@iteration}</span>
<strong>{$plan.name|escape:'html'}</strong>
<span class="vo-plan-count">{$plan.count} 笔</span>
<em class="vo-plan-amount">${$plan.amount|escape:'html'}</em>
</div>
{foreachelse}
<div class="vo-empty">
<i class="mdi mdi-package-variant-closed" aria-hidden="true"></i>
<span>本月暂时没有有效的已支付开通账单</span>
</div>
{/foreach}
</div>
</section>
<h2 class="h5 card-title mb-0">本月开通套餐</h2>
<span class="text-muted fs-13">按当前有效的已支付开通账单排序。</span>
</div>
<a class="link-primary fw-medium" href="/admin/shop">套餐管理</a>
</div>
<div class="card-body">
<div class="admin-report-list">
{foreach $overview.top_plans as $plan}
<div>
<span>#{$plan@iteration} · {$plan.name|escape:'html'} · {$plan.count} 笔</span>
<strong>${$plan.amount|escape:'html'}</strong>
</div>
{foreachelse}
<div class="justify-content-center py-4"><span>本月暂时没有有效的已支付开通账单</span></div>
{/foreach}
</div>
</div>
</div>
</div>
<nav class="vo-panel" aria-labelledby="overview-shortcuts-title">
<header class="vo-panel-head">
<div>
<h2 id="overview-shortcuts-title">常用入口</h2>
<p>直接进入日常运营最常使用的页面。</p>
<div class="col-xl-5">
<div class="card h-100">
<div class="card-header">
<h2 class="h5 card-title mb-0">常用入口</h2>
</div>
<div class="card-body">
<div class="admin-shortcuts">
<a href="/admin/cloud/instances"><i class="mdi mdi-server" aria-hidden="true"></i><span><strong class="d-block">虚拟机管理</strong><small class="text-muted">实例与生命周期</small></span></a>
<a href="/admin/billing"><i class="mdi mdi-receipt-text-outline" aria-hidden="true"></i><span><strong class="d-block">账单系统</strong><small class="text-muted">财务与履约</small></span></a>
<a href="/admin/hosts"><i class="mdi mdi-router-network" aria-hidden="true"></i><span><strong class="d-block">宿主机设置</strong><small class="text-muted">区域与调度配置</small></span></a>
<a href="/admin/ticket"><i class="mdi mdi-lifebuoy" aria-hidden="true"></i><span><strong class="d-block">工单系统</strong><small class="text-muted">客户支持与通知</small></span></a>
</div>
</header>
<div class="vo-shortcuts">
<a href="/admin/cloud/instances"><i class="mdi mdi-server" aria-hidden="true"></i><span><strong>虚拟机管理</strong><small>实例与生命周期</small></span></a>
<a href="/admin/billing"><i class="mdi mdi-receipt-text-outline" aria-hidden="true"></i><span><strong>账单系统</strong><small>财务与履约</small></span></a>
<a href="/admin/hosts"><i class="mdi mdi-router-network" aria-hidden="true"></i><span><strong>宿主机设置</strong><small>区域与调度配置</small></span></a>
<a href="/admin/ticket"><i class="mdi mdi-lifebuoy" aria-hidden="true"></i><span><strong>工单系统</strong><small>客户支持与通知</small></span></a>
</div>
</nav>
</div>
</div>
</div>
<div class="card mt-3">
<div class="card-body d-flex align-items-start gap-3">
<span class="admin-ticket-stat-icon"><i class="mdi mdi-shield-check-outline" aria-hidden="true"></i></span>
<div>
<h2 class="h5 card-title mb-1">数据口径</h2>
<p class="text-muted mb-0">金额来自当前状态为“已支付”的统一账单;退款后会从历史有效实收中移除。页面不连接宿主机,也不把数据库生命周期状态当作虚拟机实时电源状态。</p>
</div>
</div>
</div>
<aside class="vo-method-note">
<i class="mdi mdi-shield-check-outline" aria-hidden="true"></i>
<p><strong>数据口径</strong><span>金额来自当前状态为“已支付”的统一账单;退款后会从历史有效实收中移除。页面不连接宿主机,也不把数据库生命周期状态当作虚拟机实时电源状态。</span></p>
</aside>
</main>
{include file='admin/static_footer.tpl'}

@ -10,7 +10,6 @@
<link href="{$cdn}/theme/venix/css/app.min.css?v={$venix_asset_version}" rel="stylesheet" type="text/css">
<link href="{$cdn}/theme/venix/css/icons.min.css?v={$venix_asset_version}" rel="stylesheet" type="text/css">
<link href="{$cdn}/theme/venix/css/admin-home.css?v={$venix_asset_version}" rel="stylesheet" type="text/css">
{if isset($admin_extra_css_href)}<link href="{$admin_extra_css_href|escape:'html'}?v={$venix_asset_version}" rel="stylesheet" type="text/css">{/if}
{if isset($admin_extra_css)}{$admin_extra_css}{/if}
<script>window.ADMIN_CAN_MANAGE = {if $admin_can_manage|default:false}true{else}false{/if}; window.ADMIN_CSRF_TOKEN = '{$admin_csrf_token|default:''|escape:"javascript"}';</script>
<script src="/theme/venix/js/admin-csrf.js?v={$venix_asset_version}"></script>

@ -4,7 +4,9 @@ $root = dirname(__DIR__);
$servicePath = $root . '/app/Services/Cloud/CloudAdminOverviewService.php';
$controllerPath = $root . '/app/Controllers/AdminController.php';
$templatePath = $root . '/resources/views/venix/admin/index.tpl';
$stylePath = $root . '/public/cloud/admin-overview.css';
$headerPath = $root . '/resources/views/venix/admin/static_header.tpl';
$sharedStylePath = $root . '/public/theme/venix/css/admin-home.css';
$removedStylePath = $root . '/public/cloud/admin-overview.css';
$schemaPath = $root . '/sql/cloud.sql';
$baseSchemaPath = $root . '/sql/ss.sql';
@ -14,13 +16,14 @@ $assert = static function ($condition, string $message): void {
}
};
$assert(is_file($servicePath) && is_file($stylePath),
'Administrator overview service or scoped stylesheet is missing.');
$assert(is_file($servicePath) && is_file($sharedStylePath) && !is_file($removedStylePath),
'Administrator overview must use the shared legacy administrator stylesheet.');
$service = file_get_contents($servicePath);
$controller = file_get_contents($controllerPath);
$template = file_get_contents($templatePath);
$styles = file_get_contents($stylePath);
$header = file_get_contents($headerPath);
$styles = file_get_contents($sharedStylePath);
$schema = file_get_contents($schemaPath);
$baseSchema = file_get_contents($baseSchemaPath);
@ -62,32 +65,40 @@ $assert(str_contains($schema, 'cloud_invoice_overview_paid (status, paid_at, pur
&& str_contains($baseSchema, '`ticket_overview_root_status` (`rootid`,`status`)'),
'Overview range queries must have bounded operational indexes.');
$assert(str_contains($template, '<main class="admin-overview">')
&& str_contains($template, "admin_extra_css_href value='/cloud/admin-overview.css'")
$assert(str_contains($template, 'card overflow-hidden admin-stat-card')
&& str_contains($template, 'admin-progress-list')
&& str_contains($template, 'admin-live-grid mb-0')
&& str_contains($template, 'admin-report-list')
&& str_contains($template, 'admin-log-links')
&& str_contains($template, 'admin-shortcuts')
&& str_contains($template, '数据库快照')
&& str_contains($template, '已启用宿主机配置')
&& str_contains($template, '不推断真实开关机状态')
&& str_contains($template, '退款后会从历史有效实收中移除')
&& substr_count($template, '<article class="vo-kpi') === 4
&& substr_count($template, '<h2>') >= 4
&& substr_count($template, 'card overflow-hidden admin-stat-card') === 4
&& !preg_match('/text-bg-(?:success|info|warning|danger)/', $template)
&& str_contains($template, 'bg-danger-subtle text-danger-emphasis')
&& str_contains($template, 'bg-warning-subtle text-warning-emphasis')
&& !str_contains($template, 'admin-overview.css')
&& !str_contains($template, 'class="vo-')
&& !str_contains($template, '$sts->')
&& !str_contains($template, '在线宿主机'),
'Overview template must state its data source and avoid invented live state.');
'Overview template must reuse legacy administrator components, state its data source and avoid invented live state.');
foreach (['/admin/cloud/instances', '/admin/billing', '/admin/hosts', '/admin/ticket'] as $href) {
$assert(str_contains($template, 'href="' . $href),
'Overview shortcut missing: ' . $href);
}
$assert(str_contains($styles, 'min-height: 44px')
&& str_contains($styles, ':focus-visible')
&& str_contains($styles, '@media (max-width: 720px)')
&& str_contains($styles, '@media (max-width: 480px)')
&& str_contains($styles, '@media (prefers-reduced-motion: reduce)')
&& !str_contains($styles, 'font-size: 10px')
&& !str_contains($styles, 'font-size: 11px')
&& !str_contains($styles, '.vo-plan-row > span:nth-of-type(2)')
&& !str_contains($styles, 'min-width: 1120px'),
'Overview responsive, touch and keyboard accessibility contracts are incomplete.');
$assert(str_contains($header, '/theme/venix/css/admin-home.css')
&& !str_contains($header, 'admin_extra_css_href')
&& str_contains($styles, '.admin-stat-card .card-body')
&& preg_match('/\.admin-live-grid\s*\{[^}]*grid-template-columns:\s*repeat\(2,\s*minmax\(0,\s*1fr\)\)/s', $styles)
&& str_contains($styles, '.admin-progress-list')
&& str_contains($styles, '.admin-shortcuts')
&& str_contains($styles, '.admin-log-links')
&& str_contains($styles, '@media (max-width: 991.98px)')
&& str_contains($styles, '@media (max-width: 575.98px)'),
'Overview must inherit the existing administrator component and responsive rules.');
echo 'Administrator operational overview contracts passed.' . PHP_EOL;

@ -72,7 +72,9 @@ $cloudRoutes = file_get_contents($root . '/config/routes_cloud.php');
$cloudSchema = file_get_contents($root . '/sql/cloud.sql');
$adminBillingTemplate = $views . '/admin/billing.tpl';
$adminBillingScript = $public . '/admin-billing.js';
$adminBillingRuntime = file_get_contents($adminBillingScript);
$adminBillingStyles = $public . '/admin-billing.css';
$adminSharedStyles = file_get_contents($root . '/public/theme/venix/css/admin-home.css');
$templateDeletionService = file_get_contents(
$root . '/app/Services/Cloud/CloudTemplateDeletionService.php');
$assert(str_contains($cloudShell, "file='user/panel_sidebar.tpl'")
@ -119,7 +121,7 @@ $assert(str_contains($routes, "'/cloud/invoices'")
&& !str_contains($routes, "'/bought'")
&& is_file($adminBillingTemplate)
&& is_file($adminBillingScript)
&& is_file($adminBillingStyles),
&& !is_file($adminBillingStyles),
'Cloud invoices and the unified administrator billing page must replace legacy bought history');
$assert(str_contains($cloudRoutes, "'/admin/billing/invoices'")
&& str_contains($cloudRoutes, "'/admin/billing/invoices/{id:[0-9]+}'")
@ -752,9 +754,62 @@ foreach (['hosts/index.tpl', 'cloud/instances.tpl', 'cloud/rescue.tpl', 'cloud/t
$adminBillingSource = file_get_contents($adminBillingTemplate);
$assert(str_contains($adminBillingSource,
'/cloud/admin-billing.js?v={$venix_asset_version}')
&& str_contains($adminBillingSource,
'/cloud/admin-billing.css?v={$venix_asset_version}'),
'Unified administrator billing assets must use the deployment cache version');
&& !str_contains($adminBillingSource, '/cloud/admin-billing.css')
&& !is_file($adminBillingStyles)
&& str_contains($adminBillingSource, 'admin-ticket-stat')
&& str_contains($adminBillingSource, 'admin-checkout-table')
&& str_contains($adminBillingSource, 'admin-modal-panel'),
'Unified administrator billing must reuse Venix admin styles and version its functional script');
$billingIds = [
'billing-notice', 'billing-refresh', 'billing-summary', 'billing-summary-total',
'billing-summary-amount-label', 'billing-summary-amount', 'billing-summary-focus-label',
'billing-summary-focus', 'billing-summary-result-label', 'billing-summary-result',
'billing-filter-title', 'billing-filter-form', 'billing-query', 'billing-user-id',
'billing-status-primary-field', 'billing-status-primary-label', 'billing-status-primary',
'billing-status-secondary-field', 'billing-status-secondary-label', 'billing-status-secondary',
'billing-category-field', 'billing-category-label', 'billing-category',
'billing-reference-field', 'billing-reference-label', 'billing-reference-select',
'billing-reference-input', 'billing-created-from', 'billing-created-to', 'billing-per-page',
'billing-apply', 'billing-reset', 'billing-panel', 'billing-view-heading',
'billing-view-description', 'billing-result-count', 'billing-table',
'billing-table-caption', 'billing-table-head', 'billing-table-body', 'billing-pagination',
'billing-previous', 'billing-page-label', 'billing-next', 'billing-detail-dialog',
'billing-detail-close', 'billing-detail-title', 'billing-detail-state', 'billing-detail-body',
];
foreach ($billingIds as $billingId) {
$assert(substr_count($adminBillingSource, 'id="' . $billingId . '"') === 1,
'Unified administrator billing hook missing or duplicated: ' . $billingId);
}
$assert(str_contains($adminBillingSource, '<main data-admin-billing>')
&& substr_count($adminBillingSource, 'data-billing-view=') === 3
&& str_contains($adminBillingRuntime, "document.querySelector('[data-admin-billing]')")
&& str_contains($adminBillingRuntime, "document.querySelectorAll('[data-billing-view]')")
&& str_contains($adminBillingRuntime, 'button.dataset.invoiceId')
&& str_contains($adminBillingRuntime, 'cell.dataset.label'),
'Unified administrator billing data hooks must remain aligned with its runtime');
$billingMobileStyles = strstr($adminSharedStyles, '@media (max-width: 575.98px)');
$assert($billingMobileStyles !== false
&& preg_match('/\[data-admin-billing\] \.form-control,\s*\[data-admin-billing\] \.form-select\s*\{(?=[^}]*min-height:\s*44px)(?=[^}]*font-size:\s*16px)[^}]*\}/s', $billingMobileStyles)
&& preg_match('/\[data-admin-billing\] \.btn,\s*\.admin-ticket-tabs a\s*\{[^}]*min-height:\s*44px/s', $billingMobileStyles),
'Administrator billing controls must remain zoom-safe and touch-friendly on phones');
$assert(preg_match('/\.admin-billing-dialog \.admin-modal-close\s*\{(?=[^}]*width:\s*44px)(?=[^}]*height:\s*44px)[^}]*\}/s', $adminSharedStyles)
&& preg_match('/\.admin-checkout-user\s*\{[^}]*min-width:\s*0/s', $adminSharedStyles)
&& preg_match('/\.admin-checkout-user strong,\s*\.admin-checkout-user span\s*\{[^}]*overflow-wrap:\s*anywhere/s', $adminSharedStyles),
'Administrator billing dialog controls and long table values must remain usable on narrow screens');
$assert(str_contains($adminBillingSource, '<header class="d-flex align-items-start justify-content-between')
&& str_contains($adminBillingSource, 'admin-modal-close position-static flex-shrink-0')
&& preg_match('/\.admin-billing-dialog-panel\s*\{(?=[^}]*display:\s*flex)(?=[^}]*flex-direction:\s*column)(?=[^}]*overflow:\s*hidden)[^}]*\}/s', $adminSharedStyles)
&& preg_match('/\.admin-billing-dialog-body\s*\{(?=[^}]*min-height:\s*0)(?=[^}]*overflow-y:\s*auto)(?=[^}]*overflow-wrap:\s*anywhere)[^}]*\}/s', $adminSharedStyles)
&& str_contains($adminBillingRuntime, "dialog.addEventListener('close'")
&& str_contains($adminBillingRuntime, "document.body.classList.remove('billing-detail-open')")
&& str_contains($adminBillingRuntime, 'opener.focus({ preventScroll: true })'),
'Administrator billing detail must keep its close action visible and restore page state after scrolling');
$assert(!preg_match('/text-bg-(?:success|info|warning|danger)/', $adminBillingRuntime)
&& str_contains($adminBillingRuntime, 'bg-success-subtle text-success-emphasis')
&& str_contains($adminBillingRuntime, 'bg-warning-subtle text-warning-emphasis')
&& str_contains($adminBillingRuntime, 'bg-danger-subtle text-danger-emphasis')
&& str_contains($adminBillingRuntime, 'bg-info-subtle text-info-emphasis'),
'Administrator billing status badges must retain readable semantic colors');
foreach (glob($views . '/user/*.tpl') as $template) {
$source = file_get_contents($template);
$assert(!str_contains($source, 'href="/user/shop"'), 'Obsolete package link remains: ' . basename($template));

Loading…
Cancel
Save