From 626b9e878a360a0c0b2d71861a7e173b31a4d6e2 Mon Sep 17 00:00:00 2001 From: yunuo970428 <405378304@qq.com> Date: Thu, 11 Jul 2024 18:06:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=BB=B4=E4=BF=AE=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../maintenanceitem/maintenanceitemAdd.vue | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/yxt-as-ui/src/views/basicinformation/maintenanceitem/maintenanceitemAdd.vue b/yxt-as-ui/src/views/basicinformation/maintenanceitem/maintenanceitemAdd.vue index b381159ad1..4fd17125f8 100644 --- a/yxt-as-ui/src/views/basicinformation/maintenanceitem/maintenanceitemAdd.vue +++ b/yxt-as-ui/src/views/basicinformation/maintenanceitem/maintenanceitemAdd.vue @@ -61,17 +61,17 @@
*工时数
- +
*外协成本
- +
*销售价
- {{ calculatePrice }} + {{ formobj.price }}
*工时提成
@@ -174,14 +174,6 @@ export default { } } }, - computed: { - // 计算销售价 = 工时单价 * 工时数 + 外协成本 - calculatePrice() { - let price = '0' - price = Math.round((parseFloat(price) + (parseFloat(this.formobj.hourPrice !== '' ? this.formobj.hourPrice : '0') * parseFloat(this.formobj.hours !== '' ? this.formobj.hours : '0')) + parseFloat(this.formobj.cost !== '' ? this.formobj.cost : '0')) * 100) / 100 - return price - } - }, methods: { init() { getOrgSidByPath({ orgPath: window.sessionStorage.getItem('defaultOrgPath') }).then((res) => { @@ -285,16 +277,22 @@ export default { this.formobj.manufacturerSid = '' } }, + // 计算销售价 = 工时单价 * 工时数 + 外协成本 + priceInput(val) { + val.price = Math.round(((parseFloat(val.hourPrice !== '' ? val.hourPrice : '0') * parseFloat(val.hours !== '' ? val.hours : '0')) + parseFloat(val.cost !== '' ? val.cost : '0')) * 100) / 100 + // 因销售价发生变化,重置工时提成和提成比例 + val.examineHourPrice = '' + this.royaltiesRatio = '' + }, // 计算提成比例 = 工时提成 / 销售价 royaltiesRatioInput(val) { - this.royaltiesRatio = Math.round((((parseFloat(val.examineHourPrice !== '' ? val.examineHourPrice : '0') / parseFloat(this.calculatePrice)) * 100).toFixed(2)) * 100) / 100 + this.royaltiesRatio = Math.round((((parseFloat(val.examineHourPrice !== '' ? val.examineHourPrice : '0') / parseFloat(val.price !== '' ? val.price : '0')) * 100).toFixed(2)) * 100) / 100 }, // 计算工时提成 = 销售价 * 提成比例 examineHourPriceInput(val) { - val.examineHourPrice = Math.round((parseFloat(this.calculatePrice) * ((parseFloat(this.royaltiesRatio !== '' ? this.royaltiesRatio : '0') / 100)).toFixed(2)) * 100) / 100 + val.examineHourPrice = Math.round((parseFloat(val.price !== '' ? val.price : '0') * ((parseFloat(this.royaltiesRatio !== '' ? this.royaltiesRatio : '0') / 100)).toFixed(2)) * 100) / 100 }, saveOrUpdate() { - this.formobj.price = this.calculatePrice this.$refs['form_obj'].validate((valid) => { if (valid) { this.submitdisabled = true