customerDetails.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  1. <template>
  2. <div class="contents" v-if="item!=null">
  3. <div class="customer-title" >
  4. <div class="customer-name">
  5. {{ showDuplicate?item.customerName+"[从]":item.customerName}}
  6. <el-button size="mini" v-if="showDuplicate" v-hasPermi="['crm:customer:lookDuplicate']" @click=" getDetails" >主客户</el-button>
  7. </div>
  8. <div>
  9. <el-button size="mini" v-hasPermi="['crm:customer:edit']" @click=" handleEdit()">修改客户</el-button>
  10. <el-button size="mini" v-hasPermi="['crm:customer:addTag']" @click=" handleAddTag()" >打标签</el-button>
  11. <el-button size="mini" v-hasPermi="['crm:customer:addRemark']" @click=" handleAddRemark()" >修改备注</el-button>
  12. </div>
  13. </div>
  14. <el-descriptions title="" :column="3" border>
  15. <el-descriptions-item label="客户编号" >
  16. <span v-if="item!=null">{{item.customerCode}}</span>
  17. </el-descriptions-item>
  18. <el-descriptions-item label="客户名称" >
  19. <span v-if="item!=null">{{item.customerName}}</span>
  20. </el-descriptions-item>
  21. <el-descriptions-item label="手机号" >
  22. <span v-if="item!=null">{{item.mobile}}</span>
  23. <el-button type="text" v-if="isReceive" size="mini" @click="callNumber(item.customerId,null,null,null)">拨号</el-button>
  24. <el-button type="text" v-if="isReceive" size="mini" @click="handleSms(item.mobile)">短信</el-button>
  25. <el-button icon="el-icon-search" size="mini" @click="handleMobile" style="margin-left: 20px;" circle v-hasPermi="['crm:customer:query2']"></el-button>
  26. </el-descriptions-item>
  27. <el-descriptions-item label="性别" >
  28. <span v-if="item!=null">
  29. <el-tag v-for="(dict, index) in sexOptions" v-if="item.sex==dict.dictValue">{{dict.dictLabel}}</el-tag>
  30. </span>
  31. </el-descriptions-item>
  32. <el-descriptions-item label="微信号" >
  33. <span v-if="item!=null">
  34. {{item.weixin}}
  35. </span>
  36. </el-descriptions-item>
  37. <el-descriptions-item label="所在地">
  38. <span v-if="item!=null">
  39. {{item.address}}
  40. </span>
  41. </el-descriptions-item>
  42. <el-descriptions-item label="客户来源" >
  43. <span v-if="item!=null">
  44. <el-tag v-for="(dict, index) in sourceOptions" v-if="item.source==dict.dictValue">{{dict.dictLabel}}</el-tag>
  45. </span>
  46. </el-descriptions-item>
  47. <el-descriptions-item label="客户类型" >
  48. <span v-if="item!=null">
  49. <el-tag v-for="(dict, index) in typeOptions" v-if="item.customerType==dict.dictValue">{{dict.dictLabel}}</el-tag>
  50. </span>
  51. </el-descriptions-item>
  52. <el-descriptions-item label="客户状态" >
  53. <span v-if="item!=null">
  54. <el-tag v-for="(dict, index) in statusOptions" v-if="item.status==dict.dictValue">{{dict.dictLabel}}</el-tag>
  55. </span>
  56. </el-descriptions-item>
  57. <el-descriptions-item label="创建时间" >
  58. <span v-if="item!=null">
  59. {{item.createTime}}
  60. </span>
  61. </el-descriptions-item>
  62. <el-descriptions-item label="最后一次跟进时间" label-class-name="my-label">
  63. <span v-if="item!=null">
  64. {{item.visitTime}}
  65. </span>
  66. </el-descriptions-item>
  67. <el-descriptions-item label="入公海时间" label-class-name="my-label">
  68. <span v-if="item!=null">
  69. {{item.poolTime}}
  70. </span>
  71. </el-descriptions-item>
  72. <el-descriptions-item label="标签" label-class-name="my-label">
  73. <span v-if="item!=null && item.tags != null">
  74. <el-tag v-for="tag in item.tags.split(',')" size="mini">{{ tag }}</el-tag>
  75. </span>
  76. <!-- <el-button size="mini" icon="el-icon-edit"></el-button> -->
  77. </el-descriptions-item>
  78. <el-descriptions-item label="进线日期" label-class-name="my-label">
  79. <span v-if="item!=null">
  80. {{item.registerDate}}
  81. </span>
  82. <!-- <el-button size="mini" icon="el-icon-edit"></el-button> -->
  83. </el-descriptions-item>
  84. <el-descriptions-item label="进线链接" label-class-name="my-label">
  85. <span v-if="item!=null">
  86. {{item.registerLinkUrl}}
  87. </span>
  88. <!-- <el-button size="mini" icon="el-icon-edit"></el-button> -->
  89. </el-descriptions-item>
  90. <el-descriptions-item label="进线客户详情" label-class-name="my-label">
  91. <span v-if="item!=null">
  92. {{item.registerDesc}}
  93. </span>
  94. <!-- <el-button size="mini" icon="el-icon-edit"></el-button> -->
  95. </el-descriptions-item>
  96. <el-descriptions-item label="进线客户填写时间" label-class-name="my-label">
  97. <span v-if="item!=null">
  98. {{item.registerSubmitTime}}
  99. </span>
  100. <!-- <el-button size="mini" icon="el-icon-edit"></el-button> -->
  101. </el-descriptions-item>
  102. <el-descriptions-item label="进线方式" label-class-name="my-label">
  103. <span v-if="item!=null">
  104. {{item.registerType}}
  105. </span>
  106. <!-- <el-button size="mini" icon="el-icon-edit"></el-button> -->
  107. </el-descriptions-item>
  108. <el-descriptions-item label="购买渠道" label-class-name="my-label">
  109. <span v-if="item!=null">
  110. {{item.platformName || ''}}
  111. </span>
  112. </el-descriptions-item>
  113. <el-descriptions-item label="购买商品" label-class-name="my-label">
  114. <span v-if="item!=null">
  115. {{item.goodsName || ''}} - {{item.goodsSpecification || ''}}
  116. </span>
  117. </el-descriptions-item>
  118. <el-descriptions-item label="购买店铺" label-class-name="my-label">
  119. <span v-if="item!=null">
  120. {{item.shopName || ''}}
  121. </span>
  122. </el-descriptions-item>
  123. <el-descriptions-item label="消费金额" label-class-name="my-label">
  124. <span v-if="item!=null">
  125. {{item.payMoney}}
  126. </span>
  127. <!-- <el-button size="mini" icon="el-icon-edit"></el-button> -->
  128. </el-descriptions-item>
  129. <el-descriptions-item label="购买次数" label-class-name="my-label">
  130. <span v-if="item!=null">
  131. {{item.buyCount}}
  132. </span>
  133. <!-- <el-button size="mini" icon="el-icon-edit"></el-button> -->
  134. </el-descriptions-item>
  135. <el-descriptions-item label="来源渠道编码" label-class-name="my-label">
  136. <span v-if="item!=null">
  137. {{item.sourceCode}}
  138. </span>
  139. <!-- <el-button size="mini" icon="el-icon-edit"></el-button> -->
  140. </el-descriptions-item>
  141. <el-descriptions-item label="推荐编码" label-class-name="my-label">
  142. <span v-if="item!=null">
  143. {{item.pushCode}}
  144. </span>
  145. <!-- <el-button size="mini" icon="el-icon-edit"></el-button> -->
  146. </el-descriptions-item>
  147. <el-descriptions-item label="推荐时间" label-class-name="my-label">
  148. <span v-if="item!=null">
  149. {{item.pushTime}}
  150. </span>
  151. <!-- <el-button size="mini" icon="el-icon-edit"></el-button> -->
  152. </el-descriptions-item>
  153. <el-descriptions-item :label="ext.name" v-for="ext in exts" label-class-name="my-label">
  154. <span >
  155. {{ext.value}}
  156. </span>
  157. </el-descriptions-item>
  158. <el-descriptions-item label="备注" label-class-name="my-label">
  159. <span v-if="item!=null">
  160. {{item.remark}}
  161. </span>
  162. <!-- <el-button size="mini" icon="el-icon-edit"></el-button> -->
  163. </el-descriptions-item>
  164. </el-descriptions>
  165. <el-tabs style="margin-top:15px;" z-index = "99" type="border-card" v-model="activeName" @tab-click="handleClick">
  166. <el-tab-pane label="跟进记录" name="visit">
  167. <customer-visit-list ref="visit"></customer-visit-list>
  168. </el-tab-pane>
  169. <el-tab-pane label="联系人" name="contacts">
  170. <customer-contacts ref="contacts"></customer-contacts>
  171. </el-tab-pane>
  172. <el-tab-pane label="订单记录" name="storeOrder">
  173. <customer-store-order-list ref="storeOrder"></customer-store-order-list>
  174. </el-tab-pane>
  175. <el-tab-pane label="通话记录" name="voiceLogs">
  176. <customer-voice-logs-list ref="voiceLogs"></customer-voice-logs-list>
  177. </el-tab-pane>
  178. <el-tab-pane label="短信记录" name="smsLogs">
  179. <customer-sms-logs-list ref="smsLogs"></customer-sms-logs-list>
  180. </el-tab-pane>
  181. <el-tab-pane label="客户日志" name="logs">
  182. <customer-logs-list ref="logs"></customer-logs-list>
  183. </el-tab-pane>
  184. <el-tab-pane label="历史订单" name="hisOrder">
  185. <customer-his-order-list ref="hisOrder"></customer-his-order-list>
  186. </el-tab-pane>
  187. <el-tab-pane label="AI通话记录" name="aiVoiceLogs">
  188. <ai-call-voice-log ref="aiVoiceRef"></ai-call-voice-log>
  189. </el-tab-pane>
  190. <el-tab-pane label="AI加微记录" name="aiAddWxLogs">
  191. <ai-add-wx-log ref="aiAddWxRef"></ai-add-wx-log>
  192. </el-tab-pane>
  193. <el-tab-pane label="AI短信记录" name="aiSendMsgLogs">
  194. <ai-send-msg-log ref="aiSendMsgRef"></ai-send-msg-log>
  195. </el-tab-pane>
  196. </el-tabs>
  197. <el-dialog :title="addTag.title" :visible.sync="addTag.open" width="600px" append-to-body>
  198. <add-tag ref="tag" @close="closeTag()"></add-tag>
  199. </el-dialog>
  200. <el-dialog :title="addRemark.title" :visible.sync="addRemark.open" width="600px" append-to-body>
  201. <add-remark ref="remark" @close="closeRemark()"></add-remark>
  202. </el-dialog>
  203. <el-dialog :title="addSms.title" :visible.sync="addSms.open" width="800px" append-to-body>
  204. <add-sms ref="sms" @close="closeSms()"></add-sms>
  205. </el-dialog>
  206. <el-dialog :title="customer.title" :visible.sync="customer.open" width="1000px" append-to-body>
  207. <add-or-edit-customer ref="customer" @close="closeCustomer()"></add-or-edit-customer>
  208. </el-dialog>
  209. <!-- <el-dialog :title="duplicate.title" :visible.sync="duplicate.open" width="800px" append-to-body>
  210. <duplicate-customer ref="duplicateCustomer" @close="closeDuplicate()"></duplicate-customer>
  211. </el-dialog> -->
  212. <el-drawer size="75%" :modal="false" :title="duplicate.title" :visible.sync="duplicate.open">
  213. <duplicate-customer ref="duplicateCustomer" />
  214. </el-drawer>
  215. </div>
  216. </template>
  217. <script>
  218. import { listCustomerExt } from "@/api/crm/customerExt";
  219. import customerVisitList from '../components/customerVisitList.vue';
  220. import customerLogsList from '../components/customerLogsList.vue';
  221. import customerSmsLogsList from '../components/customerSmsLogsList.vue';
  222. import customerVoiceLogsList from '../components/customerVoiceLogsList.vue';
  223. import customerStoreOrderList from '../components/customerStoreOrderList.vue';
  224. import duplicateCustomer from '../components/duplicateCustomer.vue';
  225. import customerContacts from './customerContacts.vue';
  226. import customerHisOrderList from '../components/customerHisOrderList.vue';
  227. import aiCallVoiceLog from './aiCallVoiceLog';
  228. import aiAddWxLog from './aiAddWxLog';
  229. import aiSendMsgLog from './aiSendMsgLog';
  230. import { getCustomerDetails1,updateCustomer,getCustomer1 } from "@/api/crm/customer";
  231. import addTag from './addTag.vue';
  232. import addRemark from './addRemark.vue';
  233. import addSms from './addSms.vue';
  234. import addOrEditCustomer from '../components/addOrEditCustomer.vue';
  235. export default {
  236. name: "customer",
  237. components: {customerHisOrderList,addOrEditCustomer,addSms,addTag,addRemark, customerContacts,customerVisitList,customerLogsList,
  238. customerVoiceLogsList,customerStoreOrderList,customerSmsLogsList,duplicateCustomer,aiCallVoiceLog,aiAddWxLog,aiSendMsgLog },
  239. data() {
  240. return {
  241. calleesId:null,
  242. roboticId:null,
  243. customer:{
  244. open:false,
  245. title:"修改客户"
  246. },
  247. isReceive:false,
  248. tagId:null,
  249. tagsOptions:[],
  250. addSms:{
  251. open:false,
  252. title:"发短信"
  253. },
  254. addTag:{
  255. open:false,
  256. title:"打标签"
  257. },
  258. addRemark:{
  259. open:false,
  260. title:"客户备注"
  261. },
  262. duplicate:{
  263. open:false,
  264. title:"客户详情"
  265. },
  266. customerId:null,
  267. // 弹出层标题
  268. title: "",
  269. // 是否显示弹出层
  270. open: false,
  271. cityIds:[],
  272. citys:[],
  273. tags:[],
  274. inputVisible: false,
  275. inputValue: '',
  276. receiveOptions:[],
  277. statusOptions:[],
  278. typeOptions:[],
  279. sourceOptions:[],
  280. sexOptions:[],
  281. customerExts:[],
  282. activeName:"",
  283. item:null,
  284. showDuplicate:false,
  285. dCustomerId:null,
  286. };
  287. },
  288. created() {
  289. this.getDicts("crm_customer_source").then((response) => {
  290. this.sourceOptions = response.data;
  291. });
  292. this.getDicts("sys_sex").then((response) => {
  293. this.sexOptions = response.data;
  294. });
  295. this.getDicts("crm_customer_tag").then((response) => {
  296. this.tagsOptions = response.data;
  297. });
  298. this.getDicts("crm_customer_status").then((response) => {
  299. this.statusOptions = response.data;
  300. });
  301. this.getDicts("crm_customer_type").then((response) => {
  302. this.typeOptions = response.data;
  303. });
  304. this.getDicts("crm_customer_is_receive").then((response) => {
  305. this.receiveOptions = response.data;
  306. });
  307. },
  308. mounted(){
  309. },
  310. methods: {
  311. handleMobile(){
  312. const customerId = this.item.customerId;
  313. getCustomer1(customerId).then(response =>{
  314. this.item.mobile = response.mobile;
  315. })
  316. },
  317. handleEdit() {
  318. this.customer.open = true;
  319. var that=this;
  320. setTimeout(() => {
  321. that.$refs.customer.handleUpdate(that.customerId);
  322. }, 200);
  323. },
  324. closeCustomer(){
  325. this.customer.open=false;
  326. this.getDetails(this.customerId)
  327. },
  328. tagsChange(e){
  329. var item=this.tagsOptions.find(val => val.dictValue === e);
  330. console.log(item);
  331. this.tags.push(item.dictLabel);
  332. this.form.tags=this.tags.toString();
  333. },
  334. closeSms(){
  335. this.addSms.open=false;
  336. this.getDetails(this.customerId)
  337. },
  338. handleSms(mobile){
  339. this.addSms.open=true;
  340. var that=this;
  341. setTimeout(() => {
  342. that.$refs.sms.reset(this.item.customerId,mobile,1);
  343. }, 500);
  344. },
  345. closeRemark(){
  346. this.addRemark.open=false;
  347. this.getDetails(this.customerId)
  348. },
  349. handleAddRemark(){
  350. this.addRemark.open=true;
  351. var that=this;
  352. setTimeout(() => {
  353. that.$refs.remark.reset(this.item);
  354. }, 500);
  355. },
  356. closeTag(){
  357. this.addTag.open=false;
  358. this.getDetails(this.customerId)
  359. },
  360. handleAddTag(){
  361. this.addTag.open=true;
  362. var that=this;
  363. setTimeout(() => {
  364. that.$refs.tag.reset(this.item);
  365. }, 500);
  366. },
  367. handleClick(tab, event) {
  368. if(tab.name=="contacts"){
  369. this.$refs.contacts.getData(this.item.customerId);
  370. }
  371. if(tab.name == "visit"){
  372. this.$refs.visit.getData(this.item.customerId,this.isReceive);
  373. }
  374. if(tab.name=="logs"){
  375. this.$refs.logs.getData(this.item.customerId);
  376. }
  377. if(tab.name=="voiceLogs"){
  378. this.$refs.voiceLogs.getData(this.item.customerId);
  379. }
  380. if(tab.name=="storeOrder"){
  381. this.$refs.storeOrder.getData(this.item.customerId);
  382. }
  383. if(tab.name=="smsLogs"){
  384. this.$refs.smsLogs.getData(this.item.customerId);
  385. }
  386. if(tab.name=="hisOrder"){
  387. this.$refs.hisOrder.getData(this.item.customerId);
  388. }
  389. if(tab.name=="aiVoiceLogs"){
  390. console.log(this.item.customerId);
  391. this.$refs.aiVoiceRef.getData(this.item.customerId,this.calleesId);
  392. } else if(tab.name=="aiAddWxLogs"){
  393. console.log(this.item.customerId);
  394. this.$refs.aiAddWxRef.getData(this.item.customerId,this.roboticId);
  395. } else if(tab.name=="aiSendMsgLogs"){
  396. console.log(this.item.customerId);
  397. this.$refs.aiSendMsgRef.getData(this.item.customerId,this.calleesId,this.roboticId);
  398. }
  399. },
  400. getDetails(customerId,calleesId,roboticId) {
  401. if(!!calleesId){
  402. this.calleesId = calleesId;
  403. console.log(this.calleesId);
  404. }
  405. if(!!roboticId){
  406. this.roboticId = roboticId;
  407. console.log(this.roboticId);
  408. }
  409. var data={customerId:customerId}
  410. this.customerId=customerId;
  411. var that=this;
  412. this.exts=[];
  413. listCustomerExt(data).then(response => {
  414. this.customerExts = response.data;
  415. this.customerExts.forEach(element => {
  416. var data={extId:element.extId,name:element.name,value:""};
  417. this.exts.push(data)
  418. });
  419. });
  420. getCustomerDetails1(data).then(response => {
  421. this.item = response.customer;
  422. this.isReceive=response.isReceive;
  423. if(this.item.extJson!=null){
  424. var extList=JSON.parse(this.item.extJson);
  425. that.exts.forEach(item => {
  426. extList.forEach(element => {
  427. if(item.extId==element.extId){
  428. item.value=element.value
  429. }
  430. });
  431. });
  432. }
  433. this.activeName="visit"
  434. setTimeout(() => {
  435. that.$refs.visit.getData(customerId);
  436. }, 500);
  437. });
  438. },
  439. initDuplicate(isDuplicate,dCustomerId){
  440. this.showDuplicate=isDuplicate;
  441. this.dCustomerId=dCustomerId;
  442. },
  443. handleDuplicate(){
  444. this.duplicate.open=true;
  445. var that=this;
  446. setTimeout(() => {
  447. that.$refs.duplicateCustomer.getDetails(that.dCustomerId);
  448. }, 200);
  449. },
  450. closeDuplicate(){
  451. this.duplicate.open=false;
  452. this.getDetails(this.customerId)
  453. },
  454. }
  455. };
  456. </script>
  457. <style lang="scss" scoped>
  458. .contents{
  459. height: 100%;
  460. background-color: #fff;
  461. padding: 0px 20px;
  462. }
  463. .customer-title{
  464. margin-bottom: 15px;
  465. display: flex;
  466. align-items: center;
  467. justify-content: space-between;
  468. .customer-name{
  469. font-size: 28px;
  470. }
  471. }
  472. </style>
  473. <style>
  474. .el-descriptions-item__label.is-bordered-label{
  475. font-weight: normal;
  476. }
  477. </style>