index.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <ele-page flex-table>
  3. <page-search @search="reload" :status="useStatus" />
  4. <common-table ref="pageRef" :pageConfig="pageConfig" :columns="columns">
  5. <template #toolbar>
  6. <div class="flex items-center mb-4">
  7. <el-statistic
  8. :value="statistics.sumMoney"
  9. title="累计申请金额"
  10. :precision="2"
  11. value-style="font-size:30px"
  12. class="mr-20"
  13. />
  14. <el-statistic
  15. :value="statistics.unAuditMoney"
  16. title="待审核补贴"
  17. :precision="2"
  18. value-style="font-size:30px"
  19. class="mr-20"
  20. />
  21. <el-statistic
  22. :value="statistics.auditMoney"
  23. title="已审核补贴金额"
  24. :precision="2"
  25. value-style="font-size:30px"
  26. class="mr-20"
  27. />
  28. </div>
  29. <div class="common-title mb-4">交易记录</div>
  30. <!-- 状态 1-待审核 2-审核通过 3-审核拒绝 4-未提交 5-已放弃 -->
  31. <el-radio-group
  32. @change="handleStatusChange"
  33. v-model="useStatus"
  34. >
  35. <el-radio-button label="全部" value="" />
  36. <el-radio-button label="待审核" value="1" />
  37. <el-radio-button label="已审核" value="2" />
  38. <el-radio-button label="审核拒绝" value="3" />
  39. <el-radio-button label="未提交" value="4" />
  40. <el-radio-button label="用户放弃" value="5" />
  41. </el-radio-group>
  42. <el-button
  43. type="primary"
  44. @click="handleBatchAudit"
  45. v-permission="'finance:subsidyReview:audit'"
  46. style="margin-left: 20px"
  47. >
  48. 批量审核
  49. </el-button>
  50. </template>
  51. <template #type="{ row }">
  52. <dict-data
  53. code="order_compensation_type"
  54. type="text"
  55. :model-value="row.type"
  56. />
  57. </template>
  58. <template #status="{ row }">
  59. <dict-data
  60. code="order_compensation_status"
  61. type="text"
  62. :model-value="row.status"
  63. />
  64. </template>
  65. <template #orderId="{ row }">
  66. <el-button type="primary" link @click="handleOrderId(row)">{{
  67. row.orderId
  68. }}</el-button>
  69. </template>
  70. <template #action="{ row }">
  71. <div>
  72. <el-button
  73. type="primary"
  74. link
  75. v-if="row.status == 1"
  76. v-permission="'finance:subsidyReview:audit'"
  77. @click="handleAudit(row)"
  78. >
  79. [审核]
  80. </el-button>
  81. <el-button
  82. type="primary"
  83. link
  84. v-permission="'finance:subsidyReview:log'"
  85. @click="handleLog(row)"
  86. >
  87. [操作日志]
  88. </el-button>
  89. <!-- 替客户申请 showSubmit -->
  90. <el-button
  91. type="danger"
  92. link
  93. v-if="row.showSubmit == 1"
  94. v-permission="'finance:subsidyReview:showSubmit'"
  95. @click="handleShowSubmit(row)"
  96. >
  97. [替客户申请]
  98. </el-button>
  99. </div>
  100. </template>
  101. </common-table>
  102. <orderDetail ref="orderDetailRef" />
  103. <!-- 操作日志弹窗 -->
  104. <log-dialog ref="logDialogRef" />
  105. <!-- 批量审核弹窗 -->
  106. <batch-audit ref="batchAuditRef" @success="handleBatchAuditSuccess" />
  107. </ele-page>
  108. </template>
  109. <script setup>
  110. import { ref, reactive, onMounted, getCurrentInstance } from 'vue';
  111. import CommonTable from '@/components/CommonPage/CommonTable.vue';
  112. import pageSearch from './page-search.vue';
  113. import request from '@/utils/request';
  114. import OrderDetail from '@/views/recycleOrder/components/order-detail.vue';
  115. import LogDialog from './components/log-dialog.vue';
  116. import BatchAudit from './components/batch-audit.vue';
  117. import { ElMessage } from 'element-plus';
  118. import { rowKey } from 'element-plus/es/components/table-v2/src/common';
  119. defineOptions({ name: 'SubsidyReview' });
  120. const { proxy } = getCurrentInstance();
  121. // 添加统计数据的响应式对象
  122. const statistics = reactive({
  123. sumMoney: 0,
  124. unAuditMoney: 0,
  125. auditMoney: 0
  126. });
  127. // 获取统计数据
  128. async function fetchStatistics() {
  129. try {
  130. const res = await request.get('/order/orderCompensationLog/getSum');
  131. if (res.data.code === 200) {
  132. Object.assign(statistics, res.data.data);
  133. }
  134. } catch (error) {
  135. console.error('获取统计数据失败:', error);
  136. }
  137. }
  138. const orderDetailRef = ref(null);
  139. const handleOrderId = (row) => {
  140. orderDetailRef.value?.handleOpen(row);
  141. };
  142. onMounted(() => {
  143. fetchStatistics();
  144. });
  145. const useStatus = ref('');
  146. function handleStatusChange(value) {
  147. useStatus.value = value;
  148. pageConfig.params.status = value;
  149. reload();
  150. }
  151. /** 表格列配置 */
  152. const columns = ref([
  153. { type: 'selection', width: 55, align: 'center' },
  154. { label: '申请时间', prop: 'submitTime', align: 'center', width: 180 },
  155. { label: '用户ID', prop: 'userId', align: 'center' },
  156. { label: '用户昵称', prop: 'nickName', align: 'center' },
  157. {
  158. label: '对方账户',
  159. prop: 'nickName2',
  160. align: 'center',
  161. formatter: (row) => '小程序余额'
  162. },
  163. { label: '结算金额', prop: 'compensationMoney', align: 'center' },
  164. { label: '交易状态', prop: 'status', align: 'center', slot: 'status' },
  165. {
  166. label: '交易类型',
  167. prop: 'type',
  168. align: 'center',
  169. slot: 'type'
  170. },
  171. {
  172. label: '订单编号',
  173. prop: 'orderId',
  174. align: 'center',
  175. minWidth: 120,
  176. slot: 'orderId'
  177. },
  178. {
  179. columnKey: 'action',
  180. label: '操作',
  181. width: 150,
  182. align: 'center',
  183. slot: 'action',
  184. fixed: 'right'
  185. }
  186. ]);
  187. /** 页面组件实例 */
  188. const pageRef = ref(null);
  189. const pageConfig = reactive({
  190. pageUrl: '/order/orderCompensationLog/pagelist',
  191. fileName: '补贴审核',
  192. cacheKey: 'subsidyReview',
  193. rowKey:'id',
  194. params: {
  195. status: useStatus.value
  196. }
  197. });
  198. //刷新表格
  199. function reload(where = {}) {
  200. where.status = useStatus.value;
  201. pageRef.value?.reload(where);
  202. }
  203. // 审核
  204. const handleAudit = (row) => {
  205. // 使用批量审核的弹窗,传入单个ID
  206. batchAuditRef.value?.open([row.id]);
  207. };
  208. // 日志弹窗引用
  209. const logDialogRef = ref(null);
  210. // 操作日志
  211. const handleLog = (row) => {
  212. logDialogRef.value?.open(row);
  213. };
  214. // 批量审核
  215. const batchAuditRef = ref(null);
  216. const handleBatchAudit = () => {
  217. const selectedRows = pageRef.value?.getSelections() || [];
  218. if (selectedRows.length === 0) {
  219. ElMessage.warning('请先选择要审核的记录');
  220. return;
  221. }
  222. // 只能审核待审核状态的记录
  223. const pendingRows = selectedRows.filter((row) => row.status == 1);
  224. if (pendingRows.length === 0) {
  225. ElMessage.warning('请选择待审核状态的记录');
  226. return;
  227. }
  228. if (pendingRows.length !== selectedRows.length) {
  229. ElMessage.warning(
  230. '只能审核待审核状态的记录,已自动过滤其他状态的记录'
  231. );
  232. }
  233. const ids = pendingRows.map((row) => row.id);
  234. batchAuditRef.value?.open(ids);
  235. };
  236. const handleBatchAuditSuccess = () => {
  237. // 批量审核成功后刷新表格和统计数据
  238. reload();
  239. fetchStatistics();
  240. // 清空选中状态
  241. pageRef.value?.tableRef?.clearSelection();
  242. };
  243. //替客户申请
  244. const handleShowSubmit = (row) => {
  245. pageRef.value.messageBoxConfirm({
  246. message: '确定替客户申请吗?',
  247. fetch: () =>
  248. proxy.$http.post(
  249. `/order/orderCompensationLog/adminSubmitAudit/${row.id}`
  250. )
  251. });
  252. };
  253. </script>