customerDetail.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  1. <template>
  2. <div>
  3. <basicDetails
  4. ref="details"
  5. :titleText="mainData.enterprisename"
  6. formPath="salerPrivatecustomer"
  7. :editData="mainData"
  8. :mainAreaData="mainAreaData"
  9. turnPageId="20221012164402"
  10. idname="sa_customersid"
  11. tags=""
  12. typeTask="我的客户"
  13. :tabs="[
  14. '详细信息',
  15. '联系人',
  16. '客户地址',
  17. '开票信息',
  18. '项目商机',
  19. '报价单',
  20. '关联合同',
  21. '账户余额',
  22. '银行卡信息',
  23. '关联线索',
  24. ]"
  25. @pageChange="pageChange"
  26. @onEditSuccess="onEditSuccess"
  27. @logSuccess="queryMainData"
  28. @sysTag="sysTag"
  29. >
  30. <div slot="tags">
  31. <!-- 使用此插槽可不传[tags] -->
  32. <!-- :tabs="['经销商团队','代理区域','营销类别','账户余额']" -->
  33. <!-- <tagPanl slot="tags" :data="tags" :id="mainData.sa_customersid" @onSuccess="queryMainData"/>-->
  34. </div>
  35. <div slot="customOperationBef">
  36. <commissionSet
  37. class="inline-16"
  38. v-if="tool.checkAuth($route.name, 'commissionSet')"
  39. ownertable="sa_customers"
  40. @setSuccess="queryMainData"
  41. :data="mainData"
  42. ></commissionSet>
  43. </div>
  44. <div slot="customOperation">
  45. <!-- 此区域提供了自定义操作按钮 -->
  46. <el-button
  47. class="inline-16"
  48. type="primary"
  49. size="mini"
  50. @click="portraitShowFun"
  51. >{{ $t("360°画像") }}</el-button
  52. >
  53. <!-- <mindmap class="inline-16" ref="mindmap" :id="this.$route.query.id" name="custom"></mindmap> -->
  54. <statusChange
  55. class="inline-16"
  56. v-if="tool.checkAuth($route.name, 'statusChange')"
  57. :disabled="mainData.disabled"
  58. :id="mainData.sa_customersid"
  59. @statusChangeSuccess="statusChangeSuccess"
  60. ></statusChange>
  61. <share
  62. class="inline-16"
  63. v-if="
  64. tool.checkAuth($route.name, 'share') &&
  65. mainData.sourcepoolname === ''
  66. "
  67. :disabled="mainData.disabled"
  68. :id="mainData.sa_customersid"
  69. @onshow="onSuccess"
  70. @shareSuccess="onSuccess"
  71. ></share>
  72. <toBack
  73. class="inline-16"
  74. v-if="
  75. tool.checkAuth($route.name, 'back') &&
  76. mainData.sa_customerpoolid_source !== 0
  77. "
  78. :disabled="mainData.disabled"
  79. :data="mainData"
  80. @backSuccess="onSuccess"
  81. ></toBack>
  82. <duplicatesCustomer
  83. class="inline-16"
  84. v-if="tool.checkAuth($route.name, 'queryDuplicates')"
  85. :data="mainData"
  86. @onSuccessTag="onSuccessTag"
  87. ></duplicatesCustomer>
  88. <confirmSelection class="inline-16" content="暂缓的客户将不计入客户相关数据统计,是否确定暂缓该客户" btn-title="暂缓" btn-type="primary" confirm-button-text="确定暂缓" cancel-button-text="取消"
  89. paramId="20221010164602" @onSuccess="queryMainData();$refs.details.$refs.tag.queryTag();$refs.baseDetail.basicData()" v-if="tool.checkAuth($route.name,'putOff') && mainData.status != '暂缓' && mainData.disabled"
  90. ></confirmSelection>
  91. <confirmSelection class="inline-16" content="是否确定取消暂缓并继续跟进客户" btn-title="取消暂缓" btn-type="primary" confirm-button-text="取消暂缓" cancel-button-text="关闭"
  92. paramId="20221010164602" @onSuccess="queryMainData();$refs.details.$refs.tag.queryTag();$refs.baseDetail.basicData()" v-if="tool.checkAuth($route.name,'putOff') && mainData.status == '暂缓' && mainData.disabled"
  93. ></confirmSelection>
  94. <to_void
  95. class="inline-16"
  96. v-if="tool.checkAuth($route.name, 'toVoid')"
  97. :id="mainData.sa_customersid"
  98. :disabled="mainData.disabled"
  99. :data="mainData"
  100. @onshow="onSuccess"
  101. @toVoidSuccess="onSuccess"
  102. ></to_void>
  103. <recovery
  104. class="inline-16"
  105. v-if="
  106. tool.checkAuth($route.name, 'recovery') &&
  107. mainData.sa_customerpoolid_source !== 0
  108. "
  109. :data="mainData"
  110. @onshow="onSuccess"
  111. @backSuccess="onSuccess"
  112. ></recovery>
  113. </div>
  114. <div slot="slot0">
  115. <detailed
  116. :data="mainData"
  117. v-if="Object.keys(mainData).length > 1"
  118. ref="baseDetail"
  119. ></detailed>
  120. </div>
  121. <div slot="slot1" class="normal-panel">
  122. <contacts
  123. :data="mainData"
  124. ref="contactsRef"
  125. @onSuccess="onSuccess"
  126. v-if="flag"
  127. ></contacts>
  128. </div>
  129. <div slot="slot2" class="normal-panel">
  130. <address_manage :data="mainData" v-if="flag"></address_manage>
  131. </div>
  132. <div slot="slot3" class="normal-panel">
  133. <financial :mainData="mainData" v-if="flag"></financial>
  134. </div>
  135. <div slot="slot4" class="normal-panel">
  136. <projectChange :data="mainData" v-if="flag"></projectChange>
  137. </div>
  138. <div slot="slot5" class="normal-panel">
  139. <quotedPrice :data="mainData" v-if="flag"></quotedPrice>
  140. </div>
  141. <div slot="slot6" class="normal-panel">
  142. <contract :data="mainData" v-if="flag"></contract>
  143. </div>
  144. <div slot="slot7" class="normal-panel">
  145. <accountMoney :data="mainData" v-if="flag"></accountMoney>
  146. </div>
  147. <div slot="slot8" class="normal-panel">
  148. <bankCard :data="mainData" v-if="flag"></bankCard>
  149. </div>
  150. <div slot="slot9" class="normal-panel">
  151. <followLeads :data="mainData" v-if="flag"></followLeads>
  152. </div>
  153. </basicDetails>
  154. <PortraitDetail
  155. ref="PortraitDetail"
  156. v-if="PortraitShow"
  157. :data="mainData"
  158. ></PortraitDetail>
  159. </div>
  160. </template>
  161. <script>
  162. import detailed from "./modules/detailedData";
  163. import contacts from "./modules/contacts/list";
  164. import address_manage from "./modules/addressManage/list";
  165. import transactionUser from "./modules/operation/transactionUser";
  166. import lock from "./modules/operation/lock";
  167. import unlock from "./modules/operation/unlock";
  168. import share from "./modules/operation/share";
  169. import send_back from "./modules/operation/sendBack";
  170. import to_void from "./modules/operation/toVoid";
  171. import transaction_status from "./modules/operation/transactionStatus";
  172. import statusChange from "./modules/operation/statusChange";
  173. import recovery from "./modules/operation/recovery";
  174. import financial from "./modules/financialInfo/index.vue";
  175. import projectChange from "./modules/projectChange/list";
  176. import quotedPrice from "./modules/quotedPrice/list";
  177. import followLeads from "./modules/followLeads/index";
  178. import toBack from "@/SDrpManagement/salerPrivatecustomer/detail/modules/operation/toBack";
  179. import contract from "./modules/contract/index";
  180. import accountMoney from "./modules/accountMoney/index";
  181. import bankCard from "./modules/bankCard/index";
  182. import duplicatesCustomer from "@/components/duplicatesData/duplicatesCustomer";
  183. import mindmap from "@/components/mindmap/index.vue";
  184. import PortraitDetail from "@/HDrpManagement/customerPortrait/modules/detail.vue";
  185. import commissionSet from "@/components/commissionSetNew/index.vue";
  186. export default {
  187. name: "detail",
  188. data() {
  189. return {
  190. mainData: {
  191. disabled: false,
  192. },
  193. mainAreaData: [],
  194. userInfo: JSON.parse(window.sessionStorage.getItem("active_account")),
  195. tags: {},
  196. visible: false,
  197. dialogFormVisible: false,
  198. dialogFormLeader: false,
  199. form: {
  200. status: "",
  201. userid: "",
  202. },
  203. users: [],
  204. flag: false,
  205. disabled: false,
  206. tagFlag: false,
  207. PortraitShow: false,
  208. };
  209. },
  210. components: {
  211. detailed,
  212. contacts,
  213. address_manage,
  214. transactionUser,
  215. lock,
  216. unlock,
  217. share,
  218. send_back,
  219. to_void,
  220. transaction_status,
  221. recovery,
  222. financial,
  223. projectChange,
  224. quotedPrice,
  225. followLeads,
  226. statusChange,
  227. toBack,
  228. contract,
  229. accountMoney,
  230. bankCard,
  231. duplicatesCustomer,
  232. mindmap,
  233. PortraitDetail,
  234. commissionSet,
  235. },
  236. watch: {
  237. /*$route (val) {
  238. if (val.path == '/customerDetail') {
  239. console.log(val,'rouer111')
  240. /!* this.getFileList()
  241. this.$refs.add.dialogVisible = false*!/
  242. }
  243. },*/
  244. async mainData(val) {
  245. const res = await this.$api.requested({
  246. id: 20220930103501,
  247. content: {
  248. ownertable: "sa_customers",
  249. ownerid: this.$route.query.id,
  250. },
  251. });
  252. const agent = await this.$api.requested({
  253. id: 20230329122604,
  254. content: {
  255. ownertable: "sa_customers",
  256. ownerid: this.$route.query.id,
  257. },
  258. });
  259. if (this.mainData.leader.length !== 0) {
  260. if (
  261. JSON.parse(window.sessionStorage.getItem("active_account")).userid ===
  262. this.mainData.leader[0].userid
  263. ) {
  264. /*是负责人*/
  265. this.mainData.disabled = true;
  266. } else {
  267. let flag = 0;
  268. for (var i = 0; i < res.data[0].team.length; i++) {
  269. if (
  270. res.data[0].team[i].userid ===
  271. JSON.parse(window.sessionStorage.getItem("active_account")).userid
  272. ) {
  273. if (res.data[0].team[i].editable === 1) {
  274. this.mainData.disabled = true;
  275. flag = 1;
  276. break;
  277. } else {
  278. flag = 0;
  279. break;
  280. }
  281. }
  282. }
  283. /*不是负责人*/
  284. flag === 0
  285. ? agent.data.editable === 0
  286. ? (this.mainData.disabled = false)
  287. : (this.mainData.disabled = true)
  288. : (this.mainData.disabled = true);
  289. this.$refs.details.$refs.group.editdataleader =
  290. agent.data.editdataleader;
  291. }
  292. }
  293. console.log("权限结果", this.mainData.disabled);
  294. },
  295. },
  296. methods: {
  297. goPortrait() {
  298. let model;
  299. let id = this.$route.query.id;
  300. JSON.parse(sessionStorage.getItem("module_info")).forEach((item1) => {
  301. item1.modules.forEach((item2) => {
  302. item2.apps.forEach((item3) => {
  303. if (item3.systemappid == 259) {
  304. model = item3;
  305. return;
  306. }
  307. });
  308. });
  309. });
  310. sessionStorage.setItem("active_modules", JSON.stringify(model));
  311. this.$store.dispatch("changeDetailDrawer", false);
  312. this.$router.push("/customerportrait");
  313. setTimeout(() => {
  314. this.$router.push({
  315. path: "/customerportrait",
  316. query: {
  317. id: id,
  318. isTrue: 1,
  319. },
  320. });
  321. }, 1000);
  322. },
  323. async queryMainData() {
  324. const res = await this.$api.requested({
  325. id: 20221012164302,
  326. content: {
  327. sa_customersid: this.$route.query.id,
  328. },
  329. });
  330. /* this.mainData = res.data*/
  331. this.mainData = Object.assign({}, this.mainData, res.data);
  332. /*if (this.mainData.reward_point){
  333. let point = ''
  334. for (var i = 0;i< this.mainData.reward_point.length;i++){
  335. if (i === this.mainData.reward_point.length -1){
  336. point = point + this.mainData.reward_point[i]
  337. }else {
  338. point = point + this.mainData.reward_point[i] + ','
  339. }
  340. }
  341. this.mainData.reward_point = point
  342. }*/
  343. this.$refs["details"].param.content.type = this.$route.query.tabIndex;
  344. this.$refs["details"].param.content.isExport = false;
  345. this.changeDataStructure();
  346. this.flag = true;
  347. },
  348. show() {
  349. this.visible = false;
  350. },
  351. portraitShowFun() {
  352. this.PortraitShow = true;
  353. this.$nextTick(() => {
  354. this.$refs.PortraitDetail.dialogFormVisible = true;
  355. });
  356. },
  357. changeDataStructure() {
  358. let that = this;
  359. this.mainAreaData = [
  360. {
  361. label: "客户编号",
  362. value: this.mainData.sa_customersid,
  363. },
  364. {
  365. label: "erp编号",
  366. value: this.mainData.erpagentnum,
  367. },
  368. {
  369. label: "客户名称",
  370. value: this.mainData.enterprisename,
  371. },
  372. {
  373. label: "客户类型",
  374. value: this.mainData.type,
  375. },
  376. {
  377. label: "客户等级",
  378. value: this.mainData.grade === 0 ? "" : this.mainData.grade,
  379. },
  380. {
  381. label: "客户分类",
  382. value: this.mainData.customergrade,
  383. },
  384. {
  385. label: "成交状态",
  386. value: this.$t(this.mainData.tradingstatus),
  387. style: function () {
  388. let style = {};
  389. switch (that.mainData.tradingstatus) {
  390. case "已成交":
  391. style = { color: "#3874f6" };
  392. break;
  393. case "未成交":
  394. style = { color: "#e6a23c" };
  395. break;
  396. case "多次成交":
  397. style = { color: "#e6a23c" };
  398. break;
  399. default:
  400. break;
  401. }
  402. return style;
  403. },
  404. },
  405. {
  406. label: "合作状态",
  407. value: this.$t(this.mainData.status),
  408. style: function () {
  409. let style = {};
  410. switch (that.mainData.status) {
  411. case "潜在":
  412. style = { color: "#3874f6" };
  413. break;
  414. case "合作中":
  415. style = { color: "#67c23a" };
  416. break;
  417. case "暂缓":
  418. style = { color: "#e6a23c" };
  419. break;
  420. case "暂缓":
  421. style = { color: "#d90a0a" };
  422. break;
  423. case "已终止":
  424. style = { color: "#f56c6c" };
  425. break;
  426. default:
  427. break;
  428. }
  429. return style;
  430. },
  431. },
  432. {
  433. label: "来源公海",
  434. value: this.mainData.sourcepoolname,
  435. },
  436. {
  437. label: "负责人",
  438. value: this.mainData.leader
  439. ? this.mainData.leader.length
  440. ? this.mainData.leader[0].name
  441. : "--"
  442. : "--",
  443. },
  444. {
  445. label: "部门",
  446. value: this.mainData.leader
  447. ? this.mainData.leader.length
  448. ? this.mainData.leader[0].depname
  449. : "--"
  450. : "--",
  451. },
  452. {
  453. label: "归属经销商",
  454. value: this.mainData.agentname,
  455. },
  456. {
  457. label: "营销费用",
  458. value:
  459. "¥ " + this.tool.formatAmount(this.mainData.salesfeesamount, 2),
  460. },
  461. ];
  462. if (
  463. this.$route.query.portrait == "1" ||
  464. this.$route.query.portrait == "ht" ||
  465. this.$route.query.portrait == "xm" ||
  466. this.$route.query.portrait == "dd" ||
  467. this.$route.query.portrait == "fw"
  468. ) {
  469. this.$refs.mindmap.onShow();
  470. }
  471. },
  472. // 监听切换数据,上一页,下一页
  473. pageChange(id, rowindex, tabIndex) {
  474. console.log("翻页");
  475. this.flag = false;
  476. /* tabIndex = this.$route.query.tabIndex*/
  477. /* this.$router.replace({path:'/customerDetail',query:{id:id,rowindex:rowindex,tabIndex:tabIndex,portrait:''}})*/
  478. this.queryMainData(id);
  479. },
  480. onSuccess() {
  481. this.visible = false;
  482. this.queryMainData(this.$route.query.id);
  483. this.$emit("onSuccess");
  484. },
  485. statusChangeSuccess() {
  486. /* this.$refs.details.refreshTag()
  487. this.$refs.baseDetail.basicData()
  488. this.$refs.baseDetail.systemData()*/
  489. this.flag = false;
  490. this.queryMainData();
  491. },
  492. onEditSuccess() {
  493. this.flag = false;
  494. this.queryMainData();
  495. },
  496. sysTag(val) {
  497. this.tagFlag = false;
  498. for (let i = 0; i < val.length; i++) {
  499. if (val[i] == "疑似重复") {
  500. this.tagFlag = true;
  501. break;
  502. }
  503. }
  504. },
  505. onSuccessTag() {
  506. this.$refs.details.$refs.tag.queryTag();
  507. },
  508. },
  509. mounted() {},
  510. created() {
  511. this.queryMainData(this.$route.query.id);
  512. },
  513. };
  514. </script>
  515. <style scoped>
  516. </style>