增加客服上传账号统计

This commit is contained in:
yml2213
2026-08-30 19:44:08 +08:00
parent 0aef80fd11
commit 98f6ee9451
6 changed files with 232 additions and 12 deletions
@@ -36,10 +36,19 @@ export interface ListingDailyOverview {
trend: ListingDayStats[]
today_channels: ListingChannelDayStats[]
channel_trend: ListingChannelDayStats[]
today_uploaders: ListingUploaderDayStats[]
uploader_trend: ListingUploaderDayStats[]
days: number
timezone: string
}
export interface ListingUploaderDayStats {
date: string
uploader_id: number
uploader_name: string
upload_count: number
}
export interface DashboardRecentOrder {
id: number
order_no: string
@@ -90,6 +99,8 @@ export async function fetchAdminDashboard() {
trend: listingDaily?.trend ?? [],
today_channels: listingDaily?.today_channels ?? [],
channel_trend: listingDaily?.channel_trend ?? [],
today_uploaders: listingDaily?.today_uploaders ?? [],
uploader_trend: listingDaily?.uploader_trend ?? [],
days: listingDaily?.days ?? 7,
timezone: listingDaily?.timezone ?? 'Asia/Shanghai',
},
@@ -25,6 +25,7 @@ import {
type AdminDashboard,
type ListingChannelDayStats,
type ListingDayStats,
type ListingUploaderDayStats,
} from '@/features/admin/api/adminDashboard'
import { useAdminTable } from '@/features/admin/composables/useAdminTable'
import { formatCentWithSymbol } from '@/shared/utils/money'
@@ -43,6 +44,7 @@ const {
const listingTrend = computed(() => dashboard.value?.listing_daily?.trend ?? [])
const listingChannelTrend = computed(() => dashboard.value?.listing_daily?.channel_trend ?? [])
const listingUploaderTrend = computed(() => dashboard.value?.listing_daily?.uploader_trend ?? [])
const listingToday = computed(
() =>
dashboard.value?.listing_daily?.today ?? {
@@ -67,6 +69,14 @@ const listingTodayChannels = computed<ListingChannelDayStats[]>(() => {
const extras = rows.filter(row => !channelDisplayOrder.includes(row.source_channel || '未填写'))
return [...ordered, ...extras]
})
const listingTodayUploaders = computed<ListingUploaderDayStats[]>(() => {
const date = listingToday.value.date
return (dashboard.value?.listing_daily?.today_uploaders ?? [])
.filter(row => row.date === date)
.sort(
(a, b) => b.upload_count - a.upload_count || a.uploader_name.localeCompare(b.uploader_name)
)
})
function leaveCount(row: ListingChannelDayStats | ListingDayStats) {
return Number(row.active_offline_count || 0) + Number(row.trade_leave_count || 0)
@@ -311,6 +321,21 @@ function shortDate(date: string) {
</div>
</div>
<div v-if="listingTodayUploaders.length" class="listing-uploader-block">
<div class="channel-summary-title">今日外部上传账号统计</div>
<div class="listing-uploader-summary">
<div
v-for="row in listingTodayUploaders"
:key="`today-uploader-${row.uploader_id}-${row.uploader_name}`"
class="listing-uploader-item"
>
<span class="uploader-name">{{ row.uploader_name || '未填写' }}</span>
<strong class="uploader-total">{{ row.upload_count }}</strong>
<span class="uploader-unit">个账号</span>
</div>
</div>
</div>
<!-- 7日上下架趋势明细表 -->
<div class="table-container trend-table-wrap">
<el-table class="custom-enterprise-table" :data="listingTrend" size="small" stripe>
@@ -381,6 +406,24 @@ function shortDate(date: string) {
</el-table>
</div>
</div>
<div v-if="listingUploaderTrend.length" class="listing-uploader-block">
<div class="channel-summary-title"> 7 日客服上传账号明细</div>
<div class="table-container">
<el-table
class="custom-enterprise-table"
:data="listingUploaderTrend"
size="small"
stripe
>
<el-table-column prop="date" label="统计日期" min-width="120" />
<el-table-column prop="uploader_name" label="客服" min-width="140">
<template #default="{ row }">{{ row.uploader_name || '未填写' }}</template>
</el-table-column>
<el-table-column prop="upload_count" label="上传账号数" width="130" align="center" />
</el-table>
</div>
</div>
</section>
<!-- 待处理事项 & 快捷入口 -->
@@ -1148,6 +1191,49 @@ function shortDate(date: string) {
margin-top: 20px;
}
.listing-uploader-block {
margin-top: 20px;
}
.listing-uploader-summary {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: 12px;
margin-bottom: 20px;
}
.listing-uploader-item {
display: flex;
align-items: baseline;
gap: 8px;
border: 1px solid #dbeafe;
border-radius: 10px;
background: #eff6ff;
padding: 14px;
}
.uploader-name {
overflow: hidden;
color: #1e3a8a;
font-size: 13.5px;
font-weight: 700;
text-overflow: ellipsis;
white-space: nowrap;
}
.uploader-total {
margin-left: auto;
color: #2563eb;
font-size: 20px;
font-weight: 800;
}
.uploader-unit {
color: #64748b;
font-size: 11.5px;
white-space: nowrap;
}
.channel-badge {
font-weight: 600;
}