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() {