index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. <template>
  2. <div class="bgcolor complaintDetail">
  3. <div class="navBarTOP">
  4. <van-nav-bar class="navBar" left-arrow :title="title" @click-left="onClickLeft" />
  5. </div>
  6. <div class="lineGrey"></div>
  7. <div class="lineGrey"></div>
  8. <div class="lineGrey"></div>
  9. <div class="lineGrey"></div>
  10. <div class="lineGrey"></div>
  11. <!-- 投诉详情 -->
  12. <infoDetail v-if="infoData" :infoData="infoData" :customerClassify="customerClassifyOption">
  13. <!-- <van-button
  14. type="info"
  15. v-if="infoData.customerClueStatus == 0"
  16. style="
  17. float: right;
  18. background: #0057ba;
  19. border-color: #0057ba;
  20. color: #fff;
  21. margin-top: -36px;
  22. border-radius: 5px;
  23. "
  24. size="small"
  25. plain
  26. class="centerBtn"
  27. @click="onstopVisit"
  28. >转交其他组织</van-button
  29. > -->
  30. </infoDetail>
  31. <!-- 催办历史 -->
  32. <hasten
  33. v-if="infoData && infoData.customerClueInfoUrgeList"
  34. :hastenList="infoData.customerClueInfoUrgeList"></hasten>
  35. <!-- 投诉记录 -->
  36. <complaintLog
  37. v-if="infoData && infoData.customerClueInfoComplaintList.length"
  38. :customerClueInfoComplaintList="infoData.customerClueInfoComplaintList"></complaintLog>
  39. <!-- 跟进记录 userCustomerClueList -->
  40. <!-- 历史跟进记录 -->
  41. <p style="margin: 0 16px 8px; color: #888" v-if="infoData && infoData.userCustomerClueList">
  42. 该投诉历史跟进记录
  43. </p>
  44. <van-cell-group inset class="cardclewContentCell" v-if="infoData">
  45. <div style="border-radius: 6px; overflow: hidden">
  46. <van-cell
  47. is-link
  48. v-for="(item, index) in infoData.userCustomerClueList"
  49. :key="index"
  50. @click="viewFn(item.userCustomerClueId)">
  51. <template #title>
  52. <span class="custom-title">{{ item.nickName }}</span>
  53. </template>
  54. <div class="cardContent">
  55. <p class="textLeft" style="padding-bottom: 0px; margin: 0">{{ item.createTime }}</p>
  56. </div>
  57. </van-cell>
  58. </div>
  59. </van-cell-group>
  60. <p v-if="infoData && infoData.isClose == 1" style="padding: 10px 0"></p>
  61. <!-- 跟进任务填写 -->
  62. <div class="assign" v-if="infoData && infoData.isClose != 1">
  63. <!-- <div class="assign"> -->
  64. <div style="padding: 10px 16px 0 16px; color: red; font-size: 14px">
  65. 400客服已对来电进行分类,若分类有误,可重新分类
  66. </div>
  67. <!-- 来电分类 -->
  68. <div class="complaintType">
  69. <div class="typeItem">
  70. <van-field
  71. readonly
  72. clickable
  73. name="picker"
  74. :value="customerClassifyValue"
  75. label="来电分类一 :"
  76. placeholder="点击选择来电分类一"
  77. @click="showPicker1 = true" />
  78. </div>
  79. <div class="typeItem">
  80. <van-field
  81. readonly
  82. clickable
  83. name="picker"
  84. :value="customerSubClassifyValue"
  85. label="来电分类二 :"
  86. placeholder="点击选择来电分类二"
  87. @click="showPicker2 = true" />
  88. </div>
  89. </div>
  90. <!-- <div class="followUp required">跟进结果</div> -->
  91. <div class="taskGather" v-if="taskGather">
  92. <radioGroup :clueOptionList="taskGather"></radioGroup>
  93. </div>
  94. <div class="tc" style="padding: 0 16px">
  95. <van-button class="submitBtn" block type="info" color="#0057ba" @click="onSubmit">
  96. 提交
  97. </van-button>
  98. </div>
  99. </div>
  100. <van-dialog v-model="show" title="转发客资" show-cancel-button :before-close="confirm">
  101. <p>
  102. <van-notice-bar wrapable :scrollable="false" text="一旦转交出去,则无法再查看,请确认!" />
  103. </p>
  104. <van-row class="serchInput">
  105. <van-col span="24">
  106. <van-cell
  107. class="monthNow selectcell"
  108. :title="companyName"
  109. is-link
  110. arrow-direction="down"
  111. @click="regionClick" />
  112. </van-col>
  113. <van-col span="24">
  114. <van-cell
  115. class="monthNow selectcell"
  116. :title="regionName"
  117. is-link
  118. @click="SalesRegionClick"
  119. arrow-direction="down" />
  120. </van-col>
  121. <van-col span="24">
  122. <van-cell
  123. class="monthNow selectcell"
  124. :title="deptName"
  125. is-link
  126. @click="SalesDepartmentClick"
  127. arrow-direction="down" />
  128. </van-col>
  129. </van-row>
  130. </van-dialog>
  131. <!-- 渠道投诉跟进历史 -->
  132. <van-dialog
  133. v-model="showView"
  134. title="投诉历史"
  135. show-cancel-button
  136. cancel-button-text="关闭"
  137. :show-confirm-button="false"
  138. class="dialogz">
  139. <followUpHistory :historyId="historyId" :showView="showView"></followUpHistory>
  140. </van-dialog>
  141. <van-popup v-model="showPicker1" position="bottom">
  142. <van-picker
  143. show-toolbar
  144. value-key="remark"
  145. :columns="customerClassifyOption"
  146. @confirm="onConfirm1"
  147. @cancel="showPicker1 = false" />
  148. </van-popup>
  149. <van-popup v-model="showPicker2" position="bottom">
  150. <van-picker
  151. show-toolbar
  152. value-key="dictLabel"
  153. :columns="customerSubClassifyOption"
  154. @confirm="onConfirm2"
  155. @cancel="showPicker2 = false" />
  156. </van-popup>
  157. <van-popup v-model="RegionShow" capture position="bottom">
  158. <van-picker
  159. :columns="companyList"
  160. show-toolbar
  161. value-key="deptName"
  162. @cancel="RegionShow = false"
  163. @confirm="onregionConfirm" />
  164. </van-popup>
  165. <van-popup v-model="SalesRegionShow" capture position="bottom">
  166. <van-picker
  167. :columns="regionList"
  168. show-toolbar
  169. value-key="deptName"
  170. @cancel="SalesRegionShow = false"
  171. @confirm="onSalesRegionConfirm" />
  172. </van-popup>
  173. <van-popup v-model="SalesDepartmentShow" capture position="bottom">
  174. <van-picker
  175. :columns="deptList"
  176. show-toolbar
  177. value-key="deptName"
  178. @cancel="SalesDepartmentShow = false"
  179. @confirm="onSalesDepartmentConfirm" />
  180. </van-popup>
  181. </div>
  182. </template>
  183. <script>
  184. import {
  185. getComplaintCustomerClueInfoById,
  186. insertCustomerClueAnswerKs,
  187. customerClassify,
  188. customerSubClassify,
  189. } from '@/api/complaintDetail';
  190. import infoDetail from './infoDetail.vue';
  191. import complaintLog from './complaintLog.vue';
  192. import { mapState } from 'vuex';
  193. import radioGroup from './radioGroup';
  194. import followUpHistory from './followUpHistory';
  195. import { getDictOption } from '@/api/index';
  196. import { updateCustomerClueDept, getDeptInfo } from '@/api/clew';
  197. import store from '@/store';
  198. import hasten from '@/views/clew/hasten';
  199. export default {
  200. name: 'complaintDetail',
  201. components: {
  202. infoDetail,
  203. complaintLog,
  204. radioGroup,
  205. followUpHistory,
  206. hasten,
  207. },
  208. computed: {
  209. ...mapState({
  210. userInfo: (state) => state.user.userInfo,
  211. }),
  212. },
  213. data() {
  214. return {
  215. id: '',
  216. infoData: null,
  217. title: '',
  218. postName: '',
  219. taskGather: null, //跟进任务集合
  220. requiredFlag: true, //问题必填检验
  221. requiredMessage: '', //必填提示信息
  222. showView: false,
  223. historyId: '',
  224. customerClassifyValue: '',
  225. customerClassify: '',
  226. customerSubClassifyValue: '',
  227. customerSubClassify: '',
  228. showPicker1: false,
  229. showPicker2: false,
  230. customerClassifyOption: [],
  231. customerSubClassifyOption: [],
  232. deptCode: '',
  233. regionList: [],
  234. deptList: [],
  235. companyName: '',
  236. companyCode: '',
  237. regionName: '',
  238. regionCode: '',
  239. deptName: '',
  240. show: false,
  241. RegionShow: false,
  242. SalesRegionShow: false,
  243. SalesDepartmentShow: false,
  244. companyList: [],
  245. deptForm: { type: '', parentId: '' },
  246. };
  247. },
  248. watch: {},
  249. activated() {
  250. this.id = this.$route.query.id;
  251. this.postName = localStorage.getItem('postName');
  252. this.getDeptInfo();
  253. this.getComplaintCustomerClueInfoByIdFun();
  254. },
  255. methods: {
  256. async getCustomerClassify() {
  257. let option = await customerClassify();
  258. this.customerClassifyOption = option.data || [];
  259. // 来电分类一
  260. let item = this.customerClassifyOption.find(
  261. (val) => val.dictValue == this.infoData.customerClassify
  262. );
  263. this.customerClassifyValue = item ? item.remark : '';
  264. this.customerClassify = item ? item.dictValue : '';
  265. if (this.customerClassify != '') this.getCustomerSubClassify(this.customerClassify);
  266. },
  267. async getCustomerSubClassify(parentId) {
  268. let option = await customerSubClassify({ parentId: parentId });
  269. this.customerSubClassifyOption = option.data || [];
  270. // 来电分类二
  271. let item = this.customerSubClassifyOption.find(
  272. (val) => val.dictValue == this.infoData.customerSubClassify
  273. );
  274. item = item || this.customerSubClassifyOption[0];
  275. this.customerSubClassifyValue = item.dictLabel || '';
  276. this.customerSubClassify = item.dictValue;
  277. },
  278. getComplaintCustomerClueInfoByIdFun() {
  279. this.toastLoading(0, '加载中...', true);
  280. this.id = this.$route.query.id;
  281. getComplaintCustomerClueInfoById({ customerClueInfoId: this.id }).then((response) => {
  282. this.toastLoading().clear();
  283. if (response.code == 200) {
  284. this.infoData = response.data;
  285. this.title = response.data.name;
  286. if (this.infoData.isClose != 1) {
  287. // response.data.customerClue.customerClueItemList[0].customerClueInfoId = this.id;
  288. this.taskGather = response.data.customerClue.customerClueItemList;
  289. }
  290. this.getCustomerClassify();
  291. // 当前客资归属人不是当前登录人
  292. let deptIds = JSON.parse(localStorage.getItem('deptIds'));
  293. if (deptIds.indexOf(this.infoData.deptId) == -1) {
  294. this.$dialog
  295. .confirm({
  296. title: '提示',
  297. message: '该渠道投诉已经被转移给其他人',
  298. showCancelButton: false,
  299. })
  300. .then(() => {
  301. window.location.replace(window.location.origin + '/mobile/clew');
  302. });
  303. }
  304. } else {
  305. this.$toast(res.msg);
  306. }
  307. });
  308. },
  309. onSubmit() {
  310. // 没有选择跟进记录
  311. // if (!this.taskGather[0].searchValue) {
  312. // this.$toast('请选择跟进结果');
  313. // return;
  314. // }
  315. this.requiredFlag = true;
  316. let customerClueItemList = [];
  317. // 每一个层级都是一道题的题目,子级就是题,被选中和填写的题要带上题目一块上传(题的同级也要上传)
  318. // 第一级题目下的题默认都要上传
  319. let params = {
  320. customerClueItemList: [],
  321. customerClassify: this.customerClassify,
  322. customerSubClassify: this.customerSubClassify,
  323. };
  324. params.customerClueItemList.push(...this.deepClone(this.taskGather, 0));
  325. // let optionList = this.taskGather[0].customerClueOptionList;
  326. this.filterOption(this.taskGather, params);
  327. console.log(JSON.stringify(params));
  328. // 必填验证
  329. if (this.requiredFlag) {
  330. this.toastLoading(0, '加载中...', true);
  331. insertCustomerClueAnswerKs(params).then((res) => {
  332. this.toastLoading().clear();
  333. if (res.code == 200) {
  334. if (this.$route.query.token != undefined) {
  335. window.location.replace(window.location.origin + '/mobile/clew');
  336. } else {
  337. store.dispatch('setRefreshClewPage', true);
  338. // 返回上一页不会刷新页面
  339. this.$router.go(-1);
  340. // this.$router.replace({ path: '/clew' });
  341. }
  342. } else {
  343. this.$toast(res.msg);
  344. }
  345. });
  346. } else {
  347. this.$toast(this.requiredMessage);
  348. }
  349. },
  350. filterOption(optionList, params) {
  351. for (let val = 0; val < optionList.length; val++) {
  352. if (
  353. optionList[val].isMust == '0' &&
  354. optionList[val].searchValue == null &&
  355. optionList[val].answerType == 'dx'
  356. ) {
  357. // 题目必填校验
  358. this.requiredFlag = false;
  359. this.requiredMessage = '请选择' + optionList[val].customerClueName;
  360. return;
  361. } else if (optionList[val].isMust == '0' && optionList[val].searchValue) {
  362. // 子级题校验
  363. let customerClueOptionList = optionList[val].customerClueOptionList;
  364. for (let i = 0; i < customerClueOptionList.length; i++) {
  365. // 选中的题目Y:选中,N:未选中
  366. if (customerClueOptionList[i].value == 'Y') {
  367. if (customerClueOptionList[i].customerClueItemList) {
  368. // 必填校验
  369. this.isRequiredFlag(customerClueOptionList[i].customerClueItemList);
  370. // 赋值选中题
  371. let customerClueItemList =
  372. params.customerClueItemList[val].customerClueOptionList[i].customerClueItemList;
  373. customerClueItemList.push(
  374. ...this.deepClone(customerClueOptionList[i].customerClueItemList, 0)
  375. );
  376. if (customerClueOptionList[i].customerClueItemList[0]) {
  377. this.filterOption(customerClueOptionList[i].customerClueItemList, params);
  378. }
  379. }
  380. }
  381. }
  382. }
  383. }
  384. },
  385. // 深拷贝指定拷贝层级
  386. deepClone(obj, num) {
  387. // 检查是否为对象或数组
  388. if (obj === null || typeof obj !== 'object') {
  389. return obj; // 基本类型直接返回
  390. }
  391. // 创建一个数组或对象
  392. const copy = Array.isArray(obj) ? [] : {};
  393. // 遍历对象的每个属性
  394. for (const key in obj) {
  395. if (obj.hasOwnProperty(key) && num < 2) {
  396. // 递归调用深拷贝
  397. if (key == 'customerClueOptionList' || key == 'customerClueItemList') {
  398. num = num + 1;
  399. }
  400. copy[key] = this.deepClone(obj[key], num);
  401. }
  402. }
  403. return copy;
  404. },
  405. isRequiredFlag(optionList) {
  406. // console.log(optionList);
  407. for (let i = 0; i < optionList.length; i++) {
  408. // 是否必填
  409. if (optionList[i].isMust == 0) {
  410. // 输入框
  411. if (optionList[i].answerType == 'wb' || optionList[i].answerType == 'sz') {
  412. if (!optionList[i].answerValue) {
  413. // 必填类型
  414. this.requiredFlag = false;
  415. this.requiredMessage = optionList[i].remark;
  416. return;
  417. } else {
  418. // 条件校验
  419. if (optionList[i].minTextLength) {
  420. // 输入内容长度校验
  421. if (optionList[i].answerValue.length < optionList[i].minTextLength) {
  422. this.requiredFlag = false;
  423. this.requiredMessage = optionList[i].remark;
  424. return;
  425. }
  426. }
  427. }
  428. } else if (optionList[i].answerType == 'zp') {
  429. // 照片
  430. if (!optionList[i].fileInfoList || !optionList[i].fileInfoList.length) {
  431. this.requiredFlag = false;
  432. this.requiredMessage = optionList[i].remark;
  433. return;
  434. }
  435. }
  436. }
  437. }
  438. },
  439. // 校验错误返回信息
  440. onFailed(errorInfo) {
  441. console.log('failed', errorInfo);
  442. },
  443. // 查看历史跟进记录
  444. viewFn(val) {
  445. // this.viewTextShow = false;
  446. this.historyId = val;
  447. this.showView = true;
  448. },
  449. onConfirm1(value) {
  450. this.customerClassifyValue = value.remark;
  451. this.customerClassify = value.dictValue;
  452. this.showPicker1 = false;
  453. this.getCustomerSubClassify(this.customerClassify);
  454. },
  455. onConfirm2(value) {
  456. this.customerSubClassifyValue = value.dictLabel;
  457. this.customerSubClassify = value.dictValue;
  458. this.showPicker2 = false;
  459. },
  460. onstopVisit() {
  461. this.deptCode = '';
  462. this.regionList = [];
  463. this.deptList = [];
  464. this.companyName = '请选择公司';
  465. this.companyCode = '';
  466. this.regionName = '请选择大区';
  467. this.regionCode = '';
  468. this.deptName = '请选择销售部';
  469. this.show = true;
  470. },
  471. confirm(action, done) {
  472. if (action === 'confirm') {
  473. if (this.deptCode != '') {
  474. updateCustomerClueDept({
  475. customerClueInfoId: this.$route.query.id,
  476. deptId: this.deptCode,
  477. }).then((require) => {
  478. if (require.code == 200) {
  479. this.$toast.success('转发成功');
  480. this.show = false;
  481. if (this.$route.query.token != undefined) {
  482. window.location.replace(window.location.origin + '/mobile/clew');
  483. } else {
  484. store.dispatch('setRefreshClewPage', true);
  485. // 返回上一页不会刷新页面
  486. this.$router.go(-1);
  487. }
  488. return done(true);
  489. } else {
  490. this.$toast(res.msg);
  491. }
  492. });
  493. } else {
  494. this.$toast('请选择要转发销售部');
  495. return done(false);
  496. }
  497. } else {
  498. return done(true);
  499. this.show = false;
  500. }
  501. },
  502. onregionConfirm(val) {
  503. this.RegionShow = false;
  504. this.companyName = val.deptName;
  505. this.companyCode = val.deptId;
  506. this.regionName = '请选择大区';
  507. this.regionCode = '';
  508. this.deptName = '请选择销售部';
  509. this.deptCode = '';
  510. this.getDeptInfo('dept', 1);
  511. },
  512. onSalesRegionConfirm(val) {
  513. this.SalesRegionShow = false;
  514. this.regionName = val.deptName;
  515. this.regionCode = val.deptId;
  516. if (val.deptId != '') {
  517. this.getDeptInfo('dept', 2);
  518. }
  519. this.deptName = '全部销售部';
  520. this.deptCode = '';
  521. },
  522. onSalesDepartmentConfirm(val) {
  523. this.SalesDepartmentShow = false;
  524. this.deptName = val.deptName;
  525. if (val.deptId != '') {
  526. this.deptCode = val.deptId;
  527. this.getDeptInfo('user');
  528. }
  529. this.userName = '全部业务员';
  530. this.userCode = '';
  531. },
  532. getDeptInfo(type, grade) {
  533. this.deptForm.type = type;
  534. if (grade == '1') {
  535. this.deptForm.parentId = this.companyCode;
  536. } else if (grade == '2') {
  537. this.deptForm.parentId = this.regionCode;
  538. } else {
  539. this.deptForm.type = '';
  540. this.deptForm.parentId = '';
  541. }
  542. getDeptInfo(this.deptForm).then((res) => {
  543. res.data.forEach((item) => {
  544. delete item.children;
  545. });
  546. if (grade == '1') {
  547. this.regionList = res.data;
  548. } else if (grade == '2') {
  549. this.deptList = res.data;
  550. } else {
  551. this.companyList = res.data;
  552. }
  553. });
  554. },
  555. regionClick() {
  556. this.RegionShow = true;
  557. },
  558. SalesRegionClick(val) {
  559. this.SalesRegionShow = true;
  560. },
  561. SalesDepartmentClick() {
  562. this.SalesDepartmentShow = true;
  563. },
  564. onClickLeft() {
  565. this.$router.go(-1);
  566. },
  567. },
  568. };
  569. </script>
  570. <style scoped lang="scss">
  571. .complaintDetail {
  572. .assign {
  573. margin: 10px;
  574. background-color: #fff;
  575. padding-bottom: 20px;
  576. .followUp {
  577. padding: 16px;
  578. font-size: 14px;
  579. font-weight: 600;
  580. }
  581. }
  582. .taskGather {
  583. padding-left: 20px;
  584. padding-bottom: 20px;
  585. .title {
  586. font-size: 15px;
  587. font-weight: 600;
  588. padding: 5px 0;
  589. }
  590. }
  591. }
  592. </style>
  593. <style lang="scss">
  594. .complaintDetail {
  595. .van-field__label {
  596. width: 100px;
  597. /* &::before {
  598. content: '*';
  599. color: red;
  600. } */
  601. }
  602. .centerBtn {
  603. float: right;
  604. background: #0057ba;
  605. border-color: #0057ba;
  606. color: #fff;
  607. margin-top: -33px;
  608. border-radius: 5px;
  609. }
  610. .dialogz {
  611. width: 100%;
  612. display: flex;
  613. flex-direction: column;
  614. overflow: hidden;
  615. height: 72vh;
  616. .van-dialog__content {
  617. flex: 1;
  618. overflow-y: auto;
  619. }
  620. }
  621. .van-cell {
  622. font-size: 15px !important;
  623. .van-cell__title {
  624. color: #000 !important;
  625. }
  626. }
  627. .complaintType {
  628. .typeItem {
  629. .van-cell__title {
  630. padding: 3px;
  631. }
  632. .van-field__value {
  633. padding: 3px;
  634. padding-left: 5px;
  635. border: 1px solid #ccc;
  636. .van-field__control {
  637. color: #626262;
  638. }
  639. }
  640. }
  641. }
  642. }
  643. </style>