duplicateCustomer.vue 17 KB

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