index.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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="'discountAmount'===field.prop">
  121. {{u.fmt.fmtMoney(row[field.prop])}}
  122. </template>
  123. <template v-else-if="'status'===field.prop">
  124. <ext-d-label type="Refund.status" v-model="row[field.prop]"/>
  125. </template>
  126. <template v-else-if="'action'===field.prop">
  127. <el-button v-if="row.status==='NEW'" size="small" plain type="warning" @click="onRefundClick(row)">退款</el-button>
  128. </template>
  129. <template v-else>
  130. <div>{{ row[field.prop] }}</div>
  131. </template>
  132. </template>
  133. </el-table-column>
  134. </el-table>
  135. <ext-page class="page-pager" v-model:value="state.pageQuery" @change="loadData(false)"/>
  136. </el-card>
  137. </div>
  138. </template>
  139. <script setup lang="ts" name="RefundLogList">
  140. import {defineAsyncComponent, reactive, onMounted, onBeforeMount, ref, getCurrentInstance, nextTick, onBeforeUnmount} from 'vue';
  141. import {$body, $get} from "/@/utils/request";
  142. import {Msg} from "/@/utils/message";
  143. import u from "/@/utils/u"
  144. import ExtPage from '/@/components/form/ExtPage.vue'
  145. import mittBus from '/@/utils/mitt';
  146. import ExtDSelect from "/@/components/form/ExtDSelect.vue";
  147. import ExtDLabel from "/@/components/form/ExtDLabel.vue";
  148. //定义引用
  149. const queryRef = ref();
  150. //定义变量
  151. const state = reactive({
  152. formQuery: {
  153. status:'NEW'
  154. },
  155. pageQuery: {
  156. pageNum: 1,
  157. pageSize: 10,
  158. total: 0
  159. },
  160. tableData: {
  161. height: 500,
  162. data: [] as Array<any>,
  163. loading: false,
  164. columns: [
  165. {label: '商户退款单号', prop: 'outRefundNo', width: 150, resizable: true,fixed:'left'},
  166. {label: '商户订单号', prop: 'outTradeNo', width: 150, resizable: true,fixed:'left'},
  167. {label: '手机号', prop: 'mobilePhone', width: 150, resizable: true,fixed:'left'},
  168. // {label: '退款渠道', prop: 'channel', width: 150,resizable: true},
  169. {label: '申请时间', prop: 'createTime', sortable: 'custom', resizable: true, width: 180},
  170. {label: '退款状态', prop: 'status', resizable: true, width: 120},
  171. {label: '退款成功时间', prop: 'successTime', sortable: 'custom', resizable: true, width: 160},
  172. {label: '原充值订单金额', prop: 'total', resizable: true, width: 140},
  173. {label: '退款申请金额', prop: 'refund', resizable: true, width: 130},
  174. {label: '优惠金额', prop: 'discountAmount', resizable: true, width: 130},
  175. // {label: '用户支付币种', prop: 'currency', resizable: true, width: 120},
  176. // {label: '资金账户', prop: 'fundsAccount', resizable: true, width: 120},
  177. {label: '退款原因', prop: 'reason', resizable: true, width: 120},
  178. // {label: '微信支付退款单号', prop: 'outRefundNo', resizable: true, width: 150},
  179. // {label: '微信支付订单号', prop: 'outTradeNo', resizable: true, width: 150},
  180. {label: '退款入账账户', prop: 'userReceivedAccount', resizable: true, width: 120},
  181. {
  182. label: '操作', prop: 'action', width: 110, align: 'center', fixed: 'right',
  183. }
  184. ],
  185. },
  186. })
  187. // 监听双向绑定 modelValue 的变化
  188. // watch(
  189. // () => state.pageIndex,
  190. // () => {
  191. //
  192. // }
  193. // );
  194. //生命周期钩子
  195. onBeforeMount(() => {
  196. })
  197. onMounted(() => {
  198. loadData();
  199. nextTick(() => {
  200. let bodyHeight = document.body.clientHeight;
  201. let queryHeight = queryRef.value.$el.clientHeight;
  202. state.tableData.height = bodyHeight - queryHeight - 320
  203. })
  204. mittBus.on("refundLog.refresh", () => {
  205. loadData();
  206. })
  207. });
  208. onBeforeUnmount(() => {
  209. mittBus.off("refundLog.refresh")
  210. })
  211. //region 方法区
  212. // 初始化表格数据
  213. const loadData = (refresh: boolean = false) => {
  214. if (refresh) {
  215. state.pageQuery.pageNum = 1;
  216. }
  217. state.tableData.loading = true;
  218. $get(`/finance/listRefundLog`, {...state.formQuery, ...state.pageQuery}).then((res: any) => {
  219. let {list, total} = res;
  220. state.tableData.data = list;
  221. state.pageQuery.total = total;
  222. state.tableData.loading = false;
  223. }).catch(e => {
  224. console.error(e)
  225. state.tableData.loading = false;
  226. })
  227. };
  228. // 打开修改用户弹窗
  229. const onRefundClick = ( row: any) => {
  230. // if(row.status){
  231. // return;
  232. // }
  233. Msg.confirm("请确认是否执行退款操作?").then(()=>{
  234. $get(`/finance/customWxRefund/${row.refundLogId}`).then((res: any) => {
  235. Msg.message(`操作已提交`)
  236. loadData(true)
  237. }).catch(e => {
  238. console.error(e)
  239. })
  240. })
  241. };
  242. const handleTableSelectionChange = (selection: any) => {
  243. console.log("handleTableSelectionChange>>", selection)
  244. // emit("on-check-change", selection)
  245. }
  246. const handleTableSortChange = (column, prop, order) => {
  247. console.log("handleTableSortChange>>", column, prop, order)
  248. // emit("on-sort-change", column)
  249. }
  250. //endregion
  251. // 暴露变量
  252. // defineExpose({
  253. // loadData,
  254. // });
  255. </script>