index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. <template>
  2. <!-- 搜索工作栏 -->
  3. <ContentWrap>
  4. <el-form
  5. class="-mb-15px"
  6. :model="queryParams"
  7. ref="queryFormRef"
  8. :inline="true"
  9. label-width="120px"
  10. >
  11. <el-form-item label="所属商户" prop="merchantId">
  12. <el-select
  13. v-model="queryParams.merchantId"
  14. clearable
  15. placeholder="请选择所属商户"
  16. class="!w-240px"
  17. >
  18. <el-option
  19. v-for="item in merchantList"
  20. :key="item.id"
  21. :label="item.name"
  22. :value="item.id"
  23. />
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item label="应用编号" prop="appId">
  27. <el-select
  28. v-model="queryParams.appId"
  29. clearable
  30. placeholder="请选择应用信息"
  31. class="!w-240px"
  32. >
  33. <el-option v-for="item in appList" :key="item.id" :label="item.name" :value="item.id" />
  34. </el-select>
  35. </el-form-item>
  36. <el-form-item label="渠道编码" prop="channelCode">
  37. <el-select
  38. v-model="queryParams.channelCode"
  39. placeholder="请输入渠道编码"
  40. clearable
  41. class="!w-240px"
  42. >
  43. <el-option
  44. v-for="dict in getStrDictOptions(DICT_TYPE.PAY_CHANNEL_CODE_TYPE)"
  45. :key="dict.value"
  46. :label="dict.label"
  47. :value="dict.value"
  48. />
  49. </el-select>
  50. </el-form-item>
  51. <el-form-item label="退款类型" prop="type">
  52. <el-select
  53. v-model="queryParams.type"
  54. placeholder="请选择退款类型"
  55. clearable
  56. class="!w-240px"
  57. >
  58. <el-option
  59. v-for="dict in getIntDictOptions(DICT_TYPE.PAY_REFUND_ORDER_TYPE)"
  60. :key="dict.value"
  61. :label="dict.label"
  62. :value="dict.value"
  63. />
  64. </el-select>
  65. </el-form-item>
  66. <el-form-item label="商户退款订单号" prop="merchantRefundNo">
  67. <el-input
  68. v-model="queryParams.merchantRefundNo"
  69. placeholder="请输入商户退款订单号"
  70. clearable
  71. @keyup.enter="handleQuery"
  72. class="!w-240px"
  73. />
  74. </el-form-item>
  75. <el-form-item label="退款状态" prop="status">
  76. <el-select
  77. v-model="queryParams.status"
  78. placeholder="请选择退款状态"
  79. clearable
  80. class="!w-240px"
  81. >
  82. <el-option
  83. v-for="dict in getIntDictOptions(DICT_TYPE.PAY_REFUND_ORDER_STATUS)"
  84. :key="dict.value"
  85. :label="dict.label"
  86. :value="dict.value"
  87. />
  88. </el-select>
  89. </el-form-item>
  90. <el-form-item label="退款回调状态" prop="notifyStatus">
  91. <el-select
  92. v-model="queryParams.notifyStatus"
  93. placeholder="请选择通知商户退款结果的回调状态"
  94. clearable
  95. class="!w-240px"
  96. >
  97. <el-option
  98. v-for="dict in getIntDictOptions(DICT_TYPE.PAY_ORDER_NOTIFY_STATUS)"
  99. :key="dict.value"
  100. :label="dict.label"
  101. :value="dict.value"
  102. />
  103. </el-select>
  104. </el-form-item>
  105. <el-form-item label="创建时间" prop="createTime">
  106. <el-date-picker
  107. v-model="queryParams.createTime"
  108. value-format="YYYY-MM-DD HH:mm:ss"
  109. type="daterange"
  110. start-placeholder="开始日期"
  111. end-placeholder="结束日期"
  112. :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
  113. class="!w-240px"
  114. />
  115. </el-form-item>
  116. <el-form-item>
  117. <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
  118. <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
  119. <el-button
  120. type="success"
  121. plain
  122. @click="handleExport"
  123. :loading="exportLoading"
  124. v-hasPermi="['system:tenant:export']"
  125. >
  126. <Icon icon="ep:download" class="mr-5px" /> 导出
  127. </el-button>
  128. </el-form-item>
  129. </el-form>
  130. </ContentWrap>
  131. <ContentWrap>
  132. <el-table v-loading="loading" :data="list">
  133. <el-table-column label="编号" align="center" prop="id" />
  134. <el-table-column label="商户名称" align="center" prop="merchantName" width="120" />
  135. <el-table-column label="应用名称" align="center" prop="appName" width="120" />
  136. <el-table-column label="渠道名称" align="center" prop="channelCodeName" width="120" />
  137. <el-table-column label="交易订单号" align="center" prop="tradeNo" width="140" />
  138. <el-table-column label="商户订单编号" align="center" prop="merchantOrderId" width="140" />
  139. <el-table-column label="商户订单号" align="left" width="230">
  140. <template #default="scope">
  141. <p class="order-font">
  142. <el-tag>退款</el-tag>
  143. {{ scope.row.merchantRefundNo }}
  144. </p>
  145. <p class="order-font">
  146. <el-tag type="success">交易</el-tag>
  147. {{ scope.row.merchantOrderId }}
  148. </p>
  149. </template>
  150. </el-table-column>
  151. <el-table-column label="支付订单号" align="center" prop="merchantRefundNo" width="250">
  152. <template #default="scope">
  153. <p class="order-font">
  154. <el-tag>交易</el-tag>
  155. {{ scope.row.tradeNo }}
  156. </p>
  157. <p class="order-font">
  158. <el-tag type="warning">渠道</el-tag>
  159. {{ scope.row.channelOrderNo }}
  160. </p>
  161. </template>
  162. </el-table-column>
  163. <el-table-column label="支付金额(元)" align="center" prop="payAmount" width="100">
  164. <template #default="scope">
  165. ¥{{ parseFloat(scope.row.payAmount / 100).toFixed(2) }}
  166. </template>
  167. </el-table-column>
  168. <el-table-column label="退款金额(元)" align="center" prop="refundAmount" width="100">
  169. <template #default="scope">
  170. ¥{{ parseFloat(scope.row.refundAmount / 100).toFixed(2) }}
  171. </template>
  172. </el-table-column>
  173. <el-table-column label="退款类型" align="center" prop="type" width="80">
  174. <template #default="scope">
  175. <dict-tag :type="DICT_TYPE.PAY_REFUND_ORDER_TYPE" :value="scope.row.type" />
  176. </template>
  177. </el-table-column>
  178. <el-table-column label="退款状态" align="center" prop="status">
  179. <template #default="scope">
  180. <dict-tag :type="DICT_TYPE.PAY_REFUND_ORDER_STATUS" :value="scope.row.status" />
  181. </template>
  182. </el-table-column>
  183. <el-table-column label="回调状态" align="center" prop="notifyStatus">
  184. <template #default="scope">
  185. <dict-tag :type="DICT_TYPE.PAY_ORDER_NOTIFY_STATUS" :value="scope.row.notifyStatus" />
  186. </template>
  187. </el-table-column>
  188. <el-table-column
  189. label="退款原因"
  190. align="center"
  191. prop="reason"
  192. width="140"
  193. :show-overflow-tooltip="true"
  194. />
  195. <el-table-column
  196. label="创建时间"
  197. align="center"
  198. prop="createTime"
  199. width="180"
  200. :formatter="dateFormatter"
  201. />
  202. <el-table-column
  203. label="退款成功时间"
  204. align="center"
  205. prop="successTime"
  206. width="180"
  207. :formatter="dateFormatter"
  208. />
  209. <el-table-column label="操作" align="center" fixed="right">
  210. <template #default="scope">
  211. <el-button
  212. type="primary"
  213. link
  214. @click="openDetail(scope.row.id)"
  215. v-hasPermi="['pay:order:query']"
  216. >
  217. 详情
  218. </el-button>
  219. </template>
  220. </el-table-column>
  221. </el-table>
  222. <!-- 分页 -->
  223. <Pagination
  224. :total="total"
  225. v-model:page="queryParams.pageNo"
  226. v-model:limit="queryParams.pageSize"
  227. @pagination="getList"
  228. />
  229. </ContentWrap>
  230. <!-- 表单弹窗:预览 -->
  231. <RefundDetail ref="detailRef" @success="getList" />
  232. </template>
  233. <script lang="ts" setup>
  234. import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
  235. import { dateFormatter } from '@/utils/formatTime'
  236. // import * as MerchantApi from '@/api/pay/merchant'
  237. import * as RefundApi from '@/api/pay/refund'
  238. import RefundDetail from './RefundDetail.vue'
  239. import download from '@/utils/download'
  240. defineOptions({ name: 'PayRefund' })
  241. const message = useMessage() // 消息弹窗
  242. const loading = ref(false) // 列表遮罩层
  243. const total = ref(0) // 列表的总页数
  244. const list = ref([]) // 列表的数据
  245. const queryParams = reactive({
  246. pageNo: 1,
  247. pageSize: 10,
  248. merchantId: undefined,
  249. appId: undefined,
  250. channelId: undefined,
  251. channelCode: undefined,
  252. orderId: undefined,
  253. tradeNo: undefined,
  254. merchantOrderId: undefined,
  255. merchantRefundNo: undefined,
  256. notifyUrl: undefined,
  257. notifyStatus: undefined,
  258. status: undefined,
  259. type: undefined,
  260. payAmount: undefined,
  261. refundAmount: undefined,
  262. reason: undefined,
  263. userIp: undefined,
  264. channelOrderNo: undefined,
  265. channelRefundNo: undefined,
  266. channelErrorCode: undefined,
  267. channelErrorMsg: undefined,
  268. channelExtras: undefined,
  269. expireTime: [],
  270. successTime: [],
  271. notifyTime: [],
  272. createTime: []
  273. })
  274. const queryFormRef = ref() // 搜索的表单
  275. const exportLoading = ref(false) // 导出等待
  276. const appList = ref([]) // 支付应用列表集合
  277. const merchantList = ref([]) // 商户列表
  278. /** 搜索按钮操作 */
  279. const handleQuery = () => {
  280. queryParams.pageNo = 1
  281. getList()
  282. }
  283. /** 查询列表 */
  284. const getList = async () => {
  285. loading.value = true
  286. try {
  287. const data = await RefundApi.getRefundPage(queryParams)
  288. list.value = data.list
  289. total.value = data.total
  290. } finally {
  291. loading.value = false
  292. }
  293. }
  294. /** 重置按钮操作 */
  295. const resetQuery = () => {
  296. queryFormRef.value.resetFields()
  297. handleQuery()
  298. }
  299. /** 导出按钮操作 */
  300. const handleExport = async () => {
  301. try {
  302. // 导出的二次确认
  303. await message.exportConfirm()
  304. // 发起导出
  305. exportLoading.value = true
  306. const data = await RefundApi.exportRefund(queryParams)
  307. download.excel(data, '支付订单.xls')
  308. } catch {
  309. } finally {
  310. exportLoading.value = false
  311. }
  312. }
  313. /** 预览详情 */
  314. const detailRef = ref()
  315. const openDetail = (id: number) => {
  316. detailRef.value.open(id)
  317. }
  318. /** 初始化 **/
  319. onMounted(async () => {
  320. await getList()
  321. // 加载商户列表
  322. // merchantList.value = await MerchantApi.getMerchantListByName()
  323. // TODO 芋艿:候选少一个查询应用列表的接口
  324. // appList.value = await AppApi.getAppListByMerchantId()
  325. })
  326. </script>
  327. <style>
  328. .order-font {
  329. padding: 2px 0;
  330. font-size: 12px;
  331. }
  332. </style>