customerDetails.vue 22 KB

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