src/main/java/cc/mrbird/febs/mall/controller/AdminMallOrderController.java
@@ -97,6 +97,17 @@ return adminMallOrderService.disagreeRefund(id); } /** * 订单退款-退款确认 * @param id * @return */ @GetMapping("refundConfirm/{id}") @ControllerEndpoint(operation = "订单退款-退款确认", exceptionMessage = "操作失败") public FebsResponse refundConfirm(@NotNull(message = "{required}") @PathVariable Long id) { return adminMallOrderService.refundConfirm(id); } src/main/java/cc/mrbird/febs/mall/service/IAdminMallOrderService.java
@@ -28,4 +28,6 @@ FebsResponse agreeRefund(Long id); FebsResponse disagreeRefund(Long id); FebsResponse refundConfirm(Long id); } src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallOrderService.java
@@ -8,6 +8,7 @@ import cc.mrbird.febs.mall.entity.*; import cc.mrbird.febs.mall.mapper.*; import cc.mrbird.febs.mall.service.IAdminMallOrderService; import cc.mrbird.febs.mall.service.IApiMallMemberWalletService; import cc.mrbird.febs.mall.vo.*; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; @@ -35,6 +36,10 @@ private final MallOrderRefundMapper mallOrderRefundMapper; private final MallOrderRefundOperationMapper mallOrderRefundOperationMapper; private final MallMoneyFlowMapper mallMoneyFlowMapper; private final IApiMallMemberWalletService iApiMallMemberWalletService; @Override public IPage<AdminMallOrderInfoVo> getOrderListInPage(MallOrderInfoDto mallOrderInfo, QueryRequest request) { @@ -150,5 +155,41 @@ return new FebsResponse().success(); } @Override public FebsResponse refundConfirm(Long id) { MallOrderRefund mallOrderRefund = mallOrderRefundMapper.selectById(id); if(ObjectUtil.isEmpty(mallOrderRefund)){ return new FebsResponse().fail().message("系统繁忙,请刷新重试"); } mallOrderRefund.setStatus(5); mallOrderRefundMapper.updateById(mallOrderRefund); MallOrderRefundOperation mallOrderRefundOperation = new MallOrderRefundOperation(); mallOrderRefundOperation.setRefundId(mallOrderRefund.getId()); mallOrderRefundOperation.setOrderId(mallOrderRefund.getOrderId()); mallOrderRefundOperation.setContent("已退款到用户账户"); mallOrderRefundOperationMapper.insert(mallOrderRefundOperation); MallOrderInfo mallOrderInfo = mallOrderInfoMapper.selectById(mallOrderRefund.getOrderId()); if(ObjectUtil.isEmpty(mallOrderInfo)){ return new FebsResponse().fail().message("系统繁忙,请刷新重试"); } mallOrderInfo.setStatus(6); mallOrderInfoMapper.updateById(mallOrderInfo); //用户钱包增加对应的余额 iApiMallMemberWalletService.addBalance(mallOrderInfo.getAmount(),mallOrderInfo.getMemberId()); //新增一条资金流水 MallMoneyFlow mallMoneyFlow = new MallMoneyFlow(); mallMoneyFlow.setMemberId(mallOrderRefund.getMemberId()); mallMoneyFlow.setOrderNo(mallOrderInfo.getOrderNo()); mallMoneyFlow.setType(4); mallMoneyFlow.setAmount(mallOrderInfo.getAmount()); mallMoneyFlowMapper.insert(mallMoneyFlow); return new FebsResponse().success(); } } src/main/resources/templates/febs/views/modules/order/refundList.html
@@ -100,6 +100,11 @@ disagreeRefund(data.id); }); } if (layEvent === 'refundConfirm') { febs.modal.confirm('退款确认', '确认已退款?', function () { refundConfirm(data.id); }); } }); function agreeRefund(id) { @@ -111,6 +116,13 @@ function disagreeRefund(id) { febs.get(ctx + 'admin/order/disagreeRefund/' + id, null, function () { febs.alert.success('操作成功'); $query.click(); }); } function refundConfirm(id) { febs.get(ctx + 'admin/order/refundConfirm/' + id, null, function () { febs.alert.success('操作成功'); $query.click(); }); @@ -172,6 +184,9 @@ return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="agree" shiro:hasPermission="user:update">同意</button>' +'<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="disagree" shiro:hasPermission="user:update">拒绝</button>' +'<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="refunding" shiro:hasPermission="user:update">退款进度</button>' }else if(d.status === 4){ return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="refunding" shiro:hasPermission="user:update">退款进度</button>' +'<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="refundConfirm" shiro:hasPermission="user:update">退款确认</button>' }else{ return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="refunding" shiro:hasPermission="user:update">退款进度</button>' }