1
wwl
2025-03-10 1a12347f2419cc2b7bd5e2b7e233d315cf2c32c9
1
1个文件已修改
300 ■■■■ 已修改文件
src/views/system/tijian/index.vue 300 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/tijian/index.vue
@@ -89,7 +89,7 @@
              <span slot="label" style="display: inline-block; border-bottom: 2px solid blue" @click="openname">
                姓名
              </span>
              <el-input v-model="form.cusName" placeholder="请输入姓名" :disabled="isDisabled" />
              <el-input v-model="form.cusName" placeholder="请输入姓名" :disabled="isDisabled" @input="form.cusName = $event.replace(/\s/g, '')" />
            </el-form-item>
            <el-form-item label="证件类型" prop="idType">
@@ -147,7 +147,7 @@
              <span slot="label" style="display: inline-block; border-bottom: 2px solid blue" @click="handleQuery">
                证件号码
              </span>
              <el-input :disabled="isDisabled" v-model="form.cusIdcard" placeholder="请输入身份证号" @input="inputChange" />
              <el-input :disabled="isDisabled" v-model="form.cusIdcard" placeholder="请输入身份证号" @input="handleIdCardInput"/>
              <!-- <i style="
                    font-size: 1rem;
                    position: absolute;
@@ -179,7 +179,7 @@
                trigger: 'blur',
              },
            ]">
              <el-input v-model="form.cusPhone" placeholder="请输入联系电话" :disabled="isDisabled" />
              <el-input v-model="form.cusPhone" placeholder="请输入联系电话" :disabled="isDisabled" @input="form.cusPhone = $event.replace(/\s/g, '')"/>
            </el-form-item>
            <el-form-item label="出生日期" prop="cusBrithday">
@@ -743,15 +743,12 @@
  getPackageListName,
  getaddtTransition,
  tuantiqueren,
  getTransitionList,
  getTransitionList1,
  getByTeamNo,
  delTbBycusCardIdAndProId,
  getLoadFile,
  getIsRequired,
  getconfigKey,
  getHistryTjOrderProByCusIdCard,
  readCertCardInfos,
  gaibianzhekou,
} from "@/api/system/tijian";
import { addComp } from "@/api/system/comp";
@@ -1076,6 +1073,10 @@
    this.marryall = 0;
  },
  methods: {
    handleIdCardInput(value) {
  this.form.cusIdcard = value.replace(/\s/g, '');
  this.inputChange(); // 保留原有的身份证输入处理逻辑
},
    debounceNumberChange(currentValue, oldValue) {
      clearTimeout(this.debounceTimer);
      this.debounceTimer = setTimeout(() => {
@@ -1125,7 +1126,7 @@
        .catch(() => { });
    },
    handleManualChange(row) {
      // console.log("这是主动出发的");
      console.log("这是主动出发的");
      this.updateProPrice(row);
    },
    validateDiscount(row) {
@@ -1152,7 +1153,7 @@
        (Math.floor((this.TotalPrice / this.TotalPrice1) * 100) / 100) * 10;
    },
    updateProPrice1(row) {
      // console.log("进入了1")
      console.log("进入了1")
      const ordPrice = new Big(row.ordPrice);
      const discount = new Big(row.discount);
      const result = ordPrice.times(discount.div(10));
@@ -1699,36 +1700,41 @@
        });
    },
    /** 登记提交按钮 */
    submitForm() {
      let _this = this;
      this.$refs["form"].validate((valid) => {
        if (valid) {
          // return;
          if (this.form.cusSex === "女") {
            this.form.cusSex = 1;
          }
          if (this.form.cusSex === "男") {
            this.form.cusSex = 0;
          }
          if (this.form.cusSex === "未知") {
            this.form.cusSex = 2;
          }
          if (this.form.tjType === "") {
            this.form.tjType = this.dict.type.dict_team[0].value;
          }
    /** 登记提交按钮 */
submitForm() {
  let _this = this;
  this.$refs["form"].validate((valid) => {
    if (valid) {
      // 创建表单数据的副本并去除空格
      const formData = { ...this.form };
      formData.cusName = formData.cusName ? formData.cusName.replace(/\s/g, '') : '';
      formData.cusPhone = formData.cusPhone ? formData.cusPhone.replace(/\s/g, '') : '';
      formData.cusIdcard = formData.cusIdcard ? formData.cusIdcard.replace(/\s/g, '') : '';
          addCustomer(this.form).then((response) => {
            this.responseList = response.data;
      // 处理性别值
      if (formData.cusSex === "女") {
        formData.cusSex = 1;
      }
      if (formData.cusSex === "男") {
        formData.cusSex = 0;
      }
      if (formData.cusSex === "未知") {
        formData.cusSex = 2;
      }
      if (formData.tjType === "") {
        formData.tjType = this.dict.type.dict_team[0].value;
      }
            this.$modal.msgSuccess("新增成功");
            _this.tcShow = true;
            _this.isDisabled = true;
            _this.top = false;
          });
        }
      addCustomer(formData).then((response) => {
        this.responseList = response.data;
        this.$modal.msgSuccess("新增成功");
        _this.tcShow = true;
        _this.isDisabled = true;
        _this.top = false;
      });
    },
    }
  });
},
    getmailType() {
      if (this.getType == "2") {
@@ -1841,7 +1847,6 @@
        let configKey = "getInfoFromSqlData";
        getconfigKey(configKey).then((res) => {
          if (res.code == 200) {
            console.log(res.msg, 'res.msg');
            if (res.msg == "N") {
              var websocket = null;
              var url = this.valueUrl;
@@ -1881,11 +1886,9 @@
              //接收到消息的回调方法
              websocket.onmessage = (event) => {
                var resultObj = eval("(" + event.data + ")");  // 注意:eval存在安全隐患,建议用JSON.parse
                var resultObj = eval("(" + event.data + ")");
                this.readCardWebSocket(resultObj);
              };
            } else if (res.msg == "Y") {
              /* this.$refs.aaa.open = true;
              this.$refs.aaa.getAllList();
@@ -1904,8 +1907,8 @@
    // 最新使用webSocket通信
    readCardWebSocket(resultObj) {
      let _this = this;
      console.log(resultObj, 'resultObj');
      if (resultObj.code === 200 && resultObj.data.name && resultObj.data.name != null) {
      if (resultObj.code === 200 && resultObj.data.name != null) {
        //回显相关数据
        _this.form.cusName = resultObj.data.name;
        _this.form.cusSex = resultObj.data.sex == "0" ? "女" : "男";
@@ -2049,9 +2052,9 @@
            }
          }
        };
        // websocket.onclose = function () {
        //   alert("读卡器连接关闭");
        // };
        websocket.onclose = function () {
          alert("读卡器连接关闭");
        };
        websocket.onmessage = function (event) {
          var resultObj = JSON.parse(event.data);
          _this.form.cusName = resultObj.data.name;
@@ -2143,9 +2146,9 @@
            }
          }
        };
        // websocket.onclose = function () {
        //   alert("读卡器连接关闭");
        // };
        websocket.onclose = function () {
          alert("读卡器连接关闭");
        };
        websocket.onmessage = function (event) {
          var resultObj = JSON.parse(event.data);
          _this.form.cusName = resultObj.data.name;
@@ -2935,103 +2938,122 @@
      });
    },
    submitCheckinfee() {
      let _this = this;
      if (_this.tjCategory !== "") {
        let List = _this.tableData1;
        if (this.responseList.cusId) {
          var userId = this.responseList.cusId;
        } else {
          var userId = _this.form.cusId;
        }
        let tjType = _this.form.tjType;
        if (this.tableData[0]) {
          var pacId = this.tableData[0].pacId;
        }
        List.forEach((item) => {
          if (item.list) {
            item.list.forEach((item1) => {
              this.tjOrderList.push({
                proName: item1.proName,
                proPrice: item1.nowPrice,
                proId: item1.proId,
              });
            });
          } else if (item.tjProjectList) {
            item.tjProjectList.forEach((item1) => {
              this.tjOrderList.push({
                proName: item1.proName,
                proPrice: item1.priceNow,
                proId: item1.proId,
              });
            });
          } else {
            this.tjOrderList.push({
              proName: item.proName,
              proPrice: item.ysPrice,
              proId: item.proId,
            });
          }
        });
        let copeWith = this.TotalPrice1;
        let paidIn = this.TotalPrice.toString();
        let discount = this.discount;
        this.tjFlowingWater = { copeWith, paidIn, discount };
  let _this = this;
  if (_this.tjCategory !== "") {
    let List = _this.tableData1;
    if (this.responseList.cusId) {
      var userId = this.responseList.cusId;
    } else {
      var userId = _this.form.cusId;
    }
    let tjType = _this.form.tjType;
    if (this.tableData[0]) {
      var pacId = this.tableData[0].pacId;
    }
        let data;
        if (pacId || this.getType == "2") {
          data = {
            photo: this.srcUrl,
            pacId,
            tjOrderList: this.tjOrderList,
            tjFlowingWater: this.tjFlowingWater,
            userId,
            tjType,
            getType: this.getType,
            addAddress: this.addAddress,
            tjCategory: this.tjCategory,
          };
        } else {
          data = {
            photo: this.srcUrl,
            tjOrderList: this.tjOrderList,
            tjFlowingWater: this.tjFlowingWater,
            userId,
            tjType,
            getType: this.getType,
            tjCategory: this.tjCategory,
          };
        }
        getOrder(data).then((res) => {
          this.$modal.msgSuccess("提交成功");
          this.tjNumbers = res.msg;
          this.charge = true;
          let data = {
            tjNum: res.msg,
          };
          getfindTj(data).then((response) => {
            if (response.data) {
              this.feeitems = response.data;
              if (this.feeitems.length != 0) {
                this.$nextTick(() => {
                  this.$refs.multipleTable.toggleRowSelection(
                    this.feeitems[0],
                    true
                  );
                });
              } else {
                this.$refs.multipleTable.clearSelection();
              }
              this.loading = false;
            } else {
              this.feeitems = [];
              this.loading = false;
            }
    // 去空格处理
    const processedForm = {
      ...this.form,
      cusName: this.form.cusName ? this.form.cusName.replace(/\s/g, '') : '',
      cusPhone: this.form.cusPhone ? this.form.cusPhone.replace(/\s/g, '') : '',
      cusIdcard: this.form.cusIdcard ? this.form.cusIdcard.replace(/\s/g, '') : ''
    };
    List.forEach((item) => {
      if (item.list) {
        item.list.forEach((item1) => {
          this.tjOrderList.push({
            proName: item1.proName,
            proPrice: item1.nowPrice,
            proId: item1.proId,
          });
        });
      } else if (item.tjProjectList) {
        item.tjProjectList.forEach((item1) => {
          this.tjOrderList.push({
            proName: item1.proName,
            proPrice: item1.priceNow,
            proId: item1.proId,
          });
        });
      } else {
        this.$modal.msgError("请选择体检类别");
        this.tjOrderList.push({
          proName: item.proName,
          proPrice: item.ysPrice,
          proId: item.proId,
        });
      }
    },
    });
    let copeWith = this.TotalPrice1;
    let paidIn = this.TotalPrice.toString();
    let discount = this.discount;
    this.tjFlowingWater = { copeWith, paidIn, discount };
    let data;
    if (pacId || this.getType == "2") {
      data = {
        photo: this.srcUrl,
        pacId,
        tjOrderList: this.tjOrderList,
        tjFlowingWater: this.tjFlowingWater,
        userId,
        tjType,
        getType: this.getType,
        addAddress: this.addAddress,
        tjCategory: this.tjCategory,
        // 使用去掉空格后的数据
        cusName: processedForm.cusName,
        cusPhone: processedForm.cusPhone,
        cusIdcard: processedForm.cusIdcard
      };
    } else {
      data = {
        photo: this.srcUrl,
        tjOrderList: this.tjOrderList,
        tjFlowingWater: this.tjFlowingWater,
        userId,
        tjType,
        getType: this.getType,
        tjCategory: this.tjCategory,
        // 使用去掉空格后的数据
        cusName: processedForm.cusName,
        cusPhone: processedForm.cusPhone,
        cusIdcard: processedForm.cusIdcard
      };
    }
    getOrder(data).then((res) => {
      this.$modal.msgSuccess("提交成功");
      this.tjNumbers = res.msg;
      this.charge = true;
      let data = {
        tjNum: res.msg,
      };
      getfindTj(data).then((response) => {
        if (response.data) {
          this.feeitems = response.data;
          if (this.feeitems.length != 0) {
            this.$nextTick(() => {
              this.$refs.multipleTable.toggleRowSelection(
                this.feeitems[0],
                true
              );
            });
          } else {
            this.$refs.multipleTable.clearSelection();
          }
          this.loading = false;
        } else {
          this.feeitems = [];
          this.loading = false;
        }
      });
    });
  } else {
    this.$modal.msgError("请选择体检类别");
  }
},
    // 表格单选
    handleSelect(selection, val) {