|
|
@@ -375,7 +375,7 @@
|
|
|
<div class="tag-list">
|
|
|
<el-tag
|
|
|
v-for="name in scope.row.tagIdsName"
|
|
|
- :key="name"
|
|
|
+ :key="scope.row.id + '_' + name"
|
|
|
type="success"
|
|
|
size="small"
|
|
|
>
|
|
|
@@ -475,7 +475,7 @@
|
|
|
<el-table-column label="注册时间" align="center" prop="registerTime" width="100px" />
|
|
|
<el-table-column label="备注电话号码" align="center" prop="remarkMobiles" width="150px">
|
|
|
<template slot-scope="scope">
|
|
|
- <div v-for="i in JSON.parse(scope.row.remarkMobiles)" :key="i">{{i}}</div>
|
|
|
+ <div v-for="(i, idx) in JSON.parse(scope.row.remarkMobiles)" :key="scope.row.id + '_' + idx">{{i}}</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="备注企业名称" align="center" prop="remarkCorpName" />
|
|
|
@@ -1275,6 +1275,7 @@
|
|
|
<div class="recording-header">
|
|
|
<span class="recording-index">跟进记录 {{ rIndex + 1 }}</span>
|
|
|
<el-button
|
|
|
+ v-if="rIndex >= 8"
|
|
|
size="mini"
|
|
|
type="danger"
|
|
|
icon="el-icon-delete"
|
|
|
@@ -3043,9 +3044,20 @@ export default {
|
|
|
customerInfo: {},
|
|
|
followContent: '',
|
|
|
visitRecords: [],
|
|
|
- saving: false
|
|
|
+ saving: false,
|
|
|
+ visitSaving: false,
|
|
|
+ recordingSaving: false,
|
|
|
+ profile: { gender: null, age: null, height: null, weight: null },
|
|
|
+ dealLikelihood: '',
|
|
|
+ keyObstacle: '',
|
|
|
+ followStrategy: '',
|
|
|
+ absenceReason: '',
|
|
|
+ callStatus: '',
|
|
|
+ isDmCustomer: '',
|
|
|
+ customerLevel: ''
|
|
|
};
|
|
|
this.followUpTags = [];
|
|
|
+ this.ensureMinVisitRecords(8);
|
|
|
this.loadFollowUpData();
|
|
|
// 加载SCRM客户详情
|
|
|
if (row.fsUserId) {
|
|
|
@@ -3061,20 +3073,34 @@ export default {
|
|
|
addVisitRecordSlot() {
|
|
|
this.followUpDrawer.visitRecords.push({
|
|
|
_key: 'v_' + Date.now() + '_' + Math.random(),
|
|
|
- registerDesc: '',
|
|
|
+ callContent: '',
|
|
|
+ customerFeedback: '',
|
|
|
+ nextAction: '',
|
|
|
visitStatus: '',
|
|
|
visitTime: ''
|
|
|
});
|
|
|
},
|
|
|
- /** 删除跟进记录槽位 */
|
|
|
+ /** 保证至少 min 条跟进记录 */
|
|
|
+ ensureMinVisitRecords(min) {
|
|
|
+ while (this.followUpDrawer.visitRecords.length < min) {
|
|
|
+ this.addVisitRecordSlot();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /** 删除跟进记录槽位(仅超过8条的才可删除) */
|
|
|
deleteVisitRecord(index) {
|
|
|
+ if (index < 8) {
|
|
|
+ this.$message.warning('前8条跟进记录不可删除');
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.followUpDrawer.visitRecords.splice(index, 1);
|
|
|
},
|
|
|
/** 保存所有跟进记录(JSON方式) */
|
|
|
saveVisitRecords() {
|
|
|
this.followUpDrawer.visitSaving = true;
|
|
|
const visitRecords = this.followUpDrawer.visitRecords.map(r => ({
|
|
|
- registerDesc: r.registerDesc || '',
|
|
|
+ callContent: r.callContent || '',
|
|
|
+ customerFeedback: r.customerFeedback || '',
|
|
|
+ nextAction: r.nextAction || '',
|
|
|
visitStatus: r.visitStatus || '',
|
|
|
visitTime: r.visitTime || ''
|
|
|
}));
|
|
|
@@ -3098,9 +3124,13 @@ export default {
|
|
|
getMyCustomerList({ fsUserId: fsUserId, pageNum: 1, pageSize: 1 }).then(response => {
|
|
|
if (response.rows && response.rows.length > 0) {
|
|
|
this.followUpDrawer.customerInfo = response.rows[0];
|
|
|
- this.followUpTags = response.rows[0].tags ? response.rows[0].tags.split(',').filter(t => t) : [];
|
|
|
+ // 解析tags中的3个可编辑字段
|
|
|
+ this.parseEditableTags(response.rows[0].tags || '');
|
|
|
} else {
|
|
|
this.followUpTags = [];
|
|
|
+ this.followUpDrawer.callStatus = '';
|
|
|
+ this.followUpDrawer.isDmCustomer = '';
|
|
|
+ this.followUpDrawer.customerLevel = '';
|
|
|
}
|
|
|
}).catch(() => {});
|
|
|
},
|
|
|
@@ -3139,20 +3169,70 @@ export default {
|
|
|
syncFollowUpTags() {
|
|
|
this.followUpDrawer.customerInfo.tags = this.followUpTags.join(',');
|
|
|
},
|
|
|
+ /** 从tags逗号分隔字符串中解析3个可编辑字段 */
|
|
|
+ parseEditableTags(tagsStr) {
|
|
|
+ this.followUpDrawer.callStatus = '';
|
|
|
+ this.followUpDrawer.isDmCustomer = '';
|
|
|
+ this.followUpDrawer.customerLevel = '';
|
|
|
+ if (!tagsStr) return;
|
|
|
+ const tags = tagsStr.split(',').map(t => t.trim()).filter(t => t);
|
|
|
+ // 通话状态:未接通|拒接电话|已通话
|
|
|
+ const callStatusValues = ['未接通', '拒接电话', '已通话'];
|
|
|
+ const dmValues = ['是DM', '非DM'];
|
|
|
+ const levelValues = ['A', 'B', 'C', 'D'];
|
|
|
+ const matched = new Set();
|
|
|
+ for (const tag of tags) {
|
|
|
+ if (callStatusValues.includes(tag)) {
|
|
|
+ this.followUpDrawer.callStatus = tag;
|
|
|
+ matched.add(tag);
|
|
|
+ } else if (dmValues.includes(tag)) {
|
|
|
+ this.followUpDrawer.isDmCustomer = tag;
|
|
|
+ matched.add(tag);
|
|
|
+ } else if (levelValues.includes(tag)) {
|
|
|
+ this.followUpDrawer.customerLevel = tag;
|
|
|
+ matched.add(tag);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 其余标签填充到followUpTags
|
|
|
+ this.followUpTags = tags.filter(t => !matched.has(t));
|
|
|
+ },
|
|
|
+ /** 将followUpTags和3个可编辑字段合并为逗号分隔的tags字符串 */
|
|
|
+ buildMergedTags() {
|
|
|
+ const parts = [...this.followUpTags];
|
|
|
+ if (this.followUpDrawer.callStatus) parts.push(this.followUpDrawer.callStatus);
|
|
|
+ if (this.followUpDrawer.isDmCustomer) parts.push(this.followUpDrawer.isDmCustomer);
|
|
|
+ if (this.followUpDrawer.customerLevel) parts.push(this.followUpDrawer.customerLevel);
|
|
|
+ return parts.join(',');
|
|
|
+ },
|
|
|
/** 保存SCRM客户信息 */
|
|
|
saveCustomerInfo() {
|
|
|
const info = this.followUpDrawer.customerInfo;
|
|
|
if (!info) return;
|
|
|
this.followUpDrawer.saving = true;
|
|
|
+ const profile = this.followUpDrawer.profile || {};
|
|
|
+ // 合并3个可编辑字段到tags
|
|
|
+ const mergedTags = this.buildMergedTags();
|
|
|
updateCustomer({
|
|
|
externalContactId: this.followUpDrawer.externalContactId,
|
|
|
source: info.source,
|
|
|
visitStatus: info.visitStatus,
|
|
|
customerType: info.customerType,
|
|
|
- tags: info.tags,
|
|
|
+ customerProfile: JSON.stringify({
|
|
|
+ gender: profile.gender,
|
|
|
+ age: profile.age,
|
|
|
+ height: profile.height,
|
|
|
+ weight: profile.weight
|
|
|
+ }),
|
|
|
+ tags: mergedTags,
|
|
|
remark: info.remark,
|
|
|
lastTime: info.lastTime,
|
|
|
- followContent: this.followUpDrawer.followContent || ''
|
|
|
+ followContent: JSON.stringify({
|
|
|
+ content: this.followUpDrawer.followContent || '',
|
|
|
+ dealLikelihood: this.followUpDrawer.dealLikelihood || '',
|
|
|
+ keyObstacle: this.followUpDrawer.keyObstacle || '',
|
|
|
+ followStrategy: this.followUpDrawer.followStrategy || '',
|
|
|
+ absenceReason: this.followUpDrawer.absenceReason || ''
|
|
|
+ })
|
|
|
}).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
this.$message.success('客户信息保存成功');
|
|
|
@@ -3187,7 +3267,9 @@ export default {
|
|
|
const parsed = typeof info.visitRecords === 'string' ? JSON.parse(info.visitRecords) : info.visitRecords;
|
|
|
this.followUpDrawer.visitRecords = (parsed || []).map((r, i) => ({
|
|
|
_key: 'v_' + Date.now() + '_' + i,
|
|
|
- registerDesc: r.registerDesc || '',
|
|
|
+ callContent: r.callContent || '',
|
|
|
+ customerFeedback: r.customerFeedback || '',
|
|
|
+ nextAction: r.nextAction || '',
|
|
|
visitStatus: r.visitStatus || '',
|
|
|
visitTime: r.visitTime || ''
|
|
|
}));
|
|
|
@@ -3195,9 +3277,11 @@ export default {
|
|
|
this.followUpDrawer.visitRecords = [];
|
|
|
}
|
|
|
} else {
|
|
|
- this.followUpDrawer.visitRecords = [];
|
|
|
- }
|
|
|
- // 解析录音记录
|
|
|
+ this.followUpDrawer.visitRecords = [];
|
|
|
+ }
|
|
|
+ // 保证至少8条
|
|
|
+ this.ensureMinVisitRecords(8);
|
|
|
+ // 解析录音记录
|
|
|
if (info.recordings) {
|
|
|
try {
|
|
|
const parsed = typeof info.recordings === 'string' ? JSON.parse(info.recordings) : info.recordings;
|
|
|
@@ -3215,9 +3299,42 @@ export default {
|
|
|
} else {
|
|
|
this.followUpDrawer.recordings = [];
|
|
|
}
|
|
|
+ // 解析客户画像
|
|
|
+ if (info.customerProfile) {
|
|
|
+ try {
|
|
|
+ const parsed = typeof info.customerProfile === 'string' ? JSON.parse(info.customerProfile) : info.customerProfile;
|
|
|
+ this.followUpDrawer.profile = {
|
|
|
+ gender: parsed.gender != null ? parsed.gender : null,
|
|
|
+ age: parsed.age != null ? parsed.age : null,
|
|
|
+ height: parsed.height != null ? parsed.height : null,
|
|
|
+ weight: parsed.weight != null ? parsed.weight : null
|
|
|
+ };
|
|
|
+ } catch (e) {
|
|
|
+ this.followUpDrawer.profile = { gender: null, age: null, height: null, weight: null };
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.followUpDrawer.profile = { gender: null, age: null, height: null, weight: null };
|
|
|
+ }
|
|
|
+ // 解析跟进内容JSON
|
|
|
+ if (info.followContent) {
|
|
|
+ try {
|
|
|
+ const parsed = typeof info.followContent === 'string' ? JSON.parse(info.followContent) : info.followContent;
|
|
|
+ this.followUpDrawer.followContent = parsed.content || '';
|
|
|
+ this.followUpDrawer.dealLikelihood = parsed.dealLikelihood || '';
|
|
|
+ this.followUpDrawer.keyObstacle = parsed.keyObstacle || '';
|
|
|
+ this.followUpDrawer.followStrategy = parsed.followStrategy || '';
|
|
|
+ this.followUpDrawer.absenceReason = parsed.absenceReason || '';
|
|
|
+ } catch (e) {
|
|
|
+ // 兼容旧数据:非JSON格式直接作为content
|
|
|
+ this.followUpDrawer.followContent = info.followContent || '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 解析新增的3个可编辑字段(从tags逗号分隔中提取)
|
|
|
+ this.parseEditableTags(info.tags);
|
|
|
} else {
|
|
|
this.followUpDrawer.visitRecords = [];
|
|
|
this.followUpDrawer.recordings = [];
|
|
|
+ this.followUpDrawer.profile = { gender: null, age: null, height: null, weight: null };
|
|
|
}
|
|
|
}).catch(() => {
|
|
|
this.followUpDrawer.loading = false;
|