toFollowUpClient.html 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
  19. <script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script>
  20. <!-- <script src="js/vconsole.min.js"></script>
  21. <script>
  22. var vConsole = new window.VConsole();
  23. </script> -->
  24. </head>
  25. <style>
  26. body {
  27. margin: 0;
  28. padding: 0;
  29. }
  30. .box {
  31. width: 100vw;
  32. height: 100vh;
  33. box-sizing: border-box;
  34. background: #FAFAFA;
  35. }
  36. .page4 {
  37. width: 100vw;
  38. height: 100vh;
  39. box-sizing: border-box;
  40. }
  41. .client_list {
  42. padding: 15px 10px;
  43. height: 100%;
  44. overflow: auto;
  45. box-sizing: border-box;
  46. }
  47. .client_item {
  48. width: 100%;
  49. background: #FFFFFF;
  50. border-radius: 10px;
  51. padding: 20px 10px;
  52. box-sizing: border-box;
  53. margin-bottom: 15px;
  54. display: flex;
  55. align-items: center;
  56. justify-content: space-between;
  57. }
  58. .client_head {
  59. font-weight: 400;
  60. font-size: 14px;
  61. color: #222222;
  62. }
  63. .client_right {
  64. display: flex;
  65. align-items: center;
  66. font-weight: 400;
  67. font-size: 14px;
  68. color: #222222;
  69. }
  70. .client_status {
  71. font-weight: 400;
  72. font-size: 14px;
  73. padding-left: 25px;
  74. }
  75. .to_iocn {
  76. width: 14px;
  77. height: 14px;
  78. }
  79. </style>
  80. <body>
  81. <div id="box" class="box">
  82. <!-- 数据查看 -->
  83. <div class="page4">
  84. <div class="client_list">
  85. <div class="client_item" v-for="(item, index) in followUpList" :key="index" @click="toFollowUpClient(item)">
  86. <div class="client_head">{{item.clientName}}</div>
  87. <div class="client_right">
  88. <div>{{item.sellProcessName}}</div>
  89. <div class="client_status">
  90. <span :style="{color: item.followStatus === 'NEED_FOLLOW' ? '#FF4E4E' : '#FFA64E'}">{{item.followStatus === 'NEED_FOLLOW' ? '需要跟进' : '急需跟进'}}</span>
  91. <img class="to_iocn" src="./img/to-icon.png" alt="">
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. </body>
  99. <script>
  100. new Vue({
  101. el: '#box',
  102. data() {
  103. return {
  104. httpUrl: '',
  105. bId: null,
  106. env: '',
  107. memberId: null,
  108. followUpList: [],
  109. }
  110. },
  111. created() {
  112. this.bId = this.getQueryParam('bId')
  113. this.env = this.getQueryParam('env')
  114. if (!this.env || this.env === 'prod') {
  115. this.httpUrl = 'https://wlapi.wefanbot.com'
  116. } else {
  117. this.httpUrl = 'http://test.wefanbot.com:18993'
  118. }
  119. if (this.getQueryParam('memberId')) {
  120. // 已授权
  121. this.memberId = this.getQueryParam('memberId')
  122. this.getQyWxSign()
  123. this.executeDetail()
  124. } else {
  125. // 授权
  126. this.getAuth()
  127. }
  128. },
  129. methods: {
  130. getAuth() {
  131. fetch(this.httpUrl + `/p/insuite/p/getRedirectUri?env=${this.env}&bId=${this.bId}`)
  132. .then(res => {
  133. return res.json()
  134. }).then(result => {
  135. let { data, code, msg } = result
  136. if (code === 1) {
  137. window.location.replace(data)
  138. } else {
  139. this.$message({
  140. message: msg,
  141. type: 'warning'
  142. })
  143. }
  144. })
  145. },
  146. getQyWxSign() {
  147. fetch(this.httpUrl + '/scrm/v1/wxcp-corp/p/getAgentConfig', {
  148. method: 'post',
  149. body: JSON.stringify({
  150. bid: this.bId,
  151. url: window.location.href,
  152. }),
  153. headers: {
  154. 'Content-Type': 'application/json'
  155. }
  156. }).then(res => {
  157. return res.json()
  158. }).then(result => {
  159. let { data, code, msg } = result
  160. if (code === 1) {
  161. wx.config({
  162. beta: true,
  163. debug: false,
  164. appId: data.corpid, // 必填,企业号的唯一标识,此处填写企业号corpid
  165. timestamp: data.timestamp, // 必填,生成签名的时间戳
  166. nonceStr: data.nonceStr, // 必填,生成签名的随机串
  167. signature: data.agentSignature, // 必填,签名,见附录1
  168. jsApiList: ['checkJsApi', 'openEnterpriseChat'] // 必填,需要使用的JS接口列表
  169. })
  170. wx.agentConfig({
  171. corpid: data.corpid,
  172. agentid: data.agentId,
  173. timestamp: data.timestamp, // 必填,生成签名的时间戳
  174. nonceStr: data.nonceStr, // 必填,生成签名的随机串
  175. signature: data.agentSignature, // 必填,签名,见附录1
  176. jsApiList: ['openEnterpriseChat'], // 必填,需要使用的JS接口列表
  177. success: function (res) {
  178. // 回调
  179. console.log('agentConfig成功', res);
  180. },
  181. fail: function (res) {
  182. if (res.errMsg.indexOf('function not exist') > -1) {
  183. alert('版本过低请升级');
  184. }
  185. },
  186. complete: function (res) {
  187. // 回调
  188. console.log('complete', res);
  189. }
  190. });
  191. } else {
  192. this.$message({
  193. message: msg,
  194. type: 'warning'
  195. })
  196. }
  197. })
  198. },
  199. executeDetail() {
  200. fetch(this.httpUrl + `/wxcp/sell-process/p/member/wait-follow-clietns?memberId=${this.memberId}`)
  201. .then(res => {
  202. return res.json()
  203. }).then(result => {
  204. let { data, code, msg } = result
  205. if (code === 1) {
  206. this.followUpList = data || []
  207. } else {
  208. this.$message({
  209. message: msg,
  210. type: 'warning'
  211. })
  212. }
  213. })
  214. },
  215. toFollowUpClient(item) {
  216. wx.openEnterpriseChat({
  217. externalUserIds: item.wxcpClientExternalUserId, // 参与会话的外部联系人列表,格式为userId1;userId2;…,用分号隔开。
  218. groupName: "", // 会话名称。单聊时该参数传入空字符串""即可。
  219. chatId: "",
  220. success: function (res) {
  221. var chatId = res.chatId; //返回当前群聊ID,仅当使用agentConfig注入该接口权限时才返回chatId
  222. // 回调
  223. console.log('打开客户成功', res)
  224. },
  225. fail: function (res) {
  226. // 回调
  227. if (res.errMsg.indexOf('function not exist') > -1) {
  228. alert('版本过低请升级');
  229. }
  230. console.log('失败', res);
  231. },
  232. complete: function (res) {
  233. // 回调
  234. console.log('完成', res);
  235. }
  236. })
  237. },
  238. // 截取url中的数据
  239. getQueryParam(paramName) {
  240. // 获取当前URL的查询字符串部分
  241. const queryString = window.location.search;
  242. // 创建一个URLSearchParams对象
  243. const urlParams = new URLSearchParams(queryString);
  244. // 返回指定参数的值,如果不存在则返回null
  245. return urlParams.get(paramName);
  246. },
  247. }
  248. })
  249. </script>
  250. </html>