11
WXL
2024-03-20 40e702344f3d35e251bb098d1227fdea74ee8e4e
src/views/project/tallage/computingBill/index.vue
@@ -29,7 +29,7 @@
            <el-form-item label="算税状态" prop="sex">
              <el-select v-model="form.istax" placeholder="请选择状态">
                <el-option
                  v-for="dict in gatheringlist"
                  v-for="dict in swgatheringlist"
                  :key="dict.label"
                  :label="dict.label"
                  :value="dict.value"
@@ -55,6 +55,7 @@
            ><el-form-item label="税前金额" prop="donateno">
              <el-input
                v-model="form.pretaxamount"
                :disabled="true"
                placeholder="请输入税前金额"
              />
            </el-form-item>
@@ -63,6 +64,7 @@
            ><el-form-item label="扣税金额" prop="donateno">
              <el-input
                v-model="form.taxMoney"
                :disabled="true"
                placeholder="请输入扣税金额"
              />
            </el-form-item>
@@ -72,6 +74,7 @@
            <el-form-item label="税后金额" prop="donationcategory">
              <el-input
                v-model="form.taxedamount"
                :disabled="true"
                placeholder="请输入收款行号"
              />
            </el-form-item>
@@ -112,15 +115,15 @@
            show-summary
          >
            <el-table-column
              prop="organno"
              prop="donorname"
              align="center"
              fixed
              label="案例捐献者"
              width="90"
              width="120"
            >
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row.organno"
                  v-model="scope.row.donorname"
                  placeholder="案例捐献者"
                  :disabled="true"
                />
@@ -131,39 +134,32 @@
              label="申请人"
              align="center"
              width="120"
              prop="caseno"
              prop="username"
            >
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row.caseno"
                  v-model="scope.row.username"
                  :disabled="true"
                  placeholder="申请人"
                />
              </template>
            </el-table-column>
            <el-table-column
              prop="hospitalno"
              prop="deptmentname"
              align="center"
              label="所属组别"
              width="280"
            >
              <template slot-scope="scope">
                <!-- <el-input
                    v-model="scope.row.hospitalname"
                    :disabled="true"
                    placeholder="接收医院"
                  /> -->
                <org-selecter
                  ref="tranHosSelect"
                  :org-type="'4'"
                <el-input
                  v-model="scope.row.deptmentname"
                  :disabled="true"
                  v-model="scope.row.hospitalno"
                  style="width: 100%"
                  placeholder="接收医院"
                />
              </template>
            </el-table-column>
            <el-table-column
              prop="receiveTime"
              prop="applyTime"
              align="center"
              label="申请日期"
              width="200"
@@ -173,7 +169,7 @@
                  clearable
                  size="small"
                  style="width: 100%"
                  v-model="scope.row.receiveTime"
                  v-model="scope.row.applyTime"
                  :disabled="true"
                  type="date"
                  value-format="yyyy-MM-dd HH:mm:ss"
@@ -182,52 +178,37 @@
                </el-date-picker>
              </template>
            </el-table-column>
            <el-table-column
              prop="organname"
              fixed
              align="center"
              label="税前金额"
              width="120"
            >
            <el-table-column prop="pretaxcost" align="center" label="税前金额">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row.organname"
                  v-model="scope.row.pretaxcost"
                  :disabled="true"
                  placeholder="税前金额"
                />
              </template>
            </el-table-column>
            <el-table-column
              label="扣税金额"
              align="center"
              width="120"
              prop="name"
            >
            <el-table-column label="扣税金额" align="center" prop="taXmoney">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row.name"
                  v-model="scope.row.taXmoney"
                  :disabled="true"
                  placeholder="扣税金额"
                />
              </template>
            </el-table-column>
            <el-table-column
              prop="organcharge"
              align="center"
              label="税后金额"
              width="150"
            >
            <el-table-column prop="taxedcost" align="center" label="税后金额">
              <template slot-scope="scope">
                <el-input
                  @blur="chargeSum"
                  v-model="scope.row.organcharge"
                  :disabled="true"
                  v-model="scope.row.taxedcost"
                  placeholder="税后金额"
                />
              </template>
            </el-table-column>
            <el-table-column
              prop="organchargedesc"
              prop="remark"
              width="280"
              align="center"
              label="备注"
@@ -236,17 +217,13 @@
                <el-input
                  type="textarea"
                  :rows="1"
                  v-model="scope.row.organchargedesc"
                  :disabled="true"
                  v-model="scope.row.remark"
                  placeholder="备注"
                />
              </template>
            </el-table-column>
            <el-table-column
              label="操作"
              fixed="right"
              width="260"
              align="center"
            >
            <el-table-column label="操作" fixed="right" align="center">
              <template slot-scope="scope">
                <el-button
                  type="text"
@@ -275,6 +252,12 @@
          v-if="operationType == 'add' || operationType == 'update'"
          >保 存</el-button
        >
        <el-button
          @click="calculateFn"
          v-if="operationType == 'add' || operationType == 'update'"
          >算税</el-button
        >
        <el-button type="info" @click="cancel">关闭</el-button>
      </div>
      <!-- 添加患者 -->
@@ -297,7 +280,7 @@
              >
                <el-form-item label="捐献案例" prop="status">
                  <el-select
                    v-model="patientqueryParams.donorchargeid"
                    v-model="patientqueryParams.donorno"
                    filterable
                    placeholder="请选择"
                  >
@@ -343,39 +326,39 @@
                </el-table-column>
                <el-table-column
                  prop="organname"
                  prop="deptmentname"
                  label="所属组别"
                  show-overflow-tooltip
                >
                </el-table-column>
                <el-table-column prop="organno" label="申请人" width="120">
                <el-table-column prop="username" label="申请人" width="120">
                </el-table-column>
                <el-table-column
                  prop="caseno"
                  prop="applyTime"
                  label="申请日期"
                  show-overflow-tooltip
                >
                </el-table-column>
                <el-table-column
                  prop="name"
                  prop="pretaxcost"
                  label="税前金额"
                  show-overflow-tooltip
                >
                </el-table-column>
                <el-table-column
                  prop="hospitalname"
                  label="扣税金额"
                  prop="taXmoney"
                  label="扣税金额(缺)"
                  show-overflow-tooltip
                >
                </el-table-column>
                <el-table-column
                  prop="receiveTime"
                  prop="taxedcost"
                  label="税后金额"
                  show-overflow-tooltip
                >
                </el-table-column>
                <el-table-column
                  prop="address"
                  prop="remark"
                  label="备注"
                  show-overflow-tooltip
                >
@@ -538,10 +521,12 @@
import { getUserProfile } from "@/api/system/user";
import { getToken } from "@/utils/auth";
import {
  addFundTax,
  getExpertfeeList,
  ExpertfeeListnb,
  getFundtax,
  getMaxFundTaxId,
  updateFundtax,
  addFundtax,
  CalculationDetail,
  listbxiaostatistics
} from "@/api/project/tallage";
export default {
@@ -555,39 +540,21 @@
  name: "Donorchargemanager",
  data() {
    return {
      activeName: 1, //文件类型
      tableData: [
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄"
        },
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄"
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄"
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄"
        }
      swgatheringlist: [
        { label: "未算税", value: 0 },
        { label: "已算税", value: 1 }
      ],
      gatheringlist: [
        { label: "未算税", value: "0" },
        { label: "已算税", value: "1" }
        { label: "未付款", value: "0" },
        { label: "已付款", value: "1" }
      ],
      multipleSelection: [],
      patientqueryParams: {
        paApplyType: 1,
        pacheckno: "047",
        checkstatus: 0,
        pageNum: 1,
        pageSize: 10,
        hospitalno: null,
        paymentid: null
        pageSize: 10
      },
      dialogVisiblepatient: false,
      patienttotal: 0, //
@@ -595,10 +562,7 @@
      pdftitle: "",
      pdfimg: "",
      pdfVisible: false,
      costtypeobj: {
        value: 0,
        label: ""
      },
      maxTaxId: "",
      pdfimgsrcList: [],
      Savereminder: false, //提醒保存弹框
      Reminderquantity: 0, //提醒数量
@@ -656,7 +620,11 @@
      // 当前用户信息
      userprofile: {},
      // 表单参数
      form: {},
      form: {
        istax: 0,
        isdistribute: "0"
      },
      MaxFundTaxId: null, // 最大id
      // 列表参数
      table: {},
      reimbursementList: [],
@@ -695,7 +663,6 @@
      // 当前单据ID
      curId: 0,
      curCase: null,
      //业务操作类型
      operationType: "edit",
@@ -722,14 +689,7 @@
  created() {
    console.log(234);
    this.Getnetworkheader();
    //获取登录者信息
    getUserProfile().then(response => {
      this.userprofile = response.data;
      this.defaultperson = response.data;
      this.standardlevel = response.data.standardlevel;
    });
    this.GetMaxTaxid();
    //获取参数
    this.getroute();
@@ -783,7 +743,72 @@
      this.donorchargeorgans = this.donorchargeorgans.concat(
        this.multipleSelection
      );
      console.log(this.donorchargeorgans, "donorchargeorgans");
      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("添加成功!");
      this.dialogVisiblepatient = false;
    },
    // 计算个税
    calculateFn() {
      if (this.form.id >= this.MaxFundTaxId) {
        this.$modal.loading("正在提交,请稍候!");
        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();
                    });
                  }
                });
              } else {
                this.$modal.closeLoading();
                this.$modal.msgError(res1.msg);
              }
            });
          })
          .catch(() => {});
      } else {
        this.$modal.msgError("当前单据不为最新申请单");
      }
    },
    // 金额合计
    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
      );
    },
    // 多选框选中数据
    handleSelectionChange(val) {
@@ -792,50 +817,18 @@
    // 点击新增
    handleAddpatient(row) {
      this.dialogVisiblepatient = true;
      this.patientqueryParams.hospitalno = this.form.hospitalno;
      this.patientqueryParams.paymentid = null;
      this.patientqueryParams.paymentidIsNotNull = false;
      listDonorchargeorgan(this.patientqueryParams).then(res => {
      this.patientqueryParams.fundTaxid = -1;
      ExpertfeeListnb(this.patientqueryParams).then(res => {
        this.donorchargeList = res.rows;
        this.patienttotal = res.total;
        this.patientqueryParams.paymentidIsNotNull = true;
        console.log(this.donorchargeList);
      });
    },
    // 获取请求头
    Getnetworkheader() {
      let string = window.location.href;
      if (string.includes("9091")) {
        const index = string.indexOf("9091");
        this.Networkheader = string.slice(0, index + 4); // 截取9091及其前部字符
      } else {
        const index = string.indexOf("8032");
        this.Networkheader = string.slice(0, index + 4); // 截取8032及其前部字符
      }
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        infoid: null,
        donateno: null,
        donatetime: null,
        name: null,
        borthdate: null,
        sex: null,
        age: null,
        donationcategory: null,
        donateorgan: null,
        chargeamount: null,
        chargeamounted: null,
        remark: null,
        delFlag: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null
      };
      this.resetForm("form");
    // 获取最大taxid
    GetMaxTaxid() {
      getMaxFundTaxId().then(res => {
        this.MaxFundTaxId = Number(res.msg);
      });
    },
    /** 通过参数获取业务类型 */
@@ -843,8 +836,6 @@
      //选择业务类型:1、新增;2、修改;3、查看
      this.operationType = this.$route.query.operation;
      this.curId = this.$route.query.id;
      this.curCase = this.$route.query.data;
      this.patientqueryParams.paymentid = this.curId;
      console.log("this.$route.query", this.$route.query);
      if (this.operationType == "add") {
@@ -879,40 +870,42 @@
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.title = "新增捐献案例器官费用表";
      if (this.curCase) {
        this.form.infoid = this.curCase.id;
        this.form.paystatus = "1";
        this.form.hospitalname = this.curCase.organizationname;
        this.form.hospitalno = this.curCase.organizationid;
        this.form.borthdate = this.curCase.birthday;
      }
      this.title = "新增专家费汇总单";
      //获取登录者信息
      getUserProfile().then(res => {
        this.form.username = res.createBy;
      });
    },
    /** 修改按钮操作 */
    handleUpdate() {
      this.reset();
      this.title = "收款结算申请单编辑";
      getFundtax(this.curId ).then(response => {
      this.title = "专家费汇总单编辑";
      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();
          });
        }
      });
    },
    /** 查看操作 */
    handleDetail() {
      this.reset();
      listDonorpayment({ id: this.curId }).then(response => {
        this.title = "查看捐献案例器官费用表";
        this.form = response.rows[0];
        //器官费用信息
        listDonorchargeorgan(this.patientqueryParams).then(res => {
          console.log("listDonorchargeorgan", res);
          this.donorchargeorgans = res.rows;
          console.log(this.donorchargeorgans, "donorchargeorgans");
        });
      this.title = "查看专家费汇总单";
      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();
          });
        }
      });
    },
@@ -922,43 +915,23 @@
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.$modal.loading("正在提交,请稍候!");
          //保存
          this.form.serviceFunds = this.donorchargeorgans;
          if (this.form.id != null) {
            for (let k = 0; k < this.donorchargeorgans.length; k++) {
              this.donorchargeorgans[k].paymentid = this.form.id;
            }
            editDonorpayment(this.form).then(res1 => {
            updateFundtax(this.form).then(res1 => {
              if (res1.code == 200) {
                saveDonorchargeorgan(this.donorchargeorgans).then(res2 => {
                  if (res2.code == 200) {
                    this.$modal.msgSuccess("保存成功!");
                  } else {
                    this.$modal.msgError(res2.msg);
                  }
                  this.$modal.closeLoading();
                });
                this.$modal.msgSuccess("保存成功!");
                this.$modal.closeLoading();
              } else {
                this.$modal.closeLoading();
                this.$modal.msgError(res1.msg);
              }
            });
          } else {
            addDonorpayment(this.form).then(response => {
            addFundtax(this.form).then(response => {
              if (response.code == 200) {
                this.form.id = response.msg;
                //保存前校验数据
                for (let k = 0; k < this.donorchargeorgans.length; k++) {
                  this.donorchargeorgans[k].paymentid = response.msg;
                }
                saveDonorchargeorgan(this.donorchargeorgans).then(res2 => {
                  if (res2.code == 200) {
                    this.$modal.msgSuccess("保存成功!");
                  } else {
                    this.$modal.msgError(res2.msg);
                  }
                });
                this.form.id = response.data.fundTaxId;
                this.$modal.msgSuccess("新增成功!");
                this.$modal.closeLoading();
              } else {
                this.$modal.msgError(response.msg);
@@ -970,7 +943,6 @@
      });
    },
    //修改总实收后触发
    chargeSumall() {
      if (this.form.receivedamount == this.form.receivableamount) {
        this.donorchargeorgans.forEach(item => {
@@ -1002,17 +974,22 @@
    handleDelete(row) {
      this.$modal
        .confirm("是否确认删除该条器官费用数据项?")
        .confirm("是否确认删除该条专家费用数据项?")
        .then(() => {
          let value = row;
          value.paymentid = null;
          this.delogans.push(value);
          saveDonorchargeorgan(this.delogans).then(res2 => {
          CalculationDetail({ id: row.id }).then(res2 => {
            if (res2.code == 200) {
              let index = this.donorchargeorgans.indexOf(row);
              this.donorchargeorgans.splice(index, 1);
              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();
                  });
                }
              });
            }
          });
        })