yxh
2023-07-26 9d242e52a874480a612124dd3833ab7cfa65c74f
修改个税计算
已修改1个文件
132 ■■■■ 文件已修改
src/views/project/fund/expertFeeFundApply/index.vue 132 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/project/fund/expertFeeFundApply/index.vue
@@ -662,6 +662,10 @@
        username: null,
        usertype: null,
      },
      //
      amount: 0.00,
      //申请单类型
      currentApplyType: "1",
      //专家列表
@@ -705,6 +709,10 @@
      donateconsolationfundList: [],
      //费用明细列表
      fundDetails: [],
      formData: {},
      totalPreTaxAmount: 0.0,
      totalAfterTaxAmount: 0.0,
      totalAmount: 0.0,
      // 弹出层标题
      title: "",
@@ -1348,7 +1356,7 @@
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          let formData = this.form;
          this.formData = this.form;
          let totalPreTaxAmount = 0.0;
          let totalAfterTaxAmount = 0.0;
          let totalAmount = 0.0;
@@ -1385,43 +1393,78 @@
            //   tempDetail.unitname = tempDetail.unitno;
            // }
            //获取服务项目明细
            let tempItemArr = tempDetail.itemArr;
            let itemIndex = tempItemArr.findIndex(
              (item) => tempDetail.itemid == item.id
            );
            if (itemIndex > -1) {
              tempDetail.itemname = tempItemArr[itemIndex].itemName;
              tempDetail.itemid = tempItemArr[itemIndex].id;
            }
            //获取applytypename、服务费用大类
            let applytypeIndex = this.rowfeeItemTypes.findIndex(
              (item) => tempDetail.applytype == item.value
            );
            if (applytypeIndex > -1) {
              console.log("tempData1", tempData);
              tempDetail.applytypename = this.rowfeeItemTypes[applytypeIndex].label;
              tempDetail.subjecttype = this.rowfeeItemTypes[applytypeIndex].subjecttype;
              tempDetail.subjecttypename = this.rowfeeItemTypes[applytypeIndex].subjecttypename;
            }
            this.fundDetails[m] = tempDetail;
            //计算个税            
            //if (isNaN(parseFloat(tempDetail.taxedamount)))
            if (tempDetail.taxedamount == undefined || tempDetail.taxedamount == null || tempDetail.taxedamount == 0 || tempDetail.taxedamount == '') {
              //获取参数
              this.taxParam.beneficiaryNo = tempDetail.beneficiaryno;
              this.taxParam.money = tempDetail.amount.toString();
              this.taxParam.startTime = this.form.createTime.substring(0, 10);
            // 计算税后金额
            if (tempDetail.taxedamount == undefined || tempDetail.taxedamount == null || tempDetail.taxedamount == 0 || tempDetail.taxedamount == '') {
              //获取参数
              this.taxParam.money = tempDetail.amount.toString();
              getTaxByBeneFiciaryNo(this.taxParam).then((res) => {
                if (res.code == 200) {
                  tempDetail.taxamount = res.data;
                  tempDetail.taxedamount = tempDetail.amount - tempDetail.taxamount;
                  this.fundDetails[k] = tempDetail;
                  this.totalAfterTaxAmount += parseFloat(tempDetail.taxedamount);
                  this.totalAmount += parseFloat(tempDetail.amount);
                  console.log('第二步');
                  this.brforaFn()
                }
              });
            }
            //if (isNaN(parseFloat(tempDetail.amount)))
            // 计算税前金额
            if (tempDetail.amount == undefined || tempDetail.amount == null || tempDetail.amount == 0 || tempDetail.amount == '') {
              //获取参数
              this.taxParam.beneficiaryNo = tempDetail.beneficiaryno;
              this.taxParam.money = tempDetail.taxedamount.toString();
              this.taxParam.startTime = this.form.createTime.substring(0, 10);
              getTaxBeforeByAfterMoney(this.taxParam).then((res) => {
                if (res.code == 200) {
                  tempDetail.taxamount = res.data.nowTax;
                  tempDetail.amount = res.data.nowTaxBeforeMoney;
                  tempDetail.amount = parseFloat(res.data.nowTaxBeforeMoney);
                  this.fundDetails[k] = tempDetail;
                  this.totalAfterTaxAmount += parseFloat(tempDetail.taxedamount);
                  this.totalAmount += parseFloat(tempDetail.amount);
                  console.log("1", this.amount);
                  console.log('第二步');
                  this.brforaFn()
                }
              });
            }
            totalAfterTaxAmount += parseFloat(tempDetail.taxedamount);
            totalAmount += parseFloat(tempDetail.amount);
            this.fundDetails[k] = tempDetail;
          }
        }
      });
    },
          this.loading = true;
    // 第二步
    brforaFn() {
          //附件处理
      this.loading = true;
          let list = this.fileList;
          if (list.length > 0) {
            this.form.annexbankcard = list.map(item => item.url).join(",");
@@ -1429,9 +1472,9 @@
          //
          this.form.donorname = this.curCase.name;
          this.form.pretaxcost = parseFloat(totalPreTaxAmount).toFixed(2);
          this.form.taxedcost = parseFloat(totalAfterTaxAmount).toFixed(2);
          this.form.amountrequested = totalAmount.toFixed(2);
      this.form.pretaxcost = parseFloat(this.totalPreTaxAmount).toFixed(2);
      this.form.taxedcost = parseFloat(this.totalAfterTaxAmount).toFixed(2);
      this.form.amountrequested = this.totalAmount.toFixed(2);
          if (this.form.id != null) {
            this.form.recordstatus = -1;
            updateFund(this.form).then((res) => {
@@ -1439,67 +1482,20 @@
              this.dialogOpen = false;
              this.getList();
              this.selectDonotor(this.curCase);
              this.$modal.msgSuccess("修改成功");
          // this.$modal.msgSuccess("修改成功");
              this.loading = false;
              for (let m = 0; m < this.fundDetails.length; m++) {
                let tempData = this.fundDetails[m];
                let tempItemArr = tempData.itemArr;
                tempData.fundid = formData.id;
                //获取服务项目明细
                let itemIndex = tempItemArr.findIndex(
                  (item) => tempData.itemid == item.id
                );
                if (itemIndex > -1) {
                  tempData.itemname = tempItemArr[itemIndex].itemName;
                  tempData.itemid = tempItemArr[itemIndex].id;
                }
                //获取applytypename、服务费用大类
                let applytypeIndex = this.rowfeeItemTypes.findIndex(
                  (item) => tempData.applytype == item.value
                );
                if (applytypeIndex > -1) {
                  console.log("tempData1", tempData);
                  tempData.applytypename = this.rowfeeItemTypes[applytypeIndex].label;
                  tempData.subjecttype = this.rowfeeItemTypes[applytypeIndex].subjecttype;
                  tempData.subjecttypename = this.rowfeeItemTypes[applytypeIndex].subjecttypename;
                }
                console.log("tempData2", tempData);
                if (tempData.id > 0) {
                  updateFunddetail(tempData).then((res) => { });
                } else {
              tempData.fundid = this.formData.id;
                  addFunddetail(tempData).then((res) => { });
                }
              }
            });
          } else {
            //保存费用申请
            for (let m = 0; m < this.fundDetails.length; m++) {
              let tempData = this.fundDetails[m];
              let tempUtemArr = tempData.itemArr;
              //获取服务项目明细
              let itemIndex = tempUtemArr.findIndex(
                (item) => tempData.itemid == item.id
              );
              if (itemIndex > -1) {
                tempData.itemname = tempUtemArr[itemIndex].itemName;
                tempData.itemid = tempUtemArr[itemIndex].id;
              }
              //获取applytypename、服务费用大类
              let applytypeIndex = this.rowfeeItemTypes.findIndex(
                (item) => tempData.applytype == item.value
              );
              if (applytypeIndex > -1) {
                tempData.applytypename = this.rowfeeItemTypes[applytypeIndex].label;
                tempData.subjecttype = this.rowfeeItemTypes[applytypeIndex].subjecttype;
                tempData.subjecttypename = this.rowfeeItemTypes[applytypeIndex].subjecttypename;
              }
              this.fundDetails[m] = tempData;
            }
            this.form.serviceFunddetails = 0;
            this.fundDetails.map((item) => {
              this.form.serviceFunddetails += item.amount;
@@ -1517,10 +1513,10 @@
                this.loading = false;
              }
            });
        //关闭窗口
            this.dialogOpen = false;
          }
        }
      });
    },
    //获取专家列表