customerDetails.vue 18 KB

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