feat(platform-ops): 增加用户商品交易资金分类统计

This commit is contained in:
yml
2026-11-15 21:42:50 +08:00
parent 991de90136
commit a68eb815a9
9 changed files with 791 additions and 140 deletions
@@ -20,6 +20,11 @@ export interface PlatformTotals {
pending_disputes: number
pending_handoffs: number
pending_returns: number
wallet_inflow_cent: number
wallet_outflow_cent: number
today_wallet_inflow_cent: number
today_wallet_outflow_cent: number
pending_withdrawals: number
}
export interface PlatformSiteStats {
@@ -32,6 +37,7 @@ export interface PlatformSiteStats {
today_new_users: number
total_listings: number
published_listings: number
today_new_listings: number
pending_reviews: number
buyer_orders: number
buyer_gmv_cent: number
@@ -40,6 +46,11 @@ export interface PlatformSiteStats {
renting_orders: number
today_orders: number
today_gmv_cent: number
wallet_inflow_cent: number
wallet_outflow_cent: number
today_wallet_inflow_cent: number
today_wallet_outflow_cent: number
pending_withdrawals: number
}
export interface PlatformTrendPoint {
@@ -48,6 +59,8 @@ export interface PlatformTrendPoint {
new_listings: number
orders: number
paid_gmv_cent: number
wallet_inflow_cent: number
wallet_outflow_cent: number
}
export interface PlatformOverview {
@@ -3,12 +3,16 @@ import {
Calendar,
Coin,
DataLine,
DocumentChecked,
Refresh,
Shop,
Tickets,
TrendCharts,
User,
Wallet,
Warning,
} from '@element-plus/icons-vue'
import type { Component } from 'vue'
import { computed, onMounted, ref } from 'vue'
import {
@@ -20,15 +24,278 @@ import { formatCentWithSymbol } from '@/shared/utils/money'
import { formatDateTime } from '@/shared/utils/time'
import { readError } from '@/shared/utils/error'
type PlatformMode = 'overview' | 'users' | 'listings' | 'trade' | 'finance'
type MetricTone = 'blue' | 'green' | 'amber' | 'red'
interface MetricCard {
label: string
value: string
detail: string
icon: Component
tone: MetricTone
}
const props = withDefaults(defineProps<{ mode?: PlatformMode }>(), {
mode: 'overview',
})
const loading = ref(false)
const error = ref('')
const overview = ref<PlatformOverview | null>(null)
const trendMaxOrders = computed(() =>
Math.max(1, ...(overview.value?.trend || []).map(item => item.orders))
const modeCopy: Record<PlatformMode, { eyebrow: string; title: string; description: string }> = {
overview: {
eyebrow: 'PLATFORM OVERVIEW',
title: '平台运营总览',
description: '汇总大锤商行、解忧商行及后续经营站点的核心经营数据,仅用于查看统计。',
},
users: {
eyebrow: 'PLATFORM USERS',
title: '平台用户统计',
description: '按经营站点查看用户存量、实名认证和今日新增,不提供用户资料或管理操作。',
},
listings: {
eyebrow: 'PLATFORM LISTINGS',
title: '平台商品统计',
description: '按商品的来源经营站点查看供给、在售、审核和今日新增情况。',
},
trade: {
eyebrow: 'PLATFORM TRADE',
title: '平台交易统计',
description: '分别统计各站点的买入订单和出货订单,并汇总平台有效成交与今日交易。',
},
finance: {
eyebrow: 'PLATFORM FINANCE',
title: '平台资金统计',
description: '按经营站点查看钱包流水与待处理提现,仅展示汇总,不展示账户和提现明细。',
},
}
const copy = computed(() => modeCopy[props.mode])
const metrics = computed<MetricCard[]>(() => {
const totals = overview.value?.totals
if (!totals) return []
if (props.mode === 'users') {
return [
{
label: '平台用户',
value: totals.user_count.toLocaleString(),
detail: `${totals.active_tenant_count} 个经营站点独立统计`,
icon: User,
tone: 'blue',
},
{
label: '实名用户',
value: totals.verified_users.toLocaleString(),
detail: `实名率 ${percentage(totals.verified_users, totals.user_count)}`,
icon: DocumentChecked,
tone: 'green',
},
{
label: '今日新增',
value: totals.today_new_users.toLocaleString(),
detail: '按北京时间自然日统计',
icon: Calendar,
tone: 'amber',
},
{
label: '经营站点',
value: totals.active_tenant_count.toLocaleString(),
detail: `共 ${totals.tenant_count} 个站点`,
icon: Shop,
tone: 'blue',
},
]
}
if (props.mode === 'listings') {
return [
{
label: '商品总数',
value: totals.total_listings.toLocaleString(),
detail: '各经营站点商品合计',
icon: Shop,
tone: 'blue',
},
{
label: '在售商品',
value: totals.published_listings.toLocaleString(),
detail: `在售率 ${percentage(totals.published_listings, totals.total_listings)}`,
icon: TrendCharts,
tone: 'green',
},
{
label: '待审核',
value: totals.pending_reviews.toLocaleString(),
detail: '由商品来源站点后台处理',
icon: DocumentChecked,
tone: 'amber',
},
{
label: '今日新增',
value: totals.today_new_listings.toLocaleString(),
detail: '按商品创建时间统计',
icon: Calendar,
tone: 'blue',
},
]
}
if (props.mode === 'trade') {
return [
{
label: '有效订单',
value: totals.paid_orders.toLocaleString(),
detail: `全部订单 ${totals.total_orders.toLocaleString()} 笔`,
icon: Tickets,
tone: 'blue',
},
{
label: '累计成交额',
value: formatCentWithSymbol(totals.paid_gmv_cent),
detail: '按订单租金金额汇总',
icon: Coin,
tone: 'green',
},
{
label: '今日成交额',
value: formatCentWithSymbol(totals.today_gmv_cent),
detail: `今日订单 ${totals.today_orders.toLocaleString()} 笔`,
icon: Calendar,
tone: 'amber',
},
{
label: '租用中',
value: totals.renting_orders.toLocaleString(),
detail: '当前进行中的租用订单',
icon: TrendCharts,
tone: 'blue',
},
{
label: '待处理事项',
value: `${totals.pending_handoffs + totals.pending_returns + totals.pending_disputes}`,
detail: `交接 ${totals.pending_handoffs} · 归还 ${totals.pending_returns} · 申诉 ${totals.pending_disputes}`,
icon: Warning,
tone: 'red',
},
]
}
if (props.mode === 'finance') {
return [
{
label: '累计钱包流入',
value: formatCentWithSymbol(totals.wallet_inflow_cent),
detail: '钱包流水 direction=in',
icon: Wallet,
tone: 'green',
},
{
label: '累计钱包流出',
value: formatCentWithSymbol(totals.wallet_outflow_cent),
detail: '钱包流水 direction=out',
icon: Wallet,
tone: 'amber',
},
{
label: '今日流入',
value: formatCentWithSymbol(totals.today_wallet_inflow_cent),
detail: '按北京时间自然日统计',
icon: Calendar,
tone: 'green',
},
{
label: '今日流出',
value: formatCentWithSymbol(totals.today_wallet_outflow_cent),
detail: '按北京时间自然日统计',
icon: Calendar,
tone: 'amber',
},
{
label: '待处理提现',
value: totals.pending_withdrawals.toLocaleString(),
detail: '待审核与待打款申请',
icon: Coin,
tone: 'red',
},
{
label: '待处理申诉',
value: totals.pending_disputes.toLocaleString(),
detail: '可能影响资金结算',
icon: Warning,
tone: 'red',
},
]
}
return [
{
label: '经营站点',
value: totals.active_tenant_count.toLocaleString(),
detail: `共 ${totals.tenant_count} 个站点`,
icon: Shop,
tone: 'blue',
},
{
label: '平台用户',
value: totals.user_count.toLocaleString(),
detail: `实名 ${totals.verified_users.toLocaleString()} · 今日新增 ${totals.today_new_users.toLocaleString()}`,
icon: User,
tone: 'blue',
},
{
label: '在售商品',
value: totals.published_listings.toLocaleString(),
detail: `商品总数 ${totals.total_listings.toLocaleString()} · 待审核 ${totals.pending_reviews.toLocaleString()}`,
icon: TrendCharts,
tone: 'green',
},
{
label: '累计成交额',
value: formatCentWithSymbol(totals.paid_gmv_cent),
detail: `有效订单 ${totals.paid_orders.toLocaleString()} 笔`,
icon: Coin,
tone: 'green',
},
{
label: '今日成交',
value: formatCentWithSymbol(totals.today_gmv_cent),
detail: `今日订单 ${totals.today_orders.toLocaleString()} 笔`,
icon: Calendar,
tone: 'amber',
},
]
})
const trendTitle = computed(() => {
if (props.mode === 'users') return '近 7 日用户增长'
if (props.mode === 'listings') return '近 7 日商品新增'
if (props.mode === 'trade') return '近 7 日交易趋势'
if (props.mode === 'finance') return '近 7 日钱包流水'
return '近 7 日平台趋势'
})
const trendPrimaryLabel = computed(() => {
if (props.mode === 'users') return '新增用户'
if (props.mode === 'listings') return '新增商品'
if (props.mode === 'finance') return '钱包流入'
return '有效订单'
})
const trendSecondaryLabel = computed(() => {
if (props.mode === 'finance') return '钱包流出'
return '成交额'
})
const showSecondaryTrend = computed(() => ['overview', 'trade', 'finance'].includes(props.mode))
const trendMaxPrimary = computed(() =>
Math.max(1, ...(overview.value?.trend || []).map(item => primaryTrendValue(item)))
)
const trendMaxGMV = computed(() =>
Math.max(1, ...(overview.value?.trend || []).map(item => item.paid_gmv_cent))
const trendMaxSecondary = computed(() =>
Math.max(1, ...(overview.value?.trend || []).map(item => secondaryTrendValue(item) || 0))
)
async function loadOverview() {
@@ -43,7 +310,13 @@ async function loadOverview() {
}
}
function barHeight(value: number, max: number) {
function percentage(part: number, total: number) {
if (total <= 0) return '0%'
return `${Math.round((part / total) * 100)}%`
}
function barHeight(value: number | null, max: number) {
if (!value || value <= 0) return '0%'
return `${Math.max(8, Math.round((value / max) * 100))}%`
}
@@ -51,10 +324,48 @@ function shortDate(value: string) {
return value.length >= 10 ? value.slice(5) : value
}
function trendOrders(row: PlatformTrendPoint) {
function primaryTrendValue(row: PlatformTrendPoint) {
if (props.mode === 'users') return row.new_users
if (props.mode === 'listings') return row.new_listings
if (props.mode === 'finance') return row.wallet_inflow_cent
return row.orders
}
function secondaryTrendValue(row: PlatformTrendPoint) {
if (!showSecondaryTrend.value) return null
if (props.mode === 'finance') return row.wallet_outflow_cent
return row.paid_gmv_cent
}
function primaryTrendText(row: PlatformTrendPoint) {
const value = primaryTrendValue(row)
if (props.mode === 'finance') return `流入 ${formatCentWithSymbol(value)}`
if (props.mode === 'users') return `新增 ${value} 人`
if (props.mode === 'listings') return `新增 ${value} 个`
return `${value} 单`
}
function secondaryTrendText(row: PlatformTrendPoint) {
const value = secondaryTrendValue(row)
if (value === null) return ''
if (props.mode === 'finance') return `流出 ${formatCentWithSymbol(value)}`
return formatCentWithSymbol(value)
}
function trendFoot(row: PlatformTrendPoint) {
const totals = overview.value?.totals
if (!totals) return ''
if (props.mode === 'overview') {
return `用户 +${row.new_users} · 商品 +${row.new_listings}`
}
if (props.mode === 'users') return `实名存量 ${totals.verified_users}`
if (props.mode === 'listings') return `待审核 ${totals.pending_reviews}`
if (props.mode === 'trade') {
return `待交接 ${totals.pending_handoffs} · 待归还 ${totals.pending_returns}`
}
return `待提现 ${totals.pending_withdrawals}`
}
onMounted(loadOverview)
</script>
@@ -64,10 +375,10 @@ onMounted(loadOverview)
<div>
<p class="platform-eyebrow">
<el-icon><DataLine /></el-icon>
PLATFORM OVERVIEW
{{ copy.eyebrow }}
</p>
<h1>平台运营总览</h1>
<p>汇总大锤商行、解忧商行及后续经营站点的核心经营数据,仅用于查看统计。</p>
<h1>{{ copy.title }}</h1>
<p>{{ copy.description }}</p>
</div>
<div class="platform-header-actions">
<span v-if="overview" class="platform-updated">
@@ -90,55 +401,22 @@ onMounted(loadOverview)
<template v-else-if="overview">
<section class="platform-metrics">
<article class="platform-metric metric-sites">
<el-icon><Shop /></el-icon>
<article
v-for="metric in metrics"
:key="metric.label"
class="platform-metric"
:class="`metric-tone--${metric.tone}`"
>
<el-icon><component :is="metric.icon" /></el-icon>
<div>
<span>经营站点</span>
<strong>{{ overview.totals.active_tenant_count }}</strong>
<small>共 {{ overview.totals.tenant_count }} 个站点</small>
</div>
</article>
<article class="platform-metric metric-users">
<el-icon><User /></el-icon>
<div>
<span>平台用户</span>
<strong>{{ overview.totals.user_count }}</strong>
<small
>实名 {{ overview.totals.verified_users }} · 今日新增
{{ overview.totals.today_new_users }}</small
>
</div>
</article>
<article class="platform-metric metric-listings">
<el-icon><TrendCharts /></el-icon>
<div>
<span>在售商品</span>
<strong>{{ overview.totals.published_listings }}</strong>
<small
>商品总数 {{ overview.totals.total_listings }} · 待审核
{{ overview.totals.pending_reviews }}</small
>
</div>
</article>
<article class="platform-metric metric-gmv">
<el-icon><Coin /></el-icon>
<div>
<span>累计成交额</span>
<strong>{{ formatCentWithSymbol(overview.totals.paid_gmv_cent) }}</strong>
<small>有效订单 {{ overview.totals.paid_orders }} 笔</small>
</div>
</article>
<article class="platform-metric metric-today">
<el-icon><Calendar /></el-icon>
<div>
<span>今日成交</span>
<strong>{{ formatCentWithSymbol(overview.totals.today_gmv_cent) }}</strong>
<small>今日订单 {{ overview.totals.today_orders }} 笔</small>
<span>{{ metric.label }}</span>
<strong>{{ metric.value }}</strong>
<small>{{ metric.detail }}</small>
</div>
</article>
</section>
<section class="platform-panel">
<section v-if="mode === 'overview'" class="platform-panel">
<div class="platform-panel-head">
<div>
<h2>分站经营统计</h2>
@@ -215,15 +493,197 @@ onMounted(loadOverview)
</el-table>
</section>
<section v-else-if="mode === 'users'" class="platform-panel">
<div class="platform-panel-head">
<div>
<h2>分站用户统计</h2>
<p>同一手机号可在不同经营站点分别注册,因此按站点独立统计用户。</p>
</div>
<div class="platform-pending">
<span>平台汇总</span>
<strong>用户 {{ overview.totals.user_count }}</strong>
<small>实名 {{ overview.totals.verified_users }}</small>
</div>
</div>
<el-table class="platform-site-table" :data="overview.sites" stripe>
<el-table-column label="站点" min-width="180" fixed="left">
<template #default="{ row }">
<div class="platform-site-name">
<strong>{{ row.tenant_name }}</strong>
<small>{{ row.tenant_code }}</small>
</div>
</template>
</el-table-column>
<el-table-column label="状态" width="100">
<template #default="{ row }">
<el-tag :type="row.status === 'active' ? 'success' : 'info'" size="small">
{{ row.status === 'active' ? '运营中' : '已停用' }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="用户总数" min-width="140" align="right">
<template #default="{ row }">{{ row.user_count }}</template>
</el-table-column>
<el-table-column label="实名用户" min-width="160" align="right">
<template #default="{ row }">
<strong>{{ row.verified_users }}</strong>
<span class="platform-cell-sub">
实名率 {{ percentage(row.verified_users, row.user_count) }}
</span>
</template>
</el-table-column>
<el-table-column label="今日新增" min-width="140" align="right">
<template #default="{ row }">+{{ row.today_new_users }}</template>
</el-table-column>
</el-table>
</section>
<section v-else-if="mode === 'listings'" class="platform-panel">
<div class="platform-panel-head">
<div>
<h2>分站商品统计</h2>
<p>商品按来源站点归属;解忧上架的商品进入解忧审核,大锤上架的商品进入大锤审核。</p>
</div>
<div class="platform-pending">
<span>平台汇总</span>
<strong>商品 {{ overview.totals.total_listings }}</strong>
<small>在售 {{ overview.totals.published_listings }}</small>
</div>
</div>
<el-table class="platform-site-table" :data="overview.sites" stripe>
<el-table-column label="站点" min-width="180" fixed="left">
<template #default="{ row }">
<div class="platform-site-name">
<strong>{{ row.tenant_name }}</strong>
<small>{{ row.tenant_code }}</small>
</div>
</template>
</el-table-column>
<el-table-column label="商品总数" min-width="130" align="right">
<template #default="{ row }">{{ row.total_listings }}</template>
</el-table-column>
<el-table-column label="在售商品" min-width="160" align="right">
<template #default="{ row }">
<strong>{{ row.published_listings }}</strong>
<span class="platform-cell-sub">
在售率 {{ percentage(row.published_listings, row.total_listings) }}
</span>
</template>
</el-table-column>
<el-table-column label="待审核" min-width="120" align="right">
<template #default="{ row }">{{ row.pending_reviews }}</template>
</el-table-column>
<el-table-column label="今日新增" min-width="120" align="right">
<template #default="{ row }">+{{ row.today_new_listings }}</template>
</el-table-column>
</el-table>
</section>
<section v-else-if="mode === 'trade'" class="platform-panel">
<div class="platform-panel-head">
<div>
<h2>分站交易统计</h2>
<p>买入按付款站点统计,出货按商品来源站点统计;跨站购买会同时体现在两个站点。</p>
</div>
<div class="platform-pending">
<span>今日平台</span>
<strong>{{ overview.totals.today_orders }} 单</strong>
<small>{{ formatCentWithSymbol(overview.totals.today_gmv_cent) }}</small>
</div>
</div>
<el-table class="platform-site-table" :data="overview.sites" stripe>
<el-table-column label="站点" min-width="170" fixed="left">
<template #default="{ row }">
<div class="platform-site-name">
<strong>{{ row.tenant_name }}</strong>
<small>{{ row.tenant_code }}</small>
</div>
</template>
</el-table-column>
<el-table-column label="本站买入" min-width="150" align="right">
<template #default="{ row }">
<strong>{{ row.buyer_orders }} 单</strong>
<span class="platform-cell-sub">{{ formatCentWithSymbol(row.buyer_gmv_cent) }}</span>
</template>
</el-table-column>
<el-table-column label="本站出货" min-width="150" align="right">
<template #default="{ row }">
<strong>{{ row.source_orders }} 单</strong>
<span class="platform-cell-sub">{{
formatCentWithSymbol(row.source_amount_cent)
}}</span>
</template>
</el-table-column>
<el-table-column label="今日买入" min-width="150" align="right">
<template #default="{ row }">
<strong>{{ row.today_orders }} 单</strong>
<span class="platform-cell-sub">{{ formatCentWithSymbol(row.today_gmv_cent) }}</span>
</template>
</el-table-column>
<el-table-column label="租用中" min-width="100" align="right">
<template #default="{ row }">{{ row.renting_orders }}</template>
</el-table-column>
</el-table>
</section>
<section v-else-if="mode === 'finance'" class="platform-panel">
<div class="platform-panel-head">
<div>
<h2>分站资金统计</h2>
<p>钱包流水和提现申请按所属经营站点统计,不包含历史分销站点的独立视图。</p>
</div>
<div class="platform-pending">
<span>待处理</span>
<strong>提现 {{ overview.totals.pending_withdrawals }}</strong>
<small>申诉 {{ overview.totals.pending_disputes }}</small>
</div>
</div>
<el-table class="platform-site-table" :data="overview.sites" stripe>
<el-table-column label="站点" min-width="170" fixed="left">
<template #default="{ row }">
<div class="platform-site-name">
<strong>{{ row.tenant_name }}</strong>
<small>{{ row.tenant_code }}</small>
</div>
</template>
</el-table-column>
<el-table-column label="累计流入" min-width="150" align="right">
<template #default="{ row }">{{
formatCentWithSymbol(row.wallet_inflow_cent)
}}</template>
</el-table-column>
<el-table-column label="累计流出" min-width="150" align="right">
<template #default="{ row }">{{
formatCentWithSymbol(row.wallet_outflow_cent)
}}</template>
</el-table-column>
<el-table-column label="今日流入" min-width="150" align="right">
<template #default="{ row }">{{
formatCentWithSymbol(row.today_wallet_inflow_cent)
}}</template>
</el-table-column>
<el-table-column label="今日流出" min-width="150" align="right">
<template #default="{ row }">{{
formatCentWithSymbol(row.today_wallet_outflow_cent)
}}</template>
</el-table-column>
<el-table-column label="待处理提现" min-width="120" align="right">
<template #default="{ row }">{{ row.pending_withdrawals }}</template>
</el-table-column>
</el-table>
</section>
<section class="platform-panel">
<div class="platform-panel-head">
<div>
<h2>近 7 日平台趋势</h2>
<p>新增用户、新增商品、有效订单和成交额按北京时间自然日汇总。</p>
<h2>{{ trendTitle }}</h2>
<p>按北京时间自然日汇总,空白日期的数据按 0 展示。</p>
</div>
<div class="platform-trend-legend">
<span><em class="legend-orders" />有效订单</span>
<span><em class="legend-gmv" />成交额</span>
<span><em class="legend-primary" />{{ trendPrimaryLabel }}</span>
<span v-if="showSecondaryTrend">
<em class="legend-secondary" />{{ trendSecondaryLabel }}
</span>
</div>
</div>
<div class="platform-trend-grid">
@@ -231,19 +691,20 @@ onMounted(loadOverview)
<div class="platform-trend-date">{{ shortDate(item.date) }}</div>
<div class="platform-trend-bars">
<span
class="trend-bar trend-orders"
:style="{ height: barHeight(trendOrders(item), trendMaxOrders) }"
class="trend-bar trend-primary"
:style="{ height: barHeight(primaryTrendValue(item), trendMaxPrimary) }"
/>
<span
class="trend-bar trend-gmv"
:style="{ height: barHeight(item.paid_gmv_cent, trendMaxGMV) }"
v-if="showSecondaryTrend"
class="trend-bar trend-secondary"
:style="{
height: barHeight(secondaryTrendValue(item), trendMaxSecondary),
}"
/>
</div>
<strong>{{ item.orders }} 单</strong>
<small>{{ formatCentWithSymbol(item.paid_gmv_cent) }}</small>
<span class="platform-trend-foot"
>用户 +{{ item.new_users }} · 商品 +{{ item.new_listings }}</span
>
<strong>{{ primaryTrendText(item) }}</strong>
<small v-if="showSecondaryTrend">{{ secondaryTrendText(item) }}</small>
<span class="platform-trend-foot">{{ trendFoot(item) }}</span>
</article>
</div>
</section>
@@ -375,26 +836,33 @@ onMounted(loadOverview)
font-size: 11px;
}
.metric-listings,
.metric-gmv {
.platform-metric.metric-tone--green {
border-top-color: #059669;
}
.metric-listings > .el-icon,
.metric-gmv > .el-icon {
.platform-metric.metric-tone--green > .el-icon {
background: #ecfdf5;
color: #059669;
}
.metric-today {
.platform-metric.metric-tone--amber {
border-top-color: #d97706;
}
.metric-today > .el-icon {
.platform-metric.metric-tone--amber > .el-icon {
background: #fffbeb;
color: #d97706;
}
.platform-metric.metric-tone--red {
border-top-color: #dc2626;
}
.platform-metric.metric-tone--red > .el-icon {
background: #fef2f2;
color: #dc2626;
}
.platform-panel {
overflow: hidden;
padding: 20px;
@@ -459,7 +927,7 @@ onMounted(loadOverview)
.platform-trend-grid {
display: grid;
grid-template-columns: repeat(7, minmax(90px, 1fr));
grid-template-columns: repeat(7, minmax(120px, 1fr));
gap: 10px;
overflow-x: auto;
padding-bottom: 4px;
@@ -485,17 +953,17 @@ onMounted(loadOverview)
border-radius: 2px;
}
.legend-orders {
.legend-primary {
background: #3b82f6;
}
.legend-gmv {
.legend-secondary {
background: #10b981;
}
.platform-trend-day {
display: grid;
min-width: 90px;
min-width: 120px;
justify-items: center;
gap: 5px;
padding: 12px 8px;
@@ -523,17 +991,18 @@ onMounted(loadOverview)
border-radius: 3px 3px 0 0;
}
.trend-orders {
.trend-primary {
background: #3b82f6;
}
.trend-gmv {
.trend-secondary {
background: #10b981;
}
.platform-trend-day strong {
color: #0f172a;
font-size: 13px;
font-size: 12px;
text-align: center;
}
.platform-trend-day small {
@@ -554,7 +1023,7 @@ onMounted(loadOverview)
}
.platform-trend-grid {
grid-template-columns: repeat(7, 96px);
grid-template-columns: repeat(7, 126px);
}
}
</style>
+24 -1
View File
@@ -47,7 +47,11 @@ import {
adminPath,
ADMIN_DASHBOARD_PATH,
ADMIN_LOGIN_PATH,
PLATFORM_OPS_FINANCE_PATH,
PLATFORM_OPS_LISTINGS_PATH,
PLATFORM_OPS_PATH,
PLATFORM_OPS_TRADE_PATH,
PLATFORM_OPS_USERS_PATH,
} from '@/shared/utils/adminPath'
import { readError } from '@/shared/utils/error'
@@ -366,7 +370,26 @@ const navGroups = computed(() => {
label: '平台总览',
to: PLATFORM_OPS_PATH,
icon: DataLine,
permission: 'dashboard:view',
},
{
label: '用户统计',
to: PLATFORM_OPS_USERS_PATH,
icon: User,
},
{
label: '商品统计',
to: PLATFORM_OPS_LISTINGS_PATH,
icon: Shop,
},
{
label: '交易统计',
to: PLATFORM_OPS_TRADE_PATH,
icon: Tickets,
},
{
label: '资金统计',
to: PLATFORM_OPS_FINANCE_PATH,
icon: Wallet,
},
],
},
+38 -1
View File
@@ -1,6 +1,14 @@
import type { RouteRecordRaw } from 'vue-router'
import { adminPath, ADMIN_DASHBOARD_PATH, PLATFORM_OPS_PATH } from '@/shared/utils/adminPath'
import {
adminPath,
ADMIN_DASHBOARD_PATH,
PLATFORM_OPS_FINANCE_PATH,
PLATFORM_OPS_LISTINGS_PATH,
PLATFORM_OPS_PATH,
PLATFORM_OPS_TRADE_PATH,
PLATFORM_OPS_USERS_PATH,
} from '@/shared/utils/adminPath'
const adminMeta = { layout: 'admin', requiresAdmin: true }
@@ -22,6 +30,35 @@ export const adminRoutes: RouteRecordRaw[] = [
path: PLATFORM_OPS_PATH,
name: 'platform-ops-overview',
component: () => import('@/features/admin/views/AdminPlatformOverviewView.vue'),
props: { mode: 'overview' },
meta: { ...adminMeta, platformOps: true },
},
{
path: PLATFORM_OPS_USERS_PATH,
name: 'platform-ops-users',
component: () => import('@/features/admin/views/AdminPlatformOverviewView.vue'),
props: { mode: 'users' },
meta: { ...adminMeta, platformOps: true },
},
{
path: PLATFORM_OPS_LISTINGS_PATH,
name: 'platform-ops-listings',
component: () => import('@/features/admin/views/AdminPlatformOverviewView.vue'),
props: { mode: 'listings' },
meta: { ...adminMeta, platformOps: true },
},
{
path: PLATFORM_OPS_TRADE_PATH,
name: 'platform-ops-trade',
component: () => import('@/features/admin/views/AdminPlatformOverviewView.vue'),
props: { mode: 'trade' },
meta: { ...adminMeta, platformOps: true },
},
{
path: PLATFORM_OPS_FINANCE_PATH,
name: 'platform-ops-finance',
component: () => import('@/features/admin/views/AdminPlatformOverviewView.vue'),
props: { mode: 'finance' },
meta: { ...adminMeta, platformOps: true },
},
{
+8 -3
View File
@@ -3,7 +3,12 @@ import { createRouter, createWebHistory } from 'vue-router'
import { useAdminSessionStore } from '@/stores/adminSession'
import { useSessionStore } from '@/stores/session'
import { getAccessToken, getLoginPath } from '@/shared/utils/authStorage'
import { ADMIN_DASHBOARD_PATH, ADMIN_LOGIN_PATH, PLATFORM_OPS_PATH } from '@/shared/utils/adminPath'
import {
ADMIN_DASHBOARD_PATH,
ADMIN_LOGIN_PATH,
isPlatformOpsPath,
PLATFORM_OPS_PATH,
} from '@/shared/utils/adminPath'
import { isPlatformOpsHostname } from '@/stores/distributionSite'
import { accountRoutes } from './accountRoutes'
import { adminRoutes } from './adminRoutes'
@@ -105,10 +110,10 @@ router.beforeEach(async to => {
return true
}
}
if (platformOps && to.meta.requiresAdmin && to.path !== PLATFORM_OPS_PATH) {
if (platformOps && to.meta.requiresAdmin && !isPlatformOpsPath(to.path)) {
return PLATFORM_OPS_PATH
}
if (!platformOps && to.path === PLATFORM_OPS_PATH) {
if (!platformOps && isPlatformOpsPath(to.path)) {
return ADMIN_DASHBOARD_PATH
}
if (to.meta.requiresAdmin) {
+8
View File
@@ -18,7 +18,15 @@ export function adminPath(path = '') {
export const ADMIN_LOGIN_PATH = adminPath('login')
export const ADMIN_DASHBOARD_PATH = adminPath('dashboard')
export const PLATFORM_OPS_PATH = adminPath('platform')
export const PLATFORM_OPS_USERS_PATH = adminPath('platform/users')
export const PLATFORM_OPS_LISTINGS_PATH = adminPath('platform/listings')
export const PLATFORM_OPS_TRADE_PATH = adminPath('platform/trade')
export const PLATFORM_OPS_FINANCE_PATH = adminPath('platform/finance')
export function isAdminPath(path: string) {
return path === ADMIN_BASE_PATH || path.startsWith(`${ADMIN_BASE_PATH}/`)
}
export function isPlatformOpsPath(path: string) {
return path === PLATFORM_OPS_PATH || path.startsWith(`${PLATFORM_OPS_PATH}/`)
}