feat(admin): 增加站点后台标识与本站统计口径

This commit is contained in:
yml
2026-11-15 19:33:50 +08:00
parent 219ff13c11
commit 609264919d
5 changed files with 235 additions and 17 deletions
@@ -59,6 +59,42 @@
line-height: 1.5;
}
.page-site-scope {
display: flex;
align-items: center;
gap: 7px;
width: fit-content;
max-width: 100%;
margin-top: 4px;
padding: 5px 9px;
border: 1px solid #dbeafe;
border-radius: 7px;
background: #f8fbff;
}
.page-site-dot {
width: 7px;
height: 7px;
flex: none;
border-radius: 50%;
background: #2563eb;
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.page-site-scope strong {
min-width: 0;
overflow: hidden;
color: #1e3a8a;
font-size: 12px;
text-overflow: ellipsis;
white-space: nowrap;
}
.page-site-scope span:last-child {
color: #64748b;
font-size: 11px;
}
.toolbar-actions {
display: flex;
align-items: center;
@@ -38,6 +38,10 @@ import { formatCentWithSymbol } from '@/shared/utils/money'
import { adminPath } from '@/shared/utils/adminPath'
import { disputeStatusLabel, orderStatusLabel } from '@/shared/utils/statusLabels'
import { formatDateTime } from '@/shared/utils/time'
import { useDistributionSiteStore } from '@/stores/distributionSite'
const siteStore = useDistributionSiteStore()
const currentSiteName = computed(() => siteStore.siteName || '大锤商行')
const {
loading,
@@ -138,8 +142,15 @@ function shortDate(date: string) {
<el-icon><DataLine /></el-icon>
<span>DASHBOARD</span>
</div>
<h1 class="page-title">后台仪表盘</h1>
<p class="page-subtitle">实时监控平台运营核心数据,洞察商品流转趋势与待办事项。</p>
<h1 class="page-title">{{ currentSiteName }}经营仪表盘</h1>
<p class="page-subtitle">
仅展示当前站点的用户、货源、订单与财务数据;跨站订单按本站买入和本站出货归集。
</p>
<div class="page-site-scope">
<span class="page-site-dot" aria-hidden="true" />
<strong>{{ currentSiteName }}</strong>
<span>{{ siteStore.isTenant ? '经营站点 · 本站独立口径' : '站点后台' }}</span>
</div>
</div>
<div class="toolbar-actions">
@@ -169,7 +180,7 @@ function shortDate(date: string) {
<el-icon><User /></el-icon>
</div>
<div class="metric-info">
<span class="metric-label">用户总数</span>
<span class="metric-label">本站用户</span>
<strong class="metric-val indigo-val">{{ dashboard.metrics.total_users }}</strong>
<span class="metric-sub-pill info">实名 {{ dashboard.metrics.verified_users }} 人</span>
</div>
@@ -180,7 +191,7 @@ function shortDate(date: string) {
<el-icon><ShoppingBag /></el-icon>
</div>
<div class="metric-info">
<span class="metric-label">发布商品</span>
<span class="metric-label">本站发布商品</span>
<strong class="metric-val emerald-val">{{ dashboard.metrics.total_listings }}</strong>
<span class="metric-sub-pill success"
>已上架 {{ dashboard.metrics.published_listings }} 个</span
@@ -193,7 +204,7 @@ function shortDate(date: string) {
<el-icon><Document /></el-icon>
</div>
<div class="metric-info">
<span class="metric-label">订单总数</span>
<span class="metric-label">涉及本站订单</span>
<strong class="metric-val amber-val">{{ dashboard.metrics.total_orders }}</strong>
<span v-if="tenantStats" class="metric-sub-pill warning">
本站买入 {{ tenantStats.buyer_order_count }} 单 · 出货
@@ -210,7 +221,7 @@ function shortDate(date: string) {
<el-icon><Wallet /></el-icon>
</div>
<div class="metric-info">
<span class="metric-label">今日流水</span>
<span class="metric-label">本站今日流水</span>
<strong class="metric-val rose-val">
{{ formatCentWithSymbol(dashboard.metrics.today_ledger_amount_cent) }}
</strong>
@@ -226,8 +237,8 @@ function shortDate(date: string) {
<div class="section-header-row">
<div class="section-header-title">
<el-icon class="header-icon"><Trophy /></el-icon>
<span>经营成交统计</span>
<span class="header-badge">按北京时间自然日 · 近 {{ tradingDays }} 日</span>
<span>{{ currentSiteName }}经营成交统计</span>
<span class="header-badge">本站口径 · 按北京时间自然日 · 近 {{ tradingDays }} 日</span>
</div>
</div>
@@ -382,9 +393,9 @@ function shortDate(date: string) {
<div class="section-header-row">
<div class="section-header-title">
<el-icon class="header-icon"><Shop /></el-icon>
<span>账号上下架趋势</span>
<span>{{ currentSiteName }}账号上下架趋势</span>
<span class="header-badge"
>按北京时间自然日 · 近 {{ dashboard.listing_daily.days }} 日</span
>本站口径 · 按北京时间自然日 · 近 {{ dashboard.listing_daily.days }} 日</span
>
</div>
</div>
@@ -7,11 +7,13 @@ import { useRoute, useRouter } from 'vue-router'
import { fetchAdminCaptcha, type AdminCaptcha } from '@/features/admin'
import { useAdminSessionStore } from '@/stores/adminSession'
import { useDistributionSiteStore } from '@/stores/distributionSite'
import { ADMIN_DASHBOARD_PATH, isAdminPath } from '@/shared/utils/adminPath'
const router = useRouter()
const route = useRoute()
const adminSession = useAdminSessionStore()
const siteStore = useDistributionSiteStore()
const loading = ref(false)
const captchaLoading = ref(false)
const captcha = ref<AdminCaptcha | null>(null)
@@ -64,12 +66,17 @@ async function handleLogin() {
<div class="admin-login-card">
<div class="admin-login-left">
<div class="brand-lockup">
<div class="brand-logo">H</div>
<strong>大锤商行 - 后台管理</strong>
<div class="brand-logo">{{ siteStore.brandMark }}</div>
<strong>{{ siteStore.siteName }} · 后台管理</strong>
</div>
<div class="admin-login-hero">
<h2>高效管理<br />从容掌控</h2>
<p>统一的后台管理系统,助您轻松处理订单、用户与运营数据。</p>
<div class="login-site-scope">
<span>当前登录站点</span>
<strong>{{ siteStore.siteName }}</strong>
<em>{{ siteStore.isTenant ? '经营站点' : '站点后台' }}</em>
</div>
</div>
<div class="admin-login-footer">
<span>© 哈夫币租号平台</span>
@@ -243,6 +250,45 @@ async function handleLogin() {
max-width: 320px;
}
.login-site-scope {
display: flex;
align-items: center;
gap: 8px;
width: fit-content;
max-width: 100%;
margin-top: 20px;
padding: 8px 11px;
border: 1px solid rgba(148, 163, 184, 0.24);
border-radius: 8px;
background: rgba(15, 23, 42, 0.38);
}
.login-site-scope span {
color: #94a3b8;
font-size: 11px;
white-space: nowrap;
}
.login-site-scope strong {
min-width: 0;
overflow: hidden;
color: #f8fafc;
font-size: 12px;
text-overflow: ellipsis;
white-space: nowrap;
}
.login-site-scope em {
flex: none;
padding: 1px 6px;
border-radius: 999px;
background: rgba(37, 99, 235, 0.2);
color: #93c5fd;
font-size: 10px;
font-style: normal;
font-weight: 700;
}
.admin-login-footer span {
color: #475569;
font-size: 12px;
+100 -3
View File
@@ -33,6 +33,7 @@
display: flex;
align-items: center;
gap: 8px;
min-width: 0;
text-decoration: none;
color: #fff;
overflow: hidden;
@@ -51,10 +52,29 @@
flex-shrink: 0;
}
.brand-text {
font-size: 16px;
font-weight: 600;
.brand-copy {
display: grid;
min-width: 0;
gap: 1px;
}
.brand-copy strong,
.brand-copy small {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.brand-copy strong {
color: #fff;
font-size: 14px;
font-weight: 700;
}
.brand-copy small {
color: #93a4bd;
font-size: 10px;
font-weight: 600;
}
.collapse-btn {
@@ -339,6 +359,70 @@
overflow: hidden;
}
.admin-context-bar {
display: flex;
flex: none;
align-items: center;
justify-content: space-between;
gap: 16px;
min-height: 48px;
padding: 8px 24px;
border-bottom: 1px solid #e2e8f0;
background: rgba(255, 255, 255, 0.94);
backdrop-filter: blur(10px);
}
.admin-context-site {
display: flex;
align-items: center;
gap: 9px;
min-width: 0;
}
.context-label {
flex: none;
color: #94a3b8;
font-size: 11px;
font-weight: 700;
}
.admin-context-site strong {
min-width: 0;
overflow: hidden;
color: #0f172a;
font-size: 14px;
font-weight: 800;
text-overflow: ellipsis;
white-space: nowrap;
}
.context-scope {
flex: none;
padding: 2px 7px;
border: 1px solid #bfdbfe;
border-radius: 999px;
background: #eff6ff;
color: #2563eb;
font-size: 10px;
font-weight: 700;
}
.context-hint {
min-width: 0;
overflow: hidden;
color: #64748b;
font-size: 11px;
text-overflow: ellipsis;
white-space: nowrap;
}
.admin-scope-note {
flex: none;
color: #475569;
font-size: 11px;
font-weight: 600;
}
.status-dot {
width: 8px;
height: 8px;
@@ -363,6 +447,19 @@
overflow-y: auto;
}
@media (max-width: 980px) {
.admin-context-bar {
align-items: flex-start;
flex-direction: column;
gap: 4px;
padding: 8px 16px;
}
.context-hint {
display: none;
}
}
:global(.force-password-dialog) {
max-width: calc(100vw - 32px);
}
+30 -2
View File
@@ -42,12 +42,14 @@ import { changeAdminPassword, logoutAdmin, updateSupportStatus } from '@/feature
import { useAdminNotificationUnreadCount } from '@/features/admin/composables/useAdminNotificationUnreadCount'
import { usePendingRefundCount } from '@/features/admin/composables/usePendingRefundCount'
import { useAdminSessionStore } from '@/stores/adminSession'
import { useDistributionSiteStore } from '@/stores/distributionSite'
import { adminPath, ADMIN_DASHBOARD_PATH, ADMIN_LOGIN_PATH } from '@/shared/utils/adminPath'
import { readError } from '@/shared/utils/error'
const router = useRouter()
const route = useRoute()
const adminSession = useAdminSessionStore()
const siteStore = useDistributionSiteStore()
const isCollapsed = ref(false)
const updatingStatus = ref(false)
const passwordSubmitting = ref(false)
@@ -364,6 +366,20 @@ const defaultOpeneds = computed(() => {
})
const adminName = computed(() => adminSession.nickname || adminSession.username || '管理员')
const currentSiteName = computed(() => siteStore.siteName || '大锤商行')
const currentSiteScope = computed(() => {
if (siteStore.isTenant) return '经营站点'
if (siteStore.isDistribution) return '分销站点'
return '主站'
})
const currentSiteHint = computed(() =>
siteStore.isTenant ? '用户、商品、订单与财务均按本站口径统计' : '历史分销站点管理视图'
)
const adminScopeNote = computed(() =>
adminSession.isSuperAdmin
? '平台超级管理员 · 当前仅查看本站数据'
: '站点管理员 · 数据仅限当前站点'
)
const adminRoleText = computed(() => {
if (adminSession.isSuperAdmin) return '超级管理员'
const names = adminSession.roles.map(role => role.name).filter(Boolean)
@@ -455,8 +471,11 @@ async function handleForcedPasswordChange() {
<aside class="admin-sidebar">
<div class="admin-sidebar-header">
<RouterLink class="admin-brand" :to="ADMIN_DASHBOARD_PATH">
<span class="brand-mark">H</span>
<span class="brand-text" v-show="!isCollapsed">哈夫币后台</span>
<span class="brand-mark">{{ siteStore.brandMark }}</span>
<span v-show="!isCollapsed" class="brand-copy">
<strong>{{ currentSiteName }}</strong>
<small>{{ currentSiteScope }}后台</small>
</span>
</RouterLink>
<el-icon class="collapse-btn" @click="isCollapsed = !isCollapsed">
<Fold v-if="!isCollapsed" />
@@ -562,6 +581,15 @@ async function handleForcedPasswordChange() {
</aside>
<section class="admin-workspace">
<header class="admin-context-bar">
<div class="admin-context-site">
<span class="context-label">当前后台</span>
<strong>{{ currentSiteName }}</strong>
<span class="context-scope">{{ currentSiteScope }}</span>
<span class="context-hint">{{ currentSiteHint }}</span>
</div>
<span class="admin-scope-note">{{ adminScopeNote }}</span>
</header>
<main class="admin-main">
<slot />
</main>