complaintContent.html 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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_data {
  42. padding: 15px;
  43. box-sizing: border-box;
  44. height: 100%;
  45. display: flex;
  46. flex-direction: column;
  47. justify-content: space-between;
  48. overflow: auto;
  49. }
  50. .client_head {
  51. font-weight: 500;
  52. font-size: 14px;
  53. color: #222222;
  54. line-height: 20px;
  55. margin-bottom: 10px;
  56. }
  57. .client_content {
  58. background: #FFFFFF;
  59. border-radius: 10px;
  60. padding: 12px 10px;
  61. font-weight: 400;
  62. font-size: 14px;
  63. color: #999999;
  64. max-height: 100%;
  65. min-height: 300px;
  66. margin-bottom: 10px;
  67. line-height: 24px;
  68. }
  69. .follow_btn {
  70. background: #1677FF;
  71. border-radius: 15px;
  72. font-weight: 500;
  73. font-size: 14px;
  74. color: #FFFFFF;
  75. padding: 15px 0;
  76. text-align: center;
  77. }
  78. </style>
  79. <body>
  80. <div id="box" class="box">
  81. <!-- 数据查看 -->
  82. <div class="page4">
  83. <div class="client_data">
  84. <div>
  85. <div class="client_head">{{clientName}}</div>
  86. <div class="client_content">{{sentimentReason}}</div>
  87. </div>
  88. <div class="follow_btn" @click="toComfirm">去处理</div>
  89. </div>
  90. </div>
  91. </div>
  92. </body>
  93. <script>
  94. new Vue({
  95. el: '#box',
  96. data() {
  97. return {
  98. httpUrl: '',
  99. bId: null,
  100. corpId: null,
  101. id: null,
  102. externalUserid: null,
  103. clientName: null,
  104. sentimentReason: null,
  105. type: null,
  106. chatId: null,
  107. notifyStatus: null
  108. }
  109. },
  110. created() {
  111. const data = JSON.parse(window.name)
  112. this.httpUrl = data.httpUrl,
  113. this.corpId = data.corpId,
  114. this.bId = data.bId,
  115. this.id = data.id,
  116. this.externalUserid = data.externalUserid,
  117. this.clientName = data.clientName,
  118. this.sentimentReason = data.sentimentReason,
  119. this.type = Number(data.type),
  120. this.chatId = Number(data.type) ? data.chatId : '',
  121. this.notifyStatus = Number(data.notifyStatus)
  122. this.getQyWxSign()
  123. },
  124. methods: {
  125. toComfirm() {
  126. if (this.notifyStatus === 2) {
  127. if (this.type === 1) {
  128. this.toFollowGroup()
  129. } else {
  130. this.toFollowClient()
  131. }
  132. } else {
  133. fetch(this.httpUrl + `/scrm/v1/wxc-sentiment-session/p/tousuReadComfirm`, {
  134. method: 'post',
  135. body: JSON.stringify({
  136. id: this.id,
  137. corpId: this.corpId,
  138. }),
  139. headers: {
  140. 'Content-Type': 'application/json'
  141. }
  142. }).then(res => {
  143. return res.json()
  144. }).then(result => {
  145. let { data, code, msg } = result
  146. if (code === 1) {
  147. if (this.type === 1) {
  148. this.toFollowGroup()
  149. } else {
  150. this.toFollowClient()
  151. }
  152. } else {
  153. this.$message({
  154. message: msg,
  155. type: 'warning'
  156. })
  157. }
  158. })
  159. }
  160. },
  161. getQyWxSign() {
  162. fetch(this.httpUrl + '/scrm/v1/wxcp-corp/p/getAgentConfig', {
  163. method: 'post',
  164. body: JSON.stringify({
  165. bid: this.bId,
  166. url: window.location.href,
  167. }),
  168. headers: {
  169. 'Content-Type': 'application/json'
  170. }
  171. }).then(res => {
  172. return res.json()
  173. }).then(result => {
  174. let { data, code, msg } = result
  175. if (code === 1) {
  176. wx.config({
  177. beta: true,
  178. debug: false,
  179. appId: data.corpid, // 必填,企业号的唯一标识,此处填写企业号corpid
  180. timestamp: data.timestamp, // 必填,生成签名的时间戳
  181. nonceStr: data.nonceStr, // 必填,生成签名的随机串
  182. signature: data.agentSignature, // 必填,签名,见附录1
  183. jsApiList: ['checkJsApi', 'openEnterpriseChat'] // 必填,需要使用的JS接口列表
  184. })
  185. wx.agentConfig({
  186. corpid: data.corpid,
  187. agentid: data.agentId,
  188. timestamp: data.timestamp, // 必填,生成签名的时间戳
  189. nonceStr: data.nonceStr, // 必填,生成签名的随机串
  190. signature: data.agentSignature, // 必填,签名,见附录1
  191. jsApiList: ['openEnterpriseChat'], // 必填,需要使用的JS接口列表
  192. success: function (res) {
  193. // 回调
  194. console.log('agentConfig成功', res);
  195. },
  196. fail: function (res) {
  197. if (res.errMsg.indexOf('function not exist') > -1) {
  198. alert('版本过低请升级');
  199. }
  200. },
  201. complete: function (res) {
  202. // 回调
  203. console.log('complete', res);
  204. }
  205. });
  206. } else {
  207. this.$message({
  208. message: msg,
  209. type: 'warning'
  210. })
  211. }
  212. })
  213. },
  214. toFollowClient() {
  215. wx.openEnterpriseChat({
  216. externalUserIds: this.externalUserid, // 参与会话的外部联系人列表,格式为userId1;userId2;…,用分号隔开。
  217. groupName: "", // 会话名称。单聊时该参数传入空字符串""即可。
  218. chatId: "",
  219. success: function (res) {
  220. var chatId = res.chatId; //返回当前群聊ID,仅当使用agentConfig注入该接口权限时才返回chatId
  221. // 回调
  222. console.log('打开客户成功', res)
  223. },
  224. fail: function (res) {
  225. // 回调
  226. if (res.errMsg.indexOf('function not exist') > -1) {
  227. alert('版本过低请升级');
  228. }
  229. console.log('失败', res);
  230. },
  231. complete: function (res) {
  232. // 回调
  233. console.log('完成', res);
  234. }
  235. })
  236. },
  237. toFollowGroup() {
  238. wx.openEnterpriseChat({
  239. groupName: "", // 会话名称。单聊时该参数传入空字符串""即可。
  240. chatId: this.chatId,
  241. success: function (res) {
  242. var chatId = res.chatId; //返回当前群聊ID,仅当使用agentConfig注入该接口权限时才返回chatId
  243. // 回调
  244. console.log('打开客户群聊成功', res)
  245. },
  246. fail: function (res) {
  247. // 回调
  248. if (res.errMsg.indexOf('function not exist') > -1) {
  249. alert('版本过低请升级');
  250. }
  251. console.log('失败', res);
  252. },
  253. complete: function (res) {
  254. // 回调
  255. console.log('完成', res);
  256. }
  257. });
  258. },
  259. }
  260. })
  261. </script>
  262. </html>