From 276b42ea8b5cbae0b9b153ff064bd994e12a9b7f Mon Sep 17 00:00:00 2001 From: YeMingfei666 <1619116647@qq.com> Date: Fri, 6 Dec 2024 13:35:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A1=E7=AE=97=E5=85=AC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/Instead/components/discount.vue | 2 +- src/views/tool/Instead/index.vue | 29 +++++++++++++++---- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/views/tool/Instead/components/discount.vue b/src/views/tool/Instead/components/discount.vue index e2c0ae3..9fc6595 100644 --- a/src/views/tool/Instead/components/discount.vue +++ b/src/views/tool/Instead/components/discount.vue @@ -169,7 +169,7 @@ export default { confirm() { console.log(this.form.discount / 100) - this.$emit("confirm", (this.form.discount / 100)); + this.$emit("confirm", {discount:this.form.discount / 100,currentPrice:((this.form.discount*this.form.money)/100).toFixed(2)} ); this.close(); }, open(data) { diff --git a/src/views/tool/Instead/index.vue b/src/views/tool/Instead/index.vue index 14c2a75..a985ef6 100644 --- a/src/views/tool/Instead/index.vue +++ b/src/views/tool/Instead/index.vue @@ -1861,10 +1861,13 @@ export default { } }, gaijia() { + if(!this.createOrder.data.amount ){ + return 0 + } const disCountOriginPrice = - this.createOrder.data.amount - this.coupdiscount; - const disocunt = (1 - this.createOrder.discount) * disCountOriginPrice; - return disocunt.toFixed(2); + this.createOrder.data.amount - this.productCouponDiscountAmount; + const discountPrice= ((1-this.createOrder.discount)*disCountOriginPrice).toFixed(2) + return discountPrice; }, pointsCanDicountMoney() { return (this.yinFuJinE - this.points.toMoney).toFixed(2); @@ -1881,11 +1884,24 @@ export default { }, 0); return n; }, + productCouponDiscountAmount(){ + const n = this.quansSelArr.filter(v=>v.type==2).reduce((prve, cur) => { + return prve + cur.discountAmount * 1; + }, 0); + return n; + }, + fullCouponDiscountAmount(){ + const n = this.quansSelArr.filter(v=>v.type==1).reduce((prve, cur) => { + return prve + cur.discountAmount * 1; + }, 0); + return n; + }, currentPayMoney() { const amount = this.createOrder.data.amount || 0; const discount = this.createOrder.discount || 1; // const total=((amount - this.coupdiscount) * this.createOrder.discount - this.points.toMoney) - const total = amount - this.gaijia - this.coupdiscount; + // const total = amount - this.gaijia - this.coupdiscount; + const total = amount - this.productCouponDiscountAmount-this.gaijia -this.fullCouponDiscountAmount; return total <= 0 ? 0 : total; }, yinFuJinE() { @@ -2917,7 +2933,8 @@ export default { }); } }, - ChangeDiscount(discount) { + ChangeDiscount(e) { + const {discount,currentPrice}=e; const fullCoupIndex = this.quansSelArr.findIndex((v) => v.type == 1); const fullCoup = this.quansSelArr[fullCoupIndex]; this.createOrder.discount = discount; @@ -2949,7 +2966,7 @@ export default { if (!canDiscount) { return; } - const amount = (this.createOrder.data.amount - this.coupdiscount).toFixed( + const amount = (this.createOrder.data.amount -this.productCouponDiscountAmount).toFixed( 2 ); console.log(amount);