index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. <template>
  2. <div class="app-container">
  3. <el-row>
  4. <el-col :span="24">
  5. <div class="cell">
  6. <div class="cell-title">
  7. <div class="title-left">
  8. <div class="title">投诉管理</div>
  9. </div>
  10. </div>
  11. <div class="cell-body">
  12. <div class="controls">
  13. <el-form :inline="true" :model="formInline" class="demo-form-inline">
  14. <el-form-item label="状态">
  15. <el-select v-model="formInline.status" clearable placeholder="请选择">
  16. <el-option v-for="item in formInline.options" :key="item.id" :label="item.label" :value="item.id">
  17. </el-option>
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item label="投诉时间">
  21. <el-date-picker v-model="formInline.search_datatime" type="daterange" align="right" start-placeholder="开始日期"
  22. end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd">
  23. </el-date-picker>
  24. </el-form-item>
  25. <el-form-item label="">
  26. <el-input v-model="formInline.keyword" style="width: 200px;" prefix-icon="el-icon-search" clearable
  27. placeholder="请输入关键字段"></el-input>
  28. </el-form-item>
  29. <el-form-item>
  30. <el-button type="primary" class="btn-search" @click="btn_search">查询</el-button>
  31. </el-form-item>
  32. </el-form>
  33. <el-button type="primary" icon="el-icon-download" class="export" @click="exportExcel">导出投诉</el-button>
  34. </div>
  35. <el-table ref="multipleTable" :data="tableData" height="510" style="width: 100%" :cell-style="cell_style" v-loading="loading"
  36. :header-cell-style="header_cell_style">
  37. <el-table-column fixed="left" label="状态" align="center">
  38. <template slot-scope="scope">
  39. <span v-if="scope.row.status == 0" style="color: #ccc;">已删除</span>
  40. <span v-else-if="scope.row.status == 1" style="color: #F9273F;">处理中</span>
  41. <span v-else-if="scope.row.status == 2" style="color: #56AA2E;">已处理</span>
  42. </template>
  43. </el-table-column>
  44. <el-table-column label="投诉单号" align="center" width="180">
  45. <template slot-scope="scope">
  46. <span>{{ scope.row.id }}</span>
  47. </template>
  48. </el-table-column>
  49. <el-table-column label="民宿" align="center" width="280">
  50. <template slot-scope="scope">
  51. <span>{{ scope.row.hotelName }}</span>
  52. </template>
  53. </el-table-column>
  54. <el-table-column label="民宿电话" align="center" width="120">
  55. <template slot-scope="scope">
  56. <span>{{ scope.row.hotelPhone }}</span>
  57. </template>
  58. </el-table-column>
  59. <el-table-column label="投诉人电话" align="center" width="120">
  60. <template slot-scope="scope">
  61. <span>{{ scope.row.complainPhone }}</span>
  62. </template>
  63. </el-table-column>
  64. <el-table-column label="订单号" align="center" width="180">
  65. <template slot-scope="scope">
  66. <span>{{ scope.row.order_num }}</span>
  67. </template>
  68. </el-table-column>
  69. <el-table-column label="标题" align="center" width="180">
  70. <template slot-scope="scope">
  71. <span>{{ scope.row.title }}</span>
  72. </template>
  73. </el-table-column>
  74. <el-table-column label="问题描述" align="center" width="280">
  75. <template slot-scope="scope">
  76. <span>{{ scope.row.content }}</span>
  77. </template>
  78. </el-table-column>
  79. <el-table-column label="投诉时间" align="center" width="168">
  80. <template slot-scope="scope">
  81. <span>{{ scope.row.createDate.substring(0, scope.row.createDate.length - 2) }}</span>
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="备注" align="center" width="280">
  85. <template slot-scope="scope">
  86. <span>{{ scope.row.remark }}</span>
  87. </template>
  88. </el-table-column>
  89. <el-table-column fixed="right" label="操作" width="120">
  90. <template slot-scope="scope">
  91. <el-button @click="handleClickRemarks(scope.row)" type="text" size="small">受理</el-button>
  92. <el-button @click="handleClickAcceptance(scope.row)" type="text" size="small">备注</el-button>
  93. </template>
  94. </el-table-column>
  95. </el-table>
  96. <div class="pagination-table">
  97. <el-pagination @current-change="currentPageChange" :current-page.sync="pagination.currentPage" :page-size="pagination.pageSize"
  98. layout="prev, pager, next, jumper" :total="pagination.total">
  99. </el-pagination>
  100. </div>
  101. </div>
  102. </div>
  103. </el-col>
  104. </el-row>
  105. <!-- 投诉详情 -->
  106. <el-dialog title="投诉详情" custom-class="acceptance-class" :visible.sync="dialogComplaintVisible" :close-on-click-modal="true"
  107. :close-on-press-escape="false" @close="complaint_close">
  108. <p v-if="complaint.status == 1"><label class="lbl-cls">投诉状态:</label><span style="color: #F9273F;">处理中</span></p>
  109. <p v-else-if="complaint.status == 2"><label class="lbl-cls">投诉状态:</label><span style="color: #56AA2E;">处理完成</span></p>
  110. <p v-else><label class="lbl-cls">投诉状态:</label><span style="color: #ccc;">已删除</span></p>
  111. <p><label class="lbl-cls">投诉单号:</label> {{ complaint.bookingId }}</p>
  112. <p><label class="lbl-cls">民宿:</label> {{ complaint.hotelName }}</p>
  113. <p><label class="lbl-cls">民宿电话:</label> {{ complaint.hotelPhone }}</p>
  114. <p><label class="lbl-cls">投诉人电话:</label> {{ complaint.complainPhone }}</p>
  115. <p><label class="lbl-cls">订单号:</label> {{ complaint.id }}</p>
  116. <div>
  117. <h3 style="padding-top: 20px;">投诉信息</h3>
  118. <p><label class="lbl-cls">标题:</label> {{ complaint.title }}</p>
  119. <p><label class="lbl-cls">问题描述:</label> {{ complaint.content }}</p>
  120. <div class="show-imgs">
  121. <div><label class="lbl-cls">图片:</label></div>
  122. <div class="imgs">
  123. <div v-for="(image, index) in complaint.fileInfos" :key="index">
  124. <img :src="image.url" v-if="!image.url.endsWith('.mp4')"
  125. style="margin: 0 2px; border-radius: 5px;" alt="" @click="handlePictureCardPreview(image.url)" height="80px" width="80px" />
  126. </div>
  127. </div>
  128. </div>
  129. <p><label class="lbl-cls">投诉时间:</label> {{ complaint.createDate}}</p>
  130. <p><label class="lbl-cls">备注:</label><el-input type="textarea" style="margin-left: 100px; margin-top: -20px; width: calc(100% - 100px);"
  131. :rows="2" placeholder="暂无备注信息" v-model="complaint.remark">
  132. </el-input>
  133. </p>
  134. <p style="display: flex; justify-content: flex-end;">
  135. <el-button class="cancel-btn" @click="dialogComplaintVisible = false">取 消</el-button>
  136. <el-button type="primary" class="confirm-btn" @click="handleRemarks">确定受理</el-button>
  137. </p>
  138. </div>
  139. </el-dialog>
  140. <el-dialog :visible.sync="dialogVisible">
  141. <img width="100%" :src="dialogImageUrl" alt="">
  142. </el-dialog>
  143. <el-dialog title="添加备注" custom-class="add-remarks-class" :visible.sync="dialogRemarksFormVisible" :close-on-click-modal="false">
  144. <el-form :model="formRemarks">
  145. <el-form-item>
  146. <el-input type="textarea" placeholder="请输入备注" v-model="formRemarks.remark" :autosize="{minRows: 4, maxRows: 6}" maxlength="100"
  147. show-word-limit></el-input>
  148. </el-form-item>
  149. </el-form>
  150. <div slot="footer" class="dialog-footer">
  151. <el-button class="cancel-btn" @click="dialogRemarksFormVisible = false">取 消</el-button>
  152. <el-button type="primary" class="confirm-btn" @click="handleRemarks">确 定</el-button>
  153. </div>
  154. </el-dialog>
  155. </div>
  156. </template>
  157. <script>
  158. import {
  159. getTableData,
  160. getXiang,
  161. downloadExcel
  162. } from '@/api/complaintMgr'
  163. export default {
  164. data() {
  165. return {
  166. currentUserLevel: this.$store.state.user.level, // 当前用户的权限
  167. dialogImageUrl: '',
  168. formLabelWidth: '120px',
  169. // 表格单元格样式
  170. cell_style: {
  171. color: '#1A202B',
  172. 'font-size': '14px',
  173. 'font-family': 'Microsoft YaHei-3970(82674968)'
  174. },
  175. // 表格头部样式
  176. header_cell_style: {
  177. background: '#E6ECFE',
  178. color: '#1A202B',
  179. 'font-size': '16px',
  180. 'font-family': 'Microsoft YaHei-3970(82674968)'
  181. },
  182. // 查询数据
  183. formInline: {
  184. options: [{
  185. id: 0,
  186. label: '已删除'
  187. }, {
  188. id: 1,
  189. label: '处理中'
  190. }, {
  191. id: 2,
  192. label: '已处理'
  193. }],
  194. status: '',
  195. search_datatime: '',
  196. keyword: ''
  197. },
  198. tableData: [],
  199. cond_data: {},
  200. // 分页参数
  201. pagination: {
  202. currentPage: 1,
  203. pageSize: 9,
  204. total: 0
  205. },
  206. loading: true,
  207. complaint: {
  208. status: 'Pending',
  209. complaintNumber: '123456',
  210. lodge: 'Some Lodge',
  211. lodgePhone: '1234567890',
  212. complainantPhone: '0987654321',
  213. orderNumber: '987654321',
  214. title: 'Complaint Title',
  215. description: 'Complaint Description',
  216. images: [],
  217. complaintTime: '2022-01-01 10:00:00'
  218. },
  219. dialogComplaintVisible: false,
  220. dialogVisible: false,
  221. dialogRemarksFormVisible: false, // 添加备注
  222. formRemarks: {
  223. id: '',
  224. remark: ''
  225. }
  226. }
  227. },
  228. created() {
  229. // 检测权限
  230. if (this.currentUserLevel !== 2) {
  231. this.$router.replace({
  232. path: '/data'
  233. })
  234. return
  235. }
  236. // 获取消费记录,表格数据
  237. this.get_table_data('list')
  238. },
  239. mounted() {
  240. document.getElementsByClassName("el-pagination__jump")[0].childNodes[0].nodeValue = "跳至";
  241. },
  242. methods: {
  243. handlePictureCardPreview(file) {
  244. this.dialogImageUrl = file;
  245. this.dialogVisible = true;
  246. },
  247. /**
  248. * 添加备注
  249. */
  250. handleRemarks() {
  251. console.log(this.formRemarks);
  252. },
  253. /**
  254. * 受理
  255. * @param {Object} row
  256. */
  257. handleClickAcceptance(row) {
  258. // console.log(row);
  259. this.formRemarks.id = row.id;
  260. this.dialogRemarksFormVisible = true;
  261. },
  262. // 点击查看备注,弹出投诉详情对话框
  263. handleClickRemarks(row) {
  264. // console.log(row);
  265. this.dialogComplaintVisible = true
  266. getXiang(row).then((res) => {
  267. console.log(res.data);
  268. if (res.code === 200) {
  269. this.complaint = res.data
  270. } else {
  271. this.complaint = []
  272. this.$message.warning('没有符合条件的数据!')
  273. }
  274. }).catch((err) => {
  275. // console.log(err);
  276. this.$message.error(err.message)
  277. });
  278. },
  279. // 关闭投诉详情对话框
  280. complaint_close() {
  281. this.dialogComplaintVisible = false
  282. },
  283. /**
  284. * 获取消费记录,表格数据
  285. */
  286. get_table_data(param) {
  287. this.loading = true
  288. this.get_condtion();
  289. let data = this.cond_data;
  290. if (param == 'search') {
  291. data.page = 1
  292. this.pagination.currentPage = 1
  293. }
  294. var that = this
  295. // console.log(data);
  296. getTableData(data).then((res) => {
  297. // console.log(res.data);
  298. if (res.code === 200) {
  299. var d = res.data
  300. that.pagination.total = d.total
  301. that.tableData = []
  302. for (var i = 0; i < d.pageList.length; i++) {
  303. that.tableData.push(d.pageList[i])
  304. }
  305. } else {
  306. that.tableData = []
  307. that.$message.warning('没有符合条件的数据!')
  308. }
  309. }).catch((err) => {
  310. // console.log(err);
  311. that.$message.error(err.message)
  312. });
  313. that.loading = false;
  314. },
  315. /**
  316. * 查询条件
  317. */
  318. get_condtion() {
  319. let data = {
  320. page: this.pagination.currentPage,
  321. rows: this.pagination.pageSize
  322. }
  323. if (this.formInline.status !== '') {
  324. data.status = this.formInline.status
  325. }
  326. if (this.formInline.search_datatime !== '') {
  327. data.search_datatime = this.formInline.search_datatime
  328. }
  329. if (this.formInline.keyword !== '') {
  330. data.keyword = this.formInline.keyword
  331. }
  332. this.cond_data = data;
  333. },
  334. /**
  335. * 导出为Excel
  336. */
  337. exportExcel() {
  338. var that = this
  339. downloadExcel(this.cond_data).then((res) => {
  340. // console.log(res);
  341. if (res.code === 200) {
  342. that.$message.success(res.message)
  343. let xls = res.downurl
  344. window.open(xls)
  345. } else {
  346. that.tableData = []
  347. that.$message.warning(res.message)
  348. }
  349. }).catch((err) => {
  350. // console.log(err);
  351. that.$message.error(err.message)
  352. });
  353. },
  354. /**
  355. * 搜索
  356. */
  357. btn_search() {
  358. this.get_table_data('search')
  359. },
  360. /**
  361. * currentPage 改变时会触发
  362. * @param {Object} val
  363. */
  364. currentPageChange(val) {
  365. this.pagination.currentPage = val
  366. this.get_table_data('pages')
  367. }
  368. }
  369. }
  370. </script>
  371. <style lang="scss" scoped>
  372. .app-container {
  373. background-color: #EFF2F7;
  374. padding: 10px;
  375. .el-row {
  376. .el-col {
  377. padding: 10px;
  378. .cell {
  379. padding: 30px;
  380. border-radius: 10px;
  381. background-color: #FFFFFF;
  382. box-shadow: 0px 3px 21px 0px rgba(60, 108, 254, 0.16);
  383. .cell-title {
  384. display: flex;
  385. justify-content: space-between;
  386. align-items: center;
  387. margin-bottom: 30px;
  388. padding-bottom: 30px;
  389. border-bottom: 1px solid #CCCCCC;
  390. .title-left {
  391. display: flex;
  392. align-items: center;
  393. .title {
  394. font-size: 22px;
  395. font-family: Microsoft YaHei-3970(82674968);
  396. font-weight: bold;
  397. color: #1A202B;
  398. }
  399. .title-detail {
  400. margin-left: 50px;
  401. font-size: 18px;
  402. font-family: Microsoft YaHei-3970(82674968);
  403. color: #1A202B;
  404. }
  405. }
  406. .title-right {
  407. display: flex;
  408. justify-content: space-between;
  409. align-items: center;
  410. .el-button {
  411. width: 110px;
  412. height: 46px;
  413. background: #2B4CFE;
  414. font-size: 18px;
  415. color: #FFFFFF;
  416. font-family: Microsoft YaHei-3970(82674968);
  417. border-radius: 5px;
  418. }
  419. .el-button--warning {
  420. background: #F88A64;
  421. }
  422. }
  423. }
  424. .cell-body {
  425. .controls {
  426. display: flex;
  427. justify-content: space-between;
  428. align-items: center;
  429. .demo-form-inline {
  430. display: inline-flex;
  431. flex-wrap: wrap;
  432. align-items: center;
  433. justify-content: flex-start;
  434. .btn-search {
  435. background: rgba(9, 101, 98, 1);
  436. font-size: 14px;
  437. color: #FFFFFF;
  438. font-family: Microsoft YaHei-3970(82674968);
  439. border-radius: 5px;
  440. border: none;
  441. }
  442. }
  443. .export {
  444. background: rgba(9, 101, 98, 1);
  445. font-size: 14px;
  446. color: #FFFFFF;
  447. font-family: Microsoft YaHei-3970(82674968);
  448. border-radius: 5px;
  449. margin-bottom: 22px;
  450. border: none;
  451. }
  452. }
  453. .pagination-table {
  454. display: flex;
  455. justify-content: flex-end;
  456. align-items: center;
  457. height: 30px;
  458. margin-top: 20px;
  459. padding-right: 100px;
  460. .txt-notice {
  461. span {
  462. font-size: 28px;
  463. font-weight: 500;
  464. font-family: '微软雅黑';
  465. }
  466. }
  467. ::v-deep .el-pagination {
  468. display: flex;
  469. justify-content: flex-end;
  470. align-items: center;
  471. }
  472. ::v-deep .el-pagination ul {
  473. display: flex;
  474. }
  475. ::v-deep .el-pagination button,
  476. ::v-deep .el-pagination li {
  477. display: flex;
  478. justify-content: center;
  479. align-items: center;
  480. width: 50px;
  481. height: 36px;
  482. border: 1px solid #626262;
  483. border-radius: 3px;
  484. font-size: 14px;
  485. margin: 0 5px;
  486. }
  487. ::v-deep .el-pagination span {
  488. margin-left: 10px;
  489. }
  490. ::v-deep .el-pagination .el-pagination__jump {
  491. font-size: 16px;
  492. }
  493. ::v-deep .el-pagination .el-pagination__editor {
  494. width: 50px;
  495. height: 36px;
  496. margin: 0 5px;
  497. }
  498. ::v-deep .el-pagination .el-input__inner {
  499. width: 50px;
  500. height: 36px;
  501. border: 1px solid #626262;
  502. margin: -4px 0 0 0;
  503. }
  504. }
  505. }
  506. }
  507. }
  508. }
  509. ::v-deep .el-dialog {
  510. margin: 0 !important;
  511. width: 650px;
  512. height: 560px;
  513. background: #FFFFFF;
  514. box-shadow: 0px 0px 13px 0px rgba(0, 0, 0, 0.29);
  515. border-radius: 6px;
  516. position: absolute;
  517. top: 50%;
  518. left: 50%;
  519. transform: translate(-50%, -50%);
  520. .el-dialog__header {
  521. display: flex;
  522. align-items: center;
  523. width: 100%;
  524. height: 58px;
  525. padding: 30px;
  526. border-radius: 6px 6px 0px 0px;
  527. font-weight: bold;
  528. border-bottom: 1px solid rgba(230, 230, 230, 1);
  529. }
  530. .el-dialog__body {
  531. padding-bottom: 0;
  532. .el-form-item__label,
  533. .el-form-item__content {
  534. font-size: 16px;
  535. font-family: Microsoft YaHei-3970(82674968);
  536. color: #53575A;
  537. }
  538. .el-input__inner {
  539. width: 180px;
  540. }
  541. }
  542. // 删除对话框的样式
  543. .del-account-body {
  544. display: flex;
  545. flex-direction: column;
  546. justify-content: center;
  547. align-items: center;
  548. height: 180px;
  549. img {
  550. width: 72px;
  551. }
  552. .del-account-body-txt {
  553. height: 58px;
  554. line-height: 58px;
  555. font-size: 18px;
  556. font-family: Microsoft YaHei-3970(82674968);
  557. color: #333333;
  558. }
  559. }
  560. .el-dialog__footer {
  561. padding-bottom: 0 !important;
  562. text-align: center;
  563. .el-button.el-button--default {
  564. width: 75px;
  565. height: 40px;
  566. border: 1px solid #2B4CFE;
  567. border-radius: 6px;
  568. font-size: 16px;
  569. font-family: Microsoft YaHei-3970(82674968);
  570. color: #2B4CFE;
  571. }
  572. .el-button.el-button--primary {
  573. width: 75px;
  574. height: 40px;
  575. background: #2B4CFE;
  576. border-radius: 6px;
  577. font-size: 16px;
  578. font-family: Microsoft YaHei-3970(82674968);
  579. color: #FFFFFF;
  580. margin-left: 60px;
  581. }
  582. }
  583. }
  584. >>>.el-table__fixed-body-wrapper .el-table__body {
  585. padding-bottom: 17px !important; // 滚动条高度
  586. }
  587. >>>.el-table__fixed,
  588. >>>.el-table__fixed-right {
  589. height: calc(100% - 14px) !important;
  590. }
  591. }
  592. </style>
  593. <style>
  594. .acceptance-class {
  595. height: 680px !important;
  596. }
  597. .add-remarks-class {
  598. height: 300px !important;
  599. }
  600. .el-date-editor--daterange.el-input__inner {
  601. width: 280px !important;
  602. }
  603. .show-imgs {
  604. display: flex;
  605. }
  606. .imgs {
  607. display: flex;
  608. flex-direction: row;
  609. margin-left: 20px;
  610. }
  611. .lbl-cls {
  612. display: inline-block;
  613. width: 100px;
  614. text-align: right;
  615. padding-right: 10px;
  616. color: #bbb;
  617. }
  618. .cancel-btn {
  619. color: rgba(9, 101, 98, 1) !important;
  620. border: 1px solid rgba(9, 101, 98, 1) !important;
  621. }
  622. .confirm-btn {
  623. border: none !important;
  624. background: rgba(9, 101, 98, 1) !important;
  625. color: #fff !important;
  626. border-radius: 5px !important;
  627. margin-left: 28px !important;
  628. }
  629. </style>