Browse Source

删除发票后,数电发票费用要减去被删除发票的费用

huangguoce 3 days ago
parent
commit
ae3d93ce1f

+ 1 - 1
src/views/common/NewDigitalInvoiceUploadComponent.vue

@@ -872,7 +872,7 @@ export default {
 				this.$forceUpdate(); // 强制更新表格
 			});
 			this.$emit("handleUploadSuccess", JSON.parse(JSON.stringify(this.dataListNew)), this.uniqueId)
-
+			this.$emit("handleDelete", row, this.uniqueId)
 		},
 		/**
 		 * 关闭dialog时使用  清除el-upload中上传的文件

+ 19 - 17
src/views/common/reimbursement/ReimbursementComponent.vue

@@ -59,7 +59,7 @@
                             <template #content="{ row, rowIndex }">
                                 <InvoiceReimbursementUpLoadComponent @changeConfirmList="changeConfirmList"
                                     @handleCount="handleCount" @handleUploadSuccess="handleUploadSuccess"
-                                    :ref="row.uniqueId + 'Upload'">
+                                    @handleDelete="handleDelete" :ref="row.uniqueId + 'Upload'">
                                 </InvoiceReimbursementUpLoadComponent>
                             </template>
                         </vxe-column>
@@ -185,7 +185,7 @@
                             <template #content="{ row, rowIndex }">
                                 <InvoiceReimbursementUpLoadComponent @changeConfirmList="changeConfirmList"
                                     @handleCount="handleCount" @handleUploadSuccess="handleUploadSuccess"
-                                    :ref="row.uniqueId + 'Upload'">
+                                    @handleDelete="handleDelete" :ref="row.uniqueId + 'Upload'">
                                 </InvoiceReimbursementUpLoadComponent>
                             </template>
                         </vxe-column>
@@ -311,7 +311,7 @@
                             <template #content="{ row, rowIndex }">
                                 <InvoiceReimbursementUpLoadComponent @changeConfirmList="changeConfirmList"
                                     @handleCount="handleCount" @handleUploadSuccess="handleUploadSuccess"
-                                    :ref="row.uniqueId + 'Upload'">
+                                    @handleDelete="handleDelete" :ref="row.uniqueId + 'Upload'">
                                 </InvoiceReimbursementUpLoadComponent>
                             </template>
                         </vxe-column>
@@ -538,7 +538,7 @@
                             <template #content="{ row, rowIndex }">
                                 <InvoiceReimbursementUpLoadComponent @changeConfirmList="changeConfirmList"
                                     @handleCount="handleCount" @handleUploadSuccess="handleUploadSuccess"
-                                    :ref="row.uniqueId + 'Upload'">
+                                    @handleDelete="handleDelete" :ref="row.uniqueId + 'Upload'">
                                 </InvoiceReimbursementUpLoadComponent>
                             </template>
                         </vxe-column>
@@ -664,7 +664,7 @@
                             <template #content="{ row, rowIndex }">
                                 <InvoiceReimbursementUpLoadComponent @changeConfirmList="changeConfirmList"
                                     @handleCount="handleCount" @handleUploadSuccess="handleUploadSuccess"
-                                    :ref="row.uniqueId + 'Upload'">
+                                    @handleDelete="handleDelete" :ref="row.uniqueId + 'Upload'">
                                 </InvoiceReimbursementUpLoadComponent>
                             </template>
                         </vxe-column>
@@ -786,7 +786,7 @@
                             <template #content="{ row, rowIndex }">
                                 <InvoiceReimbursementUpLoadComponent @changeConfirmList="changeConfirmList"
                                     @handleCount="handleCount" @handleUploadSuccess="handleUploadSuccess"
-                                    :ref="row.uniqueId + 'Upload'">
+                                    @handleDelete="handleDelete" :ref="row.uniqueId + 'Upload'">
                                 </InvoiceReimbursementUpLoadComponent>
 
                             </template>
@@ -1015,7 +1015,7 @@
                             <template #content="{ row, rowIndex }">
                                 <InvoiceReimbursementUpLoadComponent @changeConfirmList="changeConfirmList"
                                     @handleCount="handleCount" @handleUploadSuccess="handleUploadSuccess"
-                                    :ref="row.uniqueId + 'Upload'">
+                                    @handleDelete="handleDelete" :ref="row.uniqueId + 'Upload'">
                                 </InvoiceReimbursementUpLoadComponent>
 
                             </template>
@@ -2555,8 +2555,15 @@ export default {
             obj.numberCount = Number(obj.number || 0) + Number(obj.ordinaryNumber || 0)
 
         },
+        handleDelete(row, uniqueId) {
+            this.tableData.forEach(item => {
+                if (item.uniqueId == uniqueId) {
+                    item.number = (parseFloat(item.number) - parseFloat(row.count)).toFixed(2)
+                    this.handleOrdinaryNumberInput(item, 1)
+                }
+            })
+        },
         handleUploadSuccess(files, uniqueId) {
-
             this.handleTableInfo(this.inputForm.sourceType)
             let row = this.tableData.find(item => {
                 return item.uniqueId == uniqueId
@@ -2568,7 +2575,7 @@ export default {
             this.tableRef.updateFooter(this.tableData)
             row.receiptNumber = files.length
             this.handleReceiptNumberInput(row)
-            // this.handleNumberInput(row)
+            // this.handleOrdinaryNumberInput(row, 1)
         },
         handleCheckAmount() {
             let countFlag = false
@@ -2616,11 +2623,6 @@ export default {
             return arr
         },
         handleOrdinaryNumberInput(row, index) {
-            console.log(row);
-            console.log(row);
-            console.log(row);
-            console.log(row);
-
             let value = 0
             if (index == 1) {
                 value = row.number
@@ -2631,9 +2633,9 @@ export default {
             // 如果是非数字,直接删除
             if (!regex.test(value)) {
                 if (index == 1) {
-                    row.number = value.slice(0, -1);
+                    row.number = 0
                 } else {
-                    row.ordinaryNumber = value.slice(0, -1);
+                    row.ordinaryNumber = 0
                 }
                 this.$message.warning('确保输入数字格式且小数点后只能输入两位')
                 return;
@@ -2646,7 +2648,7 @@ export default {
                         }
                     })
                     if (numberCount > 0 && row.number > numberCount) {
-                        row.number = value.slice(0, -1);
+                        row.number = 0
                         this.$message.warning('输入结果不可大于发票费用总和')
                         return
                     }