From 52ed7edf0840b5ac2dfa53f169815845b0a27926 Mon Sep 17 00:00:00 2001 From: gyq <875626088@qq.com> Date: Mon, 22 Jul 2024 17:13:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=87=BA=E5=BA=93=E5=85=A5?= =?UTF-8?q?=E5=BA=93=E6=95=B0=E9=87=8F=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/invoicing/operation_in.vue | 70 +++++++++++++++++++-------- src/views/invoicing/operation_out.vue | 65 ++++++++++++++++++------- 2 files changed, 99 insertions(+), 36 deletions(-) diff --git a/src/views/invoicing/operation_in.vue b/src/views/invoicing/operation_in.vue index 434cb8f..3dbfdac 100644 --- a/src/views/invoicing/operation_in.vue +++ b/src/views/invoicing/operation_in.vue @@ -113,14 +113,15 @@ + @change="consCountTotal($event, scope.row, 'price')"> 原价¥{{ scope.row.costPrice }}/{{ scope.row.conUnit }} - + 入库前:{{ scope.row.number }}{{ scope.row.conUnit }} @@ -150,7 +151,7 @@ {{ scope.row.name }} - ({{ scope.row.specSnap }}) + ({{ scope.row.specSnap }}) @@ -158,14 +159,15 @@ { modifyPrice(); scope.row.costPrice = e }"> + @change="modifyPrice($event, scope.row, 'costPrice')"> 成本价¥{{ scope.row.costPrice }}/{{ scope.row.unitName }} - { modifyPrice(); scope.row.totalAmount = e }"> + 入库前:{{ scope.row.stockNumber }}{{ scope.row.unitName }} @@ -305,20 +307,50 @@ export default { this.queryForm.type = type }, // 计算耗材总价 - consCountTotal() { - let zong = 0 - this.tableData.list.forEach(ele => { - zong += ele.price * ele.stockNumber - }) - this.queryForm.totalAmount = formatDecimal(zong) + consCountTotal(cvalue, row, key1, key2 = undefined) { + if (cvalue == undefined) { + setTimeout(() => { + row[key1] = 0 + + let zong = 0 + this.tableData.list.forEach(ele => { + zong += ele.price * ele.stockNumber + }) + this.queryForm.totalAmount = formatDecimal(zong) + }, 10) + } else { + row[key1] = cvalue + + let zong = 0 + this.tableData.list.forEach(ele => { + zong += ele.price * ele.stockNumber + }) + this.queryForm.totalAmount = formatDecimal(zong) + } }, // 计算商品总价 - modifyPrice() { - let zong = 0 - this.tableData.list.forEach(ele => { - zong += ele.costPrice * ele.number - }) - this.queryForm.totalAmount = formatDecimal(zong) + modifyPrice(cvalue, row, key1, key2 = undefined) { + if (cvalue == undefined) { + setTimeout(() => { + row[key1] = 0 + row[key2] = 0 + + let zong = 0 + this.tableData.list.forEach(ele => { + zong += ele.costPrice * ele.number + }) + this.queryForm.totalAmount = formatDecimal(zong) + }, 10) + } else { + row[key1] = cvalue + row[key2] = cvalue + + let zong = 0 + this.tableData.list.forEach(ele => { + zong += ele.costPrice * ele.number + }) + this.queryForm.totalAmount = formatDecimal(zong) + } }, // 提交 submitHandle() { diff --git a/src/views/invoicing/operation_out.vue b/src/views/invoicing/operation_out.vue index d55592f..982ef61 100644 --- a/src/views/invoicing/operation_out.vue +++ b/src/views/invoicing/operation_out.vue @@ -110,14 +110,15 @@ + @change="consCountTotal($event, scope.row, 'price')"> 原价¥{{ scope.row.costPrice }}/{{ scope.row.conUnit }} - + 出库前:{{ scope.row.number }}{{ scope.row.conUnit }} @@ -153,14 +154,14 @@ { modifyPrice(); scope.row.costPrice = e }"> + @change="modifyPrice($event, scope.row, 'costPrice')"> 成本价¥{{ scope.row.costPrice }}/{{ scope.row.unitName }} { modifyPrice(); scope.row.totalAmount = e }"> + @change="modifyPrice($event, scope.row, 'number', 'totalAmount')"> 出库前:{{ scope.row.stockNumber }}{{ scope.row.unitName }} @@ -299,20 +300,50 @@ export default { this.queryForm.type = type }, // 计算耗材总价 - consCountTotal() { - let zong = 0 - this.tableData.list.forEach(ele => { - zong += ele.price * ele.stockNumber - }) - this.queryForm.totalAmount = formatDecimal(zong) + consCountTotal(cvalue, row, key1, key2 = undefined) { + if (cvalue == undefined) { + setTimeout(() => { + row[key1] = 0 + + let zong = 0 + this.tableData.list.forEach(ele => { + zong += ele.price * ele.stockNumber + }) + this.queryForm.totalAmount = formatDecimal(zong) + }, 10) + } else { + row[key1] = cvalue + + let zong = 0 + this.tableData.list.forEach(ele => { + zong += ele.price * ele.stockNumber + }) + this.queryForm.totalAmount = formatDecimal(zong) + } }, // 计算商品总价 - modifyPrice() { - let zong = 0 - this.tableData.list.forEach(ele => { - zong += ele.costPrice * ele.number - }) - this.queryForm.totalAmount = zong + modifyPrice(cvalue, row, key1, key2 = undefined) { + if (cvalue == undefined) { + setTimeout(() => { + row[key1] = 0 + row[key2] = 0 + + let zong = 0 + this.tableData.list.forEach(ele => { + zong += ele.costPrice * ele.number + }) + this.queryForm.totalAmount = formatDecimal(zong) + }, 10) + } else { + row[key1] = cvalue + row[key2] = cvalue + + let zong = 0 + this.tableData.list.forEach(ele => { + zong += ele.costPrice * ele.number + }) + this.queryForm.totalAmount = formatDecimal(zong) + } }, // 提交 submitHandle() {