From 73afe9db502c2c618c3b7ac479d44655f99cbcc2 Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 29 Sep 2026 22:52:21 +0800 Subject: [PATCH] fix: restore legacy admin page styling --- web/public/cloud/admin-billing.css | 570 ----------- web/public/cloud/admin-billing.js | 69 +- web/public/cloud/admin-overview.css | 961 ------------------ web/public/theme/venix/css/admin-home.css | 86 +- web/resources/views/venix/admin/billing.tpl | 161 +-- web/resources/views/venix/admin/index.tpl | 444 ++++---- .../views/venix/admin/static_header.tpl | 1 - web/tests/AdminOverviewContractTest.php | 49 +- web/tests/VirtualizationAssetsTest.php | 63 +- 9 files changed, 546 insertions(+), 1858 deletions(-) delete mode 100644 web/public/cloud/admin-billing.css delete mode 100644 web/public/cloud/admin-overview.css diff --git a/web/public/cloud/admin-billing.css b/web/public/cloud/admin-billing.css deleted file mode 100644 index b8b35085..00000000 --- a/web/public/cloud/admin-billing.css +++ /dev/null @@ -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; } -} diff --git a/web/public/cloud/admin-billing.js b/web/public/cloud/admin-billing.js index 53544de0..f2ff2e2f 100644 --- a/web/public/cloud/admin-billing.js +++ b/web/public/cloud/admin-billing.js @@ -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 { diff --git a/web/public/cloud/admin-overview.css b/web/public/cloud/admin-overview.css deleted file mode 100644 index 5f09389c..00000000 --- a/web/public/cloud/admin-overview.css +++ /dev/null @@ -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; - } -} diff --git a/web/public/theme/venix/css/admin-home.css b/web/public/theme/venix/css/admin-home.css index 4ab94399..59ffb671 100644 --- a/web/public/theme/venix/css/admin-home.css +++ b/web/public/theme/venix/css/admin-home.css @@ -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; } diff --git a/web/resources/views/venix/admin/billing.tpl b/web/resources/views/venix/admin/billing.tpl index 7d3ae7e6..d59d75b1 100644 --- a/web/resources/views/venix/admin/billing.tpl +++ b/web/resources/views/venix/admin/billing.tpl @@ -2,89 +2,114 @@ {assign var=admin_active value='billing'} {include file='admin/static_header.tpl'} - -
-
-
-

Billing operations

-

账单系统

-

统一查看账单、实例开通任务与支付流水,财务和履约状态互不混用。

+
+
+
+

账单系统

+

统一查看账单、实例开通任务与支付流水,财务和履约状态互不混用。

- -
- -

正在读取账单数据…

+
+ 正在读取账单数据… + +
+ -
- -
-
+ +
+

Invoice detail

-

账单详情

+

账单详情

-
-

正在读取账单详情…

-
+

正在读取账单详情…

+
diff --git a/web/resources/views/venix/admin/index.tpl b/web/resources/views/venix/admin/index.tpl index baf3600d..6866c78b 100644 --- a/web/resources/views/venix/admin/index.tpl +++ b/web/resources/views/venix/admin/index.tpl @@ -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'} -
-
-
-

系统概览

-

集中查看实例交付、账单实收和需要人工介入的运营事项。

-
-
- - - {if $overview.available}数据库快照{else}快照不可用{/if} · {$overview.generated_at|escape:'html'} - - - 刷新数据 - -
-
- - {if $overview_error != ''} - +
-
-
+
+
+
+
-

需要处理

-

优先展示会影响交付、网络或回款的事项。

-
- {$overview.attention_total} -
- -
+

近 7 日有效实收

+ 只统计当前仍为已支付状态的账单,按实际支付时间归入日期。 + + ${$overview.revenue.trend_total|escape:'html'} · {$overview.revenue.trend_count} 笔 + +
+
+ {foreach $overview.revenue.trend as $day} +
+
+ {$day.weekday|escape:'html'} · {$day.label|escape:'html'} + ${$day.amount|escape:'html'} · {$day.count} 笔 +
+ +
+ {/foreach} +
+
+ + -
-
-
+
+
+
-

资源状态

-

基于业务库中的配置与生命周期状态,不推断真实开关机状态。

-
- 宿主机设置 -
-
-
-
已启用宿主机配置{$overview.hosts.enabled} / {$overview.hosts.total}
- +

需要处理

+ 优先展示影响交付、网络或回款的事项。
-
-
实例服务状态正常{$overview.instances.service_normal} / {$overview.instances.managed}
- + {$overview.attention_total} +
+ +
+
+ +
+
+
+
+
+

资源状态

+ 基于业务库中的配置与生命周期状态,不推断真实开关机状态。
+ 宿主机设置
-
- - “已启用”仅表示宿主机配置允许调度;真实连通性仍以宿主机管理页和任务结果为准。 +
+
+
+
已启用宿主机配置{$overview.hosts.enabled} / {$overview.hosts.total}
+ +
+
+
实例服务状态正常{$overview.instances.service_normal} / {$overview.instances.managed}
+ +
+
+
实例网络状态正常{$overview.instances.network_normal} / {$overview.instances.managed}
+ +
+
+
+ + “已启用”仅表示宿主机配置允许调度;真实连通性仍以宿主机管理页和任务结果为准。 +
- +
+
-
-
+
+
+
-

今日业务流转

-

注册、支付、实例交付和待收账单分开统计。

-
- 查看账单 -
-
-
新增客户{$overview.users.new_today}客户总数 {$overview.users.total}
-
完成开通{$overview.jobs.today_succeeded}今日创建任务 {$overview.jobs.today_total}
-
有效支付{$overview.revenue.today_count}${$overview.revenue.today|escape:'html'}
-
待收账单{$overview.receivables.count}${$overview.receivables.amount|escape:'html'}
-
-
+

今日业务流转

+ 注册、支付、实例交付和待收账单分开统计。 +
+ 查看账单 +
+
+
+
新增客户{$overview.users.new_today}客户总数 {$overview.users.total}
+
完成开通{$overview.jobs.today_succeeded}今日创建任务 {$overview.jobs.today_total}
+
有效支付{$overview.revenue.today_count}${$overview.revenue.today|escape:'html'}
+
待收账单{$overview.receivables.count}${$overview.receivables.amount|escape:'html'}
+
+
+ + -
-
-
+
+
+
+
-

本月开通套餐

-

按当前有效的已支付开通账单排序。

-
- 套餐管理 -
-
- {foreach $overview.top_plans as $plan} -
- {$plan@iteration} - {$plan.name|escape:'html'} - {$plan.count} 笔 - ${$plan.amount|escape:'html'} -
- {foreachelse} -
- - 本月暂时没有有效的已支付开通账单 -
- {/foreach} -
-
+

本月开通套餐

+ 按当前有效的已支付开通账单排序。 +
+ 套餐管理 + +
+
+ {foreach $overview.top_plans as $plan} +
+ #{$plan@iteration} · {$plan.name|escape:'html'} · {$plan.count} 笔 + ${$plan.amount|escape:'html'} +
+ {foreachelse} +
本月暂时没有有效的已支付开通账单
+ {/foreach} +
+
+ + - + + + + +
+
+ +
+

数据口径

+

金额来自当前状态为“已支付”的统一账单;退款后会从历史有效实收中移除。页面不连接宿主机,也不把数据库生命周期状态当作虚拟机实时电源状态。

+
+
- - {include file='admin/static_footer.tpl'} diff --git a/web/resources/views/venix/admin/static_header.tpl b/web/resources/views/venix/admin/static_header.tpl index 34f4f1a0..240e73a5 100644 --- a/web/resources/views/venix/admin/static_header.tpl +++ b/web/resources/views/venix/admin/static_header.tpl @@ -10,7 +10,6 @@ - {if isset($admin_extra_css_href)}{/if} {if isset($admin_extra_css)}{$admin_extra_css}{/if} diff --git a/web/tests/AdminOverviewContractTest.php b/web/tests/AdminOverviewContractTest.php index ad995cb9..987b5d85 100644 --- a/web/tests/AdminOverviewContractTest.php +++ b/web/tests/AdminOverviewContractTest.php @@ -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, '
') - && 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, '
') && !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; diff --git a/web/tests/VirtualizationAssetsTest.php b/web/tests/VirtualizationAssetsTest.php index 68568fea..a0752a11 100644 --- a/web/tests/VirtualizationAssetsTest.php +++ b/web/tests/VirtualizationAssetsTest.php @@ -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, '
') + && 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, '