index.vue 20 KB

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