index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <ele-page flex-table>
  3. <page-search @search="reload" />
  4. <common-table
  5. ref="pageRef"
  6. :pageConfig="pageConfig"
  7. :columns="columns"
  8. :tools="false"
  9. >
  10. <template #baseinfo="{ row }">
  11. <div class="flex flex-col items-start">
  12. <el-tag size="large" class="w-full">
  13. <el-text class="flex-1">投诉编号:{{ row.id }}</el-text>
  14. <el-text class="flex-1"
  15. >订单编号:{{ row.orderId }}</el-text
  16. >
  17. </el-tag>
  18. <div class="demo-image__preview mt-2">
  19. <el-image
  20. v-for="(item, index) in getImgList(row)"
  21. :key="index"
  22. style="
  23. width: 70px;
  24. height: 70px;
  25. border-radius: 5px;
  26. margin-right: 8px;
  27. "
  28. :src="item"
  29. fit="cover"
  30. :preview-src-list="getImgList(row)"
  31. :initial-index="index"
  32. preview-teleported
  33. />
  34. </div>
  35. </div>
  36. </template>
  37. <template #action="{ row }">
  38. <div>
  39. <el-button
  40. type="primary"
  41. link
  42. v-permission="'optimization:complain:detail'"
  43. @click="handleDetail(row)"
  44. >
  45. 详情
  46. </el-button>
  47. </div>
  48. </template>
  49. </common-table>
  50. <page-edit ref="pageEditRef" @refresh="reload" />
  51. </ele-page>
  52. </template>
  53. <script setup>
  54. import { ref, reactive } from 'vue';
  55. import CommonTable from '@/components/CommonPage/CommonTable.vue';
  56. import pageSearch from './components/page-search.vue';
  57. import pageEdit from './components/page-edit.vue';
  58. defineOptions({ name: 'MallOrderComplaintList' });
  59. const statusMap = {
  60. '1': '待处理',
  61. '2': '处理中',
  62. '3': '已完结'
  63. };
  64. /** 获取图片列表 */
  65. const getImgList = (row) => {
  66. const imgs = row.imgList || row.fileUrls || row.imgs || [];
  67. if (typeof imgs === 'string') {
  68. try {
  69. return JSON.parse(imgs);
  70. } catch (e) {
  71. return imgs.split(',').filter(i => i);
  72. }
  73. }
  74. return Array.isArray(imgs) ? imgs : [];
  75. };
  76. /** 表格列配置 */
  77. const columns = ref([
  78. {
  79. label: '基础信息',
  80. prop: 'baseinfo',
  81. align: 'center',
  82. minWidth: 240,
  83. slot: 'baseinfo'
  84. },
  85. {
  86. label: '投诉人',
  87. prop: 'userId',
  88. align: 'center'
  89. },
  90. {
  91. label: '投诉时间',
  92. prop: 'createTime',
  93. align: 'center',
  94. width: 180
  95. },
  96. {
  97. label: '投诉原因',
  98. prop: 'reason',
  99. align: 'center'
  100. },
  101. {
  102. label: '投诉状态',
  103. prop: 'status',
  104. align: 'center',
  105. formatter: (row) => statusMap[row.status] || row.status
  106. },
  107. {
  108. columnKey: 'action',
  109. label: '操作',
  110. width: 120,
  111. align: 'center',
  112. slot: 'action'
  113. }
  114. ]);
  115. /** 页面组件实例 */
  116. const pageRef = ref(null);
  117. const pageConfig = reactive({
  118. pageUrl: '/shop/orderComplaintsLog/pagelist',
  119. fileName: '投诉管理',
  120. cacheKey: 'mallOrderComplainTable'
  121. });
  122. //刷新表格
  123. function reload(where) {
  124. pageRef.value?.reload(where);
  125. }
  126. //处理
  127. const pageEditRef = ref(null);
  128. function handleDetail(row) {
  129. pageEditRef.value?.handleOpen(row);
  130. }
  131. </script>