yxh
2023-07-27 ca4261a5d05d0359d02e332b88ed149a0656eae1
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: "",
@@ -875,7 +883,7 @@
          addExternalperson(this.expertform).then((response) => {
            if (response.code == 200) {
              this.$modal.msgSuccess("新增专家信息成功!");
              listExternalperson().then((res) => {
                this.personlist = res.rows;
                console.log("new personlist", this.personlist);
@@ -1348,10 +1356,10 @@
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          let formData = this.form;
          let totalPreTaxAmount = 0.0;
          let totalAfterTaxAmount = 0.0;
          let totalAmount = 0.0;
          this.formData = this.form;
          // let totalPreTaxAmount = 0.0;
          // let totalAfterTaxAmount = 0.0;
          // let totalAmount = 0.0;
          //保存前校验数据
          for (let k = 0; k < this.fundDetails.length; k++) {
@@ -1385,133 +1393,111 @@
            //   tempDetail.unitname = tempDetail.unitno;
            // }
          }
          //附件处理
          let list = this.fileList;
          if (list.length > 0) {
            this.form.annexfiles = list.map(item => item.url).join(",");
          }
          //处理明细
          for (let i = 0; i < this.fundDetails.length; i++) {
            let tempDetail = this.fundDetails[i];
            //获取服务项目明细
            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) {
              tempDetail.applytypename = this.rowfeeItemTypes[applytypeIndex].label;
              tempDetail.subjecttype = this.rowfeeItemTypes[applytypeIndex].subjecttype;
              tempDetail.subjecttypename = this.rowfeeItemTypes[applytypeIndex].subjecttypename;
            }
            this.fundDetails[k] = tempDetail;
            /*
            //计算个税            
            //if (isNaN(parseFloat(tempDetail.taxedamount)))
            //获取参数
            this.taxParam.beneficiaryNo = tempDetail.beneficiaryno;
            this.taxParam.startTime = this.form.createTime.substring(0, 10);
            // 计算税后金额
            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);
              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);
                }
              });
            }
            //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);
                }
              });
            }
            totalAfterTaxAmount += parseFloat(tempDetail.taxedamount);
            totalAmount += parseFloat(tempDetail.amount);
            this.fundDetails[k] = tempDetail;
            */
          }
          //费用合计
          // this.form.pretaxcost = parseFloat(this.totalPreTaxAmount).toFixed(2);
          // this.form.taxedcost = parseFloat(this.totalAfterTaxAmount).toFixed(2);
          // this.form.amountrequested = this.totalAmount.toFixed(2);
          //保存数据
          this.loading = true;
          //附件处理
          let list = this.fileList;
          if (list.length > 0) {
            this.form.annexbankcard = list.map(item => item.url).join(",");
          }
          this.form.serviceFunddetails = 0;
          this.fundDetails.map((item) => {
            this.form.serviceFunddetails += item.amount;
          });
          this.form.serviceFunddetails = this.fundDetails;
          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);
          if (this.form.id != null) {
            this.form.recordstatus = -1;
            updateFund(this.form).then((response) => {
              this.getfundList();
              this.dialogOpen = false;
              this.getList();
              this.selectDonotor(this.curCase);
              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) {
                  tempData.applytypename = this.rowfeeItemTypes[applytypeIndex].label;
                }
                if (tempData.id > 0) {
                  updateFunddetail(tempData).then((response2) => { });
                } else {
                  addFunddetail(tempData).then((response2) => { });
                }
              }
            });
          } 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;
              }
              this.fundDetails[m] = tempData;
            }
            this.form.serviceFunddetails = 0;
            this.fundDetails.map((item) => {
              this.form.serviceFunddetails += item.amount;
            });
            this.form.serviceFunddetails = this.fundDetails;
            this.form.recordstatus = -1;
            batchUploadFund(this.form).then((response) => {
              if (response.code === 200) {
                this.$modal.msgSuccess("新增成功");
                this.loading = false;
                this.selectDonotor(this.curCase);
              } else {
                this.$modal.msgError("新增失败:" + response.msg);
                this.loading = false;
              }
            });
            this.dialogOpen = false;
            //捐献者
            this.form.donorname = this.curCase.name;
          }
          else {
            this.form.recordstatus = -1;
          }
          batchUploadFund(this.form).then((response) => {
            if (response.code === 200) {
              this.$modal.msgSuccess("专家劳务费保存成功!");
              this.selectDonotor(this.curCase);
            } else {
              this.$modal.msgError("专家劳务费保存失败:" + response.msg);
            }
          });
          //关闭窗口
          this.loading = false;
          this.dialogOpen = false;
        }
      });
    },
@@ -1779,6 +1765,8 @@
          this.rowfeeItemTypes.push({
            value: dataList[m].itemType,
            label: dataList[m].itemTypeName,
            subjecttype: dataList[m].subjecttype,
            subjecttypename: dataList[m].subjecttypename,
          });
        }
      });