|
@@ -179,9 +179,10 @@ public class OrderHandler {
|
|
msg.setMessage(ResultInfo.cartNoStatusError);
|
|
msg.setMessage(ResultInfo.cartNoStatusError);
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
|
|
+
|
|
String[] els = element.split("-");
|
|
String[] els = element.split("-");
|
|
for(String el : els){
|
|
for(String el : els){
|
|
- if(cartDto.getProductType() == Integer.valueOf(el)){ //订单中没有牙刷的时候,不能使用新人券
|
|
|
|
|
|
+ if(cartDto.getProductType() == Integer.valueOf(el)){ //订单中没有牙刷的时候,不能使用100元优惠券
|
|
disable = true;
|
|
disable = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -192,6 +193,7 @@ public class OrderHandler {
|
|
brushFlag = true;
|
|
brushFlag = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
if (sum <= 0) {
|
|
if (sum <= 0) {
|
|
msg.setMessage(ResultInfo.cartEmptyError);
|
|
msg.setMessage(ResultInfo.cartEmptyError);
|
|
@@ -341,11 +343,12 @@ public class OrderHandler {
|
|
|
|
|
|
/*是否含有电动牙刷*/
|
|
/*是否含有电动牙刷*/
|
|
boolean isContainProduct = false;
|
|
boolean isContainProduct = false;
|
|
- boolean brushFlag = false; //标识,是否可以使用(新人券)优惠券,只能购买刷头的时候才能使用 - 20180316 以后
|
|
|
|
|
|
+ boolean brush1Flag = false; //60元优惠券
|
|
|
|
+ boolean brush2Flag = false; //刷头兑换券
|
|
// String element = systemService.selectOneShopRuleById(249).getRuleDesc();
|
|
// String element = systemService.selectOneShopRuleById(249).getRuleDesc();
|
|
String brushelEment = systemService.selectOneShopRuleById(253).getRuleDesc();
|
|
String brushelEment = systemService.selectOneShopRuleById(253).getRuleDesc();
|
|
|
|
|
|
-// int brushelTotal = 0; // 牙刷总金额
|
|
|
|
|
|
+ int brushelTotal = 0; // 牙刷总金额
|
|
int brushelCouponTotal = 0; //优惠总价
|
|
int brushelCouponTotal = 0; //优惠总价
|
|
|
|
|
|
int total = 0; // 需要支付的总额, 单位为分
|
|
int total = 0; // 需要支付的总额, 单位为分
|
|
@@ -382,8 +385,9 @@ public class OrderHandler {
|
|
String[] brushelEls = brushelEment.split("-");
|
|
String[] brushelEls = brushelEment.split("-");
|
|
for(String brushelEl : brushelEls){
|
|
for(String brushelEl : brushelEls){
|
|
if(cartDto.getProductType() == Integer.valueOf(brushelEl)){ //判断订单中是否有刷头,有刷头 brushFlag 为true;
|
|
if(cartDto.getProductType() == Integer.valueOf(brushelEl)){ //判断订单中是否有刷头,有刷头 brushFlag 为true;
|
|
- brushFlag = true;
|
|
|
|
-// brushelTotal += subTotal;
|
|
|
|
|
|
+ brush1Flag = true;
|
|
|
|
+ brush2Flag = true;
|
|
|
|
+ brushelTotal += subTotal;
|
|
if(brushelCouponTotal == 0 || brushelCouponTotal < cartDto.getProductPrice()){
|
|
if(brushelCouponTotal == 0 || brushelCouponTotal < cartDto.getProductPrice()){
|
|
brushelCouponTotal = cartDto.getProductPrice();
|
|
brushelCouponTotal = cartDto.getProductPrice();
|
|
}
|
|
}
|
|
@@ -436,7 +440,7 @@ public class OrderHandler {
|
|
|
|
|
|
/*新人卷没有其他限制*/
|
|
/*新人卷没有其他限制*/
|
|
if(couponItemDto.getCouponIsNewPeople() == 1){ //当券为新人券
|
|
if(couponItemDto.getCouponIsNewPeople() == 1){ //当券为新人券
|
|
- if(member.getUserIdentity() != 1 || !brushFlag){ //不为会员,或者没有牙刷刷头都无法使用
|
|
|
|
|
|
+ if(member.getUserIdentity() != 1 || !brush1Flag || !brush2Flag){ //不为会员,或者没有牙刷刷头都无法使用
|
|
msg.setMessage(ResultInfo.COUPON_NO_MEMBER); //非会员需要购买电动牙刷才能使用该优惠券
|
|
msg.setMessage(ResultInfo.COUPON_NO_MEMBER); //非会员需要购买电动牙刷才能使用该优惠券
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
@@ -446,17 +450,19 @@ public class OrderHandler {
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-// int br = 0;
|
|
|
|
|
|
+
|
|
//优惠券的类型,是直接减免额度 还是折扣价
|
|
//优惠券的类型,是直接减免额度 还是折扣价
|
|
if(couponType.getCouponType()==1){
|
|
if(couponType.getCouponType()==1){
|
|
- if(couponItemDto.getCouponIsNewPeople() == 1){ //当券为新人券
|
|
|
|
|
|
+ if(couponItemDto.getCouponIsNewPeople() == 1 && couponItemDto.getCouponId() == 20000){ //当券 新人卷 刷头抵扣卷
|
|
total = total - brushelCouponTotal;
|
|
total = total - brushelCouponTotal;
|
|
-// br = brushelTotal - couponType.getCouponReduce();
|
|
|
|
-// if(br <= 0){
|
|
|
|
-// total=total-brushelTotal;
|
|
|
|
-// }else{
|
|
|
|
-// total=total-couponType.getCouponReduce();
|
|
|
|
-// }
|
|
|
|
|
|
+ }else if(couponItemDto.getCouponIsNewPeople() == 1 && couponItemDto.getCouponId() ==40000){ ////当券 新人卷 60元优惠券
|
|
|
|
+ int br = 0;
|
|
|
|
+ br = brushelTotal - couponType.getCouponReduce(); //刷头总价减去优惠券金额 小于零(只需要减去刷头总价) 大于零(需要减去优惠券总价)
|
|
|
|
+ if(br <= 0){
|
|
|
|
+ total=total-brushelTotal;
|
|
|
|
+ }else{
|
|
|
|
+ total=total-couponType.getCouponReduce();
|
|
|
|
+ }
|
|
}else{
|
|
}else{
|
|
total=total-couponType.getCouponReduce();
|
|
total=total-couponType.getCouponReduce();
|
|
}
|
|
}
|