From 97a2bd7d2621cc7be6629beebe5e03d2b3eb2283 Mon Sep 17 00:00:00 2001
From: WXL <1785969728@qq.com>
Date: 星期四, 21 三月 2024 14:12:38 +0800
Subject: [PATCH] 11

---
 src/views/project/tallage/computingBill/index.vue |   79 ++++++++++++++++++++++++---------------
 1 files changed, 49 insertions(+), 30 deletions(-)

diff --git a/src/views/project/tallage/computingBill/index.vue b/src/views/project/tallage/computingBill/index.vue
index a617bec..ae95a33 100644
--- a/src/views/project/tallage/computingBill/index.vue
+++ b/src/views/project/tallage/computingBill/index.vue
@@ -733,7 +733,7 @@
     },
     handleQuery() {},
     resetQuery() {
-      this.patientqueryParams.donorname = null;
+      this.patientqueryParams.donorno = null;
       this.patientqueryParams.donorchargeid = null;
       this.handleAddpatient();
     },
@@ -752,7 +752,15 @@
         item.taXmoney = item.taXmoney.toFixed(2);
         this.accumulation();
       });
-      this.$modal.msgSuccess("娣诲姞鎴愬姛锛�");
+      if (this.form.id) {
+        this.form.istax = 0;
+        this.form.taxedtime = "";
+        this.$modal.confirm("娣诲姞鎴愬姛锛�,闇�瑕侀噸鏂颁繚瀛樺苟璁$畻鍗曟嵁锛�").then(() => {
+          this.submitForm();
+        });
+      } else {
+        this.$modal.msgSuccess("娣诲姞鎴愬姛锛�");
+      }
 
       this.dialogVisiblepatient = false;
     },
@@ -770,19 +778,11 @@
               if (res1.code == 200) {
                 this.$modal.msgSuccess("璁$畻鎴愬姛");
                 this.$modal.closeLoading();
-                getFundtax(this.form.id).then(response => {
-                  this.form = response.data;
-                  if (this.form.serviceFunds[0]) {
-                    this.donorchargeorgans = this.form.serviceFunds;
-                    this.donorchargeorgans.forEach(item => {
-                      item.taXmoney = item.pretaxcost - item.taxedcost;
-                      item.taXmoney = item.taXmoney.toFixed(2);
-                      this.accumulation();//璁$畻
-                      this.form.istax = 1;
-                      this.submitForm();
-                    });
-                  }
-                });
+                this.form.istax = 1;
+                this.form.taxedtime = this.$moment().format(
+                  "YYYY-MM-DD HH:mm:ss"
+                );
+                this.submitForm();
               } else {
                 this.$modal.closeLoading();
                 this.$modal.msgError(res1.msg);
@@ -798,7 +798,7 @@
     // 閲戦鍚堣
     accumulation() {
       this.form.pretaxamount = this.donorchargeorgans.reduce(
-        (acc, obj) => acc + obj.pretaxcost,
+        (acc, obj) => acc + Number(obj.pretaxcost),
         0
       );
       this.form.taxMoney = this.donorchargeorgans.reduce(
@@ -806,7 +806,7 @@
         0
       );
       this.form.taxedamount = this.donorchargeorgans.reduce(
-        (acc, obj) => acc + obj.taxedcost,
+        (acc, obj) => acc + Number(obj.taxedcost),
         0
       );
     },
@@ -916,11 +916,25 @@
         if (valid) {
           this.$modal.loading("姝e湪鎻愪氦锛岃绋嶅�欙紒");
           //淇濆瓨
+          console.log(1);
           this.form.serviceFunds = this.donorchargeorgans;
+          console.log(2);
           if (this.form.id != null) {
             updateFundtax(this.form).then(res1 => {
               if (res1.code == 200) {
+                console.log(3);
                 this.$modal.msgSuccess("淇濆瓨鎴愬姛锛�");
+                getFundtax(this.form.id).then(response => {
+                  this.form = response.data;
+                  if (this.form.serviceFunds[0]) {
+                    this.donorchargeorgans = this.form.serviceFunds;
+                    this.donorchargeorgans.forEach(item => {
+                      item.taXmoney = item.pretaxcost - item.taxedcost;
+                      item.taXmoney = item.taXmoney.toFixed(2);
+                      this.accumulation();
+                    });
+                  }
+                });
                 this.$modal.closeLoading();
               } else {
                 this.$modal.closeLoading();
@@ -930,8 +944,18 @@
           } else {
             addFundtax(this.form).then(response => {
               if (response.code == 200) {
-                this.form.id = response.data.fundTaxId;
                 this.$modal.msgSuccess("鏂板鎴愬姛锛�");
+                getFundtax(response.data.fundTaxId).then(res => {
+                  this.form = res.data;
+                  if (this.form.serviceFunds[0]) {
+                    this.donorchargeorgans = this.form.serviceFunds;
+                    this.donorchargeorgans.forEach(item => {
+                      item.taXmoney = item.pretaxcost - item.taxedcost;
+                      item.taXmoney = item.taXmoney.toFixed(2);
+                      this.accumulation();
+                    });
+                  }
+                });
                 this.$modal.closeLoading();
               } else {
                 this.$modal.msgError(response.msg);
@@ -978,18 +1002,13 @@
         .then(() => {
           CalculationDetail({ id: row.id }).then(res2 => {
             if (res2.code == 200) {
-              this.$modal.msgSuccess("鍒犻櫎鎴愬姛锛�");
-              getFundtax(this.curId).then(response => {
-                this.form = response.data;
-                if (this.form.serviceFunds[0]) {
-                  this.donorchargeorgans = this.form.serviceFunds;
-                  this.donorchargeorgans.forEach(item => {
-                    item.taXmoney = item.pretaxcost - item.taxedcost;
-                    item.taXmoney = item.taXmoney.toFixed(2);
-                    this.accumulation();
-                  });
-                }
-              });
+              this.form.istax = 0;
+              this.form.taxedtime = "";
+              this.$modal
+                .confirm("鍒犻櫎鎴愬姛,闇�瑕侀噸鏂颁繚瀛樺苟璁$畻鍗曟嵁锛�")
+                .then(() => {
+                  this.submitForm();
+                });
             }
           });
         })

--
Gitblit v1.9.3