index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  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="merchantId">
  6. <el-select v-model="queryParams.merchantId" clearable @clear="()=>{queryParams.merchantId = null}"
  7. filterable remote reserve-keyword placeholder="请选择所属商户" @change="handleGetAppListByMerchantId"
  8. :remote-method="handleGetMerchantListByName" :loading="merchantLoading">
  9. <el-option v-for="item in merchantList" :key="item.id" :label="item.name" :value="item.id"/>
  10. </el-select>
  11. </el-form-item>
  12. <el-form-item label="应用编号" prop="appId">
  13. <el-select clearable v-model="queryParams.appId" filterable placeholder="请选择应用信息">
  14. <el-option v-for="item in appList" :key="item.id" :label="item.name" :value="item.id" />
  15. </el-select>
  16. </el-form-item>
  17. <el-form-item label="渠道编码" prop="channelCode">
  18. <el-select v-model="queryParams.channelCode" placeholder="请输入渠道编码" clearable
  19. @clear="()=>{queryParams.channelCode = null}">
  20. <el-option v-for="dict in payChannelCodeDictDatum" :key="dict.value" :label="dict.label" :value="dict.value"/>
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item label="商户订单编号" prop="merchantOrderId">
  24. <el-input v-model="queryParams.merchantOrderId" placeholder="请输入商户订单编号" clearable
  25. @keyup.enter.native="handleQuery"/>
  26. </el-form-item>
  27. <el-form-item label="渠道订单号" prop="channelOrderNo">
  28. <el-input v-model="queryParams.channelOrderNo" placeholder="请输入渠道订单号" clearable
  29. @keyup.enter.native="handleQuery"/>
  30. </el-form-item>
  31. <el-form-item label="支付状态" prop="status">
  32. <el-select v-model="queryParams.status" placeholder="请选择支付状态" clearable size="small">
  33. <el-option v-for="dict in payOrderDictDatum" :key="parseInt(dict.value)"
  34. :label="dict.label" :value="parseInt(dict.value)"/>
  35. </el-select>
  36. </el-form-item>
  37. <el-form-item label="退款状态" prop="refundStatus">
  38. <el-select v-model="queryParams.refundStatus" placeholder="请选择退款状态" clearable>
  39. <el-option v-for="dict in payOrderRefundDictDatum" :key="parseInt(dict.value)"
  40. :label="dict.label" :value="parseInt(dict.value)"/>
  41. </el-select>
  42. </el-form-item>
  43. <el-form-item label="回调商户状态" prop="notifyStatus">
  44. <el-select v-model="queryParams.notifyStatus" placeholder="请选择订单回调商户状态" clearable>
  45. <el-option v-for="dict in payOrderNotifyDictDatum" :key="parseInt(dict.value)"
  46. :label="dict.label" :value="parseInt(dict.value)"/>
  47. </el-select>
  48. </el-form-item>
  49. <el-form-item label="创建时间" prop="createTime">
  50. <el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
  51. range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
  52. </el-form-item>
  53. <el-form-item>
  54. <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
  55. <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
  56. </el-form-item>
  57. </el-form>
  58. <!-- 操作工具栏 -->
  59. <el-row :gutter="10" class="mb8">
  60. <el-col :span="1.5">
  61. <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
  62. v-hasPermi="['pay:order:export']">导出
  63. </el-button>
  64. </el-col>
  65. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  66. </el-row>
  67. <!-- 列表 -->
  68. <el-table v-loading="loading" :data="list">
  69. <el-table-column label="订单编号" align="center" prop="id" width="80"/>
  70. <!-- <el-table-column label="商户名称" align="center" prop="merchantName" width="120"/>-->
  71. <!-- <el-table-column label="应用名称" align="center" prop="appName" width="120"/>-->
  72. <el-table-column label="支付渠道" align="center" width="130">
  73. <template v-slot="scope">
  74. <el-popover trigger="hover" placement="top">
  75. <p>商户名称: {{ scope.row.merchantName }}</p>
  76. <p>应用名称: {{ scope.row.appName }}</p>
  77. <p>渠道名称: {{ scope.row.channelCodeName }}</p>
  78. <div slot="reference" class="name-wrapper">
  79. {{ scope.row.channelCodeName }}
  80. </div>
  81. </el-popover>
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="支付订单" align="left" width="280">
  85. <template v-slot="scope">
  86. <p class="order-font"><el-tag size="mini">商户</el-tag> {{scope.row.merchantOrderId}}</p>
  87. <p class="order-font"><el-tag size="mini" type="warning">支付</el-tag> {{scope.row.channelOrderNo}}</p>
  88. </template>
  89. </el-table-column>
  90. <!-- <el-table-column label="商户订单编号" align="center" prop="merchantOrderId" width="140"/>-->
  91. <!-- <el-table-column label="渠道订单号" align="center" prop="channelOrderNo" width="140"/>-->
  92. <el-table-column label="商品标题" align="center" prop="subject" width="180" :show-overflow-tooltip="true"/>
  93. <el-table-column label="支付金额" align="center" prop="amount" width="100">
  94. <template v-slot="scope">
  95. ¥{{ parseFloat(scope.row.amount / 100).toFixed(2) }}
  96. </template>
  97. </el-table-column>
  98. <el-table-column label="手续金额" align="center" prop="channelFeeAmount" width="100">
  99. <template v-slot="scope">
  100. ¥{{ parseFloat(scope.row.channelFeeAmount / 100).toFixed(2) }}
  101. </template>
  102. </el-table-column>
  103. <el-table-column label="退款金额" align="center" prop="refundAmount" width="100">
  104. <template v-slot="scope">
  105. ¥{{ parseFloat(scope.row.refundAmount / 100).toFixed(2) }}
  106. </template>
  107. </el-table-column>
  108. <el-table-column label="支付状态" align="center" prop="status">
  109. <template v-slot="scope">
  110. <dict-tag :type="DICT_TYPE.PAY_ORDER_STATUS" :value="scope.row.status" />
  111. </template>
  112. </el-table-column>
  113. <!-- <el-table-column label="退款状态" align="center" prop="refundStatus">-->
  114. <!-- <template v-slot="scope">-->
  115. <!-- <span>{{ getDictDataLabel(DICT_TYPE.PAY_ORDER_REFUND_STATUS, scope.row.refundStatus) }}</span>-->
  116. <!-- </template>-->
  117. <!-- </el-table-column>-->
  118. <el-table-column label="回调状态" align="center" prop="notifyStatus" width="100">
  119. <template v-slot="scope">
  120. <dict-tag :type="DICT_TYPE.PAY_ORDER_NOTIFY_STATUS" :value="scope.row.notifyStatus" />
  121. </template>
  122. </el-table-column>
  123. <el-table-column label="创建时间" align="center" prop="createTime" width="100">
  124. <template v-slot="scope">
  125. <span>{{ parseTime(scope.row.createTime) }}</span>
  126. </template>
  127. </el-table-column>
  128. <el-table-column label="支付时间" align="center" prop="successTime" width="100">
  129. <template v-slot="scope">
  130. <span>{{ parseTime(scope.row.successTime) }}</span>
  131. </template>
  132. </el-table-column>
  133. <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
  134. <template v-slot="scope">
  135. <el-button size="mini" type="text" icon="el-icon-search" @click="handleQueryDetails(scope.row)"
  136. v-hasPermi="['pay:order:query']">查看详情
  137. </el-button>
  138. </template>
  139. </el-table-column>
  140. </el-table>
  141. <!-- 分页组件 -->
  142. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
  143. @pagination="getList"/>
  144. <!-- 对话框(添加 / 修改) -->
  145. <el-dialog title="订单详情" :visible.sync="open" width="50%">
  146. <el-descriptions :column="2" label-class-name="desc-label">
  147. <el-descriptions-item label="商户名称">{{ orderDetail.merchantName }}</el-descriptions-item>
  148. <el-descriptions-item label="应用名称">{{ orderDetail.appName }}</el-descriptions-item>
  149. <el-descriptions-item label="商品名称">{{ orderDetail.subject }}</el-descriptions-item>
  150. </el-descriptions>
  151. <el-divider></el-divider>
  152. <el-descriptions :column="2" label-class-name="desc-label">
  153. <el-descriptions-item label="商户订单号">
  154. <el-tag size="small">{{ orderDetail.merchantOrderId }}</el-tag>
  155. </el-descriptions-item>
  156. <el-descriptions-item label="渠道订单号">
  157. <el-tag class="tag-purple" size="small">{{ orderDetail.channelOrderNo }}</el-tag>
  158. </el-descriptions-item>
  159. <el-descriptions-item label="支付订单号">
  160. <el-tag v-if="orderDetail.payOrderExtension.no !== ''" class="tag-pink" size="small">
  161. {{ orderDetail.payOrderExtension.no }}
  162. </el-tag>
  163. </el-descriptions-item>
  164. <el-descriptions-item label="金额">
  165. <el-tag type="success" size="small">{{ parseFloat(orderDetail.amount / 100, 2) }}</el-tag>
  166. </el-descriptions-item>
  167. <el-descriptions-item label="手续费">
  168. <el-tag type="warning" size="small">{{ parseFloat(orderDetail.channelFeeAmount / 100, 2) }}</el-tag>
  169. </el-descriptions-item>
  170. <el-descriptions-item label="手续费比例">
  171. {{ parseFloat(orderDetail.channelFeeRate / 100, 2) }}%
  172. </el-descriptions-item>
  173. <el-descriptions-item label="支付状态">
  174. <dict-tag :type="DICT_TYPE.PAY_ORDER_STATUS" :value="orderDetail.status" />
  175. </el-descriptions-item>
  176. <el-descriptions-item label="回调状态">
  177. <dict-tag :type="DICT_TYPE.PAY_ORDER_NOTIFY_STATUS" :value="orderDetail.notifyStatus" />
  178. </el-descriptions-item>
  179. <el-descriptions-item label="回调地址">{{ orderDetail.notifyUrl }}</el-descriptions-item>
  180. <el-descriptions-item label="创建时间">{{ parseTime(orderDetail.createTime) }}</el-descriptions-item>
  181. <el-descriptions-item label="支付时间">{{ parseTime(orderDetail.successTime) }}</el-descriptions-item>
  182. <el-descriptions-item label="失效时间">{{ parseTime(orderDetail.expireTime) }}</el-descriptions-item>
  183. <el-descriptions-item label="通知时间">{{ parseTime(orderDetail.notifyTime) }}</el-descriptions-item>
  184. </el-descriptions>
  185. <el-divider></el-divider>
  186. <el-descriptions :column="2" label-class-name="desc-label">
  187. <el-descriptions-item label="支付渠道">{{ orderDetail.channelCodeName }}</el-descriptions-item>
  188. <el-descriptions-item label="支付IP">{{ orderDetail.userIp }}</el-descriptions-item>
  189. <el-descriptions-item label="退款状态">
  190. <dict-tag :type="DICT_TYPE.PAY_ORDER_REFUND_STATUS" :value="orderDetail.refundStatus" />
  191. </el-descriptions-item>
  192. <el-descriptions-item label="退款次数">{{ orderDetail.refundTimes }}</el-descriptions-item>
  193. <el-descriptions-item label="退款金额">
  194. <el-tag type="warning">
  195. {{ parseFloat(orderDetail.refundAmount / 100, 2) }}
  196. </el-tag>
  197. </el-descriptions-item>
  198. </el-descriptions>
  199. <el-divider></el-divider>
  200. <el-descriptions :column="1" label-class-name="desc-label" direction="vertical" border>
  201. <el-descriptions-item label="商品描述">
  202. {{ orderDetail.body }}
  203. </el-descriptions-item>
  204. <el-descriptions-item label="支付通道异步回调内容">
  205. {{ orderDetail.payOrderExtension.channelNotifyData }}
  206. </el-descriptions-item>
  207. </el-descriptions>
  208. </el-dialog>
  209. </div>
  210. </template>
  211. <script>
  212. import { getOrderDetail, getOrderPage, exportOrderExcel} from "@/api/pay/order";
  213. import {getMerchantListByName} from "@/api/pay/merchant";
  214. import {getAppListByMerchantId} from "@/api/pay/app";
  215. import {DICT_TYPE, getDictDatas} from "@/utils/dict";
  216. import { getNowDateTime} from "@/utils/ruoyi";
  217. const defaultOrderDetail = {
  218. merchantName: '',
  219. appName: '',
  220. channelCodeName: '',
  221. subject: '',
  222. merchantOrderId: null,
  223. channelOrderNo: '',
  224. body: '',
  225. amount: null,
  226. channelFeeRate: null,
  227. channelFeeAmount: null,
  228. userIp: '',
  229. status: null,
  230. notifyUrl: '',
  231. notifyStatus: null,
  232. refundStatus: null,
  233. refundTimes: '',
  234. refundAmount: null,
  235. createTime: '',
  236. successTime: '',
  237. notifyTime: '',
  238. expireTime: '',
  239. payOrderExtension: {
  240. channelNotifyData: '',
  241. no: ''
  242. }
  243. };
  244. export default {
  245. name: "PayOrder",
  246. components: {},
  247. data() {
  248. return {
  249. // 遮罩层
  250. loading: true,
  251. // 显示搜索条件
  252. showSearch: true,
  253. // 总条数
  254. total: 0,
  255. // 支付订单列表
  256. list: [],
  257. // 弹出层标题
  258. title: "",
  259. // 是否显示弹出层
  260. open: false,
  261. // 查询参数
  262. queryParams: {
  263. pageNo: 1,
  264. pageSize: 10,
  265. merchantId: null,
  266. appId: null,
  267. channelId: null,
  268. channelCode: null,
  269. merchantOrderId: null,
  270. subject: null,
  271. body: null,
  272. notifyUrl: null,
  273. notifyStatus: null,
  274. amount: null,
  275. channelFeeRate: null,
  276. channelFeeAmount: null,
  277. status: null,
  278. userIp: null,
  279. successExtensionId: null,
  280. refundStatus: null,
  281. refundTimes: null,
  282. refundAmount: null,
  283. channelUserId: null,
  284. channelOrderNo: null,
  285. expireTime: [],
  286. successTime: [],
  287. notifyTime: [],
  288. createTime: []
  289. },
  290. // 商户加载遮罩层
  291. merchantLoading: false,
  292. // 商户列表集合
  293. merchantList: null,
  294. // 支付应用列表集合
  295. appList: null,
  296. // 支付渠道编码字典数据集合
  297. payChannelCodeDictDatum: getDictDatas(DICT_TYPE.PAY_CHANNEL_CODE_TYPE),
  298. // 订单回调商户状态字典数据集合
  299. payOrderNotifyDictDatum: getDictDatas(DICT_TYPE.PAY_ORDER_NOTIFY_STATUS),
  300. // 订单状态字典数据集合
  301. payOrderDictDatum: getDictDatas(DICT_TYPE.PAY_ORDER_STATUS),
  302. // 订单退款状态字典数据集合
  303. payOrderRefundDictDatum: getDictDatas(DICT_TYPE.PAY_ORDER_REFUND_STATUS),
  304. orderDetail: JSON.parse(JSON.stringify(defaultOrderDetail)),
  305. };
  306. },
  307. created() {
  308. // 初始化默认时间
  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. getOrderPage(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.initTime();
  352. this.handleQuery();
  353. },
  354. /**
  355. * 查看订单详情
  356. */
  357. handleQueryDetails(row) {
  358. this.orderDetail = JSON.parse(JSON.stringify(defaultOrderDetail));
  359. getOrderDetail(row.id).then(response => {
  360. this.orderDetail = response.data;
  361. if (response.data.payOrderExtension === null) {
  362. this.orderDetail.payOrderExtension = Object.assign(defaultOrderDetail.payOrderExtension, {});
  363. }
  364. this.open = true;
  365. });
  366. },
  367. /** 导出按钮操作 */
  368. handleExport() {
  369. // 处理查询参数
  370. let params = {...this.queryParams};
  371. params.pageNo = undefined;
  372. params.pageSize = undefined;
  373. // 执行导出
  374. this.$modal.confirm('是否确认导出所有支付订单数据项?').then(function () {
  375. return exportOrderExcel(params);
  376. }).then(response => {
  377. this.$download.excel(response, '支付订单.xls');
  378. }).catch(() => {});
  379. },
  380. /**
  381. * 根据商户名称模糊匹配商户信息
  382. * @param name 商户名称
  383. */
  384. handleGetMerchantListByName(name) {
  385. getMerchantListByName(name).then(response => {
  386. this.merchantList = response.data;
  387. this.merchantLoading = false;
  388. });
  389. },
  390. /**
  391. * 根据商户 ID 查询支付应用信息
  392. */
  393. handleGetAppListByMerchantId() {
  394. this.queryParams.appId = null;
  395. getAppListByMerchantId(this.queryParams.merchantId).then(response => {
  396. this.appList = response.data;
  397. });
  398. }
  399. }
  400. };
  401. </script>
  402. <style>
  403. .desc-label {
  404. font-weight: bold;
  405. }
  406. .tag-purple {
  407. color: #722ed1;
  408. background: #f9f0ff;
  409. border-color: #d3adf7;
  410. }
  411. .tag-cyan {
  412. color: #13c2c2;
  413. background: #e6fffb;
  414. border-color: #87e8de;
  415. }
  416. .tag-pink {
  417. color: #eb2f96;
  418. background: #fff0f6;
  419. border-color: #ffadd2;
  420. }
  421. .order-font{
  422. font-size: 12px;
  423. padding: 2px 0;
  424. }
  425. </style>