1
wwl
7 天以前 5017033ae6120a4fbf9d60f5c0e4c963799c0e54
src/views/system/tijian/index.vue
@@ -427,7 +427,7 @@
            <el-form-item label="姓名" prop="pacName">
              <el-input v-model="queryParam.pacName" placeholder="请输入姓名" clearable @keyup.enter.native="handle" />
            </el-form-item>
             <el-form-item label="身份证" prop="pacName">
            <el-form-item label="身份证" prop="pacName">
              <el-input v-model="queryParam.pacName" placeholder="请输入身份证" clearable @keyup.enter.native="handle" />
            </el-form-item>
            <el-form-item>
@@ -952,7 +952,7 @@
      // 显示搜索条件
      showSearch: true,
      tjtype: false,
      sftj:null,
      sftj: null,
      activeNames: "first",
      // 树状形状
      Treedata: [],
@@ -984,12 +984,10 @@
        pacName: null,
        pacRemark: null,
      },
      // valueUrl: "ws://127.0.0.1:18890",
      // valueUrl: "ws://192.168.1.3:6789/websocket",
      valueUrl: "ws://127.0.0.1:6789/websocket",
      valueUrls: "ws://127.0.0.1:6789/websocket",
      // valueUrls: "ws://"+getIp() +":6789/websocket",
      // valueUrl: "ws://127.0.0.1:6789/websocket",
      // valueUrls: "ws://127.0.0.1:6789/websocket",
      valueUrl: "ws://192.168.1.244:6789/websocket",
      valueUrls: "ws://192.168.1.244:6789/websocket",
      webSocket: null,
      // 身份证需要
      // socket: null,
@@ -1742,57 +1740,57 @@
    },
    /** 登记提交按钮 */
    /** 登记提交按钮 */
  submitForm() {
  let _this = this;
  if (!this.form.cusPhone || !this.form.cusName) {
    this.$message.warning("请填选必填项");
    return;
  }
  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, '') : '';
      // 添加 sfzImg 字段
      formData.sfzImg = this.imageUrl || ''; // 使用 base64 格式的头像数据,若为空则传空字符串
      // 处理性别值
      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;
    submitForm() {
      let _this = this;
      if (!this.form.cusPhone || !this.form.cusName) {
        this.$message.warning("请填选必填项");
        return;
      }
      // 可选:检查 sfzImg 是否存在
      // if (!formData.sfzImg) {
      //   this.$message.warning("请先获取身份证头像");
      //   return;
      // }
      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, '') : '';
          // 添加 sfzImg 字段
          formData.sfzImg = this.imageUrl || ''; // 使用 base64 格式的头像数据,若为空则传空字符串
      addCustomer(formData).then((response) => {
        this.responseList = response.data;
        this.form.tjType = this.dict.type.dict_team[0].value;
        this.$modal.msgSuccess("新增成功");
        _this.tcShow = true;
        _this.isDisabled = true;
        _this.top = false;
      }).catch((error) => {
        this.$modal.msgError("登记失败,请检查数据");
        console.error("Error in addCustomer:", error);
          // 处理性别值
          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;
          }
          // 可选:检查 sfzImg 是否存在
          // if (!formData.sfzImg) {
          //   this.$message.warning("请先获取身份证头像");
          //   return;
          // }
          addCustomer(formData).then((response) => {
            this.responseList = response.data;
            this.form.tjType = this.dict.type.dict_team[0].value;
            this.$modal.msgSuccess("新增成功");
            _this.tcShow = true;
            _this.isDisabled = true;
            _this.top = false;
          }).catch((error) => {
            this.$modal.msgError("登记失败,请检查数据");
            console.error("Error in addCustomer:", error);
          });
        }
      });
    }
  });
},
    },
    getmailType() {
      if (this.getType == "2") {
@@ -2978,7 +2976,7 @@
    // 处理订单项目
    processOrderItems(cusId) {
      getTransitionList1(cusId).then((response) => {
       this.tableData1 = response.data;
        this.tableData1 = response.data;
        // if (response.data.tjCategory != null) {
        //   this.tjCategory = response.data.tjCategory;
        // }
@@ -3288,100 +3286,100 @@
    },
    // 最后提交按钮
  submitPrice() {
  let _this = this;
  this.loadingSubmit = true;
  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;
    }
    // tjOrderList 处理
    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 };
    const newArray = this.tableData1
      .filter((item) => item.discount < 10)
      .map((item) => ({
        discount: item.discount,
        parentProId: item.parentProId,
        cusIdCard: item.cusId,
        yhj: item.nowPrice,
      }));
    gaibianzhekou(newArray).then((res) => {
      this.loadingSubmit = false;
      if (res.code === 200) {
        let data;
        if (pacId || this.tjOrderList.length > 0) {
          data = {
            photo: this.srcUrl, // 保留原有 photo 字段(如果后端仍需要)
            sfzImg: this.imageUrl, // 添加 sfzImg 字段,优先使用服务器URL,若无则使用base64
            pacId,
            tjOrderList: this.tjOrderList,
            tjFlowingWater: this.tjFlowingWater,
            userId,
            tjType,
            tjCategory: this.tjCategory,
            firmId: this.form.firmId,
            firmName: this.form.firmName,
            firmDeptName: this.form.firmDeptName,
          };
          this.listgetOrder(data);
    submitPrice() {
      let _this = this;
      this.loadingSubmit = true;
      if (_this.tjCategory !== "") {
        let List = _this.tableData1; // 单个项目信息
        if (this.responseList.cusId) {
          var userId = this.responseList.cusId;
        } else {
          this.loadingSubmit = false;
          this.$message({
            type: "warning",
            message: "请选择套餐!",
          });
          var userId = _this.form.cusId;
        }
        let tjType = _this.form.tjType;
        if (this.tableData[0]) {
          var pacId = this.tableData[0].pacId;
        }
        // tjOrderList 处理
        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 };
        const newArray = this.tableData1
          .filter((item) => item.discount < 10)
          .map((item) => ({
            discount: item.discount,
            parentProId: item.parentProId,
            cusIdCard: item.cusId,
            yhj: item.nowPrice,
          }));
        gaibianzhekou(newArray).then((res) => {
          this.loadingSubmit = false;
          if (res.code === 200) {
            let data;
            if (pacId || this.tjOrderList.length > 0) {
              data = {
                photo: this.srcUrl, // 保留原有 photo 字段(如果后端仍需要)
                sfzImg: this.imageUrl, // 添加 sfzImg 字段,优先使用服务器URL,若无则使用base64
                pacId,
                tjOrderList: this.tjOrderList,
                tjFlowingWater: this.tjFlowingWater,
                userId,
                tjType,
                tjCategory: this.tjCategory,
                firmId: this.form.firmId,
                firmName: this.form.firmName,
                firmDeptName: this.form.firmDeptName,
              };
              this.listgetOrder(data);
            } else {
              this.loadingSubmit = false;
              this.$message({
                type: "warning",
                message: "请选择套餐!",
              });
            }
          } else {
            this.loadingSubmit = false;
            this.$modal.msgError("改变折扣错误");
          }
        });
      } else {
        this.loadingSubmit = false;
        this.$modal.msgError("改变折扣错误");
        this.$modal.msgError("请选择体检类别");
      }
    });
  } else {
    this.loadingSubmit = false;
    this.$modal.msgError("请选择体检类别");
  }
},
    },
  },
};
</script>