11
WXL
2024-03-21 97a2bd7d2621cc7be6629beebe5e03d2b3eb2283
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("正在提交,请稍候!");
          //保存
          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();
                });
            }
          });
        })