index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. <template>
  2. <div class="app-container">
  3. <!-- 搜索工作栏 -->
  4. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
  5. <el-form-item label="应用编号" prop="appId">
  6. <el-select clearable v-model="queryParams.appId" filterable placeholder="请选择应用信息">
  7. <el-option v-for="item in appList" :key="item.id" :label="item.name" :value="item.id" />
  8. </el-select>
  9. </el-form-item>
  10. <el-form-item label="渠道编码" prop="channelCode">
  11. <el-select v-model="queryParams.channelCode" placeholder="请输入渠道编码" clearable
  12. @clear="()=>{queryParams.channelCode = null}">
  13. <el-option v-for="dict in payChannelCodeDictDatum" :key="dict.value" :label="dict.label" :value="dict.value"/>
  14. </el-select>
  15. </el-form-item>
  16. <el-form-item label="退款类型" prop="type">
  17. <el-select v-model="queryParams.type" placeholder="请选择退款类型" clearable>
  18. <el-option v-for="dict in payRefundOrderTypeDictDatum" :key="parseInt(dict.value)"
  19. :label="dict.label" :value="parseInt(dict.value)"/>
  20. </el-select>
  21. </el-form-item>
  22. <el-form-item label="商户退款订单号" prop="merchantRefundNo">
  23. <el-input v-model="queryParams.merchantRefundNo" placeholder="请输入商户退款订单号" clearable
  24. @keyup.enter.native="handleQuery"/>
  25. </el-form-item>
  26. <el-form-item label="退款状态" prop="status">
  27. <el-select v-model="queryParams.status" placeholder="请选择退款状态" clearable>
  28. <el-option v-for="dict in payRefundOrderDictDatum" :key="parseInt(dict.value)"
  29. :label="dict.label" :value="parseInt(dict.value)"/>
  30. </el-select>
  31. </el-form-item>
  32. <el-form-item label="退款回调状态" prop="notifyStatus">
  33. <el-select v-model="queryParams.notifyStatus" placeholder="请选择通知商户退款结果的回调状态" clearable>
  34. <el-option v-for="dict in payOrderNotifyDictDatum" :key="parseInt(dict.value)"
  35. :label="dict.label" :value="parseInt(dict.value)"/>
  36. </el-select>
  37. </el-form-item>
  38. <el-form-item label="创建时间" prop="createTime">
  39. <el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
  40. range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
  41. </el-form-item>
  42. <el-form-item>
  43. <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
  44. <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
  45. </el-form-item>
  46. </el-form>
  47. <!-- 操作工具栏 -->
  48. <el-row :gutter="10" class="mb8">
  49. <el-col :span="1.5">
  50. <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
  51. v-hasPermi="['pay:refund:export']">导出
  52. </el-button>
  53. </el-col>
  54. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  55. </el-row>
  56. <!-- 列表 -->
  57. <el-table v-loading="loading" :data="list">
  58. <el-table-column label="编号" align="center" prop="id"/>
  59. <el-table-column label="支付渠道" align="center" width="130">
  60. <template v-slot="scope">
  61. <el-popover trigger="hover" placement="top">
  62. <p>应用名称: {{ scope.row.appName }}</p>
  63. <p>渠道名称: {{ scope.row.channelCodeName }}</p>
  64. <div slot="reference" class="name-wrapper">
  65. {{ scope.row.channelCodeName }}
  66. </div>
  67. </el-popover>
  68. </template>
  69. </el-table-column>
  70. <!-- <el-table-column label="交易订单号" align="center" prop="tradeNo" width="140"/>-->
  71. <!-- <el-table-column label="商户订单编号" align="center" prop="merchantOrderId" width="140"/>-->
  72. <el-table-column label="商户订单号" align="left" width="230">
  73. <template v-slot="scope">
  74. <p class="order-font">
  75. <el-tag size="mini">退款</el-tag>
  76. {{ scope.row.merchantRefundNo }}
  77. </p>
  78. <p class="order-font">
  79. <el-tag type="success">交易</el-tag>
  80. {{ scope.row.merchantOrderId }}
  81. </p>
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="支付订单号" align="center" prop="merchantRefundNo" width="250">
  85. <template v-slot="scope">
  86. <p class="order-font">
  87. <el-tag size="mini">交易</el-tag>
  88. {{ scope.row.tradeNo }}
  89. </p>
  90. <p class="order-font">
  91. <el-tag size="mini" type="warning">渠道</el-tag>
  92. {{ scope.row.channelOrderNo }}
  93. </p>
  94. </template>
  95. </el-table-column>
  96. <el-table-column label="支付金额(元)" align="center" prop="payAmount" width="100">
  97. <template v-slot="scope" class="">
  98. ¥{{ parseFloat(scope.row.payAmount / 100).toFixed(2) }}
  99. </template>
  100. </el-table-column>
  101. <el-table-column label="退款金额(元)" align="center" prop="refundAmount" width="100">
  102. <template v-slot="scope">
  103. ¥{{ parseFloat(scope.row.refundAmount / 100).toFixed(2) }}
  104. </template>
  105. </el-table-column>
  106. <el-table-column label="退款类型" align="center" prop="type" width="80">
  107. <template v-slot="scope">
  108. <dict-tag :type="DICT_TYPE.PAY_REFUND_ORDER_TYPE" :value="scope.row.type" />
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="退款状态" align="center" prop="status">
  112. <template v-slot="scope">
  113. <dict-tag :type="DICT_TYPE.PAY_REFUND_ORDER_STATUS" :value="scope.row.status" />
  114. </template>
  115. </el-table-column>
  116. <el-table-column label="回调状态" align="center" prop="notifyStatus">
  117. <template v-slot="scope">
  118. <dict-tag :type="DICT_TYPE.PAY_ORDER_NOTIFY_STATUS" :value="scope.row.notifyStatus" />
  119. </template>
  120. </el-table-column>
  121. <el-table-column label="退款原因" align="center" prop="reason" width="140" :show-overflow-tooltip="true"/>
  122. <el-table-column label="创建时间" align="center" prop="createTime" width="100">
  123. <template v-slot="scope">
  124. <span>{{ parseTime(scope.row.createTime) }}</span>
  125. </template>
  126. </el-table-column>
  127. <el-table-column label="退款成功时间" align="center" prop="successTime" width="100">
  128. <template v-slot="scope">
  129. <span>{{ parseTime(scope.row.successTime) }}</span>
  130. </template>
  131. </el-table-column>
  132. <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
  133. <template v-slot="scope">
  134. <el-button size="mini" type="text" icon="el-icon-search" @click="handleQueryDetails(scope.row)"
  135. v-hasPermi="['pay:order:query']">查看详情
  136. </el-button>
  137. </template>
  138. </el-table-column>
  139. </el-table>
  140. <!-- 分页组件 -->
  141. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
  142. @pagination="getList"/>
  143. <!-- 对话框(添加 / 修改) -->
  144. <el-dialog title="退款订单详情" :visible.sync="open" width="700px" append-to-body>
  145. <el-descriptions :column="2" label-class-name="desc-label">
  146. <el-descriptions-item label="应用名称">{{ refundDetail.appName }}</el-descriptions-item>
  147. <el-descriptions-item label="商品名称">{{ refundDetail.subject }}</el-descriptions-item>
  148. </el-descriptions>
  149. <el-divider></el-divider>
  150. <el-descriptions :column="2" label-class-name="desc-label">
  151. <el-descriptions-item label="商户退款单号">
  152. <el-tag size="mini">{{ refundDetail.merchantRefundNo }}</el-tag>
  153. </el-descriptions-item>
  154. <el-descriptions-item label="商户订单号">{{ refundDetail.merchantOrderId }}</el-descriptions-item>
  155. <el-descriptions-item label="交易订单号">{{ refundDetail.tradeNo }}</el-descriptions-item>
  156. </el-descriptions>
  157. <el-divider></el-divider>
  158. <el-descriptions :column="2" label-class-name="desc-label">
  159. <el-descriptions-item label="支付金额">
  160. {{ parseFloat(refundDetail.payAmount / 100).toFixed(2) }}
  161. </el-descriptions-item>
  162. <el-descriptions-item label="退款金额" size="mini">
  163. <el-tag class="tag-purple" size="mini">{{ parseFloat(refundDetail.refundAmount / 100).toFixed(2) }}</el-tag>
  164. </el-descriptions-item>
  165. <el-descriptions-item label="退款类型">
  166. <template v-slot="scope">
  167. <dict-tag :type="DICT_TYPE.PAY_REFUND_ORDER_TYPE" :value="refundDetail.type" />
  168. </template>
  169. </el-descriptions-item>
  170. <el-descriptions-item label="退款状态">
  171. <dict-tag :type="DICT_TYPE.PAY_REFUND_ORDER_STATUS" :value="refundDetail.status" />
  172. </el-descriptions-item>
  173. <el-descriptions-item label="创建时间">{{ parseTime(refundDetail.createTime) }}</el-descriptions-item>
  174. <el-descriptions-item label="退款成功时间">{{ parseTime(refundDetail.successTime) }}</el-descriptions-item>
  175. <el-descriptions-item label="退款失效时间">{{ parseTime(refundDetail.expireTime) }}</el-descriptions-item>
  176. <el-descriptions-item label="更新时间">{{ parseTime(refundDetail.updateTime) }}</el-descriptions-item>
  177. </el-descriptions>
  178. <el-divider></el-divider>
  179. <el-descriptions :column="2" label-class-name="desc-label">
  180. <el-descriptions-item label="支付渠道">
  181. {{ refundDetail.channelCodeName }}
  182. </el-descriptions-item>
  183. <el-descriptions-item label="支付IP" size="mini">
  184. {{refundDetail.userIp}}
  185. </el-descriptions-item>
  186. <el-descriptions-item label="回调地址">{{ refundDetail.notifyUrl }}</el-descriptions-item>
  187. <el-descriptions-item label="回调状态">
  188. <dict-tag :type="DICT_TYPE.PAY_ORDER_NOTIFY_STATUS" :value="refundDetail.notifyStatus" />
  189. </el-descriptions-item>
  190. <el-descriptions-item label="回调时间">{{ parseTime(refundDetail.notifyTime) }}</el-descriptions-item>
  191. </el-descriptions>
  192. <el-divider></el-divider>
  193. <el-descriptions :column="2" label-class-name="desc-label">
  194. <el-descriptions-item label="渠道订单号">{{ refundDetail.channelOrderNo }}</el-descriptions-item>
  195. <el-descriptions-item label="渠道退款单号">{{ refundDetail.channelRefundNo }}</el-descriptions-item>
  196. <el-descriptions-item label="渠道错误码">{{refundDetail.channelErrorCode}}</el-descriptions-item>
  197. <el-descriptions-item label="渠道错误码描述">{{refundDetail.channelErrorMsg}}</el-descriptions-item>
  198. </el-descriptions>
  199. <br>
  200. <el-descriptions :column="1" label-class-name="desc-label" direction="vertical" border>
  201. <el-descriptions-item label="渠道额外参数">{{ refundDetail.channelExtras }}</el-descriptions-item>
  202. <el-descriptions-item label="退款原因">{{ refundDetail.reason }}</el-descriptions-item>
  203. </el-descriptions>
  204. </el-dialog>
  205. </div>
  206. </template>
  207. <script>
  208. import {getRefundPage, exportRefundExcel, getRefund} from "@/api/pay/refund";
  209. import { DICT_TYPE, getDictDatas } from "@/utils/dict";
  210. import { PayOrderRefundStatusEnum, PayRefundStatusEnum } from "@/utils/constants";
  211. import { getNowDateTime } from "@/utils/ruoyi";
  212. const defaultRefundDetail = {
  213. id: null,
  214. appId: null,
  215. appName: '',
  216. channelCode: '',
  217. channelCodeName: '',
  218. channelErrorCode: '',
  219. channelErrorMsg: '',
  220. channelExtras: '',
  221. channelId: null,
  222. channelOrderNo: '',
  223. channelRefundNo: '',
  224. createTime: null,
  225. expireTime: null,
  226. merchantOrderId: '',
  227. merchantRefundNo: '',
  228. notifyStatus: null,
  229. notifyTime: null,
  230. notifyUrl: '',
  231. orderId: null,
  232. payAmount: null,
  233. reason: '',
  234. refundAmount: null,
  235. status: null,
  236. subject: '',
  237. successTime: null,
  238. tradeNo: '',
  239. type: null,
  240. userIp: ''
  241. }
  242. export default {
  243. name: "PayRefund",
  244. components: {},
  245. data() {
  246. return {
  247. // 遮罩层
  248. loading: true,
  249. // 显示搜索条件
  250. showSearch: true,
  251. // 总条数
  252. total: 0,
  253. // 退款订单列表
  254. list: [],
  255. // 弹出层标题
  256. title: "",
  257. // 是否显示弹出层
  258. open: false,
  259. // 查询参数
  260. queryParams: {
  261. pageNo: 1,
  262. pageSize: 10,
  263. appId: null,
  264. channelId: null,
  265. channelCode: null,
  266. orderId: null,
  267. tradeNo: null,
  268. merchantOrderId: null,
  269. merchantRefundNo: null,
  270. notifyUrl: null,
  271. notifyStatus: null,
  272. status: null,
  273. type: null,
  274. payAmount: null,
  275. refundAmount: null,
  276. reason: null,
  277. userIp: null,
  278. channelOrderNo: null,
  279. channelRefundNo: null,
  280. channelErrorCode: null,
  281. channelErrorMsg: null,
  282. channelExtras: null,
  283. expireTime: [],
  284. successTime: [],
  285. notifyTime: [],
  286. createTime: []
  287. },
  288. // 商户加载遮罩层
  289. merchantLoading: false,
  290. // 商户列表集合
  291. merchantList: null,
  292. // 支付应用列表集合
  293. appList: null,
  294. // 支付渠道编码字典数据集合
  295. payChannelCodeDictDatum: getDictDatas(DICT_TYPE.PAY_CHANNEL_CODE_TYPE),
  296. // 订单退款状态字典数据集合
  297. payRefundOrderDictDatum: getDictDatas(DICT_TYPE.PAY_REFUND_ORDER_STATUS),
  298. // 退款订单类别字典数据集合
  299. payRefundOrderTypeDictDatum: getDictDatas(DICT_TYPE.PAY_REFUND_ORDER_TYPE),
  300. // 订单回调商户状态字典数据集合
  301. payOrderNotifyDictDatum: getDictDatas(DICT_TYPE.PAY_ORDER_NOTIFY_STATUS),
  302. // el-tag订单退款状态type值
  303. refundStatusType: '',
  304. // 退款订单详情
  305. refundDetail: JSON.parse(JSON.stringify(defaultRefundDetail)),
  306. };
  307. },
  308. created() {
  309. this.initTime();
  310. this.getList();
  311. this.handleGetMerchantListByName(null);
  312. },
  313. methods: {
  314. initTime(){
  315. this.queryParams.createTime = [getNowDateTime("00:00:00"), getNowDateTime("23:59:59")];
  316. },
  317. /** 查询列表 */
  318. getList() {
  319. // 判断选择的日期是否超过了一个月
  320. let oneMonthTime = 31 * 24 * 3600 * 1000;
  321. if (this.queryParams.createTime == null){
  322. this.initTime();
  323. } else {
  324. let minDateTime = new Date(this.queryParams.createTime[0]).getTime();
  325. let maxDateTime = new Date(this.queryParams.createTime[1]).getTime()
  326. if (maxDateTime - minDateTime > oneMonthTime) {
  327. this.$message.error('时间范围最大为 31 天!');
  328. return false;
  329. }
  330. }
  331. this.loading = true;
  332. // 执行查询
  333. getRefundPage(this.queryParams).then(response => {
  334. this.list = response.data.list;
  335. this.total = response.data.total;
  336. this.loading = false;
  337. });
  338. },
  339. /** 取消按钮 */
  340. cancel() {
  341. this.open = false;
  342. },
  343. /** 搜索按钮操作 */
  344. handleQuery() {
  345. this.queryParams.pageNo = 1;
  346. this.getList();
  347. },
  348. /** 重置按钮操作 */
  349. resetQuery() {
  350. this.resetForm("queryForm");
  351. this.handleQuery();
  352. },
  353. /** 导出按钮操作 */
  354. handleExport() {
  355. // 处理查询参数
  356. let params = {...this.queryParams};
  357. params.pageNo = undefined;
  358. params.pageSize = undefined;
  359. // 执行导出
  360. this.$modal.confirm('是否确认导出所有退款订单数据项?').then(function () {
  361. return exportRefundExcel(params);
  362. }).then(response => {
  363. this.$download.excel(response, '退款订单.xls');
  364. }).catch(() => {});
  365. },
  366. /**
  367. * 根据商户名称模糊匹配商户信息
  368. * @param name 商户名称
  369. */
  370. handleGetMerchantListByName(name) {
  371. getMerchantListByName(name).then(response => {
  372. this.merchantList = response.data;
  373. this.merchantLoading = false;
  374. });
  375. },
  376. /**
  377. * 根据退款类别得到样式名称
  378. * @param refundType 退款类别
  379. */
  380. findByRefundTypeGetStyle(refundType) {
  381. switch (refundType) {
  382. case PayOrderRefundStatusEnum.NO.status:
  383. return "success";
  384. case PayOrderRefundStatusEnum.SOME.status:
  385. return "warning";
  386. case PayOrderRefundStatusEnum.ALL.status:
  387. return "danger";
  388. }
  389. },
  390. /**
  391. * 根据退款状态得到样式名称
  392. * @param refundStatus 退款状态
  393. */
  394. findByRefundStatusGetStyle(refundStatus) {
  395. switch (refundStatus) {
  396. case PayRefundStatusEnum.CREATE.status:
  397. return "info";
  398. case PayRefundStatusEnum.SUCCESS.status:
  399. return "success";
  400. case PayRefundStatusEnum.FAILURE.status:
  401. case PayRefundStatusEnum.CLOSE.status:
  402. return "danger";
  403. case PayRefundStatusEnum.PROCESSING_NOTIFY.status:
  404. case PayRefundStatusEnum.PROCESSING_QUERY.status:
  405. case PayRefundStatusEnum.UNKNOWN_RETRY.status:
  406. case PayRefundStatusEnum.UNKNOWN_QUERY.status:
  407. return "warning";
  408. }
  409. },
  410. /**
  411. * 查看订单详情
  412. */
  413. handleQueryDetails(row) {
  414. this.refundDetail = JSON.parse(JSON.stringify(defaultRefundDetail));
  415. getRefund(row.id).then(response => {
  416. this.refundDetail = response.data;
  417. this.open = true;
  418. });
  419. },
  420. }
  421. };
  422. </script>
  423. <style>
  424. .desc-label {
  425. font-weight: bold;
  426. }
  427. .tag-purple {
  428. color: #722ed1;
  429. background: #f9f0ff;
  430. border-color: #d3adf7;
  431. }
  432. .tag-cyan {
  433. color: #13c2c2;
  434. background: #e6fffb;
  435. border-color: #87e8de;
  436. }
  437. .tag-pink {
  438. color: #eb2f96;
  439. background: #fff0f6;
  440. border-color: #ffadd2;
  441. }
  442. .order-font {
  443. font-size: 12px;
  444. padding: 2px 0;
  445. }
  446. </style>