From 38c26c3049d55ffda598ce0263498448b7c60834 Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期日, 08 十一月 2026 23:34:45 +0800
Subject: [PATCH] 增加增值税城建税

---
 src/views/project/tallage/computingBill/index.vue |  576 ++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 406 insertions(+), 170 deletions(-)

diff --git a/src/views/project/tallage/computingBill/index.vue b/src/views/project/tallage/computingBill/index.vue
index a617bec..508a1cf 100644
--- a/src/views/project/tallage/computingBill/index.vue
+++ b/src/views/project/tallage/computingBill/index.vue
@@ -8,8 +8,8 @@
             <el-form-item label="鐢宠鏃ユ湡" prop="createTime">
               <el-date-picker
                 v-model="form.createTime"
-                value-format="yyyy-MM-dd HH:mm:ss"
-                type="datetime"
+                value-format="yyyy-MM-dd "
+                type="date"
                 :disabled="true"
                 placeholder="閫夋嫨鍑虹敓骞存湀"
               >
@@ -43,7 +43,7 @@
               <el-date-picker
                 v-model="form.taxedtime"
                 value-format="yyyy-MM-dd HH:mm:ss"
-                type="datetime"
+                type="datetime" format="yyyy-MM-dd HH:mm"
                 :disabled="true"
                 placeholder="閫夋嫨鏃堕棿"
               >
@@ -61,21 +61,50 @@
             </el-form-item>
           </el-col>
           <el-col :span="6"
-            ><el-form-item label="鎵g◣閲戦" prop="donateno">
+            ><el-form-item label="澧炲�肩◣" prop="donateno">
+              <el-input
+                v-model="form.vatAmount"
+                :disabled="true"
+                placeholder="璇疯緭鍏ュ鍊肩◣"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="6"
+            ><el-form-item label="鍩庡缓绋�" prop="donateno">
+              <el-input
+                v-model="form.cityTaxAmount"
+                :disabled="true"
+                placeholder="璇疯緭鍏ュ煄寤虹◣"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="6"
+            ><el-form-item label="鍔冲姟绋庡墠" prop="donateno">
+              <el-input
+                v-model="form.laborPretaxAmount"
+                :disabled="true"
+                placeholder="璇疯緭鍏ュ姵鍔$◣鍓�"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="6"
+            ><el-form-item label="鍔冲姟涓◣" prop="donateno">
               <el-input
                 v-model="form.taxMoney"
                 :disabled="true"
-                placeholder="璇疯緭鍏ユ墸绋庨噾棰�"
+                placeholder="璇疯緭鍏ュ姵鍔′釜绋�"
               />
             </el-form-item>
           </el-col>
 
           <el-col :span="6">
-            <el-form-item label="绋庡悗閲戦" prop="donationcategory">
+            <el-form-item label="鍔冲姟绋庡悗" prop="donationcategory">
               <el-input
                 v-model="form.taxedamount"
                 :disabled="true"
-                placeholder="璇疯緭鍏ユ敹娆捐鍙�"
+                placeholder="璇疯緭鍏ュ姵鍔$◣鍚�"
               />
             </el-form-item>
           </el-col>
@@ -114,6 +143,14 @@
             :summary-method="getSummaries"
             show-summary
           >
+            <el-table-column
+              prop="index"
+              align="center"
+              fixed
+              label="搴忓彿"
+              width="120"
+            >
+            </el-table-column>
             <el-table-column
               prop="donorname"
               align="center"
@@ -172,8 +209,8 @@
                   v-model="scope.row.applyTime"
                   :disabled="true"
                   type="date"
-                  value-format="yyyy-MM-dd HH:mm:ss"
                   placeholder="鐢宠鏃ユ湡"
+                  value-format="yyyy-MM-dd"
                 >
                 </el-date-picker>
               </template>
@@ -187,23 +224,50 @@
                 />
               </template>
             </el-table-column>
-            <el-table-column label="鎵g◣閲戦" align="center" prop="taXmoney">
+            <el-table-column prop="vatCost" align="center" label="澧炲�肩◣">
               <template slot-scope="scope">
                 <el-input
-                  v-model="scope.row.taXmoney"
+                  v-model="scope.row.vatCost"
                   :disabled="true"
-                  placeholder="鎵g◣閲戦"
+                  placeholder="澧炲�肩◣"
+                />
+              </template>
+            </el-table-column>
+            <el-table-column prop="cityTaxCost" align="center" label="鍩庡缓绋�">
+              <template slot-scope="scope">
+                <el-input
+                  v-model="scope.row.cityTaxCost"
+                  :disabled="true"
+                  placeholder="鍩庡缓绋�"
+                />
+              </template>
+            </el-table-column>
+            <el-table-column prop="laborPretaxCost" align="center" label="鍔冲姟绋庡墠">
+              <template slot-scope="scope">
+                <el-input
+                  v-model="scope.row.laborPretaxCost"
+                  :disabled="true"
+                  placeholder="鍔冲姟绋庡墠"
+                />
+              </template>
+            </el-table-column>
+            <el-table-column label="鍔冲姟涓◣" align="center" prop="taxcost">
+              <template slot-scope="scope">
+                <el-input
+                  v-model="scope.row.taxcost"
+                  :disabled="true"
+                  placeholder="鍔冲姟涓◣"
                 />
               </template>
             </el-table-column>
 
-            <el-table-column prop="taxedcost" align="center" label="绋庡悗閲戦">
+            <el-table-column prop="taxedcost" align="center" label="鍔冲姟绋庡悗">
               <template slot-scope="scope">
                 <el-input
                   @blur="chargeSum"
                   :disabled="true"
                   v-model="scope.row.taxedcost"
-                  placeholder="绋庡悗閲戦"
+                  placeholder="鍔冲姟绋庡悗"
                 />
               </template>
             </el-table-column>
@@ -268,10 +332,29 @@
         :before-close="handleClosehz"
       >
         <div class="examine-jic">
+          <div style="margin: 0 10px 20px 10px;">
+            <el-card class="box-card">
+              <el-tag
+                v-for="item in overallCase"
+                :key="item.id"
+                closable
+                @close="handleClose(item)"
+              >
+                {{ item.donorname }}
+              </el-tag>
+              <div style="margin-top: 20px; text-align: right;">
+                鍏遍�夋嫨<span
+                  style="font-size: 18px; color: #409EFF;margin: 0 10px;"
+                  >{{ overallCase.length }}</span
+                >鏉℃暟鎹�
+              </div>
+            </el-card>
+          </div>
           <div class="jic-value">
             <el-row :gutter="20">
               <!--鐢ㄦ埛鏁版嵁-->
               <el-form
+                class="opo-query-form"
                 :model="patientqueryParams"
                 ref="queryForm"
                 size="small"
@@ -280,19 +363,43 @@
               >
                 <el-form-item label="鎹愮尞妗堜緥" prop="status">
                   <el-select
-                    v-model="patientqueryParams.donorno"
+                    v-model="patientqueryParams.donorname"
                     filterable
+                    allow-create
+                    default-first-option
                     placeholder="璇烽�夋嫨"
                   >
                     <el-option
                       v-for="item in donorchargeanlList"
                       :key="item.id"
                       :label="item.name"
-                      :value="item.id"
+                      :value="item.name"
                     >
                     </el-option>
                   </el-select>
                 </el-form-item>
+                <el-form-item label="鐢宠浜�" prop="name">
+                  <el-input
+                    v-model="patientqueryParams.pausername"
+                    placeholder="璇疯緭鍏ョ敵璇蜂汉濮撳悕"
+                    @keyup.enter.native="handleAddpatient"
+                  />
+                </el-form-item>
+                <!-- <el-form-item label="绠楃◣鐘舵��" prop="status">
+                  <el-select
+                    v-model="patientqueryParams.istax"
+                    filterable
+                    placeholder="璇烽�夋嫨"
+                  >
+                    <el-option
+                      v-for="item in istaxlist"
+                      :key="item.value"
+                      :label="item.label"
+                      :value="item.value"
+                    >
+                    </el-option>
+                  </el-select>
+                </el-form-item> -->
 
                 <el-form-item>
                   <el-button
@@ -346,14 +453,32 @@
                 >
                 </el-table-column>
                 <el-table-column
-                  prop="taXmoney"
-                  label="鎵g◣閲戦(缂�)"
+                  prop="vatCost"
+                  label="澧炲�肩◣"
+                  show-overflow-tooltip
+                >
+                </el-table-column>
+                <el-table-column
+                  prop="cityTaxCost"
+                  label="鍩庡缓绋�"
+                  show-overflow-tooltip
+                >
+                </el-table-column>
+                <el-table-column
+                  prop="laborPretaxCost"
+                  label="鍔冲姟绋庡墠"
+                  show-overflow-tooltip
+                >
+                </el-table-column>
+                <el-table-column
+                  prop="taxcost"
+                  label="鍔冲姟涓◣"
                   show-overflow-tooltip
                 >
                 </el-table-column>
                 <el-table-column
                   prop="taxedcost"
-                  label="绋庡悗閲戦"
+                  label="鍔冲姟绋庡悗"
                   show-overflow-tooltip
                 >
                 </el-table-column>
@@ -388,8 +513,17 @@
         :close-on-click-modal="false"
         :title="pdftitle"
         :visible.sync="pdfVisible"
+        :fullscreen="pdfFullscreen"
         width="60%"
+        custom-class="pdf-resize-dialog"
+        @closed="pdfFullscreen = false"
       >
+        <template slot="title">
+          <span>{{ pdftitle }}</span>
+          <el-button class="pdf-fullscreen-btn" size="mini"
+            :icon="pdfFullscreen ? 'el-icon-close' : 'el-icon-full-screen'"
+            @click="pdfFullscreen = !pdfFullscreen">{{ pdfFullscreen ? "杩樺師" : "鍏ㄥ睆" }}</el-button>
+        </template>
         <div class="pdfimg">
           <div class="box-pdf">
             <div>
@@ -475,19 +609,7 @@
             </div>
           </div>
 
-          <div v-if="this.previewpdf && pdfimgsrcList.length" class="pdfimgmin">
-            <!-- <img :src="pdfimg" /> -->
-            <el-image
-              style="width: 95%; height: 90%"
-              :src="pdfimg"
-              :preview-src-list="pdfimgsrcList"
-            >
-              <!-- <div slot="error" class="image-slot">
-                <i class="el-icon-picture-outline"></i>
-              </div> -->
-            </el-image>
-          </div>
-          <div v-else class="pdfimgmins">{{ hintitle }}</div>
+          <attachment-preview-pane :file="embeddedFile" style="flex: 1; min-width: 0;" />
         </div>
       </el-dialog>
     </div>
@@ -520,6 +642,7 @@
 import Li_area_select from "@/components/Address";
 import { getUserProfile } from "@/api/system/user";
 import { getToken } from "@/utils/auth";
+import { moneySum, moneyRound } from "@/utils/money";
 import {
   ExpertfeeListnb,
   getFundtax,
@@ -536,23 +659,27 @@
     Li_area_select,
     pdf
   },
-  dicts: ["sys_gathering", "sys_0_1"],
+  dicts: ["Collection_status", "sys_0_1"],
   name: "Donorchargemanager",
   data() {
     return {
       swgatheringlist: [
-        { label: "鏈畻绋�", value: 0 },
-        { label: "宸茬畻绋�", value: 1 }
+        { label: "宸茬畻绋�", value: 1 },
+        { label: "鏈畻绋�", value: 0 }
       ],
       gatheringlist: [
         { label: "鏈粯娆�", value: "0" },
         { label: "宸蹭粯娆�", value: "1" }
       ],
+      // 褰撳墠椤甸�変腑鏁版嵁
       multipleSelection: [],
+      // 鎬婚�変腑鏁版嵁
+      overallCase: [],
       patientqueryParams: {
         paApplyType: 1,
-        pacheckno: "047",
-        checkstatus: 0,
+        // pacheckno: "047",
+        // checkstatus: 0,
+        pfundtaxid: 0,
         pageNum: 1,
         pageSize: 10
       },
@@ -614,11 +741,13 @@
       organParams: {
         pageNum: 1,
         pageSize: 10,
-        paymentid: null
+        paymentid: null,
+        istax: 0
       },
 
       // 褰撳墠鐢ㄦ埛淇℃伅
       userprofile: {},
+      decision: false,
       // 琛ㄥ崟鍙傛暟
       form: {
         istax: 0,
@@ -655,6 +784,10 @@
 
       baselist: [],
       donorList: [],
+      istaxlist: [
+        { value: 0, label: "鏈畻绋�" },
+        { value: 2, label: "寰呯畻绋�" }
+      ],
       organchargelist: [],
       standardlevel: 0,
       defaultperson: {},
@@ -689,6 +822,7 @@
 
   created() {
     console.log(234);
+    this.Networkheader = window.location.origin;
     this.GetMaxTaxid();
 
     //鑾峰彇鍙傛暟
@@ -733,86 +867,187 @@
     },
     handleQuery() {},
     resetQuery() {
+      this.patientqueryParams.pausername = null;
       this.patientqueryParams.donorname = null;
-      this.patientqueryParams.donorchargeid = null;
       this.handleAddpatient();
     },
     handleUploadError() {},
     // 寮规娣诲姞
     AddDispatchpatients() {
-      this.donorchargeorgans = this.donorchargeorgans.concat(
-        this.multipleSelection
-      );
-      console.log(this.donorchargeorgans, "donorchargeorgans");
-      this.donorchargeorgans.forEach(item => {
-        CalculationDetail({ id: item.id, fundTaxId: this.form.id });
+      let newArr = this.donorchargeorgans.concat(this.overallCase);
+      this.donorchargeorgans = newArr.filter((item, index, self) => {
+        return !self.slice(index + 1).some(other => other.id === item.id);
       });
+
+      console.log(this.donorchargeorgans, "donorchargeorgans");
+      if (this.form.id) {
+        this.donorchargeorgans.forEach(item => {
+          CalculationDetail({ id: item.id, fundTaxId: this.form.id });
+        });
+      }
       this.donorchargeorgans.forEach(item => {
-        item.taXmoney = item.pretaxcost - item.taxedcost;
-        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;
     },
-    // 璁$畻涓◣
+    // 璁$畻涓◣锛堝厛淇濆瓨褰撳墠鍗曟嵁锛屼繚瀛樻垚鍔熷悗鍐嶇畻绋庯紱绠楃◣鎴愬姛鍚庝粠鍚庣閲嶆柊鍔犺浇锛屼笉鍐嶇敤椤甸潰鏃ч噾棰濆洖鍐欙級
     calculateFn() {
       if (this.form.id >= this.MaxFundTaxId) {
-        this.$modal.loading("姝e湪鎻愪氦锛岃绋嶅�欙紒");
         this.$modal
-          .confirm("鍗冲皢杩涜绠楃◣鏄惁宸蹭繚瀛樺叏閮ㄦ暟鎹�?")
-          .then(res => {
-            listbxiaostatistics({
-              fundTaxId: Number(this.form.id),
-              addOrupdate: 1
-            }).then(res1 => {
-              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();
+          .confirm("绠楃◣鍓嶄細鍏堜繚瀛樺綋鍓嶅崟鎹紝鏄惁缁х画?")
+          .then(() => {
+            this.form.serviceFunds = this.donorchargeorgans;
+            this.$refs["form"].validate(valid => {
+              if (!valid) {
+                this.$modal.msgError("鍗曟嵁鏍¢獙鏈�氳繃锛岃妫�鏌ュ悗閲嶈瘯");
+                return;
+              }
+              this.$modal.loading("姝e湪鎻愪氦锛岃绋嶅�欙紒");
+              updateFundtax(this.form).then(res0 => {
+                if (res0.code != 200) {
+                  this.$modal.closeLoading();
+                  this.$modal.msgError(res0.msg);
+                  return;
+                }
+                listbxiaostatistics({
+                  fundTaxId: Number(this.form.id),
+                  addOrupdate: 1
+                }).then(res1 => {
+                  if (res1.code == 200) {
+                    // 鍚庣宸插洖鍐� service_fund / service_fundtax锛岃繖閲屽彧鍋氶噸鏂板姞杞�
+                    this.refreshFundtax().then(() => {
+                      this.$modal.closeLoading();
+                      this.$modal.msgSuccess("璁$畻鎴愬姛");
                     });
+                  } else {
+                    this.$modal.closeLoading();
+                    this.$modal.msgError(res1.msg);
                   }
                 });
-              } else {
-                this.$modal.closeLoading();
-                this.$modal.msgError(res1.msg);
-              }
+              });
             });
           })
-
           .catch(() => {});
       } else {
         this.$modal.msgError("褰撳墠鍗曟嵁涓嶄负鏈�鏂扮敵璇峰崟");
       }
     },
-    // 閲戦鍚堣
+    // 浠庡悗绔噸鏂板姞杞芥眹鎬诲崟锛堝惈鏄庣粏鍗曟嵁琛岋級骞堕噸绠楀悎璁�
+    refreshFundtax() {
+      return getFundtax(this.form.id).then(response => {
+        this.form = response.data;
+        if (this.form.serviceFunds && this.form.serviceFunds[0]) {
+          this.donorchargeorgans = this.form.serviceFunds;
+          this.donorchargeorgans.forEach((item, index) => {
+            item.index = index + 1;
+          });
+        }
+        this.accumulation();
+        return response;
+      });
+    },
+    // 閲戦鍚堣锛�6 涓噾棰濆叏閮ㄥ彇鑷崟鎹笂鐨勫悗绔噾棰濓紝涓嶅啀鐢ㄢ�滅◣鍓�-绋庡悗鈥濆�掔畻锛�
     accumulation() {
-      this.form.pretaxamount = this.donorchargeorgans.reduce(
-        (acc, obj) => acc + obj.pretaxcost,
-        0
-      );
-      this.form.taxMoney = this.donorchargeorgans.reduce(
-        (acc, obj) => acc + Number(obj.taXmoney),
-        0
-      );
-      this.form.taxedamount = this.donorchargeorgans.reduce(
-        (acc, obj) => acc + obj.taxedcost,
-        0
-      );
+      this.form.pretaxamount = this.donorchargeorgans
+        .reduce((acc, obj) => acc + Number(obj.pretaxcost || 0), 0)
+        .toFixed(2);
+      this.form.vatAmount = this.donorchargeorgans
+        .reduce((acc, obj) => acc + Number(obj.vatCost || 0), 0)
+        .toFixed(2);
+      this.form.cityTaxAmount = this.donorchargeorgans
+        .reduce((acc, obj) => acc + Number(obj.cityTaxCost || 0), 0)
+        .toFixed(2);
+      this.form.laborPretaxAmount = this.donorchargeorgans
+        .reduce((acc, obj) => acc + Number(obj.laborPretaxCost || 0), 0)
+        .toFixed(2);
+      this.form.taxMoney = this.donorchargeorgans
+        .reduce((acc, obj) => acc + Number(obj.taxcost || 0), 0)
+        .toFixed(2);
+      this.form.taxedamount = this.donorchargeorgans
+        .reduce((acc, obj) => acc + Number(obj.taxedcost || 0), 0)
+        .toFixed(2);
     },
     // 澶氶�夋閫変腑鏁版嵁
-    handleSelectionChange(val) {
-      this.multipleSelection = val;
+    handleSelectionChange(selection) {
+      if (this.decision) return;
+      // 鍒ゆ柇鏄惁鏈夊垹闄�
+      if (this.multipleSelection.length <= selection.length) {
+        this.multipleSelection = selection;
+      } else {
+        this.multipleSelection.forEach(item => {
+          if (selection.includes(item)) {
+          } else {
+            if (this.multipleSelection.length == 1) {
+              this.multipleSelection = [];
+            } else {
+              this.multipleSelection.splice(
+                this.multipleSelection.indexOf(item),
+                1
+              );
+            }
+            if (this.overallCase.length == 1) {
+              this.overallCase = [];
+            } else {
+              this.overallCase.splice(this.overallCase.indexOf(item), 1);
+            }
+          }
+        });
+      }
+      // 璧嬪�肩粰鏁翠綋閫変腑鏁扮粍
+      this.multipleSelection.forEach(item => {
+        if (!this.overallCase.includes(item)) {
+          this.overallCase.push(item);
+        }
+      });
+      console.log(this.multipleSelection, "瑙﹀彂閫夋嫨鍚巑ultipleSelection");
+    },
+    // 鍒囨崲椤靛悗鎭㈠閫変腑
+    Restorecheck() {
+      console.log(this.overallCase, "this.overallCase");
+      const allid = this.overallCase.map(item => item.id);
+      const overlap = this.donorchargeList.filter(value => {
+        return allid.includes(value.id);
+      });
+      // 淇濇寔ids鍜屽綋鍓嶉〉闈㈢殑鍚屾鎬�
+      this.multipleSelection = overlap;
+      console.log(this.multipleSelection, "杩涘叆鍒嗛〉multipleSelection");
+
+      this.toggleSelection(overlap);
+    },
+    // 鎸傝浇閫夋嫨鐘舵��
+    toggleSelection(rows) {
+      if (rows) {
+        this.decision = true;
+        this.$nextTick(() => {
+          rows.forEach(row => {
+            this.$refs.multipleTable.toggleRowSelection(row, true);
+          });
+          this.decision = false;
+        });
+        console.log(123);
+      } else {
+        this.$refs.multipleTable.clearSelection();
+      }
+    },
+    // 閫夋嫨浜哄憳鏍囩鍒犻櫎浜嬩欢
+    handleClose(item) {
+      this.overallCase.splice(this.overallCase.indexOf(item), 1);
+      if (this.multipleSelection.indexOf(item) == -1) {
+      } else {
+        this.multipleSelection.splice(this.multipleSelection.indexOf(item), 1);
+        this.$refs.multipleTable.toggleRowSelection(item, false);
+        // this.toggleSelection(this.multipleSelection);
+      }
     },
     // 鐐瑰嚮鏂板
     handleAddpatient(row) {
@@ -821,7 +1056,7 @@
       ExpertfeeListnb(this.patientqueryParams).then(res => {
         this.donorchargeList = res.rows;
         this.patienttotal = res.total;
-        console.log(this.donorchargeList);
+        this.Restorecheck();
       });
     },
     // 鑾峰彇鏈�澶axid
@@ -856,11 +1091,11 @@
       });
     },
 
-    /** 閲嶇疆鎸夐挳鎿嶄綔 */
-    resetQuery() {
-      this.resetForm("queryForm");
-      this.handleQuery();
-    },
+    // /** 閲嶇疆鎸夐挳鎿嶄綔 */
+    // resetQuery() {
+    //   this.resetForm("queryForm");
+    //   this.handleQuery();
+    // },
 
     // 鍙栨秷鎸夐挳
     cancel() {
@@ -873,7 +1108,7 @@
       this.title = "鏂板涓撳璐规眹鎬诲崟";
       //鑾峰彇鐧诲綍鑰呬俊鎭�
       getUserProfile().then(res => {
-        this.form.username = res.createBy;
+        this.form.username = res.data.createBy;
       });
     },
 
@@ -882,13 +1117,12 @@
       this.title = "涓撳璐规眹鎬诲崟缂栬緫";
       getFundtax(this.curId).then(response => {
         this.form = response.data;
-        if (this.form.serviceFunds[0]) {
+        if (this.form.serviceFunds && 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.donorchargeorgans.forEach((item, index) => {
+            item.index = index + 1;
           });
+          this.accumulation();
         }
       });
     },
@@ -898,13 +1132,12 @@
       this.title = "鏌ョ湅涓撳璐规眹鎬诲崟";
       getFundtax(this.curId).then(response => {
         this.form = response.data;
-        if (this.form.serviceFunds[0]) {
+        if (this.form.serviceFunds && 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.donorchargeorgans.forEach((item, index) => {
+            item.index = index + 1;
           });
+          this.accumulation();
         }
       });
     },
@@ -916,12 +1149,16 @@
         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) {
                 this.$modal.msgSuccess("淇濆瓨鎴愬姛锛�");
-                this.$modal.closeLoading();
+                this.refreshFundtax().then(() => {
+                  this.$modal.closeLoading();
+                });
               } else {
                 this.$modal.closeLoading();
                 this.$modal.msgError(res1.msg);
@@ -930,9 +1167,11 @@
           } else {
             addFundtax(this.form).then(response => {
               if (response.code == 200) {
-                this.form.id = response.data.fundTaxId;
                 this.$modal.msgSuccess("鏂板鎴愬姛锛�");
-                this.$modal.closeLoading();
+                this.form.id = response.data.fundTaxId;
+                this.refreshFundtax().then(() => {
+                  this.$modal.closeLoading();
+                });
               } else {
                 this.$modal.msgError(response.msg);
                 this.$modal.closeLoading();
@@ -952,23 +1191,16 @@
         this.$modal.msgError("娉ㄦ剰瀹炴敹閲戦涓嶇瓑浜庡簲鏀堕噾棰濓紝璇锋牳瀵规暟鎹紒");
       }
     },
-    //淇敼瀹炴敹鎴栧簲鏀跺悗瑙﹀彂
+    //淇敼瀹炴敹鎴栧簲鏀跺悗瑙﹀彂锛堥噾棰濅竴寰嬭蛋绮剧‘杩愮畻锛�
     chargeSum() {
-      let ChargeSum = 0;
-      let ChargeamountSum = 0;
-
       //璐圭敤鍚堣
       try {
-        for (let i = 0; i < this.donorchargeorgans.length; i++) {
-          if (!isNaN(parseFloat(this.donorchargeorgans[i].organcharge))) {
-            ChargeSum += parseFloat(this.donorchargeorgans[i].organcharge);
-          }
-          if (!isNaN(parseFloat(this.donorchargeorgans[i].amount))) {
-            ChargeamountSum += parseFloat(this.donorchargeorgans[i].amount);
-          }
-        }
-        this.form.receivableamount = ChargeSum.toFixed(2);
-        this.form.receivedamount = ChargeamountSum.toFixed(2);
+        this.form.receivableamount = moneyRound(
+          moneySum(this.donorchargeorgans, "organcharge")
+        ).toFixed(2);
+        this.form.receivedamount = moneyRound(
+          moneySum(this.donorchargeorgans, "amount")
+        ).toFixed(2);
       } catch {}
     },
 
@@ -978,18 +1210,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();
+                });
             }
           });
         })
@@ -1053,25 +1280,23 @@
       const config = {
         headers: { Authorization: "Bearer " + this.ICDtoken }
       };
-      const pdfimg = this.Networkheader + "/prod-api" + response.fileName;
+      const pdfimg = this.Networkheader + process.env.VUE_APP_BASE_API + response.fileName;
       //鑾峰彇绁ㄦ嵁淇℃伅浣嶇疆
       if (response.code == 200) {
         this.previewpdf = true;
-        fetch(pdfimg, config)
-          .then(response => response.blob())
-          .then(blob => {
-            // 灏嗚幏鍙栫殑鏁版嵁娴佽浆鎹负URL
-            this.pdfimg = URL.createObjectURL(blob);
-            this.pdfimgsrcList.push(URL.createObjectURL(blob));
-            this.fileListto.push({
-              name: file.name,
-              url: URL.createObjectURL(blob)
-            });
-          })
-          .catch(error => {
-            console.error("Error loading image", error);
-            return;
-          });
+        const localBlob = file.raw;
+        const localUrl = URL.createObjectURL(localBlob);
+        this.pdfimg = localUrl;
+        this.embeddedFile = {
+          name: file.name,
+          url: localUrl,
+          type: /\.pdf$/i.test(file.name) ? "pdf" : "image"
+        };
+        this.pdfimgsrcList.push(localUrl);
+        this.fileListto.push({
+          name: file.name,
+          url: localUrl
+        });
 
         this.$modal.msgSuccess(response.msg);
 
@@ -1109,7 +1334,7 @@
       if (this.donorchargeorgans[index].annexFilesList) {
         const fetchPromises = this.donorchargeorgans[index].annexFilesList.map(
           (value, indexson) => {
-            const pdfimg = this.Networkheader + "/prod-api" + value.url;
+            const pdfimg = this.Networkheader + process.env.VUE_APP_BASE_API + value.url;
             return fetch(pdfimg, config)
               .then(response => response.blob())
               .then(blob => {
@@ -1148,28 +1373,32 @@
       );
     },
 
-    // 鐐瑰嚮宸蹭笂浼犳枃浠�
+    // 鐐瑰嚮宸蹭笂浼犳枃浠讹細鍦ㄩ檮浠跺脊绐楀彸渚у唴宓岄瑙�
     downFile(item) {
+      if (this.operationType == "detail") {
+        const list = (this.fileListto || []).map(f => ({
+          name: f.name,
+          url: f.url
+        }));
+        const index = list.findIndex(f => f.url === item.url);
+        this.$previewFile(list, index > -1 ? index : 0);
+        return;
+      }
+      const ext = String(item.name || "").toLowerCase().split(".").pop();
+      const isImage = ["jpg", "jpeg", "png", "gif", "bmp", "webp"].includes(ext);
+      if (ext !== "pdf" && !isImage) {
+        this.hintitle = "褰撳墠鏂囦欢鏆備笉鏀寔棰勮";
+        this.$modal.msgWarning("褰撳墠鏂囦欢鏆備笉鏀寔棰勮");
+        return;
+      }
+      this.embeddedFile = {
+        name: item.name,
+        url: item.url,
+        type: ext === "pdf" ? "pdf" : "image"
+      };
       this.pdftitle =
         "鍏�" + this.pdfimgsrcList.length + "椤癸紝褰撳墠閫変腑" + item.name;
-      let name = item.name.split(".");
-      if (name[1] == "pdf") {
-        this.$modal.msgWarning("褰撳墠鏂囦欢鏆備笉鏀寔棰勮");
-        this.previewpdf = false;
-        this.hintitle = "褰撳墠鏂囦欢鏆備笉鏀寔棰勮";
-      } else if (name[1] == "jpg" || "png") {
-        console.log(item, "灞曠ず");
-        this.previewpdf = true;
-        if (item.url) {
-          this.pdfimg = item.url;
-        } else {
-          this.pdfimg = "";
-        }
-      } else {
-        this.hintitle = "褰撳墠鏂囦欢鏆備笉鏀寔棰勮";
-        this.$modal.msgWarning("褰撳墠鏂囦欢鏆備笉鏀寔棰勮");
-        this.previewpdf = false;
-      }
+      this.pdfVisible = true;
     },
     getIndexInArray(arr, obj) {
       return arr.indexOf(obj);
@@ -1358,6 +1587,13 @@
   color: #000000;
   cursor: not-allowed;
 }
+::v-deep .el-tag--medium {
+  height: 28px;
+  line-height: 26px;
+  margin-right: 15px;
+  margin-bottom: 15px;
+  font-size: 16px;
+}
 
 ::v-deep .el-input--medium .el-input__inner {
   height: 36px;

--
Gitblit v1.9.3