feat: anchor customer view on store master

This commit is contained in:
malei 2026-08-01 21:56:07 +08:00
parent daa8744db4
commit 9d59d72124

View File

@ -13,7 +13,7 @@
<el-input v-model="q" clearable placeholder="姓名 / 手机 / 宠物名" style="width: 220px" /> <el-input v-model="q" clearable placeholder="姓名 / 手机 / 宠物名" style="width: 220px" />
<el-button type="primary" @click="load">查询</el-button> <el-button type="primary" @click="load">查询</el-button>
</div> </div>
<el-table :data="rows" v-loading="loading" stripe> <el-table :data="rows" v-loading="loading" row-key="storeCustomerId" stripe>
<el-table-column prop="displayName" label="客户" width="120" /> <el-table-column prop="displayName" label="客户" width="120" />
<el-table-column prop="phoneMasked" label="手机" width="140" /> <el-table-column prop="phoneMasked" label="手机" width="140" />
<el-table-column label="宠物" min-width="160"> <el-table-column label="宠物" min-width="160">
@ -23,7 +23,9 @@
</el-table-column> </el-table-column>
<el-table-column prop="lastVisitAt" label="最近到店" min-width="160" /> <el-table-column prop="lastVisitAt" label="最近到店" min-width="160" />
<el-table-column prop="leadStatus" label="留资状态" width="100" /> <el-table-column prop="leadStatus" label="留资状态" width="100" />
<el-table-column prop="source" label="来源" width="140" /> <el-table-column label="来源" width="140">
<template #default="{ row }">{{ formatSource(row.source) }}</template>
</el-table-column>
<el-table-column label="操作" width="200" fixed="right"> <el-table-column label="操作" width="200" fixed="right">
<template #default="{ row }"> <template #default="{ row }">
<el-button link type="primary" @click="openDetail(row)">详情</el-button> <el-button link type="primary" @click="openDetail(row)">详情</el-button>
@ -38,7 +40,9 @@
<el-descriptions :column="1" border> <el-descriptions :column="1" border>
<el-descriptions-item label="姓名">{{ current.displayName }}</el-descriptions-item> <el-descriptions-item label="姓名">{{ current.displayName }}</el-descriptions-item>
<el-descriptions-item label="手机">{{ current.phoneMasked }}</el-descriptions-item> <el-descriptions-item label="手机">{{ current.phoneMasked }}</el-descriptions-item>
<el-descriptions-item label="来源">{{ current.source }}</el-descriptions-item> <el-descriptions-item label="首次来源">{{ formatOriginSource(current.originSource) }}</el-descriptions-item>
<el-descriptions-item label="首次接触">{{ current.firstContactAt || '—' }}</el-descriptions-item>
<el-descriptions-item label="最近接触">{{ current.lastContactAt || '—' }}</el-descriptions-item>
<el-descriptions-item label="最近到店">{{ current.lastVisitAt || '—' }}</el-descriptions-item> <el-descriptions-item label="最近到店">{{ current.lastVisitAt || '—' }}</el-descriptions-item>
<el-descriptions-item label="留资">{{ current.leadStatus || '—' }}</el-descriptions-item> <el-descriptions-item label="留资">{{ current.leadStatus || '—' }}</el-descriptions-item>
<el-descriptions-item label="宠物"> <el-descriptions-item label="宠物">
@ -60,6 +64,7 @@ import { useRouter } from 'vue-router'
import { getServiceCustomers } from '@/api' import { getServiceCustomers } from '@/api'
type CustomerRow = { type CustomerRow = {
storeCustomerId: number
userId?: number | null userId?: number | null
displayName?: string displayName?: string
phoneMasked?: string phoneMasked?: string
@ -69,6 +74,9 @@ type CustomerRow = {
leadStatus?: string leadStatus?: string
hasPendingLead?: boolean hasPendingLead?: boolean
source?: string source?: string
originSource?: string
firstContactAt?: string
lastContactAt?: string
} }
const router = useRouter() const router = useRouter()
@ -116,6 +124,21 @@ function goLead() {
router.push({ path: '/leads', query: { due: 'today' } }) router.push({ path: '/leads', query: { due: 'today' } })
} }
function formatSource(value?: string) {
if (value === 'appointment+lead') return '预约 + 报告留资'
if (value === 'appointment') return '预约'
if (value === 'lead') return '报告留资'
return '—'
}
function formatOriginSource(value?: string) {
if (value === 'customer_booking') return '宠主自助预约'
if (value === 'assisted_booking') return '门店代客预约'
if (value === 'report_lead') return '报告留资'
if (value === 'appointment') return '历史预约'
return '—'
}
onMounted(load) onMounted(load)
</script> </script>