index.vue 21 KB

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