toFollowUpClient.html 9.0 KB

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