Commit a9241cfbf41e613fe5b033ad76c44a97cb09946a
1 parent
cb7634ec
【功能优化】优化商品列表页或者详情页会员价和限时优惠价,那个便宜展示那个
Showing
1 changed file
with
11 additions
and
4 deletions
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java
| ... | ... | @@ -100,15 +100,22 @@ public class AppTradeOrderController { |
| 100 | 100 | skuList.forEach(sku -> { |
| 101 | 101 | //查询限时优惠价格 |
| 102 | 102 | AppTradeProductSettlementRespVO.Sku skuDiscount = calculateDiscountPrice(sku.getId(), sku.getPrice()); |
| 103 | - if(skuDiscount != null){ | |
| 104 | - skus.add(skuDiscount); | |
| 105 | - } | |
| 106 | 103 | |
| 107 | 104 | //查询会员价 |
| 108 | 105 | AppTradeProductSettlementRespVO.Sku skuVip = calculateVipPrice(sku.getId(), sku.getPrice(), memberLevel); |
| 109 | - if(skuVip != null){ | |
| 106 | + | |
| 107 | + if(skuDiscount != null && skuVip != null){ | |
| 108 | + if(skuDiscount.getPrice() > skuVip.getPrice()){ | |
| 109 | + skus.add(skuDiscount); | |
| 110 | + }else{ | |
| 111 | + skus.add(skuVip); | |
| 112 | + } | |
| 113 | + }else if(skuDiscount != null){ | |
| 114 | + skus.add(skuDiscount); | |
| 115 | + }else if(skuVip != null){ | |
| 110 | 116 | skus.add(skuVip); |
| 111 | 117 | } |
| 118 | + | |
| 112 | 119 | }); |
| 113 | 120 | AppTradeProductSettlementRespVO.Reward reward = calculateReward(spuId); |
| 114 | 121 | AppTradeProductSettlementRespVO respVO = AppTradeProductSettlementRespVO.builder().id(spuId).skus(skus).build(); | ... | ... |