index.vue 16 KB

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