mock.ts
6.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
import type {
PrelearningActionResponse,
PrelearningActionState,
PrelearningActionType,
PrelearningInitPayload,
PrelearningInitResponse,
ProductType,
} from '@single-pages/contracts';
function getProductType(payload: PrelearningInitPayload): ProductType {
return payload.activityProductId.endsWith('9') ? 0 : 1;
}
function getMockCaseId(activityProductId: string): string {
const parsedActivityProductId = Number.parseInt(activityProductId, 10);
if (Number.isFinite(parsedActivityProductId)) {
return String(parsedActivityProductId * 10);
}
return '900001';
}
function getMockActionState(payload: PrelearningInitPayload): PrelearningActionState {
if (payload.entrySource === 'home_popup') {
return {
actionType: 'learn_next',
buttonLabel: '继续学习下个套餐',
disabled: false,
};
}
return {
actionType: 'complete',
buttonLabel: '完成学习',
disabled: false,
};
}
export function createMockPrelearningResponse(payload: PrelearningInitPayload): PrelearningInitResponse {
const productType = getProductType(payload);
const isPackage = productType === 0;
return {
sessionId: `debug-${payload.activityId}-${payload.activityProductId}`,
productType,
activityProduct: {
activityId: Number(payload.activityId),
activityProductId: payload.activityProductId,
productType,
tabName: isPackage ? '推荐套餐' : '商品主推',
tabDescription: isPackage ? 'AITO 春醒悦享高端车衣套餐,突出守护车漆和长期省心。' : '浏览器调试商品模型',
goodsCode: isPackage ? '' : `goods-${payload.activityProductId}`,
packageCode: isPackage ? `package-${payload.activityProductId}` : '',
goodsType: isPackage ? null : 2,
goodsTypeName: isPackage ? null : '精品',
mainImageUrl: 'https://example.com/main.png',
thumbImageUrl: 'https://example.com/thumb.png',
detailImageUrl: 'https://example.com/detail.png',
currentPrice: isPackage ? '10888.00' : '699.00',
minimumPrice: isPackage ? '8888.00' : '599.00',
discountPrice: isPackage ? '9888.00' : '599.00',
salesIncentive: isPackage ? '400.00' : '30.00',
isMainPush: true,
},
script: {
caseId: getMockCaseId(payload.activityProductId),
title: isPackage ? 'AITO 春醒悦享高端车衣套餐剧本' : '商品话术预学习',
packageInfo: {
name: isPackage ? '[套餐] AITO 春醒悦享高端车衣套餐' : '精品车载好物',
oldPrice: isPackage ? '12888.00' : '799.00',
newPrice: isPackage ? '10888.00' : '699.00',
includes: isPackage ? ['前挡保护', '车身全覆盖', '施工质保'] : [],
imageUrl: 'https://example.com/package.png',
},
profile: {
name: '吴万宇',
type: isPackage ? '同行竞争少' : '商品偏好',
car: 'AITO 问界 M7',
job: '企业主',
family: '三口之家',
behavior: '重视品质与长期价值',
objections: ['价格有点高', '朋友推荐了其他品牌', '担心施工影响质保'],
needs: isPackage
? ['刚提车需要整车保护', '关注施工品质和售后质保', '希望价格透明、服务省心']
: ['想先了解商品效果'],
includes: ['延长保修', '施工质保'],
},
gameSteps: [
{
kind: 'normal',
stageName: '开场破冰与基础介绍',
stageSummary: '核心动作:先确认客户关注点,说明车衣能保护新车漆面状态,并建立套餐会从材质、施工和质保三方面展开介绍。',
audioStartTime: '00:00',
audioEndTime: '01:29',
},
{
kind: 'highlight',
stageName: '异议处理:正面回应“外包论”与熟人竞争',
stageSummary: '引导客户把比较点从单纯价格转到施工标准、售后保障和长期用车风险。',
audioStartTime: '01:30',
audioEndTime: '02:18',
highlightTitle: '话术高光',
prompt: '客户对价格有了担心,也提到朋友那边可能便宜很多。',
dialogue: '我不是看便宜,你们贵是不是外面贴完再拿回来,后面出问题是不是没人管?',
salesPitch: '咱们这套车衣是门店标准施工,材料、施工和质保都能追溯。您比较价格时,也要把后续起边、发黄、补贴和质保响应一起算进去。',
analysis: '先承接客户对价格和熟人渠道的担忧,再把决策标准拉回可验证的服务与质保,降低客户只按价格比较的概率。',
},
{
kind: 'normal',
stageName: '合规促单与邀约交接',
stageSummary: '总结套餐价值,确认客户对施工周期、质保和价格是否还有疑问,并引导进入后续到店确认。',
audioStartTime: '02:19',
audioEndTime: '03:47',
},
],
},
actionState: getMockActionState(payload),
};
}
export function createMockPrelearningActionResponse(
currentResponse: PrelearningInitResponse,
actionType: PrelearningActionType,
): PrelearningActionResponse {
if (actionType === 'learn_next') {
const nextActivityProductId = `${currentResponse.activityProduct.activityProductId}-next`;
const nextPayload: PrelearningInitPayload = {
entrySource: 'home_popup',
activityId: String(currentResponse.activityProduct.activityId),
activityProductId: nextActivityProductId,
staffName: '调试员工',
staffUuid: 'debug-staff-001',
merchantId: 'debug-merchant-001',
caseId: getMockCaseId(nextActivityProductId),
};
return {
...createMockPrelearningResponse(nextPayload),
sessionId: currentResponse.sessionId,
};
}
if (actionType === 'view_other') {
return {
...currentResponse,
actionState: {
actionType: 'view_other',
buttonLabel: '查看其他案例',
disabled: false,
toastMessage: '您已经看完所有实战案例了,快去实战中大显身手吧!',
},
notice: '您已经看完所有实战案例了,快去实战中大显身手吧!',
};
}
return {
...currentResponse,
actionState: {
actionType: 'view_other',
buttonLabel: '查看其他案例',
disabled: false,
},
};
}