userProfile.html 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport"
  7. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no, viewport-fit=cover" />
  8. <title>微分机器人</title>
  9. <!--引入 element-ui 的样式,-->
  10. <link rel="stylesheet"
  11. href="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742018383195/element-ui.css">
  12. <!-- 必须先引入vue, 后使用element-ui -->
  13. <script
  14. src="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742017957144/vue.js"></script>
  15. <!-- 引入element 的组件库-->
  16. <script
  17. src="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742017747738/element-ui.js"></script>
  18. <!-- <script src="https://unpkg.com/vconsole/dist/vconsole.min.js"></script>
  19. <script>
  20. var vConsole = new window.VConsole();
  21. </script> -->
  22. </head>
  23. <style>
  24. body {
  25. margin: 0;
  26. padding: 0;
  27. }
  28. .box {
  29. width: 100vw;
  30. height: auto;
  31. box-sizing: border-box;
  32. background: #FAFAFA;
  33. }
  34. .page6 {
  35. width: 100vw;
  36. box-sizing: border-box;
  37. }
  38. .tab_list {
  39. width: 100%;
  40. height: 48px;
  41. background: #FFFFFF;
  42. }
  43. .client_detail {
  44. width: 100vw;
  45. min-height: 100vh;
  46. padding: 10px 10px 12px;
  47. box-sizing: border-box;
  48. }
  49. .client_msg {
  50. width: 100%;
  51. background: #FFFFFF;
  52. border-radius: 10px;
  53. padding: 15px 15px 20px;
  54. box-sizing: border-box;
  55. margin-bottom: 10px;
  56. }
  57. .client_wx {
  58. display: flex;
  59. align-items: center;
  60. margin-bottom: 15px;
  61. }
  62. .client_wx img {
  63. width: 64px;
  64. height: 64px;
  65. border-radius: 8px;
  66. margin-right: 12px;
  67. }
  68. .wx_msg {
  69. display: flex;
  70. flex-direction: column;
  71. font-weight: 500;
  72. font-size: 16px;
  73. color: #222222;
  74. }
  75. .wx_tag {
  76. color: #05D167;
  77. padding-left: 10px;
  78. }
  79. .add_time {
  80. font-weight: 400;
  81. font-size: 14px;
  82. color: #CCCCCC;
  83. padding-top: 10px;
  84. }
  85. .msg_title {
  86. font-weight: 400;
  87. font-size: 14px;
  88. color: #222222;
  89. line-height: 20px;
  90. position: relative;
  91. display: flex;
  92. align-items: center;
  93. padding-left: 5px;
  94. margin-bottom: 15px;
  95. &::before {
  96. content: '';
  97. position: absolute;
  98. width: 3px;
  99. height: 12px;
  100. left: 0;
  101. background: #1677FF;
  102. border-radius: 2px;
  103. }
  104. }
  105. .msg_title_line {
  106. padding-top: 15px;
  107. border-top: 1px dashed #E5E8ED;
  108. }
  109. .basic_msg {
  110. display: flex;
  111. flex-wrap: wrap;
  112. }
  113. .basic_msg_item {
  114. font-weight: 400;
  115. font-size: 14px;
  116. color: #222222;
  117. line-height: 20px;
  118. margin-bottom: 15px;
  119. display: flex;
  120. align-items: flex-start;
  121. justify-content: flex-start;
  122. }
  123. .basic_msg_item img {
  124. width: 16px;
  125. height: 16px;
  126. margin-left: 4px;
  127. margin-top: 2px;
  128. }
  129. .basic_msg_data {
  130. color: #999999;
  131. padding-right: 5px;
  132. flex-shrink: 0;
  133. }
  134. .three_tab_list {
  135. width: 100%;
  136. height: 58px;
  137. background: #FFFFFF;
  138. }
  139. .three_tab {
  140. width: 100%;
  141. background: #FFFFFF;
  142. border-radius: 10px;
  143. padding: 0 10px 10px;
  144. box-sizing: border-box;
  145. }
  146. .data_box {
  147. width: 100%;
  148. padding: 15px;
  149. background: #F7F9FC;
  150. border-radius: 5px;
  151. margin-bottom: 20px;
  152. box-sizing: border-box;
  153. }
  154. .belong_item {
  155. display: flex;
  156. align-items: center;
  157. margin-bottom: 15px;
  158. font-weight: 400;
  159. font-size: 14px;
  160. color: #222222;
  161. }
  162. .belong_item:last-child {
  163. margin-bottom: 0;
  164. }
  165. .belong_title {
  166. color: #999999;
  167. margin-right: 5px;
  168. flex-shrink: 0;
  169. }
  170. .client_followUp {
  171. width: 100vw;
  172. height: calc(100vh - 48px);
  173. padding: 20px 10px 60px;
  174. box-sizing: border-box;
  175. overflow-y: auto;
  176. }
  177. .stage {
  178. width: 100%;
  179. background: #F5F7FA;
  180. border-radius: 5px;
  181. padding: 15px;
  182. display: flex;
  183. align-items: center;
  184. font-weight: 400;
  185. font-size: 16px;
  186. color: #222222;
  187. box-sizing: border-box;
  188. margin-bottom: 20px;
  189. }
  190. .stage img {
  191. width: 24px;
  192. height: 24px;
  193. margin-right: 5px;
  194. }
  195. .stage_data {
  196. font-weight: 500;
  197. font-size: 16px;
  198. color: #1677FF;
  199. }
  200. .followup_list {
  201. width: 100%;
  202. padding: 15px 10px;
  203. background: #FFFFFF;
  204. border-radius: 10px;
  205. box-sizing: border-box;
  206. }
  207. .follow_time {
  208. display: flex;
  209. align-items: center;
  210. font-weight: 400;
  211. font-size: 14px;
  212. color: #222222;
  213. margin-bottom: 15px;
  214. }
  215. .time_dot {
  216. background: #E6F0FF;
  217. padding: 3px;
  218. border-radius: 50%;
  219. margin-right: 10px;
  220. box-sizing: border-box;
  221. }
  222. .dot {
  223. width: 6px;
  224. height: 6px;
  225. background: #1677FF;
  226. border-radius: 50%;
  227. }
  228. .follow_item {
  229. margin-left: 22px;
  230. padding-right: 10px;
  231. padding-left: 14px;
  232. padding-bottom: 6px;
  233. }
  234. .follow_padding {
  235. padding-top: 15px;
  236. padding-bottom: 4px;
  237. background: #F7F9FC;
  238. border-radius: 5px;
  239. }
  240. .follow_item_time {
  241. font-weight: 500;
  242. font-size: 14px;
  243. color: #222222;
  244. display: flex;
  245. align-items: center;
  246. margin-bottom: 3px;
  247. }
  248. .item_time {
  249. font-weight: 400;
  250. font-size: 12px;
  251. color: #999999;
  252. padding-right: 10px;
  253. }
  254. .item_box {
  255. display: flex;
  256. align-items: flex-end;
  257. }
  258. .follow_item_line {
  259. display: flex;
  260. flex-direction: column;
  261. align-items: center;
  262. padding-left: 13px;
  263. padding-right: 21px;
  264. }
  265. .line_dot {
  266. width: 6px;
  267. height: 6px;
  268. background: #1677FF;
  269. border-radius: 50%;
  270. margin-bottom: 5px;
  271. }
  272. .line {
  273. width: 1px;
  274. height: 66px;
  275. border-left: 1px dashed #1677FF;
  276. }
  277. .item_content {
  278. background: #FFFFFF;
  279. border-radius: 5px;
  280. padding: 10px;
  281. font-weight: 400;
  282. font-size: 12px;
  283. color: #222222;
  284. width: 100%;
  285. height: 100%;
  286. }
  287. .item_tip {
  288. font-weight: 400;
  289. font-size: 12px;
  290. color: #999999;
  291. margin-top: 6px;
  292. }
  293. .item_p {
  294. color: #1677FF;
  295. }
  296. .tag_list {
  297. display: flex;
  298. flex-wrap: wrap;
  299. }
  300. .tag_item {
  301. font-weight: 400;
  302. font-size: 12px;
  303. color: #1677FF;
  304. padding: 6px 10px;
  305. border-radius: 5px;
  306. border: 1px solid #1677FF;
  307. margin-right: 10px;
  308. margin-bottom: 15px;
  309. }
  310. .tag_item:last-child {
  311. margin-right: 0;
  312. }
  313. .read_content {
  314. display: flex;
  315. }
  316. .read_box {
  317. width: 100%;
  318. padding: 15px 15px 10px;
  319. font-weight: 400;
  320. font-size: 14px;
  321. color: #222222;
  322. background: #F7F9FC;
  323. border-radius: 5px;
  324. }
  325. .read_title {
  326. padding-bottom: 10px;
  327. }
  328. .read_num {
  329. font-weight: bold;
  330. font-size: 20px;
  331. color: #222222;
  332. line-height: 29px;
  333. }
  334. .foot_btn {
  335. position: fixed;
  336. bottom: 10px;
  337. padding: 0 35px;
  338. width: 100%;
  339. box-sizing: border-box;
  340. }
  341. .signUp_btn {
  342. height: 50px;
  343. width: 100%;
  344. background: #1677FF;
  345. border-radius: 10px;
  346. font-weight: bold;
  347. font-size: 14px;
  348. color: #FFFFFF;
  349. text-align: center;
  350. }
  351. .el-dialog {
  352. width: 335px;
  353. border-radius: 20px;
  354. }
  355. .el-dialog__header {
  356. text-align: center;
  357. }
  358. .el-dialog__title {
  359. font-weight: 500;
  360. font-size: 16px;
  361. color: #222222;
  362. }
  363. .el-dialog__body {
  364. height: 260px;
  365. overflow-y: auto;
  366. }
  367. .prize_form .el-form-item {
  368. padding: 0;
  369. }
  370. .prize_form .el-form-item__label {
  371. line-height: 20px;
  372. }
  373. .prize_form .el-input {
  374. width: 295px;
  375. }
  376. .prize_form .el-input__inner {
  377. text-align: left;
  378. }
  379. .prize_form .el-textarea.is-active .el-textarea__inner,
  380. .prize_form .el-textarea__inner:focus {
  381. border: 1px solid #1677FF;
  382. }
  383. .el-radio__input.is-checked .el-radio__inner {
  384. border-color: #1677FF;
  385. background: #1677FF;
  386. }
  387. .el-radio__input.is-checked+.el-radio__label {
  388. color: #1677FF;
  389. }
  390. .el-radio {
  391. margin-top: 10px;
  392. }
  393. .el-select .el-input.is-focus .el-input__inner {
  394. border-color: #1677FF;
  395. }
  396. .dialog-footer {
  397. text-align: center;
  398. }
  399. .dialog-footer button {
  400. width: 100%;
  401. height: 46px;
  402. background: #1677FF;
  403. border-radius: 20px;
  404. font-weight: 500;
  405. font-size: 16px;
  406. color: #FFFFFF;
  407. border: none;
  408. }
  409. </style>
  410. <body>
  411. <div id="box" class="box">
  412. <div class="page6">
  413. <el-tabs class="tab_list" v-model="activeName" stretch @tab-click="handleClick">
  414. <el-tab-pane label="客户画像" name="first"></el-tab-pane>
  415. <el-tab-pane label="客户跟进" name="second"></el-tab-pane>
  416. </el-tabs>
  417. <div class="client_detail" v-if="activeName ==='first'">
  418. <div class="client_msg">
  419. <div class="client_wx">
  420. <img :src="clientData.avatar" />
  421. <div class="wx_msg">
  422. <div>{{clientData.name}}<span class="wx_tag">@微信</span></div>
  423. <div class="add_time">添加时间:{{clientData.addTime}}</div>
  424. </div>
  425. </div>
  426. <div class="msg_title msg_title_line">基本信息</div>
  427. <div class="basic_msg" style="width: 100%;">
  428. <div class="basic_msg_item" style="width: 50%;">
  429. <span class="basic_msg_data">姓名:</span>
  430. <span>{{clientData.realName}}</span>
  431. </div>
  432. <div class="basic_msg_item" style="width: 50%;">
  433. <span class="basic_msg_data">手机:</span>
  434. <span>{{clientData.phone}}</span>
  435. <img src="./img/edit.png" alt="" @click="handleEdit('手机', clientData.phone, 'phone')">
  436. </div>
  437. <div class="basic_msg_item" style="width: 50%;">
  438. <span class="basic_msg_data">省市:</span>
  439. <span>{{clientData.province}}-{{clientData.city}}</span>
  440. </div>
  441. <div class="basic_msg_item" style="width: 50%;">
  442. <span class="basic_msg_data">意向车型:</span>
  443. <span>{{clientData.intenModel}}</span>
  444. </div>
  445. <div class="basic_msg_item" style="width: 50%;">
  446. <span class="basic_msg_data">已购车型:</span>
  447. <span>{{clientData.buyModel}}</span>
  448. </div>
  449. <div class="basic_msg_item" style="width: 50%;" v-for="(item, index) in clientData.cols">
  450. <span class="basic_msg_data">{{item.name}}:</span>
  451. <span v-if="item.value">{{item.value[0]}}</span>
  452. <img src="./img/edit.png" alt="" @click="handleEditOther">
  453. </div>
  454. </div>
  455. <!-- <div class="msg_title msg_title_line">服务信息</div>
  456. <div class="basic_msg">
  457. <div class="basic_msg_item">
  458. <span class="basic_msg_data">上次到店时间:</span>
  459. <span>2024/03/10 12:30:53</span>
  460. </div>
  461. <div class="basic_msg_item">
  462. <span class="basic_msg_data">到店业务类型:</span>
  463. <span>维修</span>
  464. </div>
  465. <div class="basic_msg_item">
  466. <span class="basic_msg_data">备注:</span>
  467. <span>水电费收到水电费收到水电费收到水电费收到水电费收到</span>
  468. </div>
  469. </div> -->
  470. </div>
  471. <div class="three_tab">
  472. <el-tabs class="three_tab_list" v-model="itemActiveName" stretch @tab-click="handleDetailTab">
  473. <el-tab-pane label="画像" name="first"></el-tab-pane>
  474. <el-tab-pane label="记录" name="second"></el-tab-pane>
  475. <!-- <el-tab-pane label="车辆" name="third"></el-tab-pane> -->
  476. </el-tabs>
  477. <div v-if="itemActiveName === 'first'">
  478. <div class="data_box">
  479. <div class="belong_item">
  480. <div class="belong_title">所属成员:</div>
  481. <template v-if="clientData.memberList">
  482. <div v-if="clientData.memberList.length > 1">
  483. {{ clientData.memberList[0] }}等<span style="color: #1677FF;">{{ clientData.memberList.length }}</span>人
  484. </div>
  485. <div v-else-if="clientData.memberList.length === 1">
  486. {{ clientData.memberList[0] }}
  487. </div>
  488. </template>
  489. </div>
  490. <div class="belong_item">
  491. <div class="belong_title">所在群聊:</div>
  492. <template v-if="clientData.groupChatList">
  493. <div v-if="clientData.groupChatList.length > 1">
  494. 「{{ clientData.groupChatList[0] }}」等<span style="color: #1677FF;">{{ clientData.groupChatList.length }}</span>个群聊
  495. </div>
  496. <div v-else-if="clientData.groupChatList.length === 1">
  497. 「{{ clientData.groupChatList[0] }}」
  498. </div>
  499. </template>
  500. </div>
  501. </div>
  502. <div class="msg_title">客户阶段</div>
  503. <div class="data_box">
  504. <div class="belong_item">
  505. <div class="belong_title">当前阶段:</div>
  506. <div style="color: #1677FF;" v-if="clientData.stepList && clientData.stepList.length">
  507. <span v-for="(item, i) in clientData.stepList" :key="i">「{{ item }}」</span>
  508. </div>
  509. </div>
  510. </div>
  511. <div class="msg_title">客户标签</div>
  512. <div class="data_box" style="padding-bottom: 0;">
  513. <div class="tag_list">
  514. <span class="tag_item" v-for="(item, i) in clientData.tagList" :key="i">{{ item }}</span>
  515. </div>
  516. </div>
  517. </div>
  518. <div v-if="itemActiveName === 'second'">
  519. <!-- <div class="read_content">
  520. <div class="read_box" style="margin-right: 10px;">
  521. <div class="read_title">阅读次数</div>
  522. <div><span class="read_num">7282</span> 次</div>
  523. </div>
  524. <div class="read_box">
  525. <div class="read_title">平均阅读时长</div>
  526. <div><span class="read_num">7282</span> min</div>
  527. </div>
  528. </div> -->
  529. <div class="followup_list" v-for="(item, key) in recordList" :key="key">
  530. <div class="follow_time">
  531. <div class="time_dot">
  532. <div class="dot"></div>
  533. </div>
  534. <span>{{key}}</span>
  535. </div>
  536. <div class="follow_padding">
  537. <div class="follow_item" v-for="(dt, dtIndex) in item" :key="dtIndex">
  538. <div class="follow_item_time">
  539. <span class="item_time">{{timeFormat(dt.createdTime, 'hh:mm')}}</span>
  540. <span v-if="dt.type === 1">阅读日志</span>
  541. <span v-else-if="dt.type === 2">行为日志</span>
  542. <span v-else-if="dt.type === 3">修改日志</span>
  543. </div>
  544. <div class="item_box">
  545. <div class="follow_item_line">
  546. <div class="line_dot"></div>
  547. <div class="line"></div>
  548. </div>
  549. <div class="item_content">
  550. <div>{{dt.title}}</div>
  551. <div class="item_tip">{{dt.content}}</div>
  552. <div class="item_tip" v-if="dt.type === 1">持续时间:<span class="item_p">{{dt.duration}}</span>秒</div>
  553. </div>
  554. </div>
  555. </div>
  556. </div>
  557. </div>
  558. </div>
  559. </div>
  560. </div>
  561. <div class="client_followUp" v-if="activeName === 'second'">
  562. <div class="stage">
  563. <img src="./img/stage.png" />
  564. <div>当前阶段:<span class="stage_data" v-for="(item, key) in stepData" :key="key">「{{item}}」</span></div>
  565. </div>
  566. <div class="followup_list" v-for="(item, key) in stepFollowList" :key="key">
  567. <div class="follow_time">
  568. <div class="time_dot">
  569. <div class="dot"></div>
  570. </div>
  571. <span>{{item.date}}</span>
  572. </div>
  573. <div class="follow_padding">
  574. <div class="follow_item" v-for="(c, cIndex) in item.content" :key="cIndex">
  575. <div class="follow_item_time">
  576. <span class="item_time">{{timeFormat(c.updatedTime, 'hh:mm')}}</span>跟进方式:
  577. <span v-if="item.followType === 0">电话联系</span>
  578. <span v-else-if="item.followType === 1">面聊</span>
  579. <span v-else-if="item.followType === 2">微信联系</span>
  580. <span v-else-if="item.followType === 3">线上会议</span>
  581. <span v-else-if="item.followType === 4">其他</span>
  582. </div>
  583. <div class="item_box">
  584. <div class="follow_item_line">
  585. <div class="line_dot"></div>
  586. <div class="line"></div>
  587. </div>
  588. <div class="item_content">
  589. <div>{{c.remark}}</div>
  590. <div class="item_tip">跟进成员:由<span class="item_p">「{{c.memberName}}」</span>跟进</div>
  591. </div>
  592. </div>
  593. </div>
  594. </div>
  595. </div>
  596. <div class="foot_btn">
  597. <el-button class="signUp_btn" :loading="loading" @click="toSignUp">去跟进</el-button>
  598. </div>
  599. </div>
  600. </div>
  601. <el-dialog title="添加客户跟进" :visible.sync="showDialog">
  602. <el-form :model="form" class="prize_form">
  603. <el-form-item label="跟进方式:" required>
  604. <el-radio-group v-model="form.followType">
  605. <el-radio :label="0">电话联系</el-radio>
  606. <el-radio :label="1">面聊</el-radio>
  607. <el-radio :label="2">微信联系</el-radio>
  608. <el-radio :label="3">线上会议</el-radio>
  609. <el-radio :label="4">其他跟进</el-radio>
  610. </el-radio-group>
  611. </el-form-item>
  612. <el-form-item label="跟进内容:" required>
  613. <el-input v-model="form.remark" type="textarea" autosize></el-input>
  614. </el-form-item>
  615. </el-form>
  616. <div slot="footer" class="dialog-footer">
  617. <el-button type="primary" @click="handleSave">确定</el-button>
  618. </div>
  619. </el-dialog>
  620. <el-dialog title="编辑信息" :visible.sync="showEditDialog">
  621. <el-form class="prize_form">
  622. <el-form-item :label="item.name" required v-for="(item, index) in editFormList" :key="index">
  623. <el-input v-model="item.value[0]"></el-input>
  624. </el-form-item>
  625. </el-form>
  626. <div slot="footer" class="dialog-footer">
  627. <el-button type="primary" @click="handleEditSave">确定</el-button>
  628. </div>
  629. </el-dialog>
  630. </div>
  631. </body>
  632. <script>
  633. new Vue({
  634. el: '#box',
  635. data() {
  636. return {
  637. httpUrl: '',
  638. bId: null,
  639. env: '',
  640. memberId: null,
  641. externalUserId: null,
  642. activeName: 'first',
  643. itemActiveName: 'first',
  644. clientData: {},
  645. recordList: {},
  646. stepData: [], // 阶段
  647. stepFollowList: [], // 跟进数据
  648. showDialog: false,
  649. form: {
  650. followType: 0,
  651. remark: ''
  652. },
  653. loading: false,
  654. showEditDialog: false,
  655. editFormList: [],
  656. editType: '',
  657. }
  658. },
  659. created() {
  660. this.bId = this.getQueryParam('bId')
  661. this.env = this.getQueryParam('env')
  662. if (!this.env || this.env === 'prod') {
  663. this.httpUrl = 'https://wlapi.wefanbot.com'
  664. } else {
  665. this.httpUrl = 'http://test.wefanbot.com:18993'
  666. }
  667. if (this.getQueryParam('memberId')) {
  668. // 已授权
  669. this.memberId = this.getQueryParam('memberId')
  670. this.getQyWxSign()
  671. } else {
  672. // 授权
  673. this.getAuth()
  674. }
  675. // this.memberId = "woU17nDAAAnoSca19vZVKiNEKdc9tyYQ"
  676. // this.externalUserId = "wmU17nDAAAqZkemA_hZuM5JIIYoA_GIA"
  677. // this.getClientExt()
  678. },
  679. methods: {
  680. getAuth() {
  681. fetch(this.httpUrl + `/p/insuite/p/getRedirectUri?env=${this.env}&bId=${this.bId}`)
  682. .then(res => {
  683. return res.json()
  684. }).then(result => {
  685. let { data, code, msg } = result
  686. if (code === 1) {
  687. window.location.replace(data)
  688. } else {
  689. this.$message({
  690. message: msg,
  691. type: 'warning'
  692. })
  693. }
  694. })
  695. },
  696. getQyWxSign() {
  697. fetch(this.httpUrl + '/scrm/v1/wxcp-corp/p/getAgentConfig', {
  698. method: 'post',
  699. body: JSON.stringify({
  700. bId: this.bId,
  701. url: window.location.href,
  702. }),
  703. headers: {
  704. 'Content-Type': 'application/json'
  705. }
  706. }).then(res => {
  707. return res.json()
  708. }).then(result => {
  709. let { data, code, msg } = result
  710. if (code === 1) {
  711. let that = this
  712. wx.agentConfig({
  713. corpid: data.corpid,
  714. agentid: data.agentId,
  715. timestamp: data.timestamp, // 必填,生成签名的时间戳
  716. nonceStr: data.nonceStr, // 必填,生成签名的随机串
  717. signature: data.agentSignature, // 必填,签名,见附录1
  718. jsApiList: ['getCurExternalContact'], // 必填,需要使用的JS接口列表
  719. success: function (res) {
  720. // 回调
  721. // 此处直接在注入回调中调用了获取当前外部联系人userId的接口,注意此接口是从聊天框的工具栏进入才能获取
  722. wx.invoke('getCurExternalContact', {
  723. }, function (res) {
  724. if (res.err_msg == "getCurExternalContact:ok") {
  725. console.log('invoke成功:', res.userId);
  726. that.externalUserId = res.userId
  727. that.getClientExt()
  728. } else {
  729. //错误处理
  730. console.log('invoke失败:', res)
  731. }
  732. });
  733. },
  734. fail: function (res) {
  735. if (res.errMsg.indexOf('function not exist') > -1) {
  736. alert('版本过低请升级');
  737. }
  738. },
  739. complete: function (res) {
  740. // 回调
  741. console.log('complete1', res);
  742. }
  743. });
  744. } else {
  745. this.$message({
  746. message: msg,
  747. type: 'warning'
  748. })
  749. }
  750. })
  751. },
  752. handleClick(tab) {
  753. this.activeName = tab.name
  754. if (tab.name ==='first') {
  755. this.getClientExt()
  756. } else if (tab.name === 'second') {
  757. this.getClientFollow()
  758. }
  759. },
  760. getClientFollow() {
  761. // 获取阶段
  762. this.getStep()
  763. // 获取阶段跟进数据
  764. this.getStepFollow()
  765. },
  766. // 获取客户画像
  767. getClientExt() {
  768. fetch(this.httpUrl + `/scrm/v1/wxcp-client-pro/p/clientExt?bId=${this.bId}&externalUserId=${this.externalUserId}&memberId=${this.memberId}`)
  769. .then(res => {
  770. return res.json()
  771. }).then(result => {
  772. let { data, code, msg } = result
  773. if (code === 1) {
  774. this.clientData = data
  775. if (this.clientData.cols && this.clientData.cols.length) {
  776. this.clientData.cols.forEach(item => {
  777. if (!item.value) {
  778. item.value = []
  779. }
  780. })
  781. }
  782. } else {
  783. this.$message({
  784. message: msg,
  785. type: 'warning'
  786. })
  787. }
  788. })
  789. },
  790. handleDetailTab(tab) {
  791. this.itemActiveName = tab.name
  792. if (tab.name === 'second') {
  793. this.getClientLog()
  794. }
  795. },
  796. // 客户画像-记录
  797. getClientLog() {
  798. fetch(this.httpUrl + '/scrm/v1/wxcp-client-pro/p/clientLog', {
  799. method: 'post',
  800. body: JSON.stringify({
  801. bid: this.bId,
  802. externalUserId: this.externalUserId,
  803. memberId: this.memberId,
  804. page: 1,
  805. pageCount: 1000,
  806. }),
  807. headers: {
  808. 'Content-Type': 'application/json'
  809. }
  810. }).then(res => {
  811. return res.json()
  812. }).then(result => {
  813. let { data, code, msg } = result
  814. if (code === 1) {
  815. this.recordList = data
  816. } else {
  817. this.$message({
  818. message: msg,
  819. type: 'warning'
  820. })
  821. }
  822. })
  823. },
  824. // 获取阶段
  825. getStep() {
  826. fetch(this.httpUrl + `/scrm/v1/wxcp-client-pro/p/clientStepList?bId=${this.bId}&externalUserId=${this.externalUserId}`)
  827. .then(res => {
  828. return res.json()
  829. }).then(result => {
  830. let { data, code, msg } = result
  831. if (code === 1) {
  832. this.stepData = data
  833. } else {
  834. this.$message({
  835. message: msg,
  836. type: 'warning'
  837. })
  838. }
  839. })
  840. },
  841. // 获取阶段跟进数据
  842. getStepFollow() {
  843. fetch(this.httpUrl + '/scrm/v1/wxcp-client-pro/p/clientFollow', {
  844. method: 'post',
  845. body: JSON.stringify({
  846. bid: this.bId,
  847. externalUserId: this.externalUserId,
  848. memberId: this.memberId,
  849. page: 1,
  850. pageCount: 1000,
  851. }),
  852. headers: {
  853. 'Content-Type': 'application/json'
  854. }
  855. }).then(res => {
  856. return res.json()
  857. }).then(result => {
  858. let { data, code, msg } = result
  859. if (code === 1) {
  860. let arr = this.groupDataByDate(data.records)
  861. this.stepFollowList = arr.reverse()
  862. } else {
  863. this.$message({
  864. message: msg,
  865. type: 'warning'
  866. })
  867. }
  868. })
  869. },
  870. // 按日期分组数据
  871. groupDataByDate(data) {
  872. const grouped = {}
  873. // 按日期分组
  874. data.forEach(item => {
  875. const dateStr = item.updatedTime.slice(0, 10); // 提取年月日
  876. if (!grouped[dateStr]) {
  877. grouped[dateStr] = []
  878. }
  879. grouped[dateStr].push(item)
  880. })
  881. // 转换为指定格式并排序
  882. return Object.keys(grouped)
  883. .sort() // 按日期升序排列
  884. .map(date => ({
  885. date,
  886. content: grouped[date]
  887. }))
  888. },
  889. toSignUp() {
  890. this.showDialog = true
  891. this.form = {
  892. followType: 0,
  893. remark: ''
  894. }
  895. },
  896. // 添加客户跟进
  897. handleSave() {
  898. fetch(this.httpUrl + '/scrm/v1/wxcp-client-pro/p/addFollow', {
  899. method: 'post',
  900. body: JSON.stringify({
  901. bid: this.bId,
  902. externalUserId: this.externalUserId,
  903. memberId: this.memberId,
  904. followType: this.form.followType,
  905. remark: this.form.remark,
  906. }),
  907. headers: {
  908. 'Content-Type': 'application/json'
  909. }
  910. }).then(res => {
  911. return res.json()
  912. }).then(result => {
  913. let { data, code, msg } = result
  914. if (code === 1) {
  915. this.showDialog = false
  916. this.getClientFollow()
  917. this.$message({
  918. message: '添加成功',
  919. type: 'success'
  920. })
  921. } else {
  922. this.$message({
  923. message: msg,
  924. type: 'warning'
  925. })
  926. }
  927. })
  928. },
  929. // 编辑手机号
  930. handleEdit(title, value, type) {
  931. this.editFormList = [{
  932. name: title,
  933. type: 0,
  934. value: [value]
  935. }]
  936. this.editType = type
  937. this.showEditDialog = true
  938. },
  939. // 编辑其他字段
  940. handleEditOther() {
  941. this.editFormList = this.clientData.cols
  942. this.editType = 'other'
  943. this.showEditDialog = true
  944. },
  945. handleEditSave() {
  946. if (this.editType === 'phone') {
  947. this.editPhone()
  948. } else if (this.editType === 'other') {
  949. this.editOthers()
  950. }
  951. },
  952. // 修改手机号
  953. editPhone() {
  954. fetch(this.httpUrl + `/scrm/v1/wxcp-client-pro/p/updatePhone?bId=${this.bId}&externalUserId=${this.externalUserId}&memberId=${this.memberId}&phone=${this.editFormList[0].value[0]}`)
  955. .then(res => {
  956. return res.json()
  957. }).then(result => {
  958. let { data, code, msg } = result
  959. if (code === 1) {
  960. this.showEditDialog = false
  961. this.getClientExt()
  962. this.$message({
  963. message: '编辑成功',
  964. type: 'success'
  965. })
  966. } else {
  967. this.$message({
  968. message: msg,
  969. type: 'warning'
  970. })
  971. }
  972. })
  973. },
  974. // 编辑其他字段
  975. editOthers() {
  976. fetch(this.httpUrl + '/scrm/v1/wxcp-client-pro/p/updateExt', {
  977. method: 'post',
  978. body: JSON.stringify({
  979. bid: this.bId,
  980. externalUserId: this.externalUserId,
  981. memberId: this.memberId,
  982. cols: this.clientData.cols
  983. }),
  984. headers: {
  985. 'Content-Type': 'application/json'
  986. }
  987. }).then(res => {
  988. return res.json()
  989. }).then(result => {
  990. let { data, code, msg } = result
  991. if (code === 1) {
  992. this.showEditDialog = false
  993. this.getClientExt()
  994. this.$message({
  995. message: '添加成功',
  996. type: 'success'
  997. })
  998. } else {
  999. this.$message({
  1000. message: msg,
  1001. type: 'warning'
  1002. })
  1003. }
  1004. })
  1005. },
  1006. // 截取url中的数据
  1007. getQueryParam(paramName) {
  1008. // 获取当前URL的查询字符串部分
  1009. const queryString = window.location.search;
  1010. // 创建一个URLSearchParams对象
  1011. const urlParams = new URLSearchParams(queryString);
  1012. // 返回指定参数的值,如果不存在则返回null
  1013. return urlParams.get(paramName);
  1014. },
  1015. timeFormat(time, format = 'yyyy-MM-dd hh:mm:ss') {
  1016. if (time === undefined || time === '' || time === null) {
  1017. return '/';
  1018. }
  1019. const date = new Date(time);
  1020. const o = {
  1021. 'M+': date.getMonth() + 1, // 月份
  1022. 'd+': date.getDate(), // 日
  1023. 'h+': date.getHours(), // 小时
  1024. 'm+': date.getMinutes(), // 分钟
  1025. 's+': date.getSeconds(), // 秒
  1026. 'q+': Math.floor((date.getMonth() + 3) / 3), // 季度
  1027. 'S': date.getMilliseconds() // 毫秒
  1028. };
  1029. // 处理年份
  1030. if (/(y+)/.test(format)) {
  1031. format = format.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
  1032. }
  1033. // 处理日期和时间部分
  1034. for (let k in o) {
  1035. if (new RegExp('(' + k + ')').test(format)) {
  1036. let value = o[k];
  1037. let padding = RegExp.$1.length === 1 ? '' : '00'; // 根据格式字符串中的长度决定是否补零
  1038. format = format.replace(RegExp.$1, ('' + value).padStart(padding.length + value.toString().length - value.toString().length, '0'));
  1039. }
  1040. }
  1041. // 如果格式只包含时间部分,移除日期部分可能的占位符
  1042. if (!/(M+|d+)/.test(format)) {
  1043. // 移除任何可能存在的日期占位符(如:'yyyy-MM-dd ')
  1044. format = format.replace(/(\s*-\s*){2}/g, ''); // 移除两个'-'之间的任何内容
  1045. format = format.replace(/^\s*yyyy-\s*/, ''); // 移除开头的'yyyy-'
  1046. }
  1047. // 如果格式只包含日期部分,移除时间部分可能的占位符
  1048. if (!/(h+|m+|s+)/.test(format)) {
  1049. // 移除任何可能存在的时间占位符(如:' hh:mm:ss')
  1050. format = format.replace(/(\s*:\s*){2}/g, ''); // 移除两个':'之间的任何内容
  1051. format = format.replace(/\s*hh:\s*$/, ''); // 移除结尾的' hh:'
  1052. }
  1053. return format;
  1054. }
  1055. }
  1056. })
  1057. </script>
  1058. </html>