pay:前端收银台的信息接入

This commit is contained in:
YunaiV 2023-02-13 23:59:03 +08:00
parent ecbeba5da0
commit 84e9c0bba0
7 changed files with 72 additions and 35 deletions

View File

@ -46,7 +46,7 @@ import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.E
public class PayOrderController { public class PayOrderController {
@Resource @Resource
private PayOrderService orderService; private PayOrderService payOrderService;
@Resource @Resource
private PayOrderExtensionService orderExtensionService; private PayOrderExtensionService orderExtensionService;
@Resource @Resource
@ -58,8 +58,17 @@ public class PayOrderController {
@Operation(summary = "获得支付订单") @Operation(summary = "获得支付订单")
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('pay:order:query')") @PreAuthorize("@ss.hasPermission('pay:order:query')")
public CommonResult<PayOrderDetailsRespVO> getOrder(@RequestParam("id") Long id) { public CommonResult<PayOrderRespVO> getOrder(@RequestParam("id") Long id) {
PayOrderDO order = orderService.getOrder(id); return success(PayOrderConvert.INSTANCE.convert(payOrderService.getOrder(id)));
}
// TODO 芋艿看看怎么优化下
@GetMapping("/get-detail")
@Operation(summary = "获得支付订单详情")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('pay:order:query')")
public CommonResult<PayOrderDetailsRespVO> getOrderDetail(@RequestParam("id") Long id) {
PayOrderDO order = payOrderService.getOrder(id);
if (ObjectUtil.isNull(order)) { if (ObjectUtil.isNull(order)) {
return success(new PayOrderDetailsRespVO()); return success(new PayOrderDetailsRespVO());
} }
@ -86,7 +95,7 @@ public class PayOrderController {
@Operation(summary = "获得支付订单分页") @Operation(summary = "获得支付订单分页")
@PreAuthorize("@ss.hasPermission('pay:order:query')") @PreAuthorize("@ss.hasPermission('pay:order:query')")
public CommonResult<PageResult<PayOrderPageItemRespVO>> getOrderPage(@Valid PayOrderPageReqVO pageVO) { public CommonResult<PageResult<PayOrderPageItemRespVO>> getOrderPage(@Valid PayOrderPageReqVO pageVO) {
PageResult<PayOrderDO> pageResult = orderService.getOrderPage(pageVO); PageResult<PayOrderDO> pageResult = payOrderService.getOrderPage(pageVO);
if (CollectionUtil.isEmpty(pageResult.getList())) { if (CollectionUtil.isEmpty(pageResult.getList())) {
return success(new PageResult<>(pageResult.getTotal())); return success(new PageResult<>(pageResult.getTotal()));
} }
@ -120,7 +129,7 @@ public class PayOrderController {
public void exportOrderExcel(@Valid PayOrderExportReqVO exportReqVO, public void exportOrderExcel(@Valid PayOrderExportReqVO exportReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
List<PayOrderDO> list = orderService.getOrderList(exportReqVO); List<PayOrderDO> list = payOrderService.getOrderList(exportReqVO);
if (CollectionUtil.isEmpty(list)) { if (CollectionUtil.isEmpty(list)) {
ExcelUtils.write(response, "支付订单.xls", "数据", ExcelUtils.write(response, "支付订单.xls", "数据",
PayOrderExcelVO.class, new ArrayList<>()); PayOrderExcelVO.class, new ArrayList<>());

View File

@ -34,6 +34,14 @@ export function getOrder(id) {
}) })
} }
// 获得支付订单的明细
export function getOrderDetail(id) {
return request({
url: '/pay/order/get-detail?id=' + id,
method: 'get'
})
}
// 获得支付订单分页 // 获得支付订单分页
export function getOrderPage(query) { export function getOrderPage(query) {
return request({ return request({

View File

@ -228,9 +228,12 @@ export const constantRoutes = [
hidden: true, hidden: true,
children: [{ children: [{
path: 'order/submit', path: 'order/submit',
name: '收银台', name: 'PayOrderSubmit',
hidden: true, hidden: true,
meta: { title: '收银台' }, meta: {
title: '收银台',
noCache: true
},
component: (resolve) => require(['@/views/pay/order/submit'], resolve) component: (resolve) => require(['@/views/pay/order/submit'], resolve)
}] }]
} }

View File

@ -172,7 +172,7 @@ export const PayOrderStatusEnum = {
}, },
CLOSED: { CLOSED: {
status: 20, status: 20,
name: '支付' name: '支付关闭'
} }
} }

View File

@ -47,7 +47,7 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope"> <template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handlePay(scope.row)" <el-button size="mini" type="text" icon="el-icon-edit" @click="handlePay(scope.row)"
v-if="!scope.row.payed">支付</el-button> v-if="!scope.row.payed">前往支付</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -187,15 +187,14 @@ export default {
}); });
}); });
}, },
/** 删除按钮操作 */ /** 支付按钮操作 */
handleDelete(row) { handlePay(row) {
const id = row.id; this.$router.push({
this.$modal.confirm('是否确认删除示例订单编号为"' + id + '"的数据项?').then(function() { name: 'PayOrderSubmit',
return deleteDemoOrder(id); query:{
}).then(() => { id: row.payOrderId
this.getList(); }
this.$modal.msgSuccess("删除成功"); })
}).catch(() => {});
} }
} }
}; };

View File

@ -215,7 +215,7 @@
</template> </template>
<script> <script>
import {getOrder, getOrderPage, exportOrderExcel} from "@/api/pay/order"; import { getOrderDetail, getOrderPage, exportOrderExcel} from "@/api/pay/order";
import {getMerchantListByName} from "@/api/pay/merchant"; import {getMerchantListByName} from "@/api/pay/merchant";
import {getAppListByMerchantId} from "@/api/pay/app"; import {getAppListByMerchantId} from "@/api/pay/app";
import {DICT_TYPE, getDictDatas} from "@/utils/dict"; import {DICT_TYPE, getDictDatas} from "@/utils/dict";
@ -250,7 +250,7 @@ const defaultOrderDetail = {
}; };
export default { export default {
name: "Order", name: "PayOrder",
components: {}, components: {},
data() { data() {
return { return {
@ -364,7 +364,7 @@ export default {
*/ */
handleQueryDetails(row) { handleQueryDetails(row) {
this.orderDetail = JSON.parse(JSON.stringify(defaultOrderDetail)); this.orderDetail = JSON.parse(JSON.stringify(defaultOrderDetail));
getOrder(row.id).then(response => { getOrderDetail(row.id).then(response => {
this.orderDetail = response.data; this.orderDetail = response.data;
if (response.data.payOrderExtension === null) { if (response.data.payOrderExtension === null) {
this.orderDetail.payOrderExtension = Object.assign(defaultOrderDetail.payOrderExtension, {}); this.orderDetail.payOrderExtension = Object.assign(defaultOrderDetail.payOrderExtension, {});

View File

@ -3,12 +3,12 @@
<!-- 支付信息 --> <!-- 支付信息 -->
<el-card v-loading="loading"> <el-card v-loading="loading">
<el-descriptions title="支付信息" :column="3" border> <el-descriptions title="支付信息" :column="3" border>
<el-descriptions-item label="支付单号">kooriookami</el-descriptions-item> <el-descriptions-item label="支付单号">{{ payOrder.id }}</el-descriptions-item>
<el-descriptions-item label="商品标题">苏州市</el-descriptions-item> <el-descriptions-item label="商品标题">{{ payOrder.subject }}</el-descriptions-item>
<el-descriptions-item label="商品内容">苏州市</el-descriptions-item> <el-descriptions-item label="商品内容">{{ payOrder.body }}</el-descriptions-item>
<el-descriptions-item label="支付金额">18100000000</el-descriptions-item> <el-descriptions-item label="支付金额">{{ (payOrder.amount / 100.0).toFixed(2) }}</el-descriptions-item>
<el-descriptions-item label="创建时间">苏州市</el-descriptions-item> <el-descriptions-item label="创建时间">{{ parseTime(payOrder.createTime) }}</el-descriptions-item>
<el-descriptions-item label="过期时间">苏州市</el-descriptions-item> <el-descriptions-item label="过期时间">{{ parseTime(payOrder.expireTime) }}</el-descriptions-item>
</el-descriptions> </el-descriptions>
</el-card> </el-card>
@ -43,7 +43,9 @@
</div> </div>
</template> </template>
<script> <script>
import {DICT_TYPE, getDictDatas} from "@/utils/dict"; import { DICT_TYPE, getDictDatas } from "@/utils/dict";
import { getOrder } from '@/api/pay/order';
import { PayOrderStatusEnum } from "@/utils/constants";
export default { export default {
name: "PayOrderSubmit", name: "PayOrderSubmit",
@ -71,11 +73,7 @@ export default {
}, },
created() { created() {
this.id = this.$route.query.id; this.id = this.$route.query.id;
// if (!this.id) { this.getDetail();
// this.$message.error(' id OA ');
// return;
// }
// this.getDetail();
this.initPayChannels(); this.initPayChannels();
}, },
methods: { methods: {
@ -98,8 +96,28 @@ export default {
}, },
/** 获得请假信息 */ /** 获得请假信息 */
getDetail() { getDetail() {
getLeave(this.id).then(response => { // 1.1
this.form = response.data; if (!this.id) {
this.$message.error('未传递支付单号,无法查看对应的支付信息');
this.$router.go(-1);
return;
}
getOrder(this.id).then(response => {
// 1.2
if (!response.data) {
this.$message.error('支付订单不存在,请检查!');
this.$router.go(-1);
return;
}
// 1.3
if (response.data.status !== PayOrderStatusEnum.WAITING.status) {
this.$message.error('支付订单不处于待支付状态,请检查!');
this.$router.go(-1);
return;
}
// 2.
this.payOrder = response.data;
}); });
}, },
} }