withdraw.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <style scoped lang="scss">
  2. .system-container {
  3. :deep(.el-card__body) {
  4. display: flex;
  5. flex-direction: column;
  6. justify-content: space-between;
  7. flex: 1;
  8. overflow: auto;
  9. .el-table {
  10. flex: 1;
  11. }
  12. }
  13. }
  14. .page-content {
  15. margin-bottom: 20px;
  16. }
  17. .page-pager {
  18. background-color: var(--el-color-white);
  19. height: 24px;
  20. }
  21. </style>
  22. <template>
  23. <div class="system-container layout-padding">
  24. <el-card shadow="hover" class="layout-padding-auto">
  25. <ext-query-form
  26. class="page-search"
  27. ref="queryRef"
  28. v-model="state.formQuery"
  29. :columns="state.columns"
  30. :import-config="state.importConfig"
  31. :export-config="state.exportConfig"
  32. @on-change="loadData(true)"
  33. @imported="loadData(true)">
  34. <!-- <template #extraQuery></template>
  35. <template #extraLeft></template>
  36. <template #extraRight></template>-->
  37. <template #extQuery>
  38. </template>
  39. </ext-query-form>
  40. <el-table
  41. border
  42. stripe="stripe"
  43. :height="state.tableData.height"
  44. highlight-current-row
  45. current-row-key="id"
  46. row-key="id"
  47. @on-row-click="handleRowClick('view',$event)"
  48. :data="state.tableData.data"
  49. v-loading="state.tableData.loading">
  50. <template #empty>
  51. <el-empty></el-empty>
  52. </template>
  53. <el-table-column
  54. v-for="field in state.columns"
  55. :key="field.prop"
  56. :type="field.type"
  57. :label="field.label"
  58. :column-key="field.prop"
  59. :width="field.width"
  60. :min-width="field.minWidth"
  61. :fixed="field.fixed"
  62. :sortable="field.sortable"
  63. :show-overflow-tooltip="!field.fixed&&field.width>150">
  64. <template #default="{row}">
  65. <template v-if="field.prop==='name'">
  66. <div class="cursor-pointer" style="color:var(--el-color-primary-light-1)"
  67. @click="handleRowClick('view', row)">
  68. {{ row[field.prop] }}
  69. </div>
  70. </template>
  71. <template v-else-if="'stationId'===field.prop">
  72. <div class="flex-align-items-center text-align-center">
  73. <div>
  74. {{ row.stationId }}
  75. </div>
  76. <hr/>
  77. <div>
  78. {{ row.stationName }}
  79. </div>
  80. </div>
  81. </template>
  82. <template v-else-if="field.prop==='type'">
  83. <ext-d-label type="Object.type" :model-value="row[field.prop]"></ext-d-label>
  84. </template>
  85. <template v-else-if="field.prop==='status'">
  86. <ext-d-label type="WithdrawnRecord.status" :model-value="row[field.prop]"></ext-d-label>
  87. </template>
  88. <template v-else-if="field.prop==='paymentStatus'">
  89. <ext-d-label type="WithdrawnRecord.paymentStatus" :model-value="row[field.prop]"></ext-d-label>
  90. </template>
  91. <template v-else-if="['withdrawnAmount','amount','amountReceivable','amountReceived','cardBalance','coinMoney','discountAmount','discountMoney'].includes(field.prop)">
  92. {{ u.fmt.fmtMoney(row[field.prop]) }}
  93. </template>
  94. <template v-else-if="field.prop==='idleRemainTime'||field.prop==='operationRemainTime'">
  95. {{ u.fmt.fmtDuration(row[field.prop]) }}
  96. </template>
  97. <template v-else-if="['createTime','updateTime'].includes(field.prop)">
  98. {{ u.fmt.fmtDateTime(row[field.prop]) }}
  99. </template>
  100. <template v-else-if="field.prop==='action'">
  101. <el-button v-auth="'withdrawnRecord.modify'" v-if="row.status==0" type="warning" size="small" text @click="handleWithdrawAudit(row)"> 提现审核</el-button>
  102. <el-button v-auth="'withdrawnRecord.modify'" v-if="row.paymentStatus==0" type="danger" size="small" text @click="handleWithdrawConfirm(row)"> 打款确认</el-button>
  103. </template>
  104. <template v-else>
  105. <div>{{ row[field.prop] }}</div>
  106. </template>
  107. </template>
  108. </el-table-column>
  109. </el-table>
  110. <ext-page class="page-pager" v-model:value="state.pageQuery" @change="loadData(false)"/>
  111. </el-card>
  112. </div>
  113. </template>
  114. <script setup lang="ts" name="WithdrawnRecordList">
  115. import {defineAsyncComponent, reactive, onMounted, onBeforeMount, ref, getCurrentInstance, nextTick, onBeforeUnmount} from 'vue';
  116. import {$body, $get} from "/@/utils/request";
  117. import u from '/@/utils/u'
  118. import {Msg} from "/@/utils/message";
  119. import {Session} from "/@/utils/storage";
  120. import ExtPage from '/@/components/form/ExtPage.vue'
  121. import ExtQueryForm from "/@/components/form/ExtQueryForm.vue";
  122. import ExtTable from "/@/components/form/ExtTable.vue";
  123. import mittBus from '/@/utils/mitt';
  124. import {ElButton} from 'element-plus'
  125. import ExtDLabel from "/@/components/form/ExtDLabel.vue";
  126. //定义引用
  127. const queryRef = ref();
  128. const withdrawnRecordDialogRef = ref();
  129. //定义变量
  130. const state = reactive({
  131. formQuery: {},
  132. pageQuery: {
  133. pageIndex: 1,
  134. pageSize: 10,
  135. total: 0
  136. },
  137. tableData: {
  138. height: 500,
  139. data: [] as Array<any>,
  140. loading: false
  141. },
  142. importConfig: {},
  143. exportConfig: {},
  144. columns: [
  145. {label: '提现站点', width: 180, prop: 'stationId', query: true, type: 'select', resizable: true,conf:{url:'washStation/list',valueKey:'stationId',labelKey:'stationName'}},
  146. {label: '提现金额', width: 100, prop: 'withdrawnAmount', type: 'number', resizable: true},
  147. {label: '审核状态', width: 100, prop: 'status', align: 'center', query: true,type: 'dict', conf: {dict: 'WithdrawnRecord.status'}},
  148. {label: '打款状态', width: 100, prop: 'paymentStatus', query: true,type: 'dict', conf: {dict: 'WithdrawnRecord.paymentStatus'}},
  149. {label: '审核人', width: 120, prop: 'reviewer', type: 'text', resizable: true},
  150. {label: '审核时间', width: 180, prop: 'reviewTime', sortable: 'custom', type: 'datetime', resizable: true, conf: {format: (val: any) => u.fmt.fmtDate(val)}},
  151. {label: '打款人', width: 120, prop: 'payer', type: 'text', resizable: true},
  152. {label: '打款时间', width: 180, prop: 'paymentTime', sortable: 'custom', type: 'datetime', resizable: true, conf: {format: (val: any) => u.fmt.fmtDate(val)}},
  153. {label: '备注', width: 180, prop: 'remark', type: 'text', resizable: true},
  154. {label: '申请时间', width: 180, prop: 'createTime', query: false, sortable: 'custom', type: 'datetime', resizable: true, conf: {format: (val: any) => u.fmt.fmtDate(val)}},
  155. {label: '更新时间', width: 180, prop: 'updateTime', query: false, sortable: 'custom', type: 'datetime', resizable: true, conf: {format: (val: any) => u.fmt.fmtDate(val)}},
  156. {
  157. label: '操作', prop: 'action', type: 'render', width: 180, align: 'center', fixed: 'right',
  158. }
  159. ],
  160. })
  161. // 监听双向绑定 modelValue 的变化
  162. // watch(
  163. // () => state.pageIndex,
  164. // () => {
  165. //
  166. // }
  167. // );
  168. //生命周期钩子
  169. onBeforeMount(() => {
  170. })
  171. onMounted(() => {
  172. loadData();
  173. nextTick(() => {
  174. let bodyHeight = document.body.clientHeight;
  175. let queryHeight = queryRef.value.$el.clientHeight;
  176. state.tableData.height = bodyHeight - queryHeight - 220
  177. })
  178. });
  179. onBeforeUnmount(() => {
  180. })
  181. //region 方法区
  182. // 初始化表格数据
  183. const loadData = (refresh: boolean = false) => {
  184. if (refresh) {
  185. state.pageQuery.pageIndex = 1;
  186. }
  187. state.tableData.loading = true;
  188. $body(`/finance/withdrawnRecords`, {...state.formQuery, ...state.pageQuery}).then((res: any) => {
  189. let {list, total} = res;
  190. state.tableData.data = list;
  191. state.pageQuery.total = total;
  192. state.tableData.loading = false;
  193. }).catch(e => {
  194. console.error(e)
  195. state.tableData.loading = false;
  196. })
  197. };
  198. // 打开详情页弹窗
  199. const handleRowClick = (type: string, row: any) => {
  200. withdrawnRecordDialogRef.value.open(type, row);
  201. };
  202. // 删除点击
  203. const handleRowDelete = (row: any) => {
  204. Msg.confirm(`此操作将永久删除:『${row.name}』,是否继续?`).then(() => {
  205. $get(`/withdrawnRecord/delete/${row.id}`).then(() => {
  206. Msg.message("删除成功", 'success')
  207. }).catch(() => {
  208. Msg.message("删除失败", 'error')
  209. })
  210. });
  211. };
  212. const handleWithdrawAudit = (withdraw:any) => {
  213. Msg.showLoading('操作中')
  214. $body(`finance/reviewWithdrawn`,{id:withdraw.id,status:1}).then(res=>{
  215. Msg.message(`提现审核通过`)
  216. Msg.hideLoading();
  217. loadData(true)
  218. }).catch(()=>{
  219. Msg.hideLoading();
  220. })
  221. }
  222. const handleWithdrawConfirm = (withdraw:any) => {
  223. Msg.showLoading('操作中')
  224. $body(`finance/confirmWithdrawnPayment`,{id:withdraw.id,paymentStatus:1}).then(res=>{
  225. Msg.message(`提现打款已确认`)
  226. Msg.hideLoading();
  227. loadData(true)
  228. }).catch(()=>{
  229. Msg.hideLoading();
  230. })
  231. }
  232. //endregion
  233. // 暴露变量
  234. // defineExpose({
  235. // loadData,
  236. // });
  237. </script>