index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  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: #fff;
  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. <el-form
  26. :model="state.formQuery"
  27. ref="queryRef"
  28. size="default" label-width="0px" class="mt5 mb5">
  29. <ext-d-select
  30. v-model="state.formQuery.status"
  31. placeholder="退款状态"
  32. clearable
  33. type="Refund.status"
  34. @on-change="loadData(true)"
  35. class="wd150 mr10">
  36. </ext-d-select>
  37. <!-- <ext-d-select
  38. v-model="state.formQuery.fundsAccount"
  39. placeholder="资金账户"
  40. clearable
  41. type="Refund.account"
  42. @on-change="loadData(true)"
  43. class="wd150 mr10">
  44. </ext-d-select>-->
  45. <el-input
  46. v-model="state.formQuery.mobilePhone"
  47. placeholder="手机号"
  48. clearable
  49. @blur="loadData(true)"
  50. class="wd150 mr10">
  51. </el-input>
  52. <el-input
  53. v-model="state.formQuery.outRefundNo"
  54. placeholder="商户退款单号"
  55. clearable
  56. @blur="loadData(true)"
  57. class="wd150 mr10">
  58. </el-input>
  59. <el-input
  60. v-model="state.formQuery.outTradeNo"
  61. placeholder="商户订单号"
  62. clearable
  63. @blur="loadData(true)"
  64. class="wd150 mr10">
  65. </el-input>
  66. <el-input
  67. v-model="state.formQuery.refundId"
  68. placeholder="微信支付退款单号"
  69. clearable
  70. @blur="loadData(true)"
  71. class="wd150 mr10">
  72. </el-input>
  73. <el-input
  74. v-model="state.formQuery.transactionId"
  75. placeholder="微信支付订单号"
  76. clearable
  77. @blur="loadData(true)"
  78. class="wd150 mr10">
  79. </el-input>
  80. <el-button class="ml10" plain size="default" type="success" @click="loadData(true)">
  81. <SvgIcon name="ele-Search"/>
  82. 查询
  83. </el-button>
  84. </el-form>
  85. <el-table
  86. border
  87. stripe="stripe"
  88. :height="state.tableData.height"
  89. highlight-current-row
  90. current-row-key="id"
  91. row-key="id"
  92. :data="state.tableData.data"
  93. v-loading="state.tableData.loading"
  94. @selection-change="handleTableSelectionChange"
  95. @sort-change="handleTableSortChange">
  96. <template #empty>
  97. <el-empty></el-empty>
  98. </template>
  99. <el-table-column
  100. v-for="field in state.tableData.columns"
  101. :key="field.prop"
  102. :label="field.label"
  103. :column-key="field.prop"
  104. :width="field.width"
  105. :min-width="field.minWidth"
  106. :fixed="field.fixed"
  107. :sortable="field.sortable"
  108. :show-overflow-tooltip="!field.fixed&&field.width>150"
  109. >
  110. <template #default="{row}">
  111. <template v-if="field.prop==='expand'">
  112. <p style="padding-left: 2em;" v-html="row[field.prop]"></p>
  113. </template>
  114. <template v-else-if="'total'===field.prop">
  115. {{u.fmt.fmtMoney(row[field.prop])}}
  116. </template>
  117. <template v-else-if="'refund'===field.prop">
  118. {{u.fmt.fmtMoney(row[field.prop])}}
  119. </template>
  120. <template v-else-if="'status'===field.prop">
  121. <ext-d-label type="Refund.status" v-model="row[field.prop]"/>
  122. </template>
  123. <template v-else-if="'action'===field.prop">
  124. <el-button v-if="!row.status" size="small" plain type="warning" @click="onRefundClick(row)">退款</el-button>
  125. </template>
  126. <template v-else>
  127. <div>{{ row[field.prop] }}</div>
  128. </template>
  129. </template>
  130. </el-table-column>
  131. </el-table>
  132. <ext-page class="page-pager" v-model:value="state.pageQuery" @change="loadData(false)"/>
  133. </el-card>
  134. </div>
  135. </template>
  136. <script setup lang="ts" name="RefundLogList">
  137. import {defineAsyncComponent, reactive, onMounted, onBeforeMount, ref, getCurrentInstance, nextTick, onBeforeUnmount} from 'vue';
  138. import {$body, $get} from "/@/utils/request";
  139. import {Msg} from "/@/utils/message";
  140. import u from "/@/utils/u"
  141. import ExtPage from '/@/components/form/ExtPage.vue'
  142. import mittBus from '/@/utils/mitt';
  143. import ExtDSelect from "/@/components/form/ExtDSelect.vue";
  144. import ExtDLabel from "/@/components/form/ExtDLabel.vue";
  145. //定义引用
  146. const queryRef = ref();
  147. //定义变量
  148. const state = reactive({
  149. formQuery: {},
  150. pageQuery: {
  151. pageNum: 1,
  152. pageSize: 10,
  153. total: 0
  154. },
  155. tableData: {
  156. height: 500,
  157. data: [] as Array<any>,
  158. loading: false,
  159. columns: [
  160. {label: '商户退款单号', prop: 'outRefundNo', width: 150, resizable: true,fixed:'left'},
  161. {label: '商户订单号', prop: 'outTradeNo', width: 150, resizable: true,fixed:'left'},
  162. {label: '手机号', prop: 'mobilePhone', width: 150, resizable: true,fixed:'left'},
  163. {label: '退款渠道', prop: 'channel', width: 150,resizable: true},
  164. {label: '退款创建(受理)时间', prop: 'createTime', sortable: 'custom', resizable: true, width: 180},
  165. {label: '退款状态', prop: 'status', resizable: true, width: 120},
  166. {label: '退款成功时间', prop: 'successTime', sortable: 'custom', resizable: true, width: 160},
  167. {label: '订单金额', prop: 'total', resizable: true, width: 130},
  168. {label: '退款金额', prop: 'refund', resizable: true, width: 130},
  169. {label: '用户支付币种', prop: 'currency', resizable: true, width: 120},
  170. {label: '资金账户', prop: 'fundsAccount', resizable: true, width: 120},
  171. {label: '退款原因', prop: 'reason', resizable: true, width: 120},
  172. {label: '微信支付退款单号', prop: 'refundId', resizable: true, width: 150},
  173. {label: '微信支付订单号', prop: 'transactionId', resizable: true, width: 150},
  174. {label: '退款入账账户', prop: 'userReceivedAccount', resizable: true, width: 120},
  175. {
  176. label: '操作', prop: 'action', width: 110, align: 'center', fixed: 'right',
  177. }
  178. ],
  179. },
  180. })
  181. // 监听双向绑定 modelValue 的变化
  182. // watch(
  183. // () => state.pageIndex,
  184. // () => {
  185. //
  186. // }
  187. // );
  188. //生命周期钩子
  189. onBeforeMount(() => {
  190. })
  191. onMounted(() => {
  192. loadData();
  193. nextTick(() => {
  194. let bodyHeight = document.body.clientHeight;
  195. let queryHeight = queryRef.value.$el.clientHeight;
  196. state.tableData.height = bodyHeight - queryHeight - 320
  197. })
  198. mittBus.on("refundLog.refresh", () => {
  199. loadData();
  200. })
  201. });
  202. onBeforeUnmount(() => {
  203. mittBus.off("refundLog.refresh")
  204. })
  205. //region 方法区
  206. // 初始化表格数据
  207. const loadData = (refresh: boolean = false) => {
  208. if (refresh) {
  209. state.pageQuery.pageNum = 1;
  210. }
  211. state.tableData.loading = true;
  212. $get(`/finance/listRefundLog`, {...state.formQuery, ...state.pageQuery}).then((res: any) => {
  213. let {list, total} = res;
  214. state.tableData.data = list;
  215. state.pageQuery.total = total;
  216. state.tableData.loading = false;
  217. }).catch(e => {
  218. console.error(e)
  219. state.tableData.loading = false;
  220. })
  221. };
  222. // 打开修改用户弹窗
  223. const onRefundClick = ( row: any) => {
  224. // if(row.status){
  225. // return;
  226. // }
  227. Msg.confirm("请确认是否执行退款操作?").then(()=>{
  228. $get(`/finance/customWxRefund/${row.refundLogId}`).then((res: any) => {
  229. Msg.message(`操作已提交`)
  230. loadData(true)
  231. }).catch(e => {
  232. console.error(e)
  233. })
  234. })
  235. };
  236. const handleTableSelectionChange = (selection: any) => {
  237. console.log("handleTableSelectionChange>>", selection)
  238. // emit("on-check-change", selection)
  239. }
  240. const handleTableSortChange = (column, prop, order) => {
  241. console.log("handleTableSortChange>>", column, prop, order)
  242. // emit("on-sort-change", column)
  243. }
  244. //endregion
  245. // 暴露变量
  246. // defineExpose({
  247. // loadData,
  248. // });
  249. </script>