|
|
@@ -9,7 +9,7 @@
|
|
|
<div class="lineGrey"></div>
|
|
|
<div class="lineGrey"></div>
|
|
|
<!-- 客资详情 -->
|
|
|
- <assignAwaitDetail :infoData="infoData">
|
|
|
+ <assignAwaitDetail :infoData="infoData" v-if="infoData">
|
|
|
<div class="info">
|
|
|
跟进状态:
|
|
|
<span v-if="infoData.isClose == 1">跟进完成</span>
|
|
|
@@ -29,10 +29,10 @@
|
|
|
</van-button>
|
|
|
</assignAwaitDetail>
|
|
|
<!-- 历史跟进记录 -->
|
|
|
- <p style="margin: 0 16px 8px; color: #888" v-if="infoData.userCustomerClueList">
|
|
|
+ <p style="margin: 0 16px 8px; color: #888" v-if="infoData && infoData.userCustomerClueList">
|
|
|
该客资历史跟进记录
|
|
|
</p>
|
|
|
- <van-cell-group inset class="cardclewContentCell">
|
|
|
+ <van-cell-group inset class="cardclewContentCell" v-if="infoData">
|
|
|
<div style="border-radius: 6px; overflow: hidden">
|
|
|
<van-cell
|
|
|
is-link
|
|
|
@@ -49,12 +49,12 @@
|
|
|
</div>
|
|
|
</van-cell-group>
|
|
|
<!-- 跟进任务填写 -->
|
|
|
- <div class="assign">
|
|
|
+ <div class="assign" v-if="infoData && infoData.isClose != 1">
|
|
|
<div class="followUp required">跟进结果</div>
|
|
|
<div class="taskGather" v-if="taskGather && taskGather">
|
|
|
<radioGroup :clueOptionList="taskGather"></radioGroup>
|
|
|
</div>
|
|
|
- <div v-if="infoData.isClose != 1" class="tc" style="padding: 0 16px">
|
|
|
+ <div class="tc" style="padding: 0 16px">
|
|
|
<van-button class="submitBtn" block type="info" color="#0057ba" @click="onSubmit">
|
|
|
提交
|
|
|
</van-button>
|
|
|
@@ -63,6 +63,7 @@
|
|
|
<!-- 转交下属 -->
|
|
|
<van-popup v-model="showPicker" position="bottom">
|
|
|
<van-picker
|
|
|
+ title="转交下属"
|
|
|
show-toolbar
|
|
|
value-key="nickName"
|
|
|
:columns="assignTypeData"
|
|
|
@@ -77,7 +78,7 @@
|
|
|
cancel-button-text="关闭"
|
|
|
:show-confirm-button="false"
|
|
|
class="dialogz">
|
|
|
- <followUpHistory :historyId="historyId"></followUpHistory>
|
|
|
+ <followUpHistory :historyId="historyId" :showView="showView"></followUpHistory>
|
|
|
</van-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -111,7 +112,7 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
id: '',
|
|
|
- infoData: {},
|
|
|
+ infoData: null,
|
|
|
collectionItemList: [],
|
|
|
title: '',
|
|
|
postName: '',
|
|
|
@@ -120,6 +121,8 @@ export default {
|
|
|
taskGather: null, //跟进任务集合
|
|
|
showView: false,
|
|
|
historyId: '',
|
|
|
+ requiredFlag: true, //问题必填检验
|
|
|
+ requiredMessage: '', //必填提示信息
|
|
|
};
|
|
|
},
|
|
|
watch: {},
|
|
|
@@ -127,14 +130,15 @@ export default {
|
|
|
this.id = this.$route.query.id;
|
|
|
this.postName = localStorage.getItem('postName');
|
|
|
this.getCustomerClueInfoById();
|
|
|
- this.getSelectCustomerClueInfoById();
|
|
|
},
|
|
|
methods: {
|
|
|
getCustomerClueInfoById() {
|
|
|
+ this.toastLoading(0, '加载中...', true);
|
|
|
this.id = this.$route.query.id;
|
|
|
this.collectionAnswerlisd = [];
|
|
|
this.collectionItemList = [];
|
|
|
getCustomerClueInfoById({ customerClueInfoId: this.id }).then((response) => {
|
|
|
+ this.toastLoading().clear();
|
|
|
if (response.code == 200) {
|
|
|
this.infoData = response.data;
|
|
|
this.title = response.data.name;
|
|
|
@@ -148,8 +152,12 @@ export default {
|
|
|
this.infoData.customerClueStatus == 0 &&
|
|
|
this.postName &&
|
|
|
this.postName == '区域家装销售负责人'
|
|
|
- )
|
|
|
+ ) {
|
|
|
this.getSelectSubUserList();
|
|
|
+ }
|
|
|
+ if (this.infoData.isClose != 1) {
|
|
|
+ this.getSelectCustomerClueInfoById();
|
|
|
+ }
|
|
|
} else {
|
|
|
this.$toast(res.msg);
|
|
|
}
|
|
|
@@ -159,7 +167,10 @@ export default {
|
|
|
selectCustomerClueInfoById({ customerClueInfoId: this.id }).then((res) => {
|
|
|
if (res.code == 200) {
|
|
|
// res.data.customerClue.searchValue.customerClueItemList
|
|
|
- this.taskGather = res.data.customerClue.customerClueItemList;
|
|
|
+ if (res.data.customerClue) {
|
|
|
+ res.data.customerClue.customerClueItemList[0].customerClueInfoId = this.id;
|
|
|
+ this.taskGather = res.data.customerClue.customerClueItemList;
|
|
|
+ }
|
|
|
} else {
|
|
|
this.$toast(res.msg);
|
|
|
}
|
|
|
@@ -175,17 +186,26 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
confirm(value) {
|
|
|
- allocationSubCustomer({
|
|
|
- userId: value.userId, // string 用户ID
|
|
|
- customerClueInfoId: this.id, // string 客资主键ID
|
|
|
- }).then((res) => {
|
|
|
- if (res.code == 200) {
|
|
|
- this.$toast(res.msg);
|
|
|
- this.onClickLeft();
|
|
|
- } else {
|
|
|
- this.$toast(res.msg);
|
|
|
- }
|
|
|
- });
|
|
|
+ this.$dialog
|
|
|
+ .confirm({
|
|
|
+ title: '提示',
|
|
|
+ message: '一旦转交出去,则无法再查看,请确认!',
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.toastLoading(0, '加载中...', true);
|
|
|
+ allocationSubCustomer({
|
|
|
+ userId: value.userId, // string 用户ID
|
|
|
+ customerClueInfoId: this.id, // string 客资主键ID
|
|
|
+ }).then((res) => {
|
|
|
+ this.toastLoading().clear();
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$toast(res.msg);
|
|
|
+ this.onClickLeft();
|
|
|
+ } else {
|
|
|
+ this.$toast(res.msg);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
// 查看历史跟进记录
|
|
|
viewFn(val) {
|
|
|
@@ -199,38 +219,79 @@ export default {
|
|
|
this.$toast('请选择跟进结果');
|
|
|
return;
|
|
|
}
|
|
|
+ this.requiredFlag = true;
|
|
|
let customerClueItemList = [];
|
|
|
// 每一个层级都是一道题的题目,子级就是题,被选中和填写的题要带上题目一块上传(题的同级也要上传)
|
|
|
// 第一级题目下的题默认都要上传
|
|
|
- this.copyData(this.taskGather);
|
|
|
- // 过滤最外层题目
|
|
|
- let topOptionList = this.taskGather[0].customerClueOptionList.find(
|
|
|
- (val) => val.customerClueOptionId == this.taskGather[0].searchValue
|
|
|
- );
|
|
|
- // console.log(topOptionList);
|
|
|
- // insertFollowCustomerClueAnswer({ customerClueItemList: [this.taskGather] }).then((res) => {
|
|
|
- // if (res.code == 200) {
|
|
|
- // this.$toast(res.msg);
|
|
|
- // } else {
|
|
|
- // this.$toast(res.msg);
|
|
|
- // }
|
|
|
- // });
|
|
|
+ let params = { customerClueItemList: [] };
|
|
|
+ params.customerClueItemList.push(...this.deepClone(this.taskGather, 0));
|
|
|
+ let optionList = this.taskGather[0].customerClueOptionList;
|
|
|
+ this.filterOption(optionList, params);
|
|
|
+ // 必填验证
|
|
|
+ if (this.requiredFlag) {
|
|
|
+ this.toastLoading(0, '加载中...', true);
|
|
|
+ insertFollowCustomerClueAnswer(params).then((res) => {
|
|
|
+ this.toastLoading().clear();
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$toast(res.msg);
|
|
|
+ this.onClickLeft();
|
|
|
+ } else {
|
|
|
+ this.$toast(res.msg);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$toast(this.requiredMessage);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ filterOption(optionList, params) {
|
|
|
+ let copy = null;
|
|
|
+ for (let i = 0; i < optionList.length; i++) {
|
|
|
+ if (optionList[i].value == 'Y') {
|
|
|
+ if (optionList[i].customerClueItemList) {
|
|
|
+ // 必填校验
|
|
|
+ this.isRequiredFlag(optionList[i].customerClueItemList[0]);
|
|
|
+ params.customerClueItemList.push(
|
|
|
+ ...this.deepClone(optionList[i].customerClueItemList, 0)
|
|
|
+ );
|
|
|
+ if (
|
|
|
+ optionList[i].customerClueItemList[0] &&
|
|
|
+ optionList[i].customerClueItemList[0].customerClueOptionList.length
|
|
|
+ ) {
|
|
|
+ this.filterOption(
|
|
|
+ optionList[i].customerClueItemList[0].customerClueOptionList,
|
|
|
+ params
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
- copyData(data) {
|
|
|
- for (let i = 0; i < data.length; i++) {
|
|
|
- console.log(data[i]);
|
|
|
- // numbersCopy = [];
|
|
|
- // const target = Array.isArray(source) ? [] : {};
|
|
|
- // for (const key in data[0]) {
|
|
|
- // if (Object.prototype.hasOwnProperty.call(data[0], key)) {
|
|
|
- // if (typeof data[0][key] === 'object' && data[0][key] !== null) {
|
|
|
- // target[key] = deepClone(data[0][key]);
|
|
|
- // } else {
|
|
|
- // target[key] = data[0][key];
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // return target;
|
|
|
+ deepClone(obj, num) {
|
|
|
+ // 检查是否为对象或数组
|
|
|
+ if (obj === null || typeof obj !== 'object') {
|
|
|
+ return obj; // 基本类型直接返回
|
|
|
+ }
|
|
|
+ // 创建一个数组或对象
|
|
|
+ const copy = Array.isArray(obj) ? [] : {};
|
|
|
+ // 遍历对象的每个属性
|
|
|
+ for (const key in obj) {
|
|
|
+ if (obj.hasOwnProperty(key) && num < 2) {
|
|
|
+ // 递归调用深拷贝
|
|
|
+ if (key == 'customerClueOptionList' || key == 'customerClueItemList') {
|
|
|
+ num = num + 1;
|
|
|
+ }
|
|
|
+ copy[key] = this.deepClone(obj[key], num);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return copy;
|
|
|
+ },
|
|
|
+ isRequiredFlag(optionList) {
|
|
|
+ // 必填类型
|
|
|
+ if (optionList.answerType == 'wb' && optionList.isMust == 0) {
|
|
|
+ if (!optionList.answerValue) {
|
|
|
+ this.requiredFlag = false;
|
|
|
+ this.requiredMessage = optionList.remark;
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
// 校验错误返回信息
|
|
|
@@ -245,6 +306,16 @@ export default {
|
|
|
</script>
|
|
|
<style scoped lang="scss">
|
|
|
.assignPage {
|
|
|
+ .assign {
|
|
|
+ margin: 16px;
|
|
|
+ background-color: #fff;
|
|
|
+ padding-bottom: 20px;
|
|
|
+ .followUp {
|
|
|
+ padding: 16px;
|
|
|
+ font-size: 14px;
|
|
|
+ font-weight: 600;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|
|
|
<style lang="scss">
|
|
|
@@ -264,5 +335,16 @@ export default {
|
|
|
margin-top: -33px;
|
|
|
border-radius: 5px;
|
|
|
}
|
|
|
+ .dialogz {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ overflow: hidden;
|
|
|
+ height: 72vh;
|
|
|
+ .van-dialog__content {
|
|
|
+ flex: 1;
|
|
|
+ overflow-y: auto;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|