diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java index 35af568..78fce42 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java @@ -1065,7 +1065,7 @@ public class PayService { TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getShopId())); - if ("0".equals(shopInfo.getIsReturn())) { + if ("1".equals(shopInfo.getIsReturn())) { if (ObjectUtil.isEmpty(pwd)) { return Result.fail(CodeEnum.PARAM); } @@ -1156,7 +1156,12 @@ public class PayService { detailPo.setStatus("closed"); } - BigDecimal returnAmount = payAmount; + BigDecimal returnAmount = it.getPriceAmount().divide(new BigDecimal(it.getNum()), 2, RoundingMode.DOWN).multiply(new BigDecimal(map1.get(it.getId())));; + + if (ObjectUtil.isNotEmpty(orderInfo.getDiscountRatio()) && ObjectUtil.isNotNull(orderInfo.getDiscountRatio())) { + returnAmount = returnAmount.multiply(orderInfo.getDiscountRatio()).setScale(2, BigDecimal.ROUND_DOWN); + } + detailPo.setReturnNum(map1.get(it.getId())); detailPos.add(detailPo); it.setNum(map1.get(it.getId()));