index.vue
19 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
<template>
<div
class="customer-file-page flex-1 overflow-y-auto pb-24"
v-if="flag"
>
<div class="header-section bg-gradient-to-r from-blue-500 to-blue-600 p-5 pb-8 text-white rounded-b-2xl shadow-sm relative">
<h2 class="text-lg font-bold flex items-center gap-2">
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="20"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="text-blue-100"
aria-hidden="true"
>
<path d="M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z"></path>
<path d="M20 2v4"></path>
<path d="M22 4h-4"></path>
<circle
cx="4"
cy="20"
r="2"
></circle>
</svg>
完善轻改客户档案
</h2>
<p class="text-blue-100 text-xs mt-1.5 opacity-90 mb-4">请根据刚刚的接待情况,补全以下信息</p>
<customer-info-card :info="customerInfo" />
</div>
<div class="content-section px-4 -mt-4 space-y-4 relative z-10">
<div class="form-card bg-white p-4 rounded-xl shadow-sm border border-gray-100">
<div class="flex items-center gap-2 mb-4">
<div class="w-1 h-4 bg-blue-600 rounded-full"></div>
<h3 class="font-semibold text-gray-800 text-[15px]">接待反馈</h3>
</div>
<div class="space-y-5">
<div>
<label class="text-sm text-gray-600 font-medium">接待结果 <span class="text-red-500">*</span></label>
<div class="flex flex-wrap gap-2.5 mt-2">
<button
v-for="item in receptionResult"
:key="item.value"
:disabled="formReadonly"
:class="['px-6 py-1.5 rounded-full text-[13px] transition-all duration-200 border font-medium',
(formData.receptionResult === item.value ? (item.value === 0 ? 'bg-green-500 text-white border-green-500 shadow-sm' : 'bg-red-500 text-white border-red-500 shadow-sm') : 'bg-gray-50 text-gray-600 border-gray-200 active:bg-gray-100')]"
@click="updateForm('receptionResult', item.value)"
>{{ item.label }}</button>
</div>
</div>
<div
v-if="formData.receptionResult === 0"
class="pt-1"
>
<div class="flex items-center gap-1.5 mb-2">
<label class="text-sm text-gray-600 font-medium">成交归因 <span class="text-red-500">*</span></label>
<info-icon @click="showGuide('deal')" />
</div>
<div class="flex flex-wrap gap-2.5">
<button
v-for="item in transactionReasons"
:key="item.value"
:disabled="formReadonly"
:class="['px-4 py-1.5 rounded-full text-[13px] transition-all duration-200 border',
(formData.dealAttribution === item.value ? 'bg-blue-600 text-white border-blue-600 font-medium' : 'bg-gray-50 text-gray-600 border-gray-200 active:bg-gray-100')]"
@click="updateForm('dealAttribution', item.value)"
>{{ item.label }}</button>
</div>
</div>
<div
v-if="formData.receptionResult === 1"
class="pt-1"
>
<div class="flex items-center gap-1.5 mb-2">
<label class="text-sm text-gray-600 font-medium">战败归因 <span class="text-red-500">*</span></label>
<info-icon @click="showGuide('defeat')" />
</div>
<div class="flex flex-wrap gap-2.5">
<button
v-for="item in defeatReasons"
:key="item.value"
:disabled="formReadonly"
:class="['px-4 py-1.5 rounded-full text-[13px] transition-all duration-200 border',
(formData.loseReason === item.value ? 'bg-blue-600 text-white border-blue-600 font-medium' : 'bg-gray-50 text-gray-600 border-gray-200 active:bg-gray-100')]"
@click="updateForm('loseReason', item.value)"
>{{ item.label }}</button>
</div>
</div>
</div>
</div>
<div class="form-card bg-white p-4 rounded-xl shadow-sm border border-gray-100">
<div class="flex items-center gap-2 mb-4">
<div class="w-1 h-4 bg-blue-600 rounded-full"></div>
<h3 class="font-semibold text-gray-800 text-[15px]">客户画像</h3>
</div>
<div class="space-y-5">
<option-group
v-for="item in customerProfileFields"
:key="item.field"
:label="item.label"
:required="item.required"
:options="item.options"
:field="item.field"
:value="formData[item.field]"
:readonly="formReadonly"
@select="updateForm"
/>
</div>
</div>
<div class="form-card bg-white p-4 rounded-xl shadow-sm border border-gray-100">
<div class="flex items-center gap-2 mb-4">
<div class="w-1 h-4 bg-blue-600 rounded-full"></div>
<h3 class="font-semibold text-gray-800 text-[15px]">购车基础信息</h3>
</div>
<div class="space-y-5">
<option-group
v-for="item in purchaseInfoFields"
:key="item.field"
:label="item.label"
:required="item.required"
:options="item.options"
:field="item.field"
:value="formData[item.field]"
:readonly="formReadonly"
@select="updateForm"
/>
</div>
</div>
<div class="form-card bg-white p-4 rounded-xl shadow-sm border border-gray-100">
<div class="flex items-center gap-2 mb-4">
<div class="w-1 h-4 bg-blue-600 rounded-full"></div>
<h3 class="font-semibold text-gray-800 text-[15px]">轻改精品意向</h3>
</div>
<div class="space-y-5">
<div>
<label class="text-sm text-gray-600 font-medium">购车时加装项目 <span class="text-xs text-gray-400 font-normal ml-1">(多选)</span></label>
<div class="flex flex-wrap gap-2.5 mt-2">
<button
v-for="item in installItems"
:key="item.value"
:disabled="formReadonly"
:class="['px-4 py-1.5 rounded-full text-[13px] transition-all duration-200 border',
(formData.installItems.includes(+item.value) ? 'bg-blue-600 text-white border-blue-600 font-medium' : 'bg-gray-50 text-gray-600 border-gray-200 active:bg-gray-100')]"
@click="toggleMulti('installItems', item.value)"
>{{ item.label }}</button>
</div>
</div>
<div class="p-3 bg-gray-50 rounded-lg border border-gray-100">
<label class="text-sm text-gray-700 font-medium block mb-2">赠送精品项目 <span class="text-xs text-gray-400 font-normal ml-1">(多选)</span></label>
<div class="flex flex-wrap gap-2.5">
<button
v-for="item in giftItems"
:key="item.value"
:disabled="formReadonly"
:class="['px-4 py-1.5 rounded-full text-[13px] transition-all duration-200 border',
(formData.giftItems.includes(+item.value) ? 'bg-blue-600 text-white border-blue-600 font-medium' : 'bg-gray-50 text-gray-600 border-gray-200 active:bg-gray-100')]"
@click="toggleMulti('giftItems', item.value)"
>{{ item.label }}</button>
</div>
<div
v-if="formData.giftItems.includes(5)"
class="mt-3 pt-3 border-t border-gray-200"
>
<label class="text-sm text-gray-700 font-medium block mb-2">窗膜品牌 <span class="text-red-500">*</span></label>
<input
:disabled="formReadonly"
maxlength="10"
v-model="formData.filmBrand"
type="text"
placeholder="如:龙膜、3M等"
class="w-full px-3 py-2.5 text-sm border border-gray-300 rounded-lg focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 transition-all"
/>
</div>
</div>
<option-group
label="是否了解其它品牌精品"
:options="knowOtherBrandGoods"
field="knowOtherBrandGoods"
:value="formData.knowOtherBrandGoods"
:readonly="formReadonly"
@select="updateForm"
/>
</div>
</div>
</div>
<div
class="fixed bottom-0 left-0 right-0 z-10 p-4 bg-white border-t border-gray-200 shadow-lg"
v-if="!formReadonly"
>
<button
:class="['w-full py-3 px-6 text-[15px] font-medium rounded-xl transition-all duration-200',
isFormValid
? 'bg-blue-400 text-white active:scale-95 hover:bg-blue-500'
: 'bg-gray-200 text-gray-400 cursor-not-allowed']"
:disabled="!isFormValid"
@click="submitForm"
>
提交档案
</button>
</div>
<attribution-guide
:visible="showAttributionGuide"
:title="guideType === 'deal' ? '成交类型定义说明' : '战败类型定义说明'"
:descriptions="guideType === 'deal' ? dealAttributionDescriptions : defeatReasonDescriptions"
@close="closeGuide"
/>
</div>
</template>
<script>
import InfoIcon from './components/InfoIcon.vue'
import OptionGroup from './components/OptionGroup.vue'
import CustomerInfoCard from './components/CustomerInfoCard.vue'
import AttributionGuide from './components/AttributionGuide.vue'
import { customerApi } from '@/api'
import dayjs from 'dayjs'
import { Notify } from 'vant'
export default {
name: 'CustomerFile',
components: { InfoIcon, OptionGroup, CustomerInfoCard, AttributionGuide },
computed: {
isFormValid () {
const { receptionResult, dealAttribution, loseReason, carUserType, isMortgage, purchaseBackground, giftItems, filmBrand } = this.formData
if (receptionResult === 0) {
const baseValid = !!(receptionResult !== null && dealAttribution != null && carUserType !== null && isMortgage !== null && purchaseBackground !== null)
const filmBrandValid = giftItems.includes(5) ? !!filmBrand : true
return baseValid && filmBrandValid
} else if (receptionResult === 1) {
const baseValid = !!(receptionResult !== null && loseReason != null && carUserType !== null && isMortgage !== null && purchaseBackground !== null)
const filmBrandValid = giftItems.includes(5) ? !!filmBrand : true
return baseValid && filmBrandValid
}
return false
}
},
data () {
return {
flag: false,
formReadonly: false,
receptionId: '',
phone: '',
customerInfo: { customerName: '', phoneNumber: '', carBrand: '', receptionStartTime: '' },
formData: {
receptionResult: null, dealAttribution: '', loseReason: '', carUserType: null,
customerBackground: '', easyCommunication: '', isMortgage: null, downPaymentRatio: '',
purchaseBackground: null, isLocalUse: '', purchasePurpose: '',
installItems: [], giftItems: [], knowOtherBrandGoods: '', filmBrand: ''
},
receptionResult: [{ label: '成 交', value: 0 }, { label: '战 败', value: 1 }],
transactionReasons: [
{ label: '自然成交', value: 0 },
{ label: '活动成交', value: 1 },
{ label: '对比成交', value: 2 },
{ label: '引导成交', value: 3 },
{ label: '口碑成交', value: 4 },
{ label: '培育成交', value: 5 }
],
defeatReasons: [
{ label: '价格战败', value: 0 },
{ label: '竞品战败', value: 1 },
{ label: '产品战败', value: 2 },
{ label: '需求战败', value: 3 },
{ label: '决策战败', value: 4 },
{ label: '服务战败', value: 5 },
{ label: '其他战败', value: 6 }
],
customerProfileFields: [
{
label: '用车人', field: 'carUserType', required: true, options: [
{ label: '主人本人', value: 0 },
{ label: '公司户', value: 1 },
{ label: '代办', value: 2 },
{ label: '决策者', value: 3 }
]
},
{
label: '客户背景', field: 'customerBackground', required: false, options: [
{ label: '企业老板', value: 0 },
{ label: '老师', value: 1 },
{ label: '医生', value: 2 },
{ label: '建筑', value: 3 },
{ label: '个体', value: 4 },
{ label: '自由职业', value: 5 },
{ label: '其他', value: 6 }
]
},
{ label: '是否好沟通', field: 'easyCommunication', required: false, options: [{ label: '是', value: 0 }, { label: '否', value: 1 }] }
],
purchaseInfoFields: [
{ label: '是否按揭', field: 'isMortgage', required: true, options: [{ label: '是', value: 0 }, { label: '否', value: 1 }] },
{
label: '首付比例', field: 'downPaymentRatio', required: false, options: [
{ label: '全款', value: 0 },
{ label: '50%', value: 1 },
{ label: '零首付', value: 2 }
]
},
{ label: '购车背景', field: 'purchaseBackground', required: true, options: [{ label: '首购', value: 0 }, { label: '增购', value: 1 }] },
{ label: '是否本地用车', field: 'isLocalUse', required: false, options: [{ label: '本地', value: 0 }, { label: '外地', value: 1 }] },
{ label: '购车用途', field: 'purchasePurpose', required: false, options: [{ label: '公司车', value: 0 }, { label: '家庭用车', value: 1 }] }
],
installItems: [
{ label: '零重力座椅', value: 0 },
{ label: '轮毂', value: 1 },
{ label: '内饰', value: 2 },
{ label: '玻璃', value: 3 }
],
giftItems: [
{ label: '脚垫', value: 0 },
{ label: '车衣', value: 1 },
{ label: '底盘护板', value: 2 },
{ label: '电动踏板', value: 3 },
{ label: '小桌板', value: 4 },
{ label: '窗膜', value: 5 }
],
knowOtherBrandGoods: [{ label: '是', value: 0 }, { label: '否', value: 1 }],
showAttributionGuide: false,
guideType: '',
dealAttributionDescriptions: [
{ label: '自然成交', description: '需求明确,主动到店/咨询,无过多犹豫,快速下单。' },
{ label: '活动成交', description: '受促销、限时优惠、团购、节日政策刺激成交。' },
{ label: '对比成交', description: '经多品牌/多商家比价后,认可我方优势成交。' },
{ label: '引导成交', description: '需求模糊、决策犹豫,经销售专业引导后成交。' },
{ label: '口碑成交', description: '老客户转介绍、亲友推荐、口碑影响成交。' },
{ label: '培育成交', description: '长期跟进、多次沟通,逐步建立信任后成交。' }
],
defeatReasonDescriptions: [
{ label: '价格战败', description: '预算不足、认为价格偏高,或竞品价格更低。' },
{ label: '竞品战败', description: '最终选择其他品牌/商家,认可对方优势。' },
{ label: '产品战败', description: '对配置、性能、外观、品质、售后不满意。' },
{ label: '需求战败', description: '需求变更、暂缓购买、取消计划、资金问题。' },
{ label: '决策战败', description: '自身犹豫不定,或受家人/朋友反对未下单。' },
{ label: '服务战败', description: '接待不专业、响应慢、体验差、承诺未兑现。' },
{ label: '其他战败', description: '非以上原因,如突发状况、异地、流程问题等。' }
]
}
},
mounted () {
const { receptionId, phone } = this.$route.query
this.receptionId = receptionId
this.phone = phone
if (receptionId != null || receptionId != undefined) this.getCustomerFileDetail()
},
methods: {
async getCustomerFileDetail () {
try {
this.showLoading('加载中...')
const data = await customerApi.getCustomerFileDetail({
receptionId: this.receptionId
})
this.hideLoading()
let { formData, customerInfo } = this
Object.keys(formData).forEach(key => {
let value = data[key]
if (key == 'installItems' || key == 'giftItems') value = value != null ? value.split(',').map(v => Number(v)) : []
formData[key] = value
})
Object.keys(customerInfo).forEach(key => {
if (key == 'receptionStartTime' && data[key]) data[key] = dayjs(data[key]).format('HH:mm:ss')
customerInfo[key] = data[key] || ''
})
if (data.submitStatus) this.formReadonly = true
this.formData = formData
this.customerInfo = customerInfo
this.flag = true
} catch (error) {
this.hideLoading()
Notify(error?.message)
}
},
updateForm (field, value) {
if (field === 'receptionResult') {
this.formData.dealAttribution = ''
this.formData.loseReason = ''
}
this.$set(this.formData, field, value)
},
toggleMulti (field, value) {
const arr = this.formData[field]
const index = arr.indexOf(value)
index > -1 ? arr.splice(index, 1) : arr.push(value)
},
async submitForm () {
let formData = JSON.parse(JSON.stringify(this.formData)),
{ installItems, giftItems } = formData,
{ receptionId, phone } = this
if (installItems.length && giftItems.length) {
formData.installItems = installItems.join(',')
formData.giftItems = giftItems.join(',')
}
this.showLoading('提交中...')
const data = await customerApi.updateCustomerFile({ receptionId, updatedBy: phone, ...formData })
this.hideLoading()
if (data) {
this.to('customerFileSuccess')
} else Notify('提交失败,请重试')
},
showGuide (type) {
this.guideType = type
this.showAttributionGuide = true
},
closeGuide () {
this.showAttributionGuide = false
},
}
}
</script>
<style scoped lang='scss'>
.customer-file-page {
min-height: 100vh;
background-color: #f5f7fa;
}
button {
&:active {
transform: scale(0.95);
}
}
</style>