Commit 84e9c0bba0403095e4c3118c3d34189c23b4f1b3
1 parent
ecbeba5d
pay:前端收银台的信息接入
Showing
7 changed files
with
72 additions
and
35 deletions
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/PayOrderController.java
| @@ -46,7 +46,7 @@ import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.E | @@ -46,7 +46,7 @@ import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.E | ||
| 46 | public class PayOrderController { | 46 | public class PayOrderController { |
| 47 | 47 | ||
| 48 | @Resource | 48 | @Resource |
| 49 | - private PayOrderService orderService; | 49 | + private PayOrderService payOrderService; |
| 50 | @Resource | 50 | @Resource |
| 51 | private PayOrderExtensionService orderExtensionService; | 51 | private PayOrderExtensionService orderExtensionService; |
| 52 | @Resource | 52 | @Resource |
| @@ -58,8 +58,17 @@ public class PayOrderController { | @@ -58,8 +58,17 @@ public class PayOrderController { | ||
| 58 | @Operation(summary = "获得支付订单") | 58 | @Operation(summary = "获得支付订单") |
| 59 | @Parameter(name = "id", description = "编号", required = true, example = "1024") | 59 | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| 60 | @PreAuthorize("@ss.hasPermission('pay:order:query')") | 60 | @PreAuthorize("@ss.hasPermission('pay:order:query')") |
| 61 | - public CommonResult<PayOrderDetailsRespVO> getOrder(@RequestParam("id") Long id) { | ||
| 62 | - PayOrderDO order = orderService.getOrder(id); | 61 | + public CommonResult<PayOrderRespVO> getOrder(@RequestParam("id") Long id) { |
| 62 | + return success(PayOrderConvert.INSTANCE.convert(payOrderService.getOrder(id))); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + // TODO 芋艿:看看怎么优化下; | ||
| 66 | + @GetMapping("/get-detail") | ||
| 67 | + @Operation(summary = "获得支付订单详情") | ||
| 68 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 69 | + @PreAuthorize("@ss.hasPermission('pay:order:query')") | ||
| 70 | + public CommonResult<PayOrderDetailsRespVO> getOrderDetail(@RequestParam("id") Long id) { | ||
| 71 | + PayOrderDO order = payOrderService.getOrder(id); | ||
| 63 | if (ObjectUtil.isNull(order)) { | 72 | if (ObjectUtil.isNull(order)) { |
| 64 | return success(new PayOrderDetailsRespVO()); | 73 | return success(new PayOrderDetailsRespVO()); |
| 65 | } | 74 | } |
| @@ -86,7 +95,7 @@ public class PayOrderController { | @@ -86,7 +95,7 @@ public class PayOrderController { | ||
| 86 | @Operation(summary = "获得支付订单分页") | 95 | @Operation(summary = "获得支付订单分页") |
| 87 | @PreAuthorize("@ss.hasPermission('pay:order:query')") | 96 | @PreAuthorize("@ss.hasPermission('pay:order:query')") |
| 88 | public CommonResult<PageResult<PayOrderPageItemRespVO>> getOrderPage(@Valid PayOrderPageReqVO pageVO) { | 97 | public CommonResult<PageResult<PayOrderPageItemRespVO>> getOrderPage(@Valid PayOrderPageReqVO pageVO) { |
| 89 | - PageResult<PayOrderDO> pageResult = orderService.getOrderPage(pageVO); | 98 | + PageResult<PayOrderDO> pageResult = payOrderService.getOrderPage(pageVO); |
| 90 | if (CollectionUtil.isEmpty(pageResult.getList())) { | 99 | if (CollectionUtil.isEmpty(pageResult.getList())) { |
| 91 | return success(new PageResult<>(pageResult.getTotal())); | 100 | return success(new PageResult<>(pageResult.getTotal())); |
| 92 | } | 101 | } |
| @@ -120,7 +129,7 @@ public class PayOrderController { | @@ -120,7 +129,7 @@ public class PayOrderController { | ||
| 120 | public void exportOrderExcel(@Valid PayOrderExportReqVO exportReqVO, | 129 | public void exportOrderExcel(@Valid PayOrderExportReqVO exportReqVO, |
| 121 | HttpServletResponse response) throws IOException { | 130 | HttpServletResponse response) throws IOException { |
| 122 | 131 | ||
| 123 | - List<PayOrderDO> list = orderService.getOrderList(exportReqVO); | 132 | + List<PayOrderDO> list = payOrderService.getOrderList(exportReqVO); |
| 124 | if (CollectionUtil.isEmpty(list)) { | 133 | if (CollectionUtil.isEmpty(list)) { |
| 125 | ExcelUtils.write(response, "支付订单.xls", "数据", | 134 | ExcelUtils.write(response, "支付订单.xls", "数据", |
| 126 | PayOrderExcelVO.class, new ArrayList<>()); | 135 | PayOrderExcelVO.class, new ArrayList<>()); |
yudao-ui-admin/src/api/pay/order.js
| @@ -34,6 +34,14 @@ export function getOrder(id) { | @@ -34,6 +34,14 @@ export function getOrder(id) { | ||
| 34 | }) | 34 | }) |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | +// 获得支付订单的明细 | ||
| 38 | +export function getOrderDetail(id) { | ||
| 39 | + return request({ | ||
| 40 | + url: '/pay/order/get-detail?id=' + id, | ||
| 41 | + method: 'get' | ||
| 42 | + }) | ||
| 43 | +} | ||
| 44 | + | ||
| 37 | // 获得支付订单分页 | 45 | // 获得支付订单分页 |
| 38 | export function getOrderPage(query) { | 46 | export function getOrderPage(query) { |
| 39 | return request({ | 47 | return request({ |
yudao-ui-admin/src/router/index.js
| @@ -228,9 +228,12 @@ export const constantRoutes = [ | @@ -228,9 +228,12 @@ export const constantRoutes = [ | ||
| 228 | hidden: true, | 228 | hidden: true, |
| 229 | children: [{ | 229 | children: [{ |
| 230 | path: 'order/submit', | 230 | path: 'order/submit', |
| 231 | - name: '收银台', | 231 | + name: 'PayOrderSubmit', |
| 232 | hidden: true, | 232 | hidden: true, |
| 233 | - meta: { title: '收银台' }, | 233 | + meta: { |
| 234 | + title: '收银台', | ||
| 235 | + noCache: true | ||
| 236 | + }, | ||
| 234 | component: (resolve) => require(['@/views/pay/order/submit'], resolve) | 237 | component: (resolve) => require(['@/views/pay/order/submit'], resolve) |
| 235 | }] | 238 | }] |
| 236 | } | 239 | } |
yudao-ui-admin/src/utils/constants.js
yudao-ui-admin/src/views/pay/demo/index.vue
| @@ -47,7 +47,7 @@ | @@ -47,7 +47,7 @@ | ||
| 47 | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | 47 | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
| 48 | <template v-slot="scope"> | 48 | <template v-slot="scope"> |
| 49 | <el-button size="mini" type="text" icon="el-icon-edit" @click="handlePay(scope.row)" | 49 | <el-button size="mini" type="text" icon="el-icon-edit" @click="handlePay(scope.row)" |
| 50 | - v-if="!scope.row.payed">支付</el-button> | 50 | + v-if="!scope.row.payed">前往支付</el-button> |
| 51 | </template> | 51 | </template> |
| 52 | </el-table-column> | 52 | </el-table-column> |
| 53 | </el-table> | 53 | </el-table> |
| @@ -187,15 +187,14 @@ export default { | @@ -187,15 +187,14 @@ export default { | ||
| 187 | }); | 187 | }); |
| 188 | }); | 188 | }); |
| 189 | }, | 189 | }, |
| 190 | - /** 删除按钮操作 */ | ||
| 191 | - handleDelete(row) { | ||
| 192 | - const id = row.id; | ||
| 193 | - this.$modal.confirm('是否确认删除示例订单编号为"' + id + '"的数据项?').then(function() { | ||
| 194 | - return deleteDemoOrder(id); | ||
| 195 | - }).then(() => { | ||
| 196 | - this.getList(); | ||
| 197 | - this.$modal.msgSuccess("删除成功"); | ||
| 198 | - }).catch(() => {}); | 190 | + /** 支付按钮操作 */ |
| 191 | + handlePay(row) { | ||
| 192 | + this.$router.push({ | ||
| 193 | + name: 'PayOrderSubmit', | ||
| 194 | + query:{ | ||
| 195 | + id: row.payOrderId | ||
| 196 | + } | ||
| 197 | + }) | ||
| 199 | } | 198 | } |
| 200 | } | 199 | } |
| 201 | }; | 200 | }; |
yudao-ui-admin/src/views/pay/order/index.vue
| @@ -215,7 +215,7 @@ | @@ -215,7 +215,7 @@ | ||
| 215 | </template> | 215 | </template> |
| 216 | 216 | ||
| 217 | <script> | 217 | <script> |
| 218 | -import {getOrder, getOrderPage, exportOrderExcel} from "@/api/pay/order"; | 218 | +import { getOrderDetail, getOrderPage, exportOrderExcel} from "@/api/pay/order"; |
| 219 | import {getMerchantListByName} from "@/api/pay/merchant"; | 219 | import {getMerchantListByName} from "@/api/pay/merchant"; |
| 220 | import {getAppListByMerchantId} from "@/api/pay/app"; | 220 | import {getAppListByMerchantId} from "@/api/pay/app"; |
| 221 | import {DICT_TYPE, getDictDatas} from "@/utils/dict"; | 221 | import {DICT_TYPE, getDictDatas} from "@/utils/dict"; |
| @@ -250,7 +250,7 @@ const defaultOrderDetail = { | @@ -250,7 +250,7 @@ const defaultOrderDetail = { | ||
| 250 | }; | 250 | }; |
| 251 | 251 | ||
| 252 | export default { | 252 | export default { |
| 253 | - name: "Order", | 253 | + name: "PayOrder", |
| 254 | components: {}, | 254 | components: {}, |
| 255 | data() { | 255 | data() { |
| 256 | return { | 256 | return { |
| @@ -364,7 +364,7 @@ export default { | @@ -364,7 +364,7 @@ export default { | ||
| 364 | */ | 364 | */ |
| 365 | handleQueryDetails(row) { | 365 | handleQueryDetails(row) { |
| 366 | this.orderDetail = JSON.parse(JSON.stringify(defaultOrderDetail)); | 366 | this.orderDetail = JSON.parse(JSON.stringify(defaultOrderDetail)); |
| 367 | - getOrder(row.id).then(response => { | 367 | + getOrderDetail(row.id).then(response => { |
| 368 | this.orderDetail = response.data; | 368 | this.orderDetail = response.data; |
| 369 | if (response.data.payOrderExtension === null) { | 369 | if (response.data.payOrderExtension === null) { |
| 370 | this.orderDetail.payOrderExtension = Object.assign(defaultOrderDetail.payOrderExtension, {}); | 370 | this.orderDetail.payOrderExtension = Object.assign(defaultOrderDetail.payOrderExtension, {}); |
yudao-ui-admin/src/views/pay/order/submit.vue
| @@ -3,12 +3,12 @@ | @@ -3,12 +3,12 @@ | ||
| 3 | <!-- 支付信息 --> | 3 | <!-- 支付信息 --> |
| 4 | <el-card v-loading="loading"> | 4 | <el-card v-loading="loading"> |
| 5 | <el-descriptions title="支付信息" :column="3" border> | 5 | <el-descriptions title="支付信息" :column="3" border> |
| 6 | - <el-descriptions-item label="支付单号">kooriookami</el-descriptions-item> | ||
| 7 | - <el-descriptions-item label="商品标题">苏州市</el-descriptions-item> | ||
| 8 | - <el-descriptions-item label="商品内容">苏州市</el-descriptions-item> | ||
| 9 | - <el-descriptions-item label="支付金额">18100000000</el-descriptions-item> | ||
| 10 | - <el-descriptions-item label="创建时间">苏州市</el-descriptions-item> | ||
| 11 | - <el-descriptions-item label="过期时间">苏州市</el-descriptions-item> | 6 | + <el-descriptions-item label="支付单号">{{ payOrder.id }}</el-descriptions-item> |
| 7 | + <el-descriptions-item label="商品标题">{{ payOrder.subject }}</el-descriptions-item> | ||
| 8 | + <el-descriptions-item label="商品内容">{{ payOrder.body }}</el-descriptions-item> | ||
| 9 | + <el-descriptions-item label="支付金额">¥{{ (payOrder.amount / 100.0).toFixed(2) }}</el-descriptions-item> | ||
| 10 | + <el-descriptions-item label="创建时间">{{ parseTime(payOrder.createTime) }}</el-descriptions-item> | ||
| 11 | + <el-descriptions-item label="过期时间">{{ parseTime(payOrder.expireTime) }}</el-descriptions-item> | ||
| 12 | </el-descriptions> | 12 | </el-descriptions> |
| 13 | </el-card> | 13 | </el-card> |
| 14 | 14 | ||
| @@ -43,7 +43,9 @@ | @@ -43,7 +43,9 @@ | ||
| 43 | </div> | 43 | </div> |
| 44 | </template> | 44 | </template> |
| 45 | <script> | 45 | <script> |
| 46 | -import {DICT_TYPE, getDictDatas} from "@/utils/dict"; | 46 | +import { DICT_TYPE, getDictDatas } from "@/utils/dict"; |
| 47 | +import { getOrder } from '@/api/pay/order'; | ||
| 48 | +import { PayOrderStatusEnum } from "@/utils/constants"; | ||
| 47 | 49 | ||
| 48 | export default { | 50 | export default { |
| 49 | name: "PayOrderSubmit", | 51 | name: "PayOrderSubmit", |
| @@ -71,11 +73,7 @@ export default { | @@ -71,11 +73,7 @@ export default { | ||
| 71 | }, | 73 | }, |
| 72 | created() { | 74 | created() { |
| 73 | this.id = this.$route.query.id; | 75 | this.id = this.$route.query.id; |
| 74 | - // if (!this.id) { | ||
| 75 | - // this.$message.error('未传递 id 参数,无法查看 OA 请假信息'); | ||
| 76 | - // return; | ||
| 77 | - // } | ||
| 78 | - // this.getDetail(); | 76 | + this.getDetail(); |
| 79 | this.initPayChannels(); | 77 | this.initPayChannels(); |
| 80 | }, | 78 | }, |
| 81 | methods: { | 79 | methods: { |
| @@ -98,8 +96,28 @@ export default { | @@ -98,8 +96,28 @@ export default { | ||
| 98 | }, | 96 | }, |
| 99 | /** 获得请假信息 */ | 97 | /** 获得请假信息 */ |
| 100 | getDetail() { | 98 | getDetail() { |
| 101 | - getLeave(this.id).then(response => { | ||
| 102 | - this.form = response.data; | 99 | + // 1.1 未传递订单编号 |
| 100 | + if (!this.id) { | ||
| 101 | + this.$message.error('未传递支付单号,无法查看对应的支付信息'); | ||
| 102 | + this.$router.go(-1); | ||
| 103 | + return; | ||
| 104 | + } | ||
| 105 | + getOrder(this.id).then(response => { | ||
| 106 | + // 1.2 无法查询到支付信息 | ||
| 107 | + if (!response.data) { | ||
| 108 | + this.$message.error('支付订单不存在,请检查!'); | ||
| 109 | + this.$router.go(-1); | ||
| 110 | + return; | ||
| 111 | + } | ||
| 112 | + // 1.3 订单已支付 | ||
| 113 | + if (response.data.status !== PayOrderStatusEnum.WAITING.status) { | ||
| 114 | + this.$message.error('支付订单不处于待支付状态,请检查!'); | ||
| 115 | + this.$router.go(-1); | ||
| 116 | + return; | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + // 2. 可以展示 | ||
| 120 | + this.payOrder = response.data; | ||
| 103 | }); | 121 | }); |
| 104 | }, | 122 | }, |
| 105 | } | 123 | } |