mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-02 18:26:38 +08:00
commit
09f61bc114
@ -52,7 +52,7 @@
|
|||||||
<div class="rc-userbottom">
|
<div class="rc-userbottom">
|
||||||
<p>¥{{ item.productPrice }}</p>
|
<p>¥{{ item.productPrice }}</p>
|
||||||
<p>X{{ item.buyCount }}</p>
|
<p>X{{ item.buyCount }}</p>
|
||||||
<p class="price">¥{{ item.productPrice }}</p>
|
<p class="price">¥{{ item.productPrice * item.buyCount }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -295,6 +295,7 @@ export default {
|
|||||||
break;
|
break;
|
||||||
case 3: //Limited product % discount
|
case 3: //Limited product % discount
|
||||||
case 4: //% discount
|
case 4: //% discount
|
||||||
|
debugger;
|
||||||
total = total + (itemInCart.productPrice * itemInCart.buyCount) * this.curCoupon.discount;
|
total = total + (itemInCart.productPrice * itemInCart.buyCount) * this.curCoupon.discount;
|
||||||
this.discountAmount = (itemInCart.productPrice * itemInCart.buyCount) * ( 1 - this.curCoupon.discount);
|
this.discountAmount = (itemInCart.productPrice * itemInCart.buyCount) * ( 1 - this.curCoupon.discount);
|
||||||
this.discountedItemIndex = tmpCounter;
|
this.discountedItemIndex = tmpCounter;
|
||||||
@ -328,16 +329,68 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
...mapMutations(["checkIsLogin"]),
|
...mapMutations(["checkIsLogin"]),
|
||||||
wholeOrderDiscount(){
|
wholeOrderDiscount(){
|
||||||
//TODO
|
this.discountedItemIndex = 0;
|
||||||
if(this.curCoupon.minPrice && this.curCoupon.minPrice > this.sumPrice) {
|
if(this.curCoupon.minPrice && this.curCoupon.minPrice > this.sumPrice) {
|
||||||
if(this.curCoupon.couponAmount && this.curCoupon.couponAmount>0)
|
if(this.curCoupon.couponAmount && this.curCoupon.couponAmount>0) {
|
||||||
|
this.discountAmount = this.curCoupon.discount;
|
||||||
return this.sumPrice - this.curCoupon.couponAmount;
|
return this.sumPrice - this.curCoupon.couponAmount;
|
||||||
else
|
} else if(this.curCoupon.discount && this.curCoupon.discount>0) {
|
||||||
return 0;
|
this.discountAmount = this.sumPrice*this.curCoupon.discount;
|
||||||
|
return this.sumPrice * (1-this.curCoupon.discount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
qualifiedProductDiscount(){
|
qualifiedProductDiscount(){
|
||||||
//TODO
|
//TODO
|
||||||
|
this.discountedItemIndex = 0;
|
||||||
|
let tmpCounter = 0 ;
|
||||||
|
|
||||||
|
//Sort items by items amount
|
||||||
|
|
||||||
|
//Sort items by items amount end
|
||||||
|
|
||||||
|
for(let itemInCart of this.goldmedal) {
|
||||||
|
if((!this.curCoupon.productCodes || this.curCoupon.productCodes.indexOf(itemInCart.productCode)>-1) && !couponUsed) {
|
||||||
|
if(this.curCoupon.minQuantity && this.curCoupon.minQuantity>itemInCart.buyCount) {
|
||||||
|
//Check minQuantity
|
||||||
|
total+=(itemInCart.buyCount * itemInCart.productPrice);
|
||||||
|
} else if(this.curCoupon.minPrice && this.curCoupon.minPrice > (itemInCart.buyCount * itemInCart.productPrice)) {
|
||||||
|
//Check minPrice
|
||||||
|
total+=(itemInCart.buyCount * itemInCart.productPrice);
|
||||||
|
} 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.discountedItemIndex = tmpCounter;
|
||||||
|
couponUsed=true;
|
||||||
|
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.discountedItemIndex = tmpCounter;
|
||||||
|
couponUsed=true;
|
||||||
|
break;
|
||||||
|
case 3: //Limited product % discount
|
||||||
|
case 4: //% discount
|
||||||
|
total = total + (itemInCart.productPrice * itemInCart.buyCount) * this.curCoupon.discount;
|
||||||
|
this.discountAmount = (itemInCart.productPrice * itemInCart.buyCount) * ( 1 - this.curCoupon.discount);
|
||||||
|
this.discountedItemIndex = tmpCounter;
|
||||||
|
couponUsed=true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
total += itemInCart.productPrice * itemInCart.buyCount;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//Into coupon discount calculation end
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
total += itemInCart.productPrice * itemInCart.buyCount;
|
||||||
|
}
|
||||||
|
tmpCounter++;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async getAddressList() {
|
async getAddressList() {
|
||||||
let memberId = JSON.parse(localStorage.getItem("userInfo")).data.id;
|
let memberId = JSON.parse(localStorage.getItem("userInfo")).data.id;
|
||||||
|
Loading…
Reference in New Issue
Block a user