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;