feat: show event-backed report funnel

This commit is contained in:
malei 2026-08-01 22:29:20 +08:00
parent 9d59d72124
commit 1dce8e94d0
2 changed files with 18 additions and 7 deletions

View File

@ -33,6 +33,9 @@ export const getLeads = (status = 'pending') =>
export const getServiceCustomers = (params: Record<string, unknown> = {}) =>
apiGet('/admin/service-customers', params)
export const getWorkbenchReportFunnel = (date?: string) =>
apiGet('/admin/workbench/report-funnel', date ? { date } : {})
export const getAdminStore = () => apiGet<Record<string, unknown>>('/admin/store')
export const updateStore = (data: Record<string, unknown>) => apiPut('/store/update', data)

View File

@ -57,7 +57,7 @@
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { getAppointmentList, getLeads, getReportList } from '@/api'
import { getAppointmentList, getLeads, getReportList, getWorkbenchReportFunnel } from '@/api'
import { isHighlightProcessingStale } from '@/utils/publicLinks'
const SUPPRESS_KEY = 'petstore_admin_todo_suppress_date'
@ -69,7 +69,9 @@ const pendingLead = ref(0)
const highlightFailed = ref(0)
const pendingReport = ref(0)
const todayReports = ref(0)
const openedReports = ref(0)
const todayLeads = ref(0)
const rebookCount = ref<number | null>(null)
const todoDialog = ref(false)
const suppressToday = ref(false)
@ -82,10 +84,11 @@ function isSameDay(iso?: string | null) {
}
onMounted(async () => {
const [apptRes, reportRes, leadRes] = await Promise.all([
const [apptRes, reportRes, leadRes, funnelRes] = await Promise.all([
getAppointmentList({ page: 1, pageSize: 200 }),
getReportList({ page: 1, pageSize: 200 }),
getLeads('pending'),
getWorkbenchReportFunnel(todayStr),
])
const appts = Array.isArray(apptRes.data) ? apptRes.data as Array<Record<string, unknown>> : []
const reports = Array.isArray(reportRes.data) ? reportRes.data as Array<Record<string, unknown>> : []
@ -98,8 +101,13 @@ onMounted(async () => {
const d = l.remindDate as string | undefined
return !d || d <= todayStr
}).length
todayLeads.value = leads.filter((l) => isSameDay(l.createTime as string)).length
todayReports.value = reports.filter((r) => isSameDay(r.createTime as string)).length
const eventFunnel = (funnelRes.data || {}) as Record<string, unknown>
todayReports.value = Number(eventFunnel.reportSubmittedCount || 0)
openedReports.value = Number(eventFunnel.reportOpenedCount || 0)
todayLeads.value = Number(eventFunnel.leadSubmittedCount || 0)
rebookCount.value = eventFunnel.rebookTrackingReady === true
? Number(eventFunnel.rebookCreatedCount || 0)
: null
highlightFailed.value = reports.filter(
(r) =>
r.highlightVideoStatus === 'failed' ||
@ -127,10 +135,10 @@ const todos = computed(() => [
])
const funnel = computed(() => [
{ label: '今日已报告', value: todayReports.value },
{ label: '已打开', value: '—' },
{ label: '今日已提交报告', value: todayReports.value },
{ label: '已打开', value: openedReports.value },
{ label: '已留资', value: todayLeads.value },
{ label: '报告转预约', value: '—' },
{ label: '报告转预约', value: rebookCount.value ?? '—' },
])
function go(to: { path: string; query?: Record<string, string | undefined> }) {