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 | 46 | public class PayOrderController { |
| 47 | 47 | |
| 48 | 48 | @Resource |
| 49 | - private PayOrderService orderService; | |
| 49 | + private PayOrderService payOrderService; | |
| 50 | 50 | @Resource |
| 51 | 51 | private PayOrderExtensionService orderExtensionService; |
| 52 | 52 | @Resource |
| ... | ... | @@ -58,8 +58,17 @@ public class PayOrderController { |
| 58 | 58 | @Operation(summary = "获得支付订单") |
| 59 | 59 | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| 60 | 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 | 72 | if (ObjectUtil.isNull(order)) { |
| 64 | 73 | return success(new PayOrderDetailsRespVO()); |
| 65 | 74 | } |
| ... | ... | @@ -86,7 +95,7 @@ public class PayOrderController { |
| 86 | 95 | @Operation(summary = "获得支付订单分页") |
| 87 | 96 | @PreAuthorize("@ss.hasPermission('pay:order:query')") |
| 88 | 97 | public CommonResult<PageResult<PayOrderPageItemRespVO>> getOrderPage(@Valid PayOrderPageReqVO pageVO) { |
| 89 | - PageResult<PayOrderDO> pageResult = orderService.getOrderPage(pageVO); | |
| 98 | + PageResult<PayOrderDO> pageResult = payOrderService.getOrderPage(pageVO); | |
| 90 | 99 | if (CollectionUtil.isEmpty(pageResult.getList())) { |
| 91 | 100 | return success(new PageResult<>(pageResult.getTotal())); |
| 92 | 101 | } |
| ... | ... | @@ -120,7 +129,7 @@ public class PayOrderController { |
| 120 | 129 | public void exportOrderExcel(@Valid PayOrderExportReqVO exportReqVO, |
| 121 | 130 | HttpServletResponse response) throws IOException { |
| 122 | 131 | |
| 123 | - List<PayOrderDO> list = orderService.getOrderList(exportReqVO); | |
| 132 | + List<PayOrderDO> list = payOrderService.getOrderList(exportReqVO); | |
| 124 | 133 | if (CollectionUtil.isEmpty(list)) { |
| 125 | 134 | ExcelUtils.write(response, "支付订单.xls", "数据", |
| 126 | 135 | PayOrderExcelVO.class, new ArrayList<>()); | ... | ... |
yudao-ui-admin/src/api/pay/order.js
| ... | ... | @@ -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 | 46 | export function getOrderPage(query) { |
| 39 | 47 | return request({ | ... | ... |
yudao-ui-admin/src/router/index.js
| ... | ... | @@ -228,9 +228,12 @@ export const constantRoutes = [ |
| 228 | 228 | hidden: true, |
| 229 | 229 | children: [{ |
| 230 | 230 | path: 'order/submit', |
| 231 | - name: '收银台', | |
| 231 | + name: 'PayOrderSubmit', | |
| 232 | 232 | hidden: true, |
| 233 | - meta: { title: '收银台' }, | |
| 233 | + meta: { | |
| 234 | + title: '收银台', | |
| 235 | + noCache: true | |
| 236 | + }, | |
| 234 | 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 | 47 | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
| 48 | 48 | <template v-slot="scope"> |
| 49 | 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 | 51 | </template> |
| 52 | 52 | </el-table-column> |
| 53 | 53 | </el-table> |
| ... | ... | @@ -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 | 215 | </template> |
| 216 | 216 | |
| 217 | 217 | <script> |
| 218 | -import {getOrder, getOrderPage, exportOrderExcel} from "@/api/pay/order"; | |
| 218 | +import { getOrderDetail, getOrderPage, exportOrderExcel} from "@/api/pay/order"; | |
| 219 | 219 | import {getMerchantListByName} from "@/api/pay/merchant"; |
| 220 | 220 | import {getAppListByMerchantId} from "@/api/pay/app"; |
| 221 | 221 | import {DICT_TYPE, getDictDatas} from "@/utils/dict"; |
| ... | ... | @@ -250,7 +250,7 @@ const defaultOrderDetail = { |
| 250 | 250 | }; |
| 251 | 251 | |
| 252 | 252 | export default { |
| 253 | - name: "Order", | |
| 253 | + name: "PayOrder", | |
| 254 | 254 | components: {}, |
| 255 | 255 | data() { |
| 256 | 256 | return { |
| ... | ... | @@ -364,7 +364,7 @@ export default { |
| 364 | 364 | */ |
| 365 | 365 | handleQueryDetails(row) { |
| 366 | 366 | this.orderDetail = JSON.parse(JSON.stringify(defaultOrderDetail)); |
| 367 | - getOrder(row.id).then(response => { | |
| 367 | + getOrderDetail(row.id).then(response => { | |
| 368 | 368 | this.orderDetail = response.data; |
| 369 | 369 | if (response.data.payOrderExtension === null) { |
| 370 | 370 | this.orderDetail.payOrderExtension = Object.assign(defaultOrderDetail.payOrderExtension, {}); | ... | ... |
yudao-ui-admin/src/views/pay/order/submit.vue
| ... | ... | @@ -3,12 +3,12 @@ |
| 3 | 3 | <!-- 支付信息 --> |
| 4 | 4 | <el-card v-loading="loading"> |
| 5 | 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 | 12 | </el-descriptions> |
| 13 | 13 | </el-card> |
| 14 | 14 | |
| ... | ... | @@ -43,7 +43,9 @@ |
| 43 | 43 | </div> |
| 44 | 44 | </template> |
| 45 | 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 | 50 | export default { |
| 49 | 51 | name: "PayOrderSubmit", |
| ... | ... | @@ -71,11 +73,7 @@ export default { |
| 71 | 73 | }, |
| 72 | 74 | created() { |
| 73 | 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 | 77 | this.initPayChannels(); |
| 80 | 78 | }, |
| 81 | 79 | methods: { |
| ... | ... | @@ -98,8 +96,28 @@ export default { |
| 98 | 96 | }, |
| 99 | 97 | /** 获得请假信息 */ |
| 100 | 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 | } | ... | ... |