historicalRecord.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. <template>
  2. <div class="row rightAlignment">
  3. <div v-show="getShow" class="row init">
  4. <!-- 对话框 -->
  5. <div class="dialog">
  6. <div class="del " @click="shutDown">
  7. <img :src="require('@/assets/img/del.png')" >
  8. </div>
  9. <div class="head row allAlignment center">
  10. <!-- <div class="row allAlignment center"> -->
  11. <div class="u_name">
  12. <span>{{user_name}}</span>
  13. </div>
  14. <div v-if="isShowBt" @click="onShowBt" class="btn_untreated">
  15. <span >加载更多消息</span>
  16. </div>
  17. <div v-else="">
  18. </div>
  19. <!-- </div> -->
  20. </div>
  21. <div class="chatWindow" >
  22. <div v-for="(item,index) in dataList " :key="index">
  23. <!-- 模拟用户 -->
  24. <div v-if="item.to_id.startsWith('KF')" style="padding-top:10px;">
  25. <div class="title_time">
  26. <span>{{item.time_line}}</span>
  27. </div>
  28. <div v-if="item.content.text" class=" row wrap" >
  29. <div class="left_session item-center" v-html="item.content.text"></div>
  30. </div>
  31. <div v-if="item.content.img" class="row " >
  32. <div class="left_session item-center " >
  33. <img :src="imgsrc+item.content.img" alt="">
  34. </div>
  35. </div>
  36. </div>
  37. <!-- 模拟客户 -->
  38. <div v-else style="padding-top:10px;">
  39. <div class="row rightAlignment title_time" style="width: 100%;">
  40. <span>{{item.time_line}}</span>
  41. </div>
  42. <div v-if="item.content.text" class="row rightAlignment">
  43. <div class="right_session item-center wrap" v-html="item.content.text"></div>
  44. </div>
  45. <div v-if="item.content.img" class="row rightAlignment" >
  46. <div class="right_session item-center ">
  47. <img :src="imgsrc+item.content.img" alt="">
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. <div>
  54. </div>
  55. <div class="copyEditor">
  56. <!-- <div>
  57. <span>评价结果</span>
  58. </div>
  59. <div class="row ">
  60. <div>
  61. <img src="" alt="">
  62. <div>
  63. <span>{{alarm.evaluate_id == 1 ?'差评': alarm.evaluate_id == 2 ? '一般': alarm.evaluate_id == 3 ?'满意':'未评价'}}</span>
  64. </div>
  65. </div>
  66. <div>
  67. <div>
  68. <span>触犯报警:</span>
  69. </div>
  70. <div>
  71. <span v-if="alarm.verifyReturnTime == 2">回复超时</span>
  72. <span v-if="alarm.cvtOvertime == 2">会话超时</span>
  73. <span v-if="alarm.serverSensitive == 2">客服敏感词</span>
  74. <span v-if="alarm.userSensitive == 2">用户敏感词</span>
  75. <span v-if="alarm.respond == 2">未回应</span>
  76. </div>
  77. </div>
  78. </div> -->
  79. </div>
  80. </div>
  81. <!-- 用户信息展示框 -->
  82. <div class="user_info">
  83. <div style=" padding: 20px;">
  84. <ul style="padding-inline-start:0px; margin-block-start:0; margin-top:40px;">
  85. <li style="font-weight:bold;font-weight:bold; color:#666666;">访问信息</li>
  86. <li>IP地址:{{account.user_ip}}</li>
  87. <li>来源终端:{{account.system}}-{{account.browse}}</li>
  88. </ul>
  89. <ul style="padding-inline-start:0px; margin-block-start: 0;">
  90. <li style="font-weight:bold;font-weight:bold; color:#666666;">用户信息</li>
  91. <li>账号:{{account.account_name}}</li>
  92. <li>标签:{{account.label}}</li>
  93. <li>昵称:{{account.nick_name}}</li>
  94. <li>手机:{{account.account_phone}}</li>
  95. <li>邮箱:{{account.account_email}}</li>
  96. <li>地址:{{account.address}}</li>
  97. <li>备注:{{account.remark}}</li>
  98. </ul>
  99. <!-- <div>
  100. <span>访客备注:</span>
  101. <div class="margin_t">
  102. <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="textarea">
  103. </el-input>
  104. </div>
  105. <div class="bt_save margin_t">
  106. <span>保存</span>
  107. </div>
  108. </div> -->
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. </template>
  114. <script>
  115. import '@/css/index.css';
  116. import { Loading } from 'element-ui';
  117. export default {
  118. props:['show','uid','user_name'],
  119. name:'historicalRecord',
  120. data(){
  121. return{
  122. textarea:'',
  123. stateType:'',
  124. frce:'',
  125. inputValse:'',
  126. dataList:[],//会话记录
  127. alarm:'',//评价谢谢
  128. account:'',//用户信息
  129. imgsrc:'',//图片路径域
  130. isShowBt:false,//显示加载按钮
  131. currentPage:'',//当前页数
  132. }
  133. },
  134. mounted() {
  135. this.imgsrc = window.url_https_ajax;
  136. if(typeof this.$store.getters.get_user_info != 'string'){
  137. this.token = this.$store.getters.get_user_info.token;
  138. }else if(this.$store.getters.get_user_info!= ""){
  139. this.token = JSON.parse(this.$store.getters.get_user_info).token;
  140. }
  141. this.time = JSON.parse(sessionStorage.getItem("time"));
  142. },
  143. computed:{
  144. getShow(){
  145. if(this.show){
  146. this.getRecordList(1)
  147. }
  148. return this.show;
  149. },
  150. },
  151. methods:{
  152. /*****************************************/
  153. //关闭会话详情记录
  154. shutDown(){
  155. this.dataList = [];
  156. this.$emit('childValue',false);
  157. },
  158. /*****************************************/
  159. //获取会话详情列表
  160. getRecordList(page,size = 10){
  161. Loading.service({text:'拼命加载中',background:'rgba(0, 0, 0, 0.8)'});
  162. let str ="historyinfo" + "customer-service" + "history" + "service";
  163. this.$http.get(this.$ports.history.historyInfo,{
  164. params:{
  165. servicelog_id:this.uid,
  166. currentPage: page,
  167. pageSize: size
  168. },
  169. headers:{
  170. 'X-Requested-With': 'XMLHttpRequest',
  171. 'apiToken': this.$md5(str),
  172. 'userToken': this.token
  173. }
  174. }).then(res => {
  175. if(res.data.code == 1){
  176. res.data.data.list = res.data.data.list.reverse();
  177. // console.log(res.data.data);
  178. this.alarm = res.data.data.alarm;
  179. this.account = res.data.data.account;
  180. this.currentPage = res.data.data.currentPage;
  181. this.isShowBt = res.data.data.countPage > res.data.data.currentPage ? true : false;
  182. res.data.data.list.forEach(e => {
  183. e.time_line = this.$public.customFormatDateTime(e.time_line);
  184. e.content =JSON.parse(e.content);
  185. e.content.text = this.turnFace(e.content.text);
  186. this.dataList.push(e)
  187. });
  188. Loading.service().close()
  189. }
  190. });
  191. },
  192. /****************************/
  193. onShowBt(){
  194. this.getRecordList( this.currentPage*1 + 1);
  195. },
  196. /******************文字信息转表情******************/
  197. turnFace(data){
  198. let str = data.match(/\#\[.*?\]\//g);
  199. let arr =Array.from(new Set(str));
  200. arr.forEach(e=>{
  201. let imgsrc = '';
  202. for(let i = 0 ; i < this.$frce.length ; i++){
  203. let expText = e.slice(1,e.length-1);
  204. if(expText == this.$frce[i]){
  205. imgsrc = '<img class="hover" src="'+require(`@/assets/img/${i}.gif`)+'"/>'
  206. break;
  207. }
  208. }
  209. data = data.replace(new RegExp(`\\#\\[${e.substring(2,e.length-2)}\\]\\/`,'g'),imgsrc);
  210. })
  211. return data;
  212. },
  213. }
  214. }
  215. </script>
  216. <style scoped>
  217. .init{
  218. font-size: 0;
  219. background: #FFFFFF;
  220. width: 855px;
  221. border: 1px solid #d5e5ff;
  222. z-index: 10 ;
  223. }
  224. .del{
  225. /* position:fixed;*/
  226. top: 35vh;
  227. left: -31px;
  228. position: relative;
  229. width: 32px;
  230. height: 60px;
  231. cursor:pointer;
  232. /* background:red; */
  233. /* border-radius: 50% 0 0 50%;
  234. border: 1px solid #d5e5ff; */
  235. z-index: 20;
  236. }
  237. .dialog{
  238. width: 584px;
  239. /* height: 100vh; */
  240. border: 1px solid #D5E5FF;
  241. border-left: 0;
  242. border-top: 0;
  243. /* background: red; */
  244. }
  245. .user_info{
  246. width: 261px;
  247. /* height: 100vh; */
  248. font-size:14px;
  249. color:rgba(153,153,153,1);
  250. font-weight:400;
  251. }
  252. .head{
  253. padding: 0 20px;
  254. height:50px;
  255. border-bottom: 1px solid #D5E5FF;
  256. }
  257. .chatWindow{
  258. height: 420px;
  259. font-size: 14px;
  260. padding: 0 10px;
  261. font-weight:400;
  262. color:rgba(102,102,102,1);
  263. overflow:auto
  264. }
  265. .copyEditor{
  266. font-size: 14px;
  267. width: 100%;
  268. height: 160px;
  269. border-top: 1px solid #D5E5FF;
  270. }
  271. .btn_untreated{
  272. width:120px;
  273. line-height: 30px;
  274. background:#1398e08c;
  275. border-radius:5px;
  276. font-size:12px;
  277. font-weight:400;
  278. color:rgba(255,255,255,1);
  279. text-align: center;
  280. cursor:pointer;
  281. }
  282. .title_time{
  283. font-size:12px;
  284. font-weight:400;
  285. color:rgba(187,187,187,1);
  286. }
  287. .u_name{
  288. width:67px;
  289. height:20px;
  290. font-size:14px;
  291. font-family:PingFang SC;
  292. font-weight:bold;
  293. line-height:20px;
  294. color:rgba(102,102,102,1);
  295. }
  296. ul li {
  297. list-style: none;
  298. margin: 0px;
  299. padding:6px 0 ;
  300. }
  301. .bt_save{
  302. width:50px;
  303. line-height:30px;
  304. text-align: center;
  305. border:1px solid rgba(221,221,221,1);
  306. background:linear-gradient(180deg,rgba(245,245,245,1) 0%,rgba(238,238,238,1) 100%);
  307. border-radius:5px;
  308. }
  309. .margin_t{
  310. margin-top: 10px;
  311. }
  312. .left_session{
  313. border:1px solid rgba(221,221,221,1);
  314. margin-right: 50px;
  315. max-width: 100%;
  316. min-height: 20px;
  317. padding: 6px;
  318. background:rgba(245,245,245,1);
  319. border-radius:0px 10px 10px 10px;
  320. margin-top:6px;
  321. }
  322. .right_session{
  323. margin-top:6px;
  324. border:1px solid rgba(221,221,221,1);
  325. margin-left: 50px;
  326. max-width: 100%;
  327. min-height: 20px;
  328. padding: 6px;
  329. background:rgba(223,240,255,1);
  330. justify-content: flex-end;
  331. border-radius:10px 0px 10px 10px;
  332. }
  333. .key {
  334. width: 100%;
  335. position: relative;
  336. }
  337. .inputBtn {
  338. /* position: absolute;
  339. right: 30px;
  340. bottom: 10px; */
  341. width: 50px;
  342. height: 26px;
  343. background:rgba(221,221,221,1);
  344. border-radius: 5px;
  345. font-size: 14px;
  346. color: #fff;
  347. }
  348. .frceBox {
  349. position: absolute;
  350. top: -25.1vh;
  351. left: 0;
  352. width: 100%;
  353. height: 25vh;
  354. background: #fff;
  355. border-top: 1px solid #d5e5ff;
  356. overflow-x: hidden;
  357. overflow-y: auto;
  358. z-index: 999999;
  359. }
  360. .frceBox p {
  361. width: 50px;
  362. height: 50px;
  363. }
  364. .frce {
  365. /* width: 100%; */
  366. padding: 0.1rem 0;
  367. margin: 0 10px;
  368. }
  369. .input {
  370. width: 99%;
  371. height: 90px;
  372. background: #fff;
  373. resize: none;
  374. font-size: 14px;
  375. /* padding: 10px; */
  376. /* border: none; */
  377. border: 1px solid #D5E5FF;
  378. outline: none;
  379. }
  380. </style>