index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. :inline="true"
  7. v-show="showSearch"
  8. label-width="120px"
  9. >
  10. <el-form-item label="会员ID" prop="userId">
  11. <el-input
  12. v-model="queryParams.userId"
  13. placeholder="请输入会员ID"
  14. clearable
  15. size="small"
  16. @keyup.enter.native="handleQuery"
  17. @input="queryParams.userId = queryParams.userId.replace(/[^0-9]/g, '')"
  18. />
  19. </el-form-item>
  20. <el-form-item label="发送日期" prop="userAskDate">
  21. <el-date-picker
  22. clearable
  23. size="small"
  24. v-model="queryParams.userAskDate"
  25. type="date"
  26. value-format="yyyy-MM-dd"
  27. placeholder="请选择发送日期"
  28. @change="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item label="客服ID" prop="appCustomerId">
  32. <el-input
  33. v-model="queryParams.appCustomerId"
  34. placeholder="请输入客服ID"
  35. clearable
  36. size="small"
  37. @keyup.enter.native="handleQuery"
  38. @input="queryParams.appCustomerId = queryParams.appCustomerId.replace(/[^0-9]/g, '')"
  39. />
  40. </el-form-item>
  41. <el-form-item label="回复日期" prop="customerReplyDate">
  42. <el-date-picker
  43. clearable
  44. size="small"
  45. v-model="queryParams.customerReplyDate"
  46. type="date"
  47. value-format="yyyy-MM-dd"
  48. placeholder="请选择回复日期"
  49. @change="handleQuery"
  50. />
  51. </el-form-item>
  52. <el-form-item>
  53. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  54. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  55. </el-form-item>
  56. </el-form>
  57. <el-row :gutter="10" class="mb8">
  58. <right-toolbar :showSearch.sync="showSearch" @queryTable="getFindList"/>
  59. </el-row>
  60. <el-table v-loading="loading" :data="userChatLogs" border>
  61. <el-table-column type="index" label="序号" align="center" width="80"/>
  62. <el-table-column label="会员ID" align="center" prop="userId" min-width="130"/>
  63. <el-table-column label="会员名称" align="left" prop="userName" min-width="100"/>
  64. <el-table-column label="客服ID" align="left" prop="appCustomerId" min-width="100"/>
  65. <el-table-column label="客服名称" align="center" prop="appCustomerName" min-width="150">
  66. <template slot-scope="scope">
  67. <el-tag
  68. v-if="scope.row.appCustomerName"
  69. v-text="scope.row.appCustomerName"
  70. />
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="会员对话" align="left" prop="userAskShortContent" min-width="250"/>
  74. <el-table-column label="对话时间" align="center" prop="userAskTime" min-width="120"/>
  75. <el-table-column label="客服回复" align="left" prop="customerReplyShortContent" min-width="250">
  76. <template slot-scope="scope">
  77. {{ scope.row.customerReplyShortContent || '--' }}
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="回复时间" align="center" prop="customerReplyTime" min-width="120"/>
  81. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" min-width="180"
  82. fixed="right">
  83. <template slot-scope="scope">
  84. <el-button
  85. size="mini"
  86. type="text"
  87. icon="el-icon-edit"
  88. @click="openChatPage(scope.row)"
  89. >
  90. 查看详情
  91. </el-button>
  92. </template>
  93. </el-table-column>
  94. </el-table>
  95. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
  96. @pagination="getFindList" />
  97. <!-- 查看详情 -->
  98. <el-dialog
  99. title="对话详情"
  100. :visible.sync="dialog.visible"
  101. v-loading="dialog.loading"
  102. width="1000px"
  103. append-to-body
  104. :close-on-click-modal="false"
  105. >
  106. <div style="height: 600px; overflow: auto;">
  107. <el-timeline>
  108. <el-timeline-item
  109. :timestamp="dialog.chatInfo.userAskTime"
  110. placement="top"
  111. type="success"
  112. >
  113. <el-card shadow="hover" :body-style="{'padding': '8px', 'background': '#9df29f', 'color': '#161616'}">
  114. <div
  115. class="no-copy1"
  116. v-html="dialog.chatInfo.userAskFullContentFmt || '--'"
  117. >
  118. </div>
  119. </el-card>
  120. </el-timeline-item>
  121. <el-timeline-item
  122. :timestamp="dialog.chatInfo.customerReplyTime"
  123. placement="top"
  124. type="primary"
  125. >
  126. <el-card shadow="hover" :body-style="{'padding': '8px', 'background': '#eeeef0', 'color': '#161616'}">
  127. <div
  128. class="no-copy1"
  129. v-html="dialog.chatInfo.customerReplyFullContentFmt || '--'"
  130. oncontextmenu="return false"
  131. @selectstart.prevent
  132. @contextmenu.prevent
  133. >
  134. </div>
  135. </el-card>
  136. </el-timeline-item>
  137. </el-timeline>
  138. </div>
  139. <div slot="footer" class="dialog-footer" style="text-align: center">
  140. <el-button @click="cancel">关 闭</el-button>
  141. </div>
  142. </el-dialog>
  143. </div>
  144. </template>
  145. <script>
  146. import { findList, } from "@/api/app/userChatLogs";
  147. export default {
  148. name: "UserChatLogs",
  149. data() {
  150. return {
  151. loading: true,
  152. showSearch: true,
  153. userChatLogs: [],
  154. total: 0,
  155. queryParams: {
  156. pageNum: 1,
  157. pageSize: 10,
  158. userId: null,
  159. userAskDate: null,
  160. appCustomerId: null,
  161. customerReplyDate: null,
  162. },
  163. dialog: {
  164. visible: false,
  165. loading: false,
  166. chatInfo: {},
  167. },
  168. };
  169. },
  170. created() {
  171. this.getFindList();
  172. },
  173. methods: {
  174. handleQuery() {
  175. this.queryParams.pageNum = 1;
  176. this.getFindList();
  177. },
  178. resetQuery() {
  179. this.resetForm("queryForm");
  180. this.getFindList();
  181. },
  182. async getFindList() {
  183. this.loading = true;
  184. let tableInfo = await findList(this.queryParams);
  185. this.userChatLogs = tableInfo.rows;
  186. this.total = tableInfo.total;
  187. this.loading = false;
  188. },
  189. /**
  190. * 打开详情页面
  191. */
  192. openChatPage(row) {
  193. this.dialog.visible = true;
  194. this.dialog.loading = true;
  195. this.dialog.chatInfo = row;
  196. let userAskFullContentFmt = !this.isEmpty(this.dialog.chatInfo.userAskFullContent) ? this.dialog.chatInfo.userAskFullContent.replace(/\n+/g, '\n').replace(/\n/g, '<br>') : '--';
  197. this.dialog.chatInfo['userAskFullContentFmt'] = userAskFullContentFmt;
  198. let customerReplyFullContentFmt = !this.isEmpty(this.dialog.chatInfo.customerReplyFullContent) ? this.dialog.chatInfo.customerReplyFullContent.replace(/\n+/g, '\n').replace(/\n/g, '<br>') : '--';
  199. this.dialog.chatInfo['customerReplyFullContentFmt'] = customerReplyFullContentFmt;
  200. this.dialog.loading = false;
  201. },
  202. cancel() {
  203. this.dialog.visible = false;
  204. },
  205. isEmpty(value) {
  206. return value === null || value === undefined || value.length === 0;
  207. },
  208. /**
  209. * 删除
  210. * @param row
  211. */
  212. handleDelete(row) {
  213. const ids = row.id || this.ids;
  214. this.$confirm('是否确认删除欢迎语:编号为"' + ids + '"的数据项?', "警告", {
  215. confirmButtonText: "确定",
  216. cancelButtonText: "取消",
  217. type: "warning"
  218. }).then(function () {
  219. return deleteByIds(ids);
  220. }).then(() => {
  221. this.getList();
  222. this.msgSuccess("删除成功");
  223. }).catch(() => { });
  224. },
  225. }
  226. };
  227. </script>
  228. <style scoped>
  229. ::v-deep .el-card .is-always-shadow {
  230. padding: 8px;
  231. }
  232. .no-copy {
  233. user-select: none;
  234. -webkit-user-select: none;
  235. -moz-user-select: none;
  236. -ms-user-select: none;
  237. }
  238. </style>