mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-02 02:06:38 +08:00
Coupon filtering updated
This commit is contained in:
parent
3201a6ee2e
commit
7a234d4f3a
@ -69,7 +69,7 @@ export const postCourseId = (productCode, buyCount, memberId, mobile, productImg
|
||||
leftAllotment: leftAllotment,
|
||||
basePiont: basePiont
|
||||
}
|
||||
return fetch('/insertCartProductInfo', data,'POST')
|
||||
return fetch('insertCartProductInfo', data,'POST')
|
||||
}
|
||||
/**
|
||||
* 是否存在购物车
|
||||
|
@ -318,18 +318,30 @@ export default {
|
||||
} else {
|
||||
//Into coupon discount calculation
|
||||
switch(this.curCoupon.couponTypeId) {
|
||||
case 1: //Amount deduct
|
||||
total = total + (itemInCart.productPrice * itemInCart.buyCount - this.curCoupon.couponAmount);
|
||||
this.discountAmount = this.curCoupon.couponAmount;
|
||||
this.discountedProductCode = itemInCart.productCode;
|
||||
couponUsed=true;
|
||||
case 1: //Amount deduct
|
||||
if(this.curCoupon.couponAmount && this.curCoupon.couponAmount <= (itemInCart.productPrice * itemInCart.buyCount)) {
|
||||
total = total + (itemInCart.productPrice * itemInCart.buyCount - this.curCoupon.couponAmount);
|
||||
this.discountAmount = this.curCoupon.couponAmount;
|
||||
this.discountedProductCode = itemInCart.productCode;
|
||||
couponUsed=true;
|
||||
} else if(this.curCoupon.couponAmount && this.curCoupon.couponAmount > (itemInCart.productPrice * itemInCart.buyCount)) {
|
||||
total = total + itemInCart.productPrice * itemInCart.buyCount;
|
||||
this.discountAmount = 0;
|
||||
this.curCoupon = {couponName:'未能使用该优惠券'};
|
||||
}
|
||||
break;
|
||||
case 2: //Amount deduct with minPrice restriction
|
||||
case 6:
|
||||
total = total + (itemInCart.productPrice * itemInCart.buyCount) - this.curCoupon.couponAmount;
|
||||
this.discountAmount = this.curCoupon.couponAmount;
|
||||
this.discountedProductCode = itemInCart.productCode;
|
||||
couponUsed=true;
|
||||
if(this.curCoupon.couponAmount && this.curCoupon.couponAmount <= (itemInCart.productPrice * itemInCart.buyCount)) {
|
||||
total = total + (itemInCart.productPrice * itemInCart.buyCount) - this.curCoupon.couponAmount;
|
||||
this.discountAmount = this.curCoupon.couponAmount;
|
||||
this.discountedProductCode = itemInCart.productCode;
|
||||
couponUsed=true;
|
||||
} else if(this.curCoupon.couponAmount && this.curCoupon.couponAmount > (itemInCart.productPrice * itemInCart.buyCount)) {
|
||||
total = total + itemInCart.productPrice * itemInCart.buyCount;
|
||||
this.discountAmount = 0;
|
||||
this.curCoupon = {couponName:'未能使用该优惠券'};
|
||||
}
|
||||
break;
|
||||
case 3: //Limited product % discount
|
||||
case 4: //% discount
|
||||
@ -417,7 +429,7 @@ export default {
|
||||
valDateFromTime=0;
|
||||
valDateToTime=0;
|
||||
dateChecked=true;
|
||||
/*
|
||||
/* */
|
||||
if(myCoupon.fValidFrom) {
|
||||
//Fix ios date issue
|
||||
myCoupon.fValidFrom = myCoupon.fValidFrom.replace(/-/g, '/');
|
||||
@ -435,19 +447,22 @@ export default {
|
||||
if(valDateToTime && curTime > valDateToTime) {
|
||||
dateChecked=false;
|
||||
}
|
||||
*/
|
||||
|
||||
if(myCoupon.minQuantity && myCoupon.minQuantity>itemInCart.buyCount) {
|
||||
dateChecked=false;
|
||||
}
|
||||
if(myCoupon.minPrice && myCoupon.minPrice>this.sumPrice) {
|
||||
dateChecked=false;
|
||||
}
|
||||
if(myCoupon.couponAmount && myCoupon.couponAmount>this.sumPrice) {
|
||||
dateChecked=false;
|
||||
}
|
||||
if(myCoupon.udf2!='H5') {
|
||||
dateChecked=false;
|
||||
}
|
||||
|
||||
//if(dateChecked && myCoupon.activityId != 10 && myCoupon.status == 0 && (!myCoupon.productCodes || myCoupon.productCodes.indexOf(itemInCart.productCode)>-1)) {
|
||||
if(dateChecked) {
|
||||
if(dateChecked && myCoupon.activityId != 10 && myCoupon.status == 0 && (!myCoupon.productCodes || myCoupon.productCodes.indexOf(itemInCart.productCode)>-1)) {
|
||||
//if(dateChecked) {
|
||||
//data.data.splice(tmpIndex,1);
|
||||
_self.drawlist.push(myCoupon);
|
||||
avaliableCouponNum++;
|
||||
|
@ -344,7 +344,6 @@ export default {
|
||||
let stopIndex = 0;
|
||||
for(let singleCode of productCode) {
|
||||
let data = await goodsmessage(singleCode);
|
||||
console.log(data);
|
||||
if (data && data.length>0) {
|
||||
newlist.push(data[0]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user