qinxianzhangyao
2024-07-15 fb66c7aafd8d7ef6f4be05a0c12cfa3c4ca84863
src/views/reservation/reservations/index.vue
@@ -29,7 +29,7 @@
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
    <el-row :gutter="10" style="margin: 10px 15px;">
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-delete" size="mini" :disabled="multiple" @click="batch"
          v-hasPermi="['reservation:reservation:remove']">撤销预约</el-button>
@@ -42,13 +42,14 @@
    </el-row>
    <el-table border v-loading="loading" :data="reservationList" @selection-change="handleSelectionChange"
      :default-sort="{ prop: 'reservationTime', order: 'descending' }" highlight-current-row>
      :default-sort="{ prop: 'reservationTime', order: 'descending' }" highlight-current-row style="margin-left: 15px;">
      <el-table-column type="selection" width="40px" align="center" fixed="left" :selectable="selectHandle" />
      <el-table-column label="姓名" align="center" prop="name" width="90px" :show-overflow-tooltip="true" fixed="left" />
      <el-table-column label="性别" align="center" prop="sex" width="60px" :show-overflow-tooltip="true">
        <template slot-scope="scope">
          <span v-if="scope.row.sex == '0'">男</span>
          <span v-if="scope.row.sex == '1'">女</span>
          <span v-if="scope.row.sex == '2'">未知</span>
        </template>
      </el-table-column>
      <el-table-column label="年龄" align="center" prop="age" width="60px" :show-overflow-tooltip="true" />
@@ -59,15 +60,18 @@
        </template>
      </el-table-column>
      <el-table-column label="联系电话" align="center" prop="phoe" width="110px" :show-overflow-tooltip="true" />
      <el-table-column label="邮箱" align="center" prop="email" :show-overflow-tooltip="true" width="160px" />
      <el-table-column label="地址" align="center" prop="address" :show-overflow-tooltip="true" width="160px" />
      <el-table-column label="预约时间" align="center" prop="reservationTime" width="100px" :show-overflow-tooltip="true"
        sortable>
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.reservationTime, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column label="体检类型" align="center" prop="tjType" width="80px" :show-overflow-tooltip="true" />
      <el-table-column label="体检类型" align="center" prop="tjType" width="80px" :show-overflow-tooltip="true">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.dict_team" :value="scope.row.tjType" />
        </template>
      </el-table-column>
      <el-table-column label="婚姻" align="center" prop="marriage" width="60px" :show-overflow-tooltip="true">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.dict_user_marry" :value="scope.row.marriage" />
@@ -87,6 +91,8 @@
        </template>
      </el-table-column>
      <el-table-column label="单位名称" align="center" prop="company" :show-overflow-tooltip="true" />
      <el-table-column label="邮箱" align="center" prop="email" :show-overflow-tooltip="true" width="160px" />
      <el-table-column label="地址" align="center" prop="address" :show-overflow-tooltip="true" width="160px" />
      <el-table-column label="操作" align="center" width="90px" fixed="right">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-s-order" @click="handleUpdate1(scope.row)"
@@ -161,10 +167,10 @@
                <el-input v-model="formIn.address" placeholder="请输入现居住地址" style="width: 410px" />
              </el-form-item>
              <el-form-item label="体检类别" prop="tjCategory">
                <el-select style="width: 150px" v-model="formIn.tjCategory" placeholder="请选择体检类别">
                  <el-option v-for="dict in dict.type.dict_tjtype" :key="dict.value" :label="dict.label"
                    :value="dict.value"></el-option>
                </el-select>
                <el-select style="width: 140px" v-model="formIn.tjCategory" placeholder="请选择体检类别">
            <el-option v-for="dict in dict.type.dict_tjtype" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
              </el-form-item>
              <el-form-item label="部门" prop="department">
                <el-input v-model="formIn.department" placeholder="请输入部门" style="width: 160px" />
@@ -272,7 +278,7 @@
                    <!-- <div class="tab1"> -->
                    <!-- <el-form :inline="true" class="tab1"> -->
                    <el-form-item label="应收金额">
                      <el-input placeholder="应收金额" :value="TotalPrice1 + '.00'" disabled style="width: 160px"></el-input>
                      <el-input placeholder="应收金额" :value="TotalPrice1 " disabled style="width: 160px"></el-input>
                    </el-form-item>
                    <el-form-item label="优惠折扣">
                      <!-- <el-input style="width: 100px" type="number" v-model="discount" :value="discount"></el-input> -->
@@ -280,7 +286,7 @@
                        :step="0.1" :max="10" :min="1" @change="numberChange" :disabled="isfalse"></el-input-number>
                    </el-form-item>
                    <el-form-item label="实收金额">
                      <el-input placeholder="实收金额" v-model="TotalPrice" style="width: 120px"></el-input>
                      <el-input placeholder="实收金额" v-model="TotalPrice" style="width: 120px" disabled></el-input>
                    </el-form-item>
                    <el-form-item>
@@ -311,9 +317,9 @@
                            item.parentName +
                            " (应收金额:" +
                            item.ordPrice +
                            ".00元 / 实收金额:" +
                            " / 实收金额:" +
                            item.nowPrice +
                            ".00元)"
                            "元)"
                          }}
                        </template>
                        <el-table :data="item.list" border style="width: 100%" height="270">
@@ -344,7 +350,7 @@
                          </el-table-column>
                          <el-table-column prop="nowPrice" label="实收金额">
                          </el-table-column>
                          <el-table-column prop="isEat" label="空腹">
                          <el-table-column prop="proCheckMethod" label="空腹">
                          </el-table-column>
                        </el-table>
@@ -364,7 +370,7 @@
                          </el-table-column>
                          <el-table-column prop="nowPrice" label="实收金额">
                          </el-table-column>
                          <el-table-column prop="isEat" label="空腹">
                          <el-table-column prop="proCheckMethod" label="空腹">
                          </el-table-column>
                        </el-table>
@@ -518,7 +524,7 @@
              <el-form-item label="卡号" prop="indexCard">
                <el-input v-model="formIn.indexCard" placeholder="请输入卡号" style="width: 190px" />
              </el-form-item>
              <el-button type="primary" @click="Package" size="mini">选择套餐</el-button>
              <!-- <el-button type="primary" @click="Package" size="mini">选择套餐</el-button> -->
            </el-form>
          </div>
@@ -542,6 +548,7 @@
                      <template slot="empty">数据正在加载中</template>
                      <el-table-column type="selection" width="40px" align="center" label="选择" />
                      <el-table-column label="套餐名称" align="center" prop="pacName" width="120px" />
                      <el-table-column label="套餐价格" align="center" prop="price" width="120px" />
                      <el-table-column label="套餐明细" align="center" prop="allProName" :show-overflow-tooltip="true" />
                    </el-table>
                  </div>
@@ -610,7 +617,7 @@
                    <!-- <div class="tab1"> -->
                    <!-- <el-form :inline="true" class="tab1"> -->
                    <el-form-item label="应收金额">
                      <el-input placeholder="应收金额" :value="TotalPrice1 + '.00'" disabled style="width: 160px"></el-input>
                      <el-input placeholder="应收金额" :value="TotalPrice1" disabled style="width: 160px"></el-input>
                    </el-form-item>
                    <el-form-item label="优惠折扣">
                      <!-- <el-input style="width: 100px" type="number" v-model="discount" :value="discount"></el-input> -->
@@ -622,7 +629,7 @@
                    </el-form-item>
                    <el-form-item>
                      <el-button type="primary" @click="submitPrice" :disabled="confirm" size="mini">签到登记</el-button>
                      <el-button type="primary" @click="submitPrice" :disabled="confirm" size="mini">预约修改</el-button>
                    </el-form-item>
                    <!-- </el-form> -->
                    <!-- </div> -->
@@ -662,7 +669,7 @@
                          </el-table-column>
                          <el-table-column prop="nowPrice" label="实收金额">
                          </el-table-column>
                          <el-table-column prop="isEat" label="空腹">
                          <el-table-column prop="proCheckMethod" label="空腹">
                          </el-table-column>
                        </el-table>
@@ -685,7 +692,7 @@
                          </el-table-column>
                          <el-table-column prop="nowPrice" label="实收金额">
                          </el-table-column>
                          <el-table-column prop="isEat" label="空腹">
                          <el-table-column prop="proCheckMethod" label="空腹">
                          </el-table-column>
                        </el-table>
@@ -705,7 +712,7 @@
                          </el-table-column>
                          <el-table-column prop="nowPrice" label="实收金额">
                          </el-table-column>
                          <el-table-column prop="isEat" label="空腹">
                          <el-table-column prop="proCheckMethod" label="空腹">
                          </el-table-column>
                        </el-table>
@@ -729,7 +736,7 @@
</template>
<script>
import { listReservation, gettjCancel, tjReappoint, tjCancelTj, } from "@/api/reservation/reservation";
import { listReservation, gettjCancel, tjReappoint, tjCancelTj, getReservation } from "@/api/reservation/reservation";
import printJS from "print-js";
import { deptTreeSelect, projectGetList, getPackageListName, getaddtTransition, getTransitionList, } from "@/api/system/tijian";
import { getCompany, queryCompany } from "@/api/team/tuanti";
@@ -744,6 +751,17 @@
    "sys_user_sex", "dict_team", "tj_time_region", "dict_tjtype", "dict_job",
    "dict_user_cardtype", "dict_ageunit",],
  data() {
    let checkPhoneNum = (rule, value, callback) => {
         console.log( value)
      let patter = new RegExp(/^1\s*[3456789]\s*(\d\s*){9}$/);
      if (value == "" && value == undefined && !value) {
        return callback('');
      }  else if(value != undefined && value != ""){
        return callback();
      }else if (!patter.test(value)) {
        return callback('');
      }
    };
    return {
      isfalse: false,
      tijiao1: true,
@@ -871,24 +889,24 @@
      fmobj: {},
      // 表单校验
      rules: {
        cusName: [{ required: true, message: "姓名不能为空", trigger: "blur" }],
        cusName: [{ required: true, validator: checkPhoneNum,  trigger: "blur" }],
        cusSex: [
          { required: true, message: "性别不能为空", trigger: "change" },
          { required: true, validator: checkPhoneNum,  trigger: "change" },
        ],
        cusBrithday: [
          { required: true, message: "出生日期不能为空", trigger: "blur" },
          { required: true, validator: checkPhoneNum,  trigger: "blur" },
        ],
        // cusAddr: [
        //   { required: true, message: "现居住地址不能为空", trigger: "blur" },
        // ],
        cusPhone: [
          { required: true, message: "联系电话不能为空", trigger: "blur" },
          { required: true, validator: checkPhoneNum,  trigger: "blur" },
        ],
        reservationTime: [
          { required: true, message: "预约日期不能为空", trigger: "change" },
          { required: true, validator: checkPhoneNum,  trigger: "change" },
        ],
        timeRegion: [
          { required: true, message: "时间不能为空", trigger: "blur" },
          { required: true, validator: checkPhoneNum,  trigger: "blur" },
        ],
      },
      options: [
@@ -942,21 +960,21 @@
        name: [
          {
            required: true,
            message: "姓名不能为空",
            validator: checkPhoneNum,
            trigger: "blur",
          },
        ],
        idCard: [
          {
            required: true,
            message: "身份证号不能为空",
            validator: checkPhoneNum,
            trigger: "blur",
          },
        ],
        phoe: [
          {
            required: true,
            message: "联系电话不能为空",
            validator: checkPhoneNum,
            trigger: "blur",
          },
        ],
@@ -1077,6 +1095,7 @@
      console.log(row)
      this.title = "修改体检预约";
      this.formIn = row;
      this.form.tjType = this.formIn.tjType
      if (this.formIn.timeRegion === 0) {
        this.formIn.timeRegion = "8:00-9:00";
      }
@@ -1091,66 +1110,76 @@
      }
      if (this.formIn.isExpire === 2) {
        this.drawer = true;
        this.discount = this.formIn.discount;
        if( this.formIn.discount!= null){
          this.discount = this.formIn.discount;
        }
        //全部套餐
        if (this.formIn.sex != null) {
          let cusSex = this.formIn.sex;
          deptTreeSelect(cusSex).then((response) => {
            this.newpacName = response.rows;
            this.newpacName.forEach((item3) => {
              this.tableData1.forEach((item4) => {
                item4.list.forEach((item6) => {
                  if (item6.pacName === item3.pacName) {
                    this.$refs.tb.toggleRowSelection(item3, true);
                    throw Error();
                  }
                });
              });
            });
            // this.newpacName.forEach((item3) => {
            //   this.tableData1.forEach((item4) => {
            //     item4.list.forEach((item6) => {
            //       if (item6.pacName === item3.pacName) {
            //         this.$refs.tb.toggleRowSelection(item3, true);
            //         throw Error();
            //       }
            //     });
            //   });
            // });
            this.loading = false;
          });
        } else {
          deptTreeSelect().then((response) => {
            this.newpacName = response.rows;
            this.newpacName.forEach((item3) => {
              this.tableData1.forEach((item4) => {
                item4.list.forEach((item6) => {
                  if (item6.pacName === item3.pacName) {
                    this.$nextTick(() => {
                      this.$refs.tb.toggleRowSelection(item3, true);
                    });
                    throw Error();
                  }
                });
              });
            });
            // this.newpacName.forEach((item3) => {
            //   this.tableData1.forEach((item4) => {
            //     item4.list.forEach((item6) => {
            //       if (item6.pacName === item3.pacName) {
            //         this.$nextTick(() => {
            //           this.$refs.tb.toggleRowSelection(item3, true);
            //         });
            //         throw Error();
            //       }
            //     });
            //   });
            // });
            this.loading = false;
          });
        }
        let cusId = this.formIn.idCard;
        let id = this.formIn.id;
        this.list1 = true;
        (this.tableData1 = []),
          (this.newpacName = []),
          getTransitionList(cusId).then((response) => {
          getReservation(id).then((response) => {
            if (response.data) {
              this.tableData1 = response.data;
              if (this.tableData1.length != 0) {
                this.TotalPrice1 = 0;
                this.tableData1.forEach((item) => {
                  this.TotalPrice1 += item.nowPrice;
                  this.TotalPrice = (
                    this.TotalPrice1 *
                    (this.discount / 10)
                  ).toFixed(2);
                  if (item.pacName === null) {
                    item.pacName = "单项";
              let cusId = response.data.idCard;
              getTransitionList(cusId).then((response) => {
                if (response.data) {
                  this.tableData1 = response.data;
                  if (this.tableData1.length != 0) {
                    this.TotalPrice1 = 0;
                    this.tableData1.forEach((item) => {
                      this.TotalPrice1 += item.nowPrice;
                      console.log(this.discount)
                      this.TotalPrice = (
                        this.TotalPrice1 *
                        (this.discount / 10)
                      ).toFixed(2);
                      if (item.pacName === null) {
                        item.pacName = "单项";
                      }
                    });
                    this.list1 = false;
                    this.list3 = true;
                  } else {
                    this.list1 = true;
                  }
                });
                this.list1 = false;
                this.list3 = true;
              } else {
                this.list1 = true;
              }
                }
              })
            } else {
              this.tableData1 = [];
              this.list3 = false;
@@ -1158,12 +1187,12 @@
            }
          });
        /** 查询部门下拉树结构 */
        projectGetList().then((response) => {
          this.treedataList = response.data.list;
        this.dXData = response.data.list;
          return;
        });
        // /** 查询部门下拉树结构 */
        // projectGetList().then((response) => {
        //   this.treedataList = response.data.list;
        //   this.dXData = response.data.list;
        //   return;
        // });
      } else {
        this.$message.warning("已过期请重新预约");
      }
@@ -1192,7 +1221,10 @@
        this.tijiao1 = false;
      }
      this.drawer1 = true;
      this.discount = this.formIn.discount;
      if( this.formIn.discount != null){
        this.discount = this.formIn.discount;
      }
      //全部套餐
      if (this.formIn.sex != null) {
        let cusSex = this.formIn.sex;
@@ -1230,10 +1262,13 @@
          this.loading = false;
        });
      }
      let cusId = this.formIn.idCard;
      let id = this.formIn.id;
      this.list1 = true;
      (this.tableData1 = []),
        (this.newpacName = []),
        getReservation(id).then((response) => {
            if (response.data) {
              let cusId = response.data.idCard;
        getTransitionList(cusId).then((response) => {
          if (response.data) {
            this.tableData1 = response.data;
@@ -1260,6 +1295,8 @@
            this.list1 = true;
          }
        });
      }
    })
      /** 查询部门下拉树结构 */
      projectGetList().then((response) => {
@@ -1432,7 +1469,7 @@
    // 最后提交按钮
    submitPrice() {
      let _this = this;
      if (_this.tableData1.length > 0) {
      // if (_this.tableData1.length > 0) {
        if (this.tableData[0]) {
          var pacId = this.tableData[0].pacId;
        }
@@ -1514,9 +1551,9 @@
        });
        this.getList();
        this.$tab.refreshPage();
      } else {
        this.$message.warning("请选择您要体检的内容");
      }
      // } else {
      //   this.$message.warning("请选择您要体检的内容");
      // }
    },
    // 最后提交按钮
    submitPrice1() {