Commit c7c4f4e5 by huiyang.chen

fix 商品券加购,存在则删除

parent 7fa1ef62
......@@ -237,6 +237,14 @@ public class ShoppingCartMCoffeeServiceImpl {
//使用券的是,如果购物车已经存在这个券,先清除,再添加
cartGoods.setQty(0);
}
if (StringUtils.isNotEmpty(goodsId) && StringUtils.isBlank(couponCode) && goodsId.equals(cartGoods.getSkuId())) {
if (cartGoods.getQty() > 1 ){
cartGoods.setQty(cartGoods.getQty() - 1);
}else {
//如果购物车存在相同的商品,则先删除购物车商品,在新增商品券购物车行
cartGoods.setQty(0);
}
}
//同样商品券不能使用
/* if (StringUtils.isNotEmpty(couponCode)&& StringUtils.isNotEmpty(cartGoods.getCouponCode()) && goodsId.equals(cartGoods.getGoodsId())) {
throw new ServiceException(ResponseResult.SHOPPING_CART_GOODS_COUPON_CAN_NOT_USE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment