From 56dbecb21f69ad7534ebf97e765cb739b25bf8c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=8F?= <1978476055@qq.com> Date: Tue, 19 Nov 2024 17:03:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=B9=E6=83=A0=E4=B8=93=E5=8C=BA=E6=88=90?= =?UTF-8?q?=E9=95=BF=E5=80=BC,=E6=8A=98=E6=89=A3=E5=8F=98=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/product/addProduct/index.vue | 85 ++++++++++++++++++++------ 1 file changed, 65 insertions(+), 20 deletions(-) diff --git a/src/views/product/addProduct/index.vue b/src/views/product/addProduct/index.vue index 786b1b2..e5d63be 100644 --- a/src/views/product/addProduct/index.vue +++ b/src/views/product/addProduct/index.vue @@ -4174,37 +4174,52 @@ export default { ]; this.proportionList = val ? proportionList : this.isProportionList; this.OneattrValue.map(item => { - let obj = this.proportionList.find( - items => items.value == item.proportion - ); + let proportion = val ? "0.45" : "0.60"; + + let obj = this.proportionList.find(items => items.value == proportion); let growth = val ? Math.floor(item.price * 0.2) : Math.floor(item.price * obj.growth); - let proportion = val ? "0.45" : "0.60"; + + let cost = toFixedNoRounding(item.price * proportion); + let coupon = Math.floor(item.price * obj.coupon); + this.$set(item, "growth", growth); this.$set(item, "proportion", proportion); + this.$set(item, "cost", cost); + this.$set(item, "coupon", coupon); }); this.ManyAttrValue.map(item => { - let obj = this.proportionList.find( - items => items.value == item.proportion - ); + let proportion = val ? "0.45" : "0.60"; + + let obj = this.proportionList.find(items => items.value == proportion); let growth = val ? Math.floor(item.price * 0.2) : Math.floor(item.price * obj.growth); - let proportion = val ? "0.45" : "0.60"; + + let cost = toFixedNoRounding(item.price * proportion); + let coupon = Math.floor(item.price * obj.coupon); + this.$set(item, "growth", growth); this.$set(item, "proportion", proportion); + this.$set(item, "cost", cost); + this.$set(item, "coupon", coupon); }); this.oneFormBatch.map(item => { - let obj = this.proportionList.find( - items => items.value == item.proportion - ); + let proportion = val ? "0.45" : "0.60"; + + let obj = this.proportionList.find(items => items.value == proportion); let growth = val ? Math.floor(item.price * 0.2) : Math.floor(item.price * obj.growth); - let proportion = val ? "0.45" : "0.60"; + + let cost = toFixedNoRounding(item.price * proportion); + let coupon = Math.floor(item.price * obj.coupon); + this.$set(item, "growth", growth); this.$set(item, "proportion", proportion); + this.$set(item, "cost", cost); + this.$set(item, "coupon", coupon); }); console.log(this.OneattrValue); console.log(this.ManyAttrValue); @@ -4489,11 +4504,37 @@ export default { } this.ManyAttrValue.map(item => { let proportion = this.formValidate.is_benefit ? "0.45" : "0.60"; + let obj = this.proportionList.find( + items => items.value == proportion + ); + let growth = this.formValidate.is_benefit + ? Math.floor(item.price * 0.2) + : Math.floor(item.price * obj.growth); + + let cost = toFixedNoRounding(item.price * proportion); + let coupon = Math.floor(item.price * obj.coupon); + + this.$set(item, "growth", growth); this.$set(item, "proportion", proportion); + this.$set(item, "cost", cost); + this.$set(item, "coupon", coupon); }); this.oneFormBatch.map(item => { let proportion = this.formValidate.is_benefit ? "0.45" : "0.60"; + let obj = this.proportionList.find( + items => items.value == proportion + ); + let growth = this.formValidate.is_benefit + ? Math.floor(item.price * 0.2) + : Math.floor(item.price * obj.growth); + + let cost = toFixedNoRounding(item.price * proportion); + let coupon = Math.floor(item.price * obj.coupon); + + this.$set(item, "growth", growth); this.$set(item, "proportion", proportion); + this.$set(item, "cost", cost); + this.$set(item, "coupon", coupon); }); this.getAttr(); }) @@ -4685,15 +4726,19 @@ export default { } this.OneattrValue.map(item => { let proportion = this.formValidate.is_benefit ? "0.45" : "0.60"; + + let obj = this.proportionList.find(items => items.value == proportion); + let growth = this.formValidate.is_benefit + ? Math.floor(item.price * 0.2) + : Math.floor(item.price * obj.growth); + + let cost = toFixedNoRounding(item.price * proportion); + let coupon = Math.floor(item.price * obj.coupon); + + this.$set(item, "growth", growth); this.$set(item, "proportion", proportion); - }); - this.ManyAttrValue.map(item => { - let proportion = this.formValidate.is_benefit ? "0.45" : "0.60"; - this.$set(item, "proportion", proportion); - }); - this.oneFormBatch.map(item => { - let proportion = this.formValidate.is_benefit ? "0.45" : "0.60"; - this.$set(item, "proportion", proportion); + this.$set(item, "cost", cost); + this.$set(item, "coupon", coupon); }); this.getAttr(); this.fullscreenLoading = false;