Files
Neo-ZQYY/apps/miniprogram/miniprogram/utils/mock-data.ts

756 lines
23 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// TODO: 联调时删除此文件,改为真实 API 调用
// ============================================================
// 类型定义
// ============================================================
export type TaskType = 'callback' | 'priority_recall' | 'relationship' | 'high_priority'
/** 备注评分记录 */
export interface Note {
id: string
content: string
tagType: 'customer' | 'coach' | 'system'
tagLabel: string
createdAt: string
/** 满意度评分 0-100 表示未评分 */
score?: number
/** 格式化时间标签(由前端附加) */
timeLabel?: string
}
export interface Task {
id: string
customerName: string
customerAvatar: string
taskType: TaskType
taskTypeLabel: string
deadline: string
heartScore: number
hobbies: string[]
isPinned: boolean
hasNote: boolean
status: 'pending' | 'completed' | 'abandoned'
}
export interface TaskDetail extends Task {
aiAnalysis: { summary: string; suggestions: string[] }
notes: Note[]
lastVisitDate?: string
lastSpendAmount?: number
callbackReason?: string
daysAbsent?: number
spendTrend?: 'up' | 'down' | 'flat'
churnRisk?: 'high' | 'medium' | 'low'
preferences?: string[]
consumptionHabits?: string
socialPreference?: string
}
export interface Note {
id: string
/** 备注正文 */
content: string
/** 标签类型customer=客户备注coach=助教备注 */
tagType: 'customer' | 'coach'
/** 标签文案,如"客户:王先生"、"助教:小燕" */
tagLabel: string
/** 创建时间,展示用格式 */
createdAt: string
}
export interface RetentionClue {
id: string
/** 线索大类 */
category: 'customer_basic' | 'consumption' | 'play_pref' | 'promo_pref' | 'social' | 'feedback'
/** 摘要 */
summary: string
/** 详情 */
detail?: string
/** 线索来源manual=助教手动ai_consumption=系统自动ai_note=备注分析 */
source: 'manual' | 'ai_consumption' | 'ai_note'
/** 记录助教ID用于判断是否为"我" */
recordedByAssistantId?: string
/** 记录助教姓名 */
recordedByName?: string
/** 创建时间 */
createdAt: string
}
export interface PerformanceData {
monthlyIncome: number
incomeChange: number
currentTier: string
nextTierGap: number
todayServiceCount: number
weekServiceCount: number
monthServiceCount: number
}
export interface PerformanceRecord {
id: string
customerName: string
amount: number
date: string
type: string
category: string
}
export interface FinanceMetric {
title: string
value: number
unit: string
trend: 'up' | 'down' | 'flat'
trendValue: string
helpText?: string
}
export interface BoardFinanceData {
metrics: FinanceMetric[]
timeRange: string
filterOptions: Array<{ value: string; text: string }>
}
export interface CustomerCard {
id: string
name: string
avatar: string
heartScore: number
tags: string[]
keyMetric: { label: string; value: string }
}
export interface CoachCard {
id: string
name: string
avatar: string
level: string
keyMetrics: Array<{ label: string; value: string }>
}
export interface CustomerDetail {
id: string
name: string
avatar: string
tags: string[]
heartScore: number
phone: string
spiIndex: number
consumptionRecords: ConsumptionRecord[]
}
export interface ConsumptionRecord {
id: string
date: string
project: string
duration: number
amount: number
coachName: string
}
export interface ChatMessage {
id: string
role: 'user' | 'assistant'
content: string
timestamp: string
referenceCard?: {
type: 'customer' | 'record'
title: string
summary: string
data: Record<string, string>
}
}
export interface ChatHistoryItem {
id: string
title: string
lastMessage: string
timestamp: string
customerName?: string
}
export interface UserProfile {
name: string
avatar: string
role: string
storeName: string
}
// ============================================================
// Mock 数据 — 任务模块
// ============================================================
export const mockTasks: Task[] = [
{
id: 'task-001',
customerName: '张伟',
customerAvatar: '/assets/images/avatar-default.png',
taskType: 'callback',
taskTypeLabel: '回访',
deadline: '2026-03-10',
heartScore: 9.2,
hobbies: ['chinese', 'karaoke'],
isPinned: true,
hasNote: true,
status: 'pending',
},
{
id: 'task-002',
customerName: '李娜',
customerAvatar: '/assets/images/avatar-default.png',
taskType: 'high_priority',
taskTypeLabel: '高优先召回',
deadline: '2026-03-08',
heartScore: 6.5,
hobbies: ['snooker'],
isPinned: false,
hasNote: false,
status: 'pending',
},
{
id: 'task-003',
customerName: '王磊',
customerAvatar: '/assets/images/avatar-default.png',
taskType: 'relationship',
taskTypeLabel: '关系构建',
deadline: '2026-03-12',
heartScore: 7.8,
hobbies: ['chinese', 'mahjong'],
isPinned: false,
hasNote: true,
status: 'pending',
},
{
id: 'task-004',
customerName: '赵敏',
customerAvatar: '/assets/images/avatar-default.png',
taskType: 'callback',
taskTypeLabel: '回访',
deadline: '2026-03-09',
heartScore: 8.8,
hobbies: ['chinese'],
isPinned: false,
hasNote: false,
status: 'pending',
},
{
id: 'task-005',
customerName: '陈浩',
customerAvatar: '/assets/images/avatar-default.png',
taskType: 'priority_recall',
taskTypeLabel: '优先召回',
deadline: '2026-03-07',
heartScore: 4.2,
hobbies: ['snooker', 'karaoke'],
isPinned: true,
hasNote: true,
status: 'pending',
},
{
id: 'task-006',
customerName: '刘洋',
customerAvatar: '/assets/images/avatar-default.png',
taskType: 'relationship',
taskTypeLabel: '关系构建',
deadline: '2026-03-15',
heartScore: 5.0,
hobbies: ['mahjong'],
isPinned: false,
hasNote: false,
status: 'completed',
},
]
export const mockTaskDetails: TaskDetail[] = [
{
...mockTasks[0],
customerName: '王先生',
taskTypeLabel: '高优先召回',
heartScore: 8.5,
aiAnalysis: {
summary: '最近 3 个月每周均有 1-2 次课程互动,客户反馈良好。上次服务评价 5 星,多次指定您为服务助教。',
suggestions: ['询问近期是否有空,邀请体验新到的器材', '告知本周末有会员专属活动', '根据其偏好时段(晚间)推荐合适的时间'],
},
notes: [
{ id: 'note-h5-1', content: '已通过微信联系王先生,表示对新到的斯诺克球桌感兴趣,周末可能来体验。', tagType: 'customer' as const, tagLabel: '客户:王先生', createdAt: '2026-02-05' },
{ id: 'note-h5-2', content: '王先生最近出差较多,到店频率降低。建议等他回来后再约。', tagType: 'customer' as const, tagLabel: '客户:王先生', createdAt: '2026-01-20' },
{ id: 'note-h5-3', content: '上次到店时推荐了会员续费活动,客户说考虑一下。', tagType: 'customer' as const, tagLabel: '客户:王先生', createdAt: '2026-01-08' },
],
notes: [],
lastVisitDate: '2026-03-01',
lastSpendAmount: 380,
callbackReason: '上次体验课后未续费,需跟进意向',
},
{
...mockTasks[1],
aiAnalysis: {
summary: '李娜已 23 天未到店,消费趋势下降,存在流失风险。',
suggestions: ['电话关怀了解原因', '发送专属优惠券', '推荐闺蜜同行活动'],
},
notes: [],
daysAbsent: 23,
spendTrend: 'down',
churnRisk: 'high',
},
{
...mockTasks[2],
aiAnalysis: {
summary: '王磊是中台球爱好者,社交活跃,适合发展为核心会员。',
suggestions: ['邀请参加周末球友赛', '推荐 VIP 会员权益', '介绍同水平球友'],
},
notes: [],
preferences: ['中式台球', '麻将'],
consumptionHabits: '周末下午为主,偏好包厢',
socialPreference: '喜欢组队打球,社交型消费者',
},
]
// ============================================================
// Mock 数据 — 维客线索模块
// ============================================================
// 维客线索 MOCK 数据
// 说明:
// - 后端已过滤,客户端直接使用
// - 任务详情页:后端返回脱敏版本(移除 recordedByAssistantId 和 recordedByName
// - 客户详情页:后端返回完整版本(包含 recordedByAssistantId 和 recordedByName
//
// 以下是任务详情页的 MOCK 数据(脱敏版本)
export const mockRetentionClues: RetentionClue[] = [
{
id: 'clue-001',
category: 'consumption',
summary: '最近 3 个月每周均有 1-2 次课程互动,客户反馈良好',
detail: '上次服务评价 5 星,多次指定您为服务助教。消费频次稳定,主要偏好中式台球 1v1 课程。',
source: 'ai_consumption',
createdAt: '2026-03-05 14:00',
},
{
id: 'clue-002',
category: 'play_pref',
summary: '中式台球爱好者,技术水平中等偏上',
detail: '对斯诺克也有兴趣,建议推荐进阶课程。',
source: 'manual',
recordedByAssistantId: 'assistant-001',
recordedByName: '王芳',
createdAt: '2026-03-01 10:30',
},
{
id: 'clue-003',
category: 'social',
summary: '社交活跃,经常带朋友来店',
detail: '可以发展为核心会员,推荐参加周末球友赛。',
source: 'ai_note',
// 后端脱敏:移除 recordedByAssistantId 和 recordedByName
createdAt: '2026-02-28 16:45',
},
{
id: 'clue-004',
category: 'promo_pref',
summary: '对储值活动敏感,倾向于大额充值',
detail: '上次充值 2000 元,选择尊享套餐。建议定期推送专属优惠。',
source: 'manual',
// 后端脱敏:移除 recordedByAssistantId 和 recordedByName因为不是当前用户
createdAt: '2026-02-25 09:15',
},
]
// 客户详情页的 MOCK 数据(完整版本,不脱敏)
export const mockRetentionCluesForCustomerDetail: RetentionClue[] = [
{
id: 'clue-001',
category: 'consumption',
summary: '最近 3 个月每周均有 1-2 次课程互动,客户反馈良好',
detail: '上次服务评价 5 星,多次指定您为服务助教。消费频次稳定,主要偏好中式台球 1v1 课程。',
source: 'ai_consumption',
createdAt: '2026-03-05 14:00',
},
{
id: 'clue-002',
category: 'play_pref',
summary: '中式台球爱好者,技术水平中等偏上',
detail: '对斯诺克也有兴趣,建议推荐进阶课程。',
source: 'manual',
recordedByAssistantId: 'assistant-001',
recordedByName: '王芳',
createdAt: '2026-03-01 10:30',
},
{
id: 'clue-003',
category: 'social',
summary: '社交活跃,经常带朋友来店',
detail: '可以发展为核心会员,推荐参加周末球友赛。',
source: 'ai_note',
recordedByAssistantId: 'assistant-003',
recordedByName: '李明',
createdAt: '2026-02-28 16:45',
},
{
id: 'clue-004',
category: 'promo_pref',
summary: '对储值活动敏感,倾向于大额充值',
detail: '上次充值 2000 元,选择尊享套餐。建议定期推送专属优惠。',
source: 'manual',
recordedByAssistantId: 'assistant-002',
recordedByName: '刘强',
createdAt: '2026-02-25 09:15',
},
]
// ============================================================
// Mock 数据 — 备注模块
// ============================================================
// mock 数据贴近 H5 原型 notes.html 中的 12 条备注
export const mockNotes: Note[] = [
{
id: 'note-001',
content: '小燕本月表现优秀课时完成率达到120%客户评价全部5星。建议下月提升课时费标准同时安排更多VIP客户给她。',
tagType: 'coach',
tagLabel: '助教:小燕',
createdAt: '2024-11-27 16:00',
},
{
id: 'note-002',
content: '客户今天表示下周有朋友生日聚会想预约包厢。已告知包厢需要提前3天预约客户说会尽快确定时间再联系。',
tagType: 'customer',
tagLabel: '客户:王先生',
createdAt: '2024-11-27 15:30',
},
{
id: 'note-003',
content: '完成高优先召回任务。客户反馈最近工作太忙这周末会来店里。已提醒客户储值卡还有2000元余额下月到期需要续费。',
tagType: 'customer',
tagLabel: '客户:王先生',
createdAt: '2024-11-26 18:45',
},
{
id: 'note-004',
content: 'Lucy最近工作状态很好主动承担了培训新员工的任务。但需要注意她最近加班较多避免过度疲劳。建议适当调整排班。',
tagType: 'coach',
tagLabel: '助教Lucy',
createdAt: '2024-11-26 11:30',
},
{
id: 'note-005',
content: '泡芙本月表现优秀课时完成率达到120%客户评价全部5星。建议下月提升课时费标准。',
tagType: 'customer',
tagLabel: '客户:陈女士',
createdAt: '2024-11-25 10:20',
},
{
id: 'note-006',
content: '泡芙的斯诺克教学水平有明显提升,最近几位客户反馈都很好。可以考虑让她带更多斯诺克方向的课程。',
tagType: 'coach',
tagLabel: '助教:泡芙',
createdAt: '2024-11-25 14:20',
},
{
id: 'note-007',
content: '客户对今天的服务非常满意,特别提到小燕的教学很专业。客户表示会推荐朋友来店里体验。',
tagType: 'customer',
tagLabel: '客户:李女士',
createdAt: '2024-11-24 21:15',
},
{
id: 'note-008',
content: '小燕反馈近期有几位客户希望增加晚间时段的课程建议协调排班增加21:00-23:00时段的助教配置。',
tagType: 'coach',
tagLabel: '助教:小燕',
createdAt: '2024-11-24 09:00',
},
{
id: 'note-009',
content: '关系构建任务完成。与客户进行了30分钟的深入交流了解到客户是企业高管经常需要商务宴请场地。已记录客户需求后续可以推荐团建套餐。',
tagType: 'customer',
tagLabel: '客户:张先生',
createdAt: '2024-11-23 19:30',
},
{
id: 'note-010',
content: '客户今天充值了5000元选择的是尊享套餐。客户提到喜欢安静的环境以后尽量安排包厢。',
tagType: 'customer',
tagLabel: '客户:张先生',
createdAt: '2024-11-22 14:00',
},
{
id: 'note-011',
content: 'Lucy本周请假2天处理家事已安排泡芙和小燕分担她的客户。回来后需要跟进客户交接情况。',
tagType: 'coach',
tagLabel: '助教Lucy',
createdAt: '2024-11-22 10:15',
},
{
id: 'note-012',
content: 'Lucy最近工作状态很好主动承担了培训新员工的任务。但需要注意她最近加班较多避免过度疲劳。',
tagType: 'customer',
tagLabel: '客户:李女士',
createdAt: '2024-11-21 09:45',
},
]
// ============================================================
// Mock 数据 — 绩效模块
// ============================================================
export const mockPerformance: PerformanceData = {
monthlyIncome: 12680,
incomeChange: 15.3,
currentTier: '银牌助教',
nextTierGap: 3320,
todayServiceCount: 4,
weekServiceCount: 18,
monthServiceCount: 67,
}
export const mockPerformanceRecords: PerformanceRecord[] = [
{ id: 'pr-001', customerName: '张伟', amount: 380, date: '2026-03-05', type: '课时', category: '中式台球' },
{ id: 'pr-002', customerName: '李娜', amount: 200, date: '2026-03-04', type: '散客', category: '斯诺克' },
{ id: 'pr-003', customerName: '王磊', amount: 1500, date: '2026-03-03', type: '储值', category: '会员充值' },
{ id: 'pr-004', customerName: '赵敏', amount: 280, date: '2026-03-02', type: '课时', category: '中式台球' },
{ id: 'pr-005', customerName: '陈浩', amount: 150, date: '2026-03-01', type: '散客', category: '中式台球' },
{ id: 'pr-006', customerName: '刘洋', amount: 320, date: '2026-02-28', type: '课时', category: '斯诺克' },
{ id: 'pr-007', customerName: '张伟', amount: 2000, date: '2026-02-25', type: '储值', category: '会员充值' },
]
// ============================================================
// Mock 数据 — 看板模块
// ============================================================
export const mockBoardFinance: BoardFinanceData = {
metrics: [
{
title: '本月营收',
value: 86500,
unit: '元',
trend: 'up',
trendValue: '+12.5%',
helpText: '包含课时费、散客消费、储值充值等所有收入',
},
{
title: '本月支出',
value: 34200,
unit: '元',
trend: 'down',
trendValue: '-3.2%',
helpText: '包含人工、水电、耗材等运营成本',
},
{
title: '净利润',
value: 52300,
unit: '元',
trend: 'up',
trendValue: '+22.1%',
},
{
title: '客单价',
value: 186,
unit: '元',
trend: 'flat',
trendValue: '+0.5%',
helpText: '本月平均每位客户消费金额',
},
],
timeRange: '2026-03',
filterOptions: [
{ value: 'today', text: '今日' },
{ value: 'week', text: '本周' },
{ value: 'month', text: '本月' },
{ value: 'quarter', text: '本季度' },
],
}
export const mockCustomers: CustomerCard[] = [
{
id: 'cust-001',
name: '张伟',
avatar: '/assets/images/avatar-default.png',
heartScore: 9.2,
tags: ['VIP', '中式台球'],
keyMetric: { label: '本月消费', value: '¥2,380' },
},
{
id: 'cust-002',
name: '李娜',
avatar: '/assets/images/avatar-default.png',
heartScore: 6.5,
tags: ['斯诺克'],
keyMetric: { label: '本月消费', value: '¥680' },
},
{
id: 'cust-003',
name: '王磊',
avatar: '/assets/images/avatar-default.png',
heartScore: 7.8,
tags: ['中式台球', '麻将'],
keyMetric: { label: '本月消费', value: '¥1,500' },
},
{
id: 'cust-004',
name: '赵敏',
avatar: '/assets/images/avatar-default.png',
heartScore: 8.8,
tags: ['中式台球', '新客'],
keyMetric: { label: '本月消费', value: '¥280' },
},
{
id: 'cust-005',
name: '陈浩',
avatar: '/assets/images/avatar-default.png',
heartScore: 4.2,
tags: ['斯诺克', 'K歌'],
keyMetric: { label: '本月消费', value: '¥150' },
},
]
export const mockCoaches: CoachCard[] = [
{
id: 'coach-001',
name: '李明',
avatar: '/assets/images/avatar-default.png',
level: '金牌助教',
keyMetrics: [
{ label: '本月课时', value: '86 节' },
{ label: '本月收入', value: '¥18,600' },
{ label: '服务客户', value: '32 人' },
],
},
{
id: 'coach-002',
name: '王芳',
avatar: '/assets/images/avatar-default.png',
level: '银牌助教',
keyMetrics: [
{ label: '本月课时', value: '67 节' },
{ label: '本月收入', value: '¥12,680' },
{ label: '服务客户', value: '25 人' },
],
},
{
id: 'coach-003',
name: '刘强',
avatar: '/assets/images/avatar-default.png',
level: '铜牌助教',
keyMetrics: [
{ label: '本月课时', value: '45 节' },
{ label: '本月收入', value: '¥8,200' },
{ label: '服务客户', value: '18 人' },
],
},
]
// ============================================================
// Mock 数据 — 客户详情模块
// ============================================================
export const mockCustomerDetail: CustomerDetail = {
id: 'cust-001',
name: '张伟',
avatar: '/assets/images/avatar-default.png',
tags: ['VIP', '中式台球', '老客户'],
heartScore: 9.2,
phone: '138****6789',
spiIndex: 87,
consumptionRecords: [
{ id: 'cr-001', date: '2026-03-05', project: '中式台球 1v1', duration: 90, amount: 380, coachName: '王芳' },
{ id: 'cr-002', date: '2026-03-01', project: '斯诺克练习', duration: 60, amount: 200, coachName: '李明' },
{ id: 'cr-003', date: '2026-02-25', project: '中式台球 1v1', duration: 120, amount: 480, coachName: '王芳' },
{ id: 'cr-004', date: '2026-02-20', project: '会员充值', duration: 0, amount: 2000, coachName: '-' },
{ id: 'cr-005', date: '2026-02-15', project: '中式台球小组课', duration: 90, amount: 280, coachName: '刘强' },
],
}
// ============================================================
// Mock 数据 — 对话模块
// ============================================================
export const mockChatMessages: ChatMessage[] = [
{
id: 'msg-001',
role: 'user',
content: '帮我看看张伟最近的消费情况',
timestamp: '2026-03-05T14:00:00+08:00',
referenceCard: {
type: 'customer',
title: '张伟 — 消费概览',
summary: '近 30 天消费 3 次,总额 ¥1,060',
data: {
'最近到店': '2026-03-05',
'偏好项目': '中式台球 1v1',
'常约助教': '王芳',
'爱心评分': '9.2',
},
},
},
{
id: 'msg-002',
role: 'assistant',
content: '张伟最近一个月消费了 3 次,总金额 ¥1,060。消费频次稳定主要偏好中式台球 1v1 课程。',
timestamp: '2026-03-05T14:00:05+08:00',
},
{
id: 'msg-003',
role: 'user',
content: '他适合推荐什么课程?',
timestamp: '2026-03-05T14:01:00+08:00',
},
{
id: 'msg-004',
role: 'assistant',
content: '根据张伟的消费习惯和技术水平,建议推荐以下课程:\n1. 斯诺克进阶课 — 拓展球类兴趣\n2. 中式台球高级技巧班 — 提升现有水平\n3. 周末球友赛 — 增强社交粘性',
timestamp: '2026-03-05T14:01:08+08:00',
},
{
id: 'msg-005',
role: 'user',
content: '好的,帮我记一下,下次回访时推荐斯诺克进阶课',
timestamp: '2026-03-05T14:02:00+08:00',
},
{
id: 'msg-006',
role: 'assistant',
content: '已记录。下次回访张伟时,我会提醒你推荐斯诺克进阶课程。',
timestamp: '2026-03-05T14:02:03+08:00',
},
]
export const mockChatHistory: ChatHistoryItem[] = [
{
id: 'chat-001',
title: '张伟消费分析',
lastMessage: '已记录。下次回访张伟时,我会提醒你推荐斯诺克进阶课程。',
timestamp: '2026-03-05T14:02:03+08:00',
customerName: '张伟',
},
{
id: 'chat-002',
title: '本周业绩汇总',
lastMessage: '本周总收入 ¥18,600环比上周增长 8.3%。',
timestamp: '2026-03-04T09:30:00+08:00',
},
{
id: 'chat-003',
title: '李娜召回策略',
lastMessage: '建议发送专属优惠券并电话关怀,了解未到店原因。',
timestamp: '2026-03-03T16:00:00+08:00',
customerName: '李娜',
},
{
id: 'chat-004',
title: '新客户接待建议',
lastMessage: '首次到店客户建议安排体验课,重点介绍会员权益。',
timestamp: '2026-03-02T11:20:00+08:00',
},
]
// ============================================================
// Mock 数据 — 用户信息
// ============================================================
export const mockUserProfile: UserProfile = {
name: '小燕',
avatar: '/assets/images/avatar-coach.png',
role: '助教',
storeName: '朗朗桌球',
}