<template>
  <div class="content-box">
    <div class="left">
      <div class="cameratxt">
        <span class="cameratxt">房态管理</span
        ><span
          style="font-size: 13px; color: rgba(51, 51, 51, 1); margin-left: 10px"
        >
          / 共182间</span
        >
      </div>
      <!-- 按钮列表 -->
      <div class="gongneng">
        <el-dropdown>
          <el-button type="primary" color="rgba(41, 109, 227, 1)">
            <span>批量控制水/电</span></el-button
          >
          <template #dropdown>
            <el-dropdown-menu>
              <el-dropdown-item @click="clean(1)">批量开电</el-dropdown-item>
              <el-dropdown-item @click="clean(2)">批量关电</el-dropdown-item>
              <el-dropdown-item @click="clean(3)">批量开水</el-dropdown-item>
              <el-dropdown-item @click="clean(4)">批量关水</el-dropdown-item>
            </el-dropdown-menu>
          </template>
        </el-dropdown>
        <!-- <el-button type="primary" color="rgba(9, 101, 98, 1)" @click="clean"
          ><el-icon><CirclePlus /></el-icon><span>批量置脏/净</span></el-button
        > -->
        <!-- <el-button type="primary" color="rgba(9, 101, 98, 1)" @click="addlist"
          ><el-icon><CirclePlus /></el-icon><span>批量开/关房</span></el-button
        > -->
        <el-dropdown>
          <el-button type="primary" color="rgba(41, 109, 227, 1)">
            <span>批量开/关房</span></el-button
          >
          <template #dropdown>
            <el-dropdown-menu>
              <el-dropdown-item @click="roomClose(1)"
                >批量开房</el-dropdown-item
              >
              <el-dropdown-item @click="roomClose(2)"
                >批量关房</el-dropdown-item
              >
            </el-dropdown-menu>
          </template>
        </el-dropdown>
      </div>
    </div>
    <div>
      <div class="middle">
        <div class="filter">
          <div class="condition">
            <el-input
              :clearable="true"
              @clear="searchBtn"
              v-model="searchInput.keyWord"
              class="w-50 m-2"
              placeholder="请输入姓名或房间号"
              style="width: 230px"
            />
            <el-button
              style="margin-left: 20px"
              color="rgba(41, 109, 227, 1)"
              type="primary"
              class="search"
              @click="searchBtn"
              ><el-icon>
                <Search />
              </el-icon>
              <span>查询</span></el-button
            >
          </div>
          <div class="type">
            <span>房间类型</span>
            <el-select
              style="width: 180px; margin-left: 20px"
              v-model="value"
              class="m-2"
              placeholder="请选择类型"
            >
              <el-option label="全部" value="1" />
              <el-option label="禁用" value="2" />
            </el-select>
          </div>
        </div>
        <div class="changeItems">
          <div
            class="changeItem"
            :class="changeIndex == 1 ? 'changeItem_active' : ''"
            @click="changeItem(1)"
          >
            单日
          </div>
          <div
            class="changeItem"
            :class="changeIndex == 2 ? 'changeItem_active' : ''"
            @click="changeItem(2)"
          >
            日历
          </div>
        </div>
      </div>
      <div class="footer">
        <div class="floor" v-for="item in roomList.list">
          <div class="title">
            <span class="t1">{{ item.title }}</span
            ><span class="t2">{{ item.roomlength }}</span>
          </div>
          <div class="roomList">
            <div class="room" v-for="i in item.children">
              <el-popover
                popper-class="roominfoPopper"
                placement="bottom-start"
                :width="360"
                trigger="click"
                effect="light"
              >
                <!-- :visible="i.visible" -->
                <template #reference>
                  <div @click="itemClick(i)">
                    <div class="roomNum">
                      <span>{{ i.roomNum }}</span>
                      <span class="status">空闲</span>
                    </div>
                    <div class="rLock">房间锁</div>
                    <div class="rLock">
                      <span>水: 25度&nbsp;&nbsp;&nbsp;电: 25度</span>
                    </div>
                    <div class="rLock">
                      <span>退房倒计时: 00:00:24</span>
                      <img
                        src="@/assets/icons/lock.png"
                        alt=""
                        style="width: 20px"
                      />
                    </div>
                  </div>
                </template>
                <div class="roomInfo">
                  <div class="title">
                    <div class="i">{{ item.title }}</div>
                    <div class="setAside">
                      <img src="@/assets/icons/setAside.png" alt="" />
                      <span>置净</span>
                    </div>
                  </div>
                  <div class="content">
                    <div class="lefts">
                      <div>
                        <span>住客 :</span>
                        <span>{{ i.shebei }}</span>
                      </div>
                      <div>
                        <span>入住 :</span>
                        <span>{{ i.wangluo }}</span>
                      </div>
                      <div>
                        <span>离店 :</span>
                        <span>{{ i.wifiMAC }}</span>
                      </div>
                      <div>
                        <span>付款 :</span>
                        <span>{{ i.lanyaMAC }}</span>
                      </div>
                      <div>
                        <span>已住 :</span>
                        <span>{{ i.time }}</span>
                      </div>
                      <div>
                        <span>电表起码 :</span>
                        <span>{{ i.dianliang }}</span>
                      </div>
                      <div>
                        <span>电表止码 :</span>
                        <span>{{ i.statu }}</span>
                      </div>
                      <div>
                        <span>代缴 :</span>
                        <span>{{ i.shebeiStatu }}</span>
                      </div>
                      <div>
                        <span>电量 :</span>
                        <span>{{ i.lastLock }}</span>
                      </div>
                    </div>
                    <div class="rigths">
                      <div @click="forbiddenClick">
                        <img
                          src="@/assets/icons/checkOut.png"
                          style="height: 20px"
                          alt=""
                        />
                        <span>退房</span>
                      </div>
                      <div @click="keyClick">
                        <img src="@/assets/icons/refund.png" alt="" />
                        <span>退款</span>
                      </div>
                      <div @click="roomChangeClick">
                        <img src="@/assets/icons/roomChange.png" alt="" />
                        <span>换房</span>
                      </div>
                      <div @click="unlockingClick">
                        <img src="@/assets/icons/sendPass.png" alt="" />
                        <span>下发密码</span>
                      </div>
                      <div @click="resetPassClick">
                        <img src="@/assets/icons/log.png" alt="" />
                        <span>日志</span>
                      </div>
                      <div @click="reserveClick">
                        <img src="@/assets/icons/yuding.png" alt="" />
                        <span>预定</span>
                      </div>
                      <div @click="checkInClick">
                        <img src="@/assets/icons/ruzhu.png" alt="" />
                        <span>入住</span>
                      </div>
                      <div @click="resetPassClick">
                        <img src="@/assets/icons/weixiu.png" alt="" />
                        <span>维修</span>
                      </div>
                      <div @click="resetPassClick">
                        <img src="@/assets/icons/suofang.png" alt="" />
                        <span>锁房</span>
                      </div>
                      <div class="roomType">
                        <div class="block">
                          <span>全</span>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </el-popover>
            </div>
          </div>
        </div>
      </div>

      <!-- 批量控制水电 -->
      <el-dialog
        class="dialogClean"
        v-model="cleanDialogVisible"
        :close-on-click-modal="false"
        :close-on-press-escape="false"
        title="批量控制水电"
        align-center
        width="700"
        :before-close="cancelClean"
      >
        <div class="trees">
          <div class="tree">
            <div class="tree-left">
              <el-checkbox
                v-model="cleanRoomAllChecked"
                style="margin-left: 15px"
                @change="chooseAll"
                >全选</el-checkbox
              >
              <span style="margin-left: 165px"
                >{{ cleanRoomLiCount.length }} / {{ dataLength }}</span
              >
            </div>
            <el-tree
              :data="cleanDatas"
              show-checkbox
              node-key="id"
              ref="cleanRoomTree"
              :props="{ label: label, children: children }"
              @check="checkcleanRoom"
            ></el-tree>
          </div>
          <div class="tree">
            <div class="tree-left">
              <p style="margin-left: 15px">
                已选 {{ cleanRoomLiCount.length }}
              </p>
            </div>
            <ul
              class="infinite-list"
              style="overflow: auto"
              infinite-scroll-immediate="false"
            >
              <li
                v-for="(i, index) in cleanRoomLiCount"
                :key="index"
                class="infinite-list-item"
              >
                <span style="margin-left: 19px">{{ i.label }}</span>
                <el-icon @click="cancelLiCheck(i)">
                  <Close />
                </el-icon>
                <!-- <i class="el-icon-close" @click="cancelCheck(i)"></i> -->
              </li>
            </ul>
          </div>
        </div>
        <div class="options">
          <el-button
            color="rgba(9, 101, 98, 1)"
            class="queding"
            type="primary"
            @click="notarizeClean(roomTree)"
          >
            确认
          </el-button>
          <el-button @click="cancelClean(roomTree)">取消</el-button>
        </div>
      </el-dialog>
      <!-- 批量开/关房 -->
      <el-dialog
        class="roomCloseDilog"
        v-model="roomCloseDialogVisible"
        :close-on-click-modal="false"
        :close-on-press-escape="false"
        title="roomCloseTitle"
        align-center
        width="700"
        :before-close="cancelRoomClose"
      >
        <div class="first" v-show="firstShow">
          <div class="trees">
            <div class="tree">
              <div class="tree-left">
                <el-checkbox
                  v-model="roomCloseChecked"
                  style="margin-left: 15px"
                  @change="chooseAllRoomClose"
                  >全选</el-checkbox
                >
                <span style="margin-left: 165px"
                  >{{ roomCloseCount.length }} / {{ roomCloseDataLength }}</span
                >
              </div>
              <el-tree
                :data="roomCloseDatas"
                show-checkbox
                node-key="id"
                ref="roomCloseTree"
                :props="defaultProps"
                @check="checkRoomClose"
              ></el-tree>
            </div>
            <div class="tree">
              <div class="tree-left">
                <p style="margin-left: 15px">
                  已选 ( {{ roomCloseCount.length }} )
                </p>
              </div>
              <ul
                class="infinite-list"
                style="overflow: auto"
                infinite-scroll-immediate="false"
              >
                <li
                  v-for="(i, index) in roomCloseCount"
                  :key="index"
                  class="infinite-list-item"
                >
                  <span style="margin-left: 19px">{{ i.label }}</span>
                  <el-icon @click="cancelCheckRoomClose(i)">
                    <Close />
                  </el-icon>
                  <!-- <i class="el-icon-close" @click="cancelCheck(i)"></i> -->
                </li>
              </ul>
            </div>
          </div>
          <div class="options">
            <el-button
              color="rgba(9, 101, 98, 1)"
              class="queding"
              type="primary"
              @click="lastStep"
            >
              下一步
            </el-button>
            <el-button @click="cancelRoomClose(roomCloseTree)">取消</el-button>
          </div>
        </div>
        <div class="last" v-show="lastShow">
          <div class="hint">
            <span>房间转“停用房”或“维修房”后，将会影响入住率</span>
            <el-tooltip
              class="box-item"
              effect="dark"
              content="入住率=间夜量/(总客房数-维修房数-停用房数-链接关房数)"
              placement="top"
            >
              <img src="@/assets/hint.png" alt="" />
            </el-tooltip>
          </div>
          <div class="roomUl">
            <div class="title">房间</div>
            <div class="delRoom">
              <ul>
                <li v-for="i in roomCloseCount">
                  <span>{{ i.label }}</span>
                  <div class="del" @click="closeRoomDel(i)"></div>
                </li>
              </ul>
            </div>
          </div>
          <div class="roomUl roomTime">
            <div class="title">日期</div>
            <div class="delRoom">
              <el-date-picker
                v-model="lastData.createTime"
                type="daterange"
                range-separator="至"
                start-placeholder="起始时间"
                end-placeholder="结束时间"
                format="YYYY-MM-DD"
                value-format="YYYY-MM-DD"
                :prefix-icon="Calendar"
                placeholder="请选择日期"
              />
            </div>
          </div>
          <div class="roomUl" v-if="roomCloseTitle == '批量关房'">
            <div class="title">关房类型</div>
            <div class="delRoom">
              <el-radio-group v-model="lastData.radio">
                <el-radio :label="1">停用房</el-radio>
                <el-radio :label="2">维修房</el-radio>
                <el-radio :label="3">保留房</el-radio>
              </el-radio-group>
            </div>
          </div>
          <div class="roomUl textarea">
            <div class="title">备注</div>
            <div class="delRoom">
              <el-input
                v-model="lastData.textarea"
                :rows="3"
                type="textarea"
                placeholder="请输入内容 (选填)"
              />
            </div>
          </div>
          <div class="options">
            <el-button
              class="queding"
              color="rgba(9, 101, 98, 1)"
              @click="notarizeRoomClose(roomCloseTree)"
              >确认</el-button
            >
            <el-button @click="firstStep"> 上一步 </el-button>
          </div>
        </div>
      </el-dialog>

      <!-- 换房弹窗 -->
      <el-dialog
        class="roomChangeDialog"
        v-model="roomChangeVisible"
        :close-on-click-modal="false"
        :close-on-press-escape="false"
        title="17栋2单元2层01 今日房价：¥155 - 换房操作"
        align-center
        width="1000"
        :before-close="cancelRoomChange"
      >
        <div class="titleHeader">
          <div class="title">
            <span>17栋2单元2层01</span> <span>今日房价：¥155 - 换房操作</span>
          </div>
          <div class="cancel" @click="cancelRoomChange">x</div>
        </div>
        <div class="roomChangeBody">
          <div class="middles">
            <div class="changeItemss">
              <div
                class="changeNews"
                :class="roomChangeIndex == 1 ? 'changeNews_active' : ''"
                @click="changeRoom(1)"
              >
                双床房
              </div>
              <div
                class="changeNews"
                :class="roomChangeIndex == 2 ? 'changeNews_active' : ''"
                @click="changeRoom(2)"
              >
                双床房
              </div>
              <div
                class="changeNews"
                :class="roomChangeIndex == 3 ? 'changeNews_active' : ''"
                @click="changeRoom(3)"
              >
                双床房
              </div>
            </div>
          </div>
          <div class="cards">
            <div class="footers">
              <div class="floor" v-for="item in roomList.list">
                <div class="roomList">
                  <div class="room" v-for="i in item.children">
                    <el-popover
                      popper-class="roominfoPopper"
                      placement="bottom-start"
                      :width="360"
                      trigger="click"
                      effect="light"
                    >
                      <!-- :visible="i.visible" -->
                      <template #reference>
                        <div @click="itemClick(i)">
                          <div class="roomNum">
                            <span>{{ i.roomNum }}</span>
                            <span class="status">空闲</span>
                          </div>
                          <div class="rLock">房间锁</div>
                          <div class="rLock">
                            <span>水: 25度&nbsp;&nbsp;&nbsp;电: 25度</span>
                          </div>
                          <div class="rLock">
                            <span>退房倒计时: 00:00:24</span>
                            <img
                              src="@/assets/icons/lock.png"
                              alt=""
                              style="width: 20px"
                            />
                          </div>
                        </div>
                      </template>
                      <div class="roomInfo">
                        <div class="title">
                          <div class="i">{{ item.title }}</div>
                          <div class="setAside">
                            <img src="@/assets/icons/setAside.png" alt="" />
                            <span>置净</span>
                          </div>
                        </div>
                        <div class="content">
                          <div class="lefts">
                            <div>
                              <span>住客 :</span>
                              <span>{{ i.shebei }}</span>
                            </div>
                            <div>
                              <span>入住 :</span>
                              <span>{{ i.wangluo }}</span>
                            </div>
                            <div>
                              <span>离店 :</span>
                              <span>{{ i.wifiMAC }}</span>
                            </div>
                            <div>
                              <span>付款 :</span>
                              <span>{{ i.lanyaMAC }}</span>
                            </div>
                            <div>
                              <span>已住 :</span>
                              <span>{{ i.time }}</span>
                            </div>
                            <div>
                              <span>电表起码 :</span>
                              <span>{{ i.dianliang }}</span>
                            </div>
                            <div>
                              <span>电表止码 :</span>
                              <span>{{ i.statu }}</span>
                            </div>
                            <div>
                              <span>代缴 :</span>
                              <span>{{ i.shebeiStatu }}</span>
                            </div>
                            <div>
                              <span>电量 :</span>
                              <span>{{ i.lastLock }}</span>
                            </div>
                          </div>
                          <div class="rigths">
                            <div @click="forbiddenClick">
                              <img
                                src="@/assets/icons/checkOut.png"
                                style="height: 20px"
                                alt=""
                              />
                              <span>退房</span>
                            </div>
                            <div @click="keyClick">
                              <img src="@/assets/icons/refund.png" alt="" />
                              <span>退款</span>
                            </div>
                            <div @click="roomChangeClick">
                              <img src="@/assets/icons/roomChange.png" alt="" />
                              <span>换房</span>
                            </div>
                            <div @click="unlockingClick">
                              <img src="@/assets/icons/sendPass.png" alt="" />
                              <span>下发密码</span>
                            </div>
                            <div @click="resetPassClick">
                              <img src="@/assets/icons/log.png" alt="" />
                              <span>日志</span>
                            </div>
                            <div class="roomType">
                              <div class="block">
                                <span>全</span>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </el-popover>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="roomChangeFooter">
          <div class="reason">
            <el-select v-model="value" class="m-2" placeholder="Select">
              <el-option label="全部" value="1" />
              <el-option label="禁用" value="2" />
            </el-select>
            <span class="reason_">换房原因 : </span>
          </div>
          <div class="options">
            <el-button
              color="rgba(41, 109, 227, 1)"
              type="primary"
              @click="submitAdd(ruleFormRef)"
              style="margin-right: 20px"
            >
              确定
            </el-button>
            <el-button @click="cancelRoomChange" style="margin: 0 20px 0 30px"
              >取消</el-button
            >
            <el-input
              clearable
              v-model="value"
              class="w-50 m-2"
              style="width: 80px"
              @blur="timeUpdata"
            />
            <span class="title">新房号 : </span>

            <el-input
              clearable
              v-model="value"
              class="w-50 m-2"
              style="width: 80px"
              @blur="timeUpdata"
            />
            <span class="title">新房价 : </span>
          </div>
        </div>
      </el-dialog>

      <!-- 预定弹窗 -->
      <el-dialog
        class="reserveDialog"
        v-model="reserveVisible"
        :close-on-click-modal="false"
        :close-on-press-escape="false"
        title="17栋2单元2层01 今日房价：¥155 - 换房操作"
        align-center
        width="1000"
        :before-close="cancelReserve"
      >
        <div class="titleHeader">
          <div class="title"><span>17栋2单元2层01</span> <span>预定</span></div>
          <div class="cancel" @click="cancelReserve">x</div>
        </div>
        <div class="roomChangeBody">
          <div class="titles">
            <img src="@/assets/icons/info.png" alt="" />
            <span>订单信息</span>
          </div>
          <el-form
            ref="reserveRef"
            :model="reserveRuleForm"
            :rules="reserveRules"
            label-width="100px"
            class="reserveRuleForm"
            :size="formSize"
            label-position="left"
            status-icon
          >
            <el-form-item label="类型 :" prop="type">
              <el-select
                v-model="reserveRuleForm.type"
                class="m-2"
                placeholder="请选择类型"
                style="width: 150px"
              >
                <el-option label="全日房" :value="1" />
                <el-option label="钟点房" :value="2" />
              </el-select>
            </el-form-item>
            <el-form-item label="预订人 :" prop="name">
              <el-input
                v-model="reserveRuleForm.name"
                placeholder="请输入预订人"
                clearable
                style="width: 150px"
              />
            </el-form-item>
            <el-form-item label="手机号码 :" prop="phone">
              <el-input
                v-model="reserveRuleForm.phone"
                placeholder="请输入手机号码"
                clearable
                style="width: 150px"
              />
            </el-form-item>
            <el-form-item label="到店时间 :" prop="arrivalTime">
              <div class="block">
                <el-date-picker
                  v-model="reserveRuleForm.arrivalTime"
                  type="date"
                  format="YYYY-MM-DD"
                  value-format="YYYY-MM-DD"
                  :prefix-icon="Calendar"
                  placeholder="选择到店时间"
                  style="width: 160px"
                />
              </div>
            </el-form-item>
            <el-form-item label="客类 :" prop="status">
              <el-select
                v-model="reserveRuleForm.status"
                class="m-2"
                placeholder="请选择客类"
                style="width: 150px"
              >
                <el-option label="教师" :value="1" />
                <el-option label="领导" :value="2" />
              </el-select>
            </el-form-item>
            <el-form-item label="预抵日期 :" prop="forecastTime">
              <div class="block">
                <el-date-picker
                  v-model="reserveRuleForm.forecastTime"
                  type="date"
                  format="YYYY-MM-DD"
                  value-format="YYYY-MM-DD"
                  :prefix-icon="Calendar"
                  placeholder="选择预抵日期"
                  style="width: 160px"
                />
              </div>
            </el-form-item>
            <el-form-item label="预离日期 :" prop="preionizationTime">
              <div class="block">
                <el-date-picker
                  v-model="reserveRuleForm.preionizationTime"
                  type="date"
                  format="YYYY-MM-DD"
                  value-format="YYYY-MM-DD"
                  :prefix-icon="Calendar"
                  placeholder="选择预离日期"
                  style="width: 160px"
                />
              </div>
            </el-form-item>
            <el-form-item label="房价 :" prop="roomPrice">
              <div class="block">
                <el-input
                  v-model="reserveRuleForm.roomPrice"
                  :disabled="true"
                  placeholder="请输入房价"
                  clearable
                  style="width: 150px"
                />
              </div>
            </el-form-item>
          </el-form>
          <div class="titles">
            <img src="@/assets/icons/calendar.png" alt="" />
            <span>未来7天占用状态</span>
          </div>
          <el-table :data="reserveData.list" border style="width: 100%">
            <el-table-column prop="one" align="center" label="23-10-09" />
            <el-table-column prop="one" align="center" label="23-10-10" />
            <el-table-column prop="one" align="center" label="23-10-11" />
            <el-table-column prop="one" align="center" label="23-10-12" />
            <el-table-column prop="one" align="center" label="23-10-13" />
            <el-table-column prop="one" align="center" label="23-10-14" />
            <el-table-column prop="one" align="center" label="23-10-15" />
            <el-table-column prop="one" align="center" label="23-10-16" />
          </el-table>
        </div>
        <div class="roomChangeFooter">
          <div class="options">
            <el-button
              color="rgba(41, 109, 227, 1)"
              type="primary"
              @click="submitAdd(ruleFormRef)"
              style="margin-right: 20px"
            >
              预定
            </el-button>
          </div>
        </div>
      </el-dialog>

      <!-- 入住弹窗 -->
      <el-dialog
        class="checkInDialog"
        v-model="checkInVisible"
        :close-on-click-modal="false"
        :close-on-press-escape="false"
        title="17栋2单元2层01 今日房价：¥155 - 换房操作"
        align-center
        width="900"
        :before-close="cancelCheckIn"
      >
        <div class="titleHeader">
          <div class="title">
            <span>17栋2单元2层01</span> <span>双床房</span>
          </div>
          <div class="cancel" @click="cancelCheckIn">x</div>
        </div>
        <div class="roomChangeBody">
          <el-form
            ref="checkInRef"
            :model="checkInRuleForm"
            :rules="checkInRules"
            class="reserveRuleForm"
            :size="formSize"
            label-position="left"
            status-icon
          >
            <div class="titles">
              <img src="@/assets/icons/info.png" alt="" />
              <span>住客信息 </span>
            </div>
            <div class="operation">
              <el-button type="primary" color="rgba(41, 109, 227, 1)"
                >读身份证</el-button
              >
              <el-button type="primary" color="rgba(41, 109, 227, 1)"
                >新增客人</el-button
              >
              <el-button type="primary" color="rgba(41, 109, 227, 1)"
                >换房</el-button
              >
            </div>
            <div class="tags">
              <div
                class="changeItem"
                :class="changeIndex == 1 ? 'changeItem_active' : ''"
                @click="changeItem(1)"
              >
                张三
              </div>
              <div
                class="changeItem"
                :class="changeIndex == 2 ? 'changeItem_active' : ''"
                @click="changeItem(2)"
              >
                李四
              </div>
            </div>
            <div class="residentInfo">
              <el-form-item label="预订人 :" prop="name">
                <el-input
                  v-model="checkInRuleForm.name"
                  placeholder="请输入预订人"
                  clearable
                  style="width: 150px"
                />
              </el-form-item>
              <el-form-item label="客类 :" prop="status">
                <el-select
                  v-model="checkInRuleForm.status"
                  class="m-2"
                  placeholder="请选择客类"
                  style="width: 150px"
                >
                  <el-option label="教师" :value="1" />
                  <el-option label="领导" :value="2" />
                </el-select>
              </el-form-item>
            </div>
            <div class="titles">
              <img src="@/assets/icons/info.png" alt="" />
              <span>入住信息 </span>
            </div>
            <div class="checkIn">
              <el-form-item label="预抵日期 :" prop="forecastTime">
                <div class="block">
                  <el-date-picker
                    v-model="checkInRuleForm.forecastTime"
                    type="date"
                    format="YYYY-MM-DD"
                    value-format="YYYY-MM-DD"
                    :prefix-icon="Calendar"
                    placeholder="选择预抵日期"
                    style="width: 160px"
                  />
                </div>
              </el-form-item>
              <el-form-item label="预离日期 :" prop="preionizationTime">
                <div class="block">
                  <el-date-picker
                    v-model="checkInRuleForm.preionizationTime"
                    type="date"
                    format="YYYY-MM-DD"
                    value-format="YYYY-MM-DD"
                    :prefix-icon="Calendar"
                    placeholder="选择预离日期"
                    style="width: 160px"
                  />
                </div>
              </el-form-item>
              <el-form-item label="类型 :" prop="type">
                <el-select
                  v-model="checkInRuleForm.type"
                  class="m-2"
                  placeholder="请选择类型"
                  style="width: 150px"
                >
                  <el-option label="全日房" :value="1" />
                  <el-option label="钟点房" :value="2" />
                </el-select>
              </el-form-item>
              <el-form-item label="房价 :" prop="roomPrice">
                <div class="block">
                  <el-input
                    v-model="checkInRuleForm.roomPrice"
                    clearable
                    placeholder="请输入房价"
                    style="width: 150px"
                  />
                </div>
              </el-form-item>
              <el-form-item label="预住天数 :" prop="dayNum">
                <div class="block">
                  <el-input
                    v-model="checkInRuleForm.dayNum"
                    placeholder="请输入预住天数"
                    clearable
                    style="width: 150px"
                  />
                </div>
              </el-form-item>
            </div>
            <div class="titles">
              <img src="@/assets/icons/electronicKey.png" alt="" />
              <span>电子钥匙 </span>
            </div>
            <div class="tags">
              <div
                class="changeItem"
                :class="checkInIndex == 1 ? 'changeItem_active' : ''"
                @click="checkInChangeItem(1)"
              >
                指纹
              </div>
              <div
                class="changeItem"
                :class="checkInIndex == 2 ? 'changeItem_active' : ''"
                @click="checkInChangeItem(2)"
              >
                ic/身份证卡
              </div>
              <div
                class="changeItem"
                :class="checkInIndex == 3 ? 'changeItem_active' : ''"
                @click="checkInChangeItem(3)"
              >
                密码
              </div>
            </div>
            <div class="changeKeys">
              <div class="icCard" v-if="checkInIndex == 1">
                <el-form-item label="指纹 :" prop="fingerprintNum">
                  <el-input
                    v-model="checkInRuleForm.fingerprintNum"
                    placeholder="请录入指纹"
                    style="width: 400px"
                    type="textarea"
                    rows="4"
                  />
                  <span
                    style="
                      color: rgba(0, 97, 255, 1);
                      margin-left: 10px;
                      cursor: pointer;
                    "
                    @click="readFingerprint"
                    >录入</span
                  >
                </el-form-item>
                <el-form-item label="生效日期 :" prop="effectiveTime">
                  <div class="block">
                    <el-date-picker
                      v-model="checkInRuleForm.effectiveTime"
                      type="date"
                      :clearable="false"
                      format="YYYY-MM-DD"
                      value-format="YYYY-MM-DD"
                      :prefix-icon="Calendar"
                      placeholder="选择生效日期"
                      style="width: 200px"
                    />
                  </div>
                </el-form-item>
                <el-form-item label="失效日期 :" prop="failureTime">
                  <div class="block">
                    <el-date-picker
                      v-model="checkInRuleForm.failureTime"
                      type="date"
                      :clearable="false"
                      format="YYYY-MM-DD"
                      value-format="YYYY-MM-DD"
                      :prefix-icon="Calendar"
                      placeholder="选择失效日期"
                      @change="endT"
                      style="width: 200px"
                    />
                  </div>
                </el-form-item>
                <el-radio-group
                  v-model="radioFingerprintDate"
                  @change="radioFingerprintChange"
                >
                  <el-radio label="一个星期">一个星期</el-radio>
                  <el-radio label="一个月">一个月</el-radio>
                  <el-radio label="半年">半年</el-radio>
                  <el-radio label="一年">一年</el-radio>
                  <el-radio label="长期">长期</el-radio>
                </el-radio-group>
              </div>
              <div class="icCard" v-if="checkInIndex == 2">
                <el-form-item label="卡号 :" prop="icCard">
                  <el-input
                    v-model="checkInRuleForm.icCard"
                    placeholder="请输入卡号"
                    style="width: 400px"
                    type="textarea"
                    rows="4"
                  >
                    <template #append>
                      <div @click="randomCipher">随机生成</div>
                    </template>
                  </el-input>
                  <span
                    style="
                      color: rgba(0, 97, 255, 1);
                      margin-left: 10px;
                      cursor: pointer;
                    "
                    @click="readIcCard"
                    >读卡</span
                  >
                </el-form-item>
                <el-form-item label="生效日期 :" prop="effectiveTime">
                  <div class="block">
                    <el-date-picker
                      v-model="checkInRuleForm.effectiveTime"
                      type="date"
                      :clearable="false"
                      format="YYYY-MM-DD"
                      value-format="YYYY-MM-DD"
                      :prefix-icon="Calendar"
                      placeholder="选择生效日期"
                      style="width: 200px"
                    />
                  </div>
                </el-form-item>
                <el-form-item label="失效日期 :" prop="failureTime">
                  <div class="block">
                    <el-date-picker
                      v-model="checkInRuleForm.failureTime"
                      type="date"
                      :clearable="false"
                      format="YYYY-MM-DD"
                      value-format="YYYY-MM-DD"
                      :prefix-icon="Calendar"
                      placeholder="选择失效日期"
                      @change="endT"
                      style="width: 200px"
                    />
                  </div>
                </el-form-item>
                <el-radio-group v-model="radioIcDate" @change="radioDateChange">
                  <el-radio label="一个星期">一个星期</el-radio>
                  <el-radio label="一个月">一个月</el-radio>
                  <el-radio label="半年">半年</el-radio>
                  <el-radio label="一年">一年</el-radio>
                  <el-radio label="长期">长期</el-radio>
                </el-radio-group>
              </div>
              <div class="keys" v-if="checkInIndex == 3">
                <el-tabs
                  v-model="checkInPassIndex"
                  class="demo-tabs"
                  @tab-change="checkInPassClick"
                >
                  <el-tab-pane label="时效密码" :name="1"> </el-tab-pane>
                  <el-tab-pane label="无网络密码" :name="2"> </el-tab-pane>
                  <el-tab-pane label="临时密码" :name="3"> </el-tab-pane>
                </el-tabs>
                <el-form-item label="密码 :" prop="pass">
                  <el-input
                    v-model="checkInRuleForm.pass"
                    placeholder="请输入6-8位数密码或者点击随机生成"
                    style="width: 400px"
                  >
                    <template #append>
                      <div @click="randomCipher">随机生成</div>
                    </template>
                  </el-input>
                </el-form-item>
                <el-form-item label="生效时间 :" prop="effectiveTime">
                  <div class="block">
                    <el-date-picker
                      v-model="checkInRuleForm.effectiveTime"
                      type="date"
                      format="YYYY-MM-DD"
                      value-format="YYYY-MM-DD"
                      :prefix-icon="Calendar"
                      placeholder="选择生效时间"
                      style="width: 200px"
                    />
                  </div>
                </el-form-item>
                <el-form-item label="失效时间 :" prop="failureTime">
                  <div class="block">
                    <el-date-picker
                      v-model="checkInRuleForm.failureTime"
                      type="date"
                      format="YYYY-MM-DD"
                      value-format="YYYY-MM-DD"
                      :prefix-icon="Calendar"
                      placeholder="选择失效时间"
                      style="width: 200px"
                    />
                  </div>
                </el-form-item>
              </div>
            </div>
          </el-form>
          <!-- <div class="titles">
            <img src="@/assets/icons/calendar.png" alt="" />
            <span>未来7天占用状态</span>
          </div> -->
        </div>
        <div class="roomChangeFooter">
          <div class="options">
            <el-button
              color="rgba(41, 109, 227, 1)"
              type="primary"
              @click="checkInConfirm(checkInRef)"
              style="margin-right: 20px"
            >
              入住
            </el-button>
          </div>
        </div>
      </el-dialog>

      <!-- 确定入住 弹出支付页面弹窗 -->
      <el-dialog
        class="payPriceialog"
        v-model="payPriceVisible"
        :close-on-click-modal="false"
        :close-on-press-escape="false"
        title="17栋2单元2层01 今日房价：¥155 - 换房操作"
        align-center
        width="900"
        :before-close="cancelPayPrice"
      >
        <div class="roomChangeBody">
          <el-form
            ref="checkInRef"
            :model="checkInRuleForm"
            :rules="checkInRules"
            class="reserveRuleForm"
            :size="formSize"
            label-position="left"
            status-icon
          >
            <div class="titles">
              <img src="@/assets/icons/info.png" alt="" />
              <span>入住信息 </span>
            </div>
            <el-form-item label="预抵日期 :" prop="forecastTime">
              <div class="block">
                <el-date-picker
                  v-model="checkInRuleForm.forecastTime"
                  type="date"
                  format="YYYY-MM-DD"
                  value-format="YYYY-MM-DD"
                  :prefix-icon="Calendar"
                  placeholder="选择预抵日期"
                  style="width: 160px"
                />
              </div>
            </el-form-item>
            <el-form-item label="预离日期 :" prop="preionizationTime">
              <div class="block">
                <el-date-picker
                  v-model="checkInRuleForm.preionizationTime"
                  type="date"
                  format="YYYY-MM-DD"
                  value-format="YYYY-MM-DD"
                  :prefix-icon="Calendar"
                  placeholder="选择预离日期"
                  style="width: 160px"
                />
              </div>
            </el-form-item>
            <el-form-item label="类型 :" prop="type">
              <el-select
                v-model="checkInRuleForm.type"
                class="m-2"
                placeholder="请选择类型"
                style="width: 150px"
              >
                <el-option label="全日房" :value="1" />
                <el-option label="钟点房" :value="2" />
              </el-select>
            </el-form-item>
            <el-form-item label="房价 :" prop="roomPrice">
              <div class="block">
                <el-input
                  v-model="checkInRuleForm.roomPrice"
                  clearable
                  placeholder="请输入房价"
                  style="width: 150px"
                />
              </div>
            </el-form-item>
            <el-form-item label="预住天数 :" prop="dayNum">
              <div class="block">
                <el-input
                  v-model="checkInRuleForm.dayNum"
                  placeholder="请输入预住天数"
                  clearable
                  style="width: 150px"
                />
              </div>
            </el-form-item>
          </el-form>
          <!-- <div class="titles">
            <img src="@/assets/icons/calendar.png" alt="" />
            <span>未来7天占用状态</span>
          </div> -->
        </div>
        <div class="roomChangeFooter">
          <div class="options">
            <el-button
              color="rgba(41, 109, 227, 1)"
              type="primary"
              @click="checkInConfirm(checkInRef)"
              style="margin-right: 20px"
            >
              入住
            </el-button>
          </div>
        </div>
      </el-dialog>
      <!-- 指纹读取弹窗 -->
      <el-dialog
        class="fingerprint"
        v-model="addFingerprintVisible"
        :close-on-click-modal="false"
        :close-on-press-escape="false"
        title="添加指纹"
        align-center
        width="550"
        :before-close="cancelAddFingerprint"
      >
        <div class="el-footer">
          <div style="height: 350px; margin: 30px auto">
            <el-steps direction="vertical" :active="stepindex">
              <el-step
                v-for="i in step.list"
                :key="i.id"
                :title="`步骤 ${i.id}`"
                :description="i.title"
              ></el-step>
            </el-steps>
          </div>
        </div>
      </el-dialog>

      <!-- 身份证读卡弹窗 -->
      <el-dialog
        class="addIdentityCard"
        v-model="addIdentityCardVisible"
        :close-on-click-modal="false"
        :close-on-press-escape="false"
        title="添加身份证"
        align-center
        width="650"
        :before-close="cancelAddIdentityCard"
      >
        <!-- <div class="el-footer">
          {{ identityCardTitle }}
        </div>
        <div class="el-footer">卡号 :{{ identityCardNum }}</div> -->
        <div class="steps">
          <el-steps
            :space="200"
            :active="identityCardIndex"
            finish-status="success"
          >
            <el-step title="环境准备" />
            <el-step title="配置" />
            <el-step title="完成" />
          </el-steps>
        </div>
        <div
          class="title"
          v-if="identityCardIndex == 0 || identityCardIndex == 1"
          style="color: #fc2307"
        >
          {{ identityCardTitle }}
        </div>
        <div class="title" v-else style="color: #68c23c">
          {{ identityCardTitle }}
        </div>
        <div class="icons">
          <img
            v-if="identityCardIndex == 0 || identityCardIndex == 1"
            src="@/assets/icons/error.png"
            alt=""
          />
          <img
            v-if="identityCardIndex == 2"
            class="loading"
            src="@/assets/icons/loading.png"
            alt=""
          />
          <img
            v-if="identityCardIndex == 3"
            src="@/assets/icons/success.png"
            alt=""
          />
        </div>
        <div class="retry">可以尝试<span @click="retry">重试</span></div>
      </el-dialog>
    </div>
  </div>
</template>

<script setup>
import {
  ref,
  reactive,
  nextTick,
  watch,
  onBeforeMount,
  onUnmounted,
} from "vue";
import { useRouter } from "vue-router";
import { ElMessage, ElMessageBox } from "element-plus";
import { Calendar } from "@element-plus/icons-vue";
import vidiconsApi from "@/api/vidicons.js";
import { dayjs } from "element-plus";
import lodash from "lodash";
import axios from "axios";
import { useStore } from "vuex";
const store = useStore();
const api = ref("");
const router = useRouter();

const nowDay = ref(dayjs().format("YYYY-MM-DD HH:mm:ss"));

// 批量置净脏数据 (------------------------)
const cleanDialogVisible = ref(false);
const cleanRoomTree = ref();
const cleanRoomAllChecked = ref(false); // 是否全选房间
// 左边
const dataLength = ref(); // 选择的房间数量
const cleanDatas = ref([
  {
    id: 1,
    label: "大床房",
    children: [
      {
        id: 11,
        label: "11",
      },
      {
        id: 12,
        label: "12",
      },
      {
        id: 13,
        label: "13",
      },
      {
        id: 14,
        label: "14",
      },
    ],
  },
  {
    id: 2,
    label: "圆床房",
    children: [
      {
        id: 21,
        label: "21",
      },
      {
        id: 22,
        label: "22",
      },
      {
        id: 23,
        label: "23",
      },
      {
        id: 24,
        label: "24",
      },
      {
        id: 25,
        label: "25",
      },
      {
        id: 26,
        label: "26",
      },
      {
        id: 27,
        label: "27",
      },
      {
        id: 28,
        label: "28",
      },
    ],
  },
  {
    id: 3,
    label: "双人床",
    children: [
      {
        id: 31,
        label: "31",
      },
      {
        id: 32,
        label: "32",
      },
      {
        id: 33,
        label: "33",
      },
      {
        id: 34,
        label: "34",
      },
      {
        id: 35,
        label: "35",
      },
      {
        id: 36,
        label: "36",
      },
      {
        id: 37,
        label: "37",
      },
      {
        id: 38,
        label: "38",
      },
    ],
  },
]); // 树形数据
// 右边
const cleanRoomLiCount = ref([]); // 右边li展示的数据

// 批量开关房数据 (------------------------)
const roomCloseDialogVisible = ref(false);
const roomCloseTree = ref();

// 表格数据
const loading = ref(false);
const tableData = reactive({
  list: [
    { roomlength: "/ 共3间" },
    { roomlength: "/ 共3间" },
    { roomlength: "/ 共3间" },
    { roomlength: "/ 共3间" },
    { roomlength: "/ 共3间" },
    { roomlength: "/ 共3间" },
    { roomlength: "/ 共3间" },
    { roomlength: "/ 共3间" },
    { roomlength: "/ 共3间" },
  ],
});

const searchInput = reactive({
  keyWord: "",
}); // 搜索按钮数据

const roomList = reactive({
  list: [
    {
      title: "17栋1单元2层01房",
      roomlength: "/ 共3间",
      children: [
        {
          roomNum: "18#1单元-2层201",
          shebei: "L6-VVIFI-QINGKE",
          wangluo: "WIFI",
          wifiMAC: "80A036AE239D",
          lanyaMAC: "F3F401122AF2",
          time: "2023-11-02 15:45:34",
          dianliang: "75%",
          statu: "在线",
          shebeiStatu: "启用",
          lastLock: "2023-11-02 15:45:34",
          visible: false,
        },
        {
          roomNum: "18#1单元-2层202",
          shebei: "L6-VVIFI-QINGKE",
          wangluo: "WIFI",
          wifiMAC: "80A036AE239D",
          lanyaMAC: "F3F401122AF2",
          time: "2023-11-02 15:45:34",
          dianliang: "75%",
          statu: "在线",
          shebeiStatu: "启用",
          lastLock: "2023-11-02 15:45:34",
          visible: false,
        },
        {
          roomNum: "18#1单元-2层203",
          shebei: "L6-VVIFI-QINGKE",
          wangluo: "WIFI",
          wifiMAC: "80A036AE239D",
          lanyaMAC: "F3F401122AF2",
          time: "2023-11-02 15:45:34",
          dianliang: "75%",
          statu: "在线",
          shebeiStatu: "启用",
          lastLock: "2023-11-02 15:45:34",
          visible: false,
        },
      ],
    },
    {
      title: "3层",
      roomlength: "/ 共3间",
      children: [
        {
          roomNum: "18#1单元-2层201",
          shebei: "L6-VVIFI-QINGKE",
          wangluo: "WIFI",
          wifiMAC: "80A036AE239D",
          lanyaMAC: "F3F401122AF2",
          time: "2023-11-02 15:45:34",
          dianliang: "75%",
          statu: "在线",
          shebeiStatu: "启用",
          lastLock: "2023-11-02 15:45:34",
          visible: false,
        },
        {
          roomNum: "18#1单元-2层202",
          shebei: "L6-VVIFI-QINGKE",
          wangluo: "WIFI",
          wifiMAC: "80A036AE239D",
          lanyaMAC: "F3F401122AF2",
          time: "2023-11-02 15:45:34",
          dianliang: "75%",
          statu: "在线",
          shebeiStatu: "启用",
          lastLock: "2023-11-02 15:45:34",
          visible: false,
        },
        {
          roomNum: "18#1单元-2层203",
          shebei: "L6-VVIFI-QINGKE",
          wangluo: "WIFI",
          wifiMAC: "80A036AE239D",
          lanyaMAC: "F3F401122AF2",
          time: "2023-11-02 15:45:34",
          dianliang: "75%",
          statu: "在线",
          shebeiStatu: "启用",
          lastLock: "2023-11-02 15:45:34",
          visible: false,
        },
      ],
    },
    {
      title: "4层",
      roomlength: "/ 共3间",
      children: [
        {
          roomNum: "18#1单元-2层201",
          shebei: "L6-VVIFI-QINGKE",
          wangluo: "WIFI",
          wifiMAC: "80A036AE239D",
          lanyaMAC: "F3F401122AF2",
          time: "2023-11-02 15:45:34",
          dianliang: "75%",
          statu: "在线",
          shebeiStatu: "启用",
          lastLock: "2023-11-02 15:45:34",
          visible: false,
        },
        {
          roomNum: "18#1单元-2层202",
          shebei: "L6-VVIFI-QINGKE",
          wangluo: "WIFI",
          wifiMAC: "80A036AE239D",
          lanyaMAC: "F3F401122AF2",
          time: "2023-11-02 15:45:34",
          dianliang: "75%",
          statu: "在线",
          shebeiStatu: "启用",
          lastLock: "2023-11-02 15:45:34",
          visible: false,
        },
        {
          roomNum: "18#1单元-2层203",
          shebei: "L6-VVIFI-QINGKE",
          wangluo: "WIFI",
          wifiMAC: "80A036AE239D",
          lanyaMAC: "F3F401122AF2",
          time: "2023-11-02 15:45:34",
          dianliang: "75%",
          statu: "在线",
          shebeiStatu: "启用",
          lastLock: "2023-11-02 15:45:34",
          visible: false,
        },
        {
          roomNum: "18#1单元-2层204",
          shebei: "L6-VVIFI-QINGKE",
          wangluo: "WIFI",
          wifiMAC: "80A036AE239D",
          lanyaMAC: "F3F401122AF2",
          time: "2023-11-02 15:45:34",
          dianliang: "75%",
          statu: "在线",
          shebeiStatu: "启用",
          lastLock: "2023-11-02 15:45:34",
          visible: false,
        },
      ],
    },
    {
      title: "5层",
      roomlength: "/ 共3间",
      children: [
        {
          roomNum: "18#1单元-2层201",
          shebei: "L6-VVIFI-QINGKE",
          wangluo: "WIFI",
          wifiMAC: "80A036AE239D",
          lanyaMAC: "F3F401122AF2",
          time: "2023-11-02 15:45:34",
          dianliang: "75%",
          statu: "在线",
          shebeiStatu: "启用",
          lastLock: "2023-11-02 15:45:34",
          visible: false,
        },
        {
          roomNum: "18#1单元-2层202",
          shebei: "L6-VVIFI-QINGKE",
          wangluo: "WIFI",
          wifiMAC: "80A036AE239D",
          lanyaMAC: "F3F401122AF2",
          time: "2023-11-02 15:45:34",
          dianliang: "75%",
          statu: "在线",
          shebeiStatu: "启用",
          lastLock: "2023-11-02 15:45:34",
          visible: false,
        },
        {
          roomNum: "18#1单元-2层203",
          shebei: "L6-VVIFI-QINGKE",
          wangluo: "WIFI",
          wifiMAC: "80A036AE239D",
          lanyaMAC: "F3F401122AF2",
          time: "2023-11-02 15:45:34",
          dianliang: "75%",
          statu: "在线",
          shebeiStatu: "启用",
          lastLock: "2023-11-02 15:45:34",
          visible: false,
        },
        {
          roomNum: "18#1单元-2层204",
          shebei: "L6-VVIFI-QINGKE",
          wangluo: "WIFI",
          wifiMAC: "80A036AE239D",
          lanyaMAC: "F3F401122AF2",
          time: "2023-11-02 15:45:34",
          dianliang: "75%",
          statu: "在线",
          shebeiStatu: "启用",
          lastLock: "2023-11-02 15:45:34",
          visible: false,
        },
      ],
    },
  ],
});

// 换房弹窗(----------------------------------------------------)
const roomChangeVisible = ref(false);
const roomChangeIndex = ref(1);

// 预定（--------------------------------------------------------）
const reserveVisible = ref(false);
const reserveRuleForm = reactive({
  type: "",
  name: "",
  phone: "",
  arrivalTime: "",
  status: "",
  forecastTime: "",
  preionizationTime: "",
  roomPrice: "",
  id: "",
});
var reserveName = (rule, value, callback) => {
  if (!value) {
    return callback(new Error("请输入姓名"));
  }

  var reg = /^[\u4e00-\u9fa5]{2,6}$/;
  if (!reg.test(value)) {
    callback(new Error("必须为2-6个汉字！"));
  } else {
    callback();
  }
};
const reserveData = reactive({ list: [{ one: "可用" }] });
// 表单验证
const reserveRules = reactive({
  type: [{ required: true, message: "类型不能为空", trigger: "blur" }],
  name: [
    { required: true, message: "姓名不能为空", trigger: "blur" },
    { validator: reserveName, trigger: "blur" },
  ],
  phone: [
    {
      required: true,
      message: "号码不能为空",
      trigger: "blur",
    },
  ],
  arrivalTime: [
    {
      required: true,
      message: "到店时间不能为空",
      trigger: "blur",
    },
  ],
  status: [
    {
      required: true,
      message: "客类不能为空",
      trigger: "blur",
    },
  ],
  forecastTime: [
    {
      required: true,
      message: "预抵日期不能为空",
      trigger: "blur",
    },
  ],
  preionizationTime: [
    {
      required: true,
      message: "预离日期不能为空",
      trigger: "blur",
    },
  ],
  roomPrice: [
    {
      required: true,
      message: "房价不能为空",
      trigger: "blur",
    },
  ],
});

// 入住 (----------------------------------------------------------)
const checkInVisible = ref(false);
const changeIndex = ref(1);
const checkInIndex = ref(1);
const checkInRef = ref();
const checkInRuleForm = reactive({
  type: "",
  name: "",
  phone: "",
  arrivalTime: "",
  status: "",
  forecastTime: "",
  preionizationTime: "",
  roomPrice: "",
  dayNum: "",
  pass: "", // 密码
  icCard: "", // ic/身份证号
  fingerprintNum: "", // 指纹
  effectiveTime: dayjs().format("YYYY-MM-DD"), // 生效日期
  failureTime: "", // 失效日期
  id: "",
});
var checkInName = (rule, value, callback) => {
  if (!value) {
    return callback(new Error("请输入姓名"));
  }

  var reg = /^[\u4e00-\u9fa5]{2,6}$/;
  if (!reg.test(value)) {
    callback(new Error("必须为2-6个汉字！"));
  } else {
    callback();
  }
};
// 表单验证
const checkInRules = reactive({
  type: [{ required: true, message: "类型不能为空", trigger: "blur" }],
  name: [
    { required: true, message: "姓名不能为空", trigger: "blur" },
    { validator: checkInName, trigger: "blur" },
  ],
  phone: [
    {
      required: true,
      message: "号码不能为空",
      trigger: "blur",
    },
  ],
  arrivalTime: [
    {
      required: true,
      message: "到店时间不能为空",
      trigger: "blur",
    },
  ],
  status: [
    {
      required: true,
      message: "客类不能为空",
      trigger: "blur",
    },
  ],
  forecastTime: [
    {
      required: true,
      message: "预抵日期不能为空",
      trigger: "blur",
    },
  ],
  preionizationTime: [
    {
      required: true,
      message: "预离日期不能为空",
      trigger: "blur",
    },
  ],
  roomPrice: [
    {
      required: true,
      message: "房价不能为空",
      trigger: "blur",
    },
  ],
  dayNum: [
    {
      required: true,
      message: "预住天数不能为空",
      trigger: "blur",
    },
  ],
  pass: [
    {
      required: true,
      message: "密码不能为空",
      trigger: "blur",
    },
  ],
  fingerprintNum: [
    {
      required: true,
      message: "指纹不能为空",
      trigger: "blur",
    },
  ],
  icCard: [
    {
      required: true,
      message: "ic/身份证号不能为空",
      trigger: "blur",
    },
  ],
  effectiveTime: [
    {
      required: true,
      message: "生效时间不能为空",
      trigger: "blur",
    },
  ],
  failureTime: [
    {
      required: true,
      message: "失效时间不能为空",
      trigger: "blur",
    },
  ],
});
// 添加指纹弹窗
const addFingerprintVisible = ref(false);
const stepindex = ref(0); // 录取指纹步骤
const step = reactive({
  list: [
    { id: 1, title: "" },
    { id: 2, title: "" },
    { id: 3, title: "" },
    { id: 4, title: "" },
  ],
}); // 指纹步骤数据
const ws = ref("");
const radioFingerprintDate = ref();
// ic/身份证卡
const addIdentityCardVisible = ref(false);
const identityCardIndex = ref(0);
const identityCardTitle = ref();
const radioIcDate = ref();
// 密码
const checkInPassIndex = ref(1);

watch(
  () => searchInput.createTime,
  (newVal, oldVal) => {
    console.log("监听时间:", newVal);
    if (newVal == null) {
      getList();
    }
  }
);

// 点击房间查看面板操作
const itemClick = (i) => {
  roomList.list.forEach((item) => {
    item.children.forEach((ii) => {
      ii.visible = false;
    });
  });
  i.visible = true;
  // if (i.visible == true) {
  //   i.visible = false;
  // } else {
  //   i.visible = true;
  // }
};

// 批量置净脏房 (--------------------------------------)
const clean = async (flag) => {
  cleanRoomLiCount.value = [];
  cleanDialogVisible.value = true;
  // let data = {
  //   managerId: sessionStorage.getItem("token"), // 当前页
  //   status: 1,
  // };
  // let res = await axios({
  //   method: "get",
  //   url: api.value + "/mhotel/house/number/status/queryListWithHouse.action",
  //   headers: {},
  //   params: data,
  // });
  // console.log(res, "批量置脏房数据");
  // if (res.data.code == 200) {
  dataLength.value = cleanDatas.value.reduce((pre, cur) => {
    return pre + cur.children.length;
  }, 0);
  // }
};
// 勾选房间
const checkcleanRoom = (data, nodes) => {
  // console.log(nodes);
  cleanRoomLiCount.value = [];
  // 选中勾选的房间赋值给count
  nodes.checkedNodes.forEach((item, index) => {
    if (!item.children) {
      // console.log(item);
      cleanRoomLiCount.value.push(item);
    }
  });
  // 判断勾选的房间数量和总数量是否相等
  if (dataLength.value == cleanRoomLiCount.value.length) {
    cleanRoomAllChecked.value = true;
  } else {
    cleanRoomAllChecked.value = false;
  }
  console.log(cleanRoomLiCount.value);
};
// 全选房间
const chooseAll = () => {
  cleanRoomLiCount.value = [];
  if (cleanRoomAllChecked.value) {
    // console.log(data.value);
    let children = [];
    cleanDatas.value.forEach((item) => {
      // console.log(item);
      item.children.forEach((i) => {
        cleanRoomLiCount.value.push(i);
        children.push(i);
      });
    });
    cleanRoomTree.value.setCheckedNodes(children);
  } else {
    cleanRoomTree.value.setCheckedNodes([]);
    cleanRoomLiCount.value = [];
  }
};
// li中删除房间
const cancelLiCheck = (i) => {
  // console.log(i);
  cleanRoomLiCount.value = cleanRoomLiCount.value.filter((item) => {
    return i.id != item.id;
  });
  // 判断勾选的房间数量和总数量是否相等;
  if (dataLength.value == cleanRoomLiCount.value.length) {
    cleanRoomAllChecked.value = true;
  } else {
    cleanRoomAllChecked.value = false;
  }
  cleanRoomTree.value.setCheckedNodes(cleanRoomLiCount.value);
  console.log(cleanRoomLiCount.value);
};
// 关闭置净脏房
const cancelClean = () => {
  cleanDialogVisible.value = false;
  cleanRoomTree.value.setCheckedNodes([]);
  // cleanRoomCount.value = [];
  // cleanRoomAllChecked.value = false;
};

// 查看员工列表 （----------------------------------------------）
const getList = async () => {
  loading.value = true;
  let data = {
    page: currentPage.value, // 当前页
    rows: pageSize.value, // 一页数据条数
    ledgerParam: searchInput.keyWord,
    managerId: sessionStorage.getItem("token"),
  };
  if (searchInput.createTime) {
    data.payStartTime = searchInput.createTime[0];
    data.payEndTime = searchInput.createTime[1];
  }

  if (searchInput.status) {
    if (searchInput.status != 0) {
      data.orderStatus = searchInput.status;
    }
  }
  let res = await axios({
    method: "post",
    url: api.value + "/mhotel/bookquearyBookPage.action",
    headers: {
      // token: sessionStorage.getItem("token"),
      // user_head: sessionStorage.getItem("userhead"),
    },
    params: data,
  });
  console.log(res, "用户列表");
  if (res.data.code == 200) {
    loading.value = false;
    // ElMessage({
    //   type: "success",
    //   showClose: true,
    //   message: res.data.message,
    //   center: true,
    // });
  } else {
    loading.value = false;
    ElMessage({
      type: "error",
      showClose: true,
      message: res.data.message,
      center: true,
    });
  }
};

// 搜索功能
const searchBtn = lodash.debounce(async () => {
  //   getList();
}, 300);

// 换房 (---------------------------------------------------------------)
const roomChangeClick = () => {
  roomChangeVisible.value = true;
};
// 切换房类型
const changeRoom = (ind) => {
  roomChangeIndex.value = ind;
  if (ind == 1) {
  } else if (ind == 2) {
  }
};
// 关闭换房
const cancelRoomChange = () => {
  roomChangeVisible.value = false;
};

// 预定 (-------------------------------------------------------------------)
const reserveClick = () => {
  reserveVisible.value = true;
};
const cancelReserve = () => {
  reserveVisible.value = false;
};

// 入住 (--------------------------------------------------------------------)
const checkInClick = () => {
  checkInVisible.value = true;
};
// 姓名切换
const changeItem = (flag) => {
  changeIndex.value = flag;
};
// 指纹 卡片 密码切换
const checkInChangeItem = (flag) => {
  checkInIndex.value = flag;
  checkInRuleForm.failureTime = "";
  radioIcDate.value = "";
  radioFingerprintDate.value = "";
};
// 指纹录取 （1111111）
const readFingerprint = () => {
  addFingerprintVisible.value = true;
  step.list = [
    { id: 1, title: "" },
    { id: 2, title: "" },
    { id: 3, title: "" },
    { id: 4, title: "" },
  ];
  stepindex.value = 0;
  var wsUrl = "ws://localhost:8181/";
  let websocket = new WebSocket(wsUrl);
  ws.value = websocket;
  websocket.onopen = function (evt) {
    var params = { type: 101, data: null };
    websocket.send(JSON.stringify(params));
  };
  websocket.onmessage = function (evt) {
    // console.log(evt.data, "输出指纹数据");
    let data = JSON.parse(evt.data);
    if (data.type == 0) {
      console.log(JSON.parse(evt.data).data.portNames[1]); // 获取到 USB接口
      let params1 = {
        type: 1,
        data: {
          type: 0,
          portName: JSON.parse(evt.data).data.portNames[1],
          baudRate: 115200,
        },
      };
      websocket.send(JSON.stringify(params1));
    } else if (data.type == 110) {
      console.log("已获取设备信息");
    } else if (data.type == 11) {
      var params2 = {
        type: 2,
        data: {
          totalStep: 4,
        },
      };
      websocket.send(JSON.stringify(params2));
    } else if (data.type == 21) {
      if (data.data.step == 0) {
        // console.log("请按压指纹");
        ElMessage({
          message: "请开始按压指纹",
          type: "success",
        });
      } else {
        // console.log(`请按下同一指纹，第${data.data.step}次按压`);
        if (data.data.step <= 4) {
          step.list.forEach((item) => {
            if (item.id == data.data.step) {
              item.title = `请按下同一指纹，第${data.data.step}次录入指纹成功`;
            }
          });
        }
        stepindex.value = data.data.step;
      }
      // _this.$message.warning("请将手指按在传感器上");
      if (data.data.step > 4) {
        var params = {
          type: 3,
          data: {
            id: data.data.id,
          },
        };
        websocket.send(JSON.stringify(params));
      }
    } else if (data.type == 31) {
      checkInRuleForm.fingerprintNum = data.data.template;
      console.log(data.data.template, "指纹数据");
      addFingerprintVisible.value = false;
      ws.value.close();
      ElMessage({
        message: "指纹录取成功",
        type: "success",
      });
      // setTimeout(() => {
      //   _this.fingerprintShow = false;
      //   ws.value.close();
      // }, 1500);
    } else {
      ElMessage({
        message: "设备连接失败，请刷新重新录入",
        type: "error",
      });
    }
  };
  websocket.onclose = function (evt) {
    console.log("关闭连接");
    // ws.value.close();
  };
  websocket.onerror = function (evt) {
    // console.log("错误提示");
  };
};
const cancelAddFingerprint = () => {
  addFingerprintVisible.value = false;
  ws.value.close();
};
const radioFingerprintChange = (value) => {
  // console.log(value);
  radioFingerprintDate.value = value;
  if (radioFingerprintDate.value == "一个星期") {
    checkInRuleForm.failureTime = dayjs(checkInRuleForm.effectiveTime)
      .add(1, "week")
      .format("YYYY-MM-DD HH:mm:ss");
  } else if (radioFingerprintDate.value == "一个月") {
    checkInRuleForm.failureTime = dayjs(checkInRuleForm.effectiveTime)
      .add(1, "month")
      .format("YYYY-MM-DD HH:mm:ss");
  } else if (radioFingerprintDate.value == "半年") {
    checkInRuleForm.failureTime = dayjs(checkInRuleForm.effectiveTime)
      .add(6, "month")
      .format("YYYY-MM-DD HH:mm:ss");
  } else if (radioFingerprintDate.value == "一年") {
    checkInRuleForm.failureTime = dayjs(checkInRuleForm.effectiveTime)
      .add(1, "year")
      .format("YYYY-MM-DD HH:mm:ss");
  } else if (radioFingerprintDate.value == "长期") {
    checkInRuleForm.failureTime = dayjs(checkInRuleForm.effectiveTime)
      .add(100, "year")
      .format("YYYY-MM-DD HH:mm:ss");
  }
};

// ic卡片（22222222）
const radioDateChange = (value) => {
  // console.log(value);
  radioIcDate.value = value;
  if (radioIcDate.value == "一个星期") {
    checkInRuleForm.failureTime = dayjs(checkInRuleForm.effectiveTime)
      .add(1, "week")
      .format("YYYY-MM-DD HH:mm:ss");
  } else if (radioIcDate.value == "一个月") {
    checkInRuleForm.failureTime = dayjs(checkInRuleForm.effectiveTime)
      .add(1, "month")
      .format("YYYY-MM-DD HH:mm:ss");
  } else if (radioIcDate.value == "半年") {
    checkInRuleForm.failureTime = dayjs(checkInRuleForm.effectiveTime)
      .add(6, "month")
      .format("YYYY-MM-DD HH:mm:ss");
  } else if (radioIcDate.value == "一年") {
    checkInRuleForm.failureTime = dayjs(checkInRuleForm.effectiveTime)
      .add(1, "year")
      .format("YYYY-MM-DD HH:mm:ss");
  } else if (radioIcDate.value == "长期") {
    checkInRuleForm.failureTime = dayjs(checkInRuleForm.effectiveTime)
      .add(100, "year")
      .format("YYYY-MM-DD HH:mm:ss");
  }
};
// 判断失效日期大于生效日期
const endT = () => {
  if (checkInRuleForm.failureTime < checkInRuleForm.effectiveTime) {
    ElMessage({
      type: "error",
      showClose: true,
      message: "失效日期应大于生效日期至少一天",
      center: true,
    });
    checkInRuleForm.failureTime = "";
  }
  radioIcDate.value = "";
};
const Card = () => {
  var wsUrl = "ws://localhost:8181/";
  let websocket = new WebSocket(wsUrl);
  // wsidentityCard.value = websocket;
  websocket.onopen = function (evt) {
    var params = { type: 104, data: null };
    websocket.send(JSON.stringify(params));
  };

  websocket.onmessage = function (evt) {
    let data = JSON.parse(evt.data);
    console.log(data);
    if (data.type == 141) {
      identityCardTitle.value = "请插入设备";
      identityCardIndex.value = 0;
    } else if (data.type == 150) {
      identityCardTitle.value = "配置失败，请检查卡片是否已放置设备上";
      identityCardIndex.value = 1;
    } else if (data.type == 140) {
      checkInRuleForm.icCard = data.data.uid;
      console.log(data.data.uid, "读取的卡号");

      identityCardIndex.value = 2;
      identityCardTitle.value = "读卡中";

      if (data.data.uid) {
        setTimeout(() => {
          identityCardIndex.value = 3;
          identityCardTitle.value = "读卡成功";
        }, 1500);
      }

      // ElMessage({
      //   type: "success",
      //   showClose: true,
      //   message: "添加卡片成功",
      //   center: true,
      // });

      // identityCardTitle.value = "获取卡号成功";

      // addIdentityCardVisible.value = false;
      // identityCardVisible.value = false;
      // identityCardRef.value.resetFields();

      // setTimeout(() => {
      //   _this.icCardShow = false;
      // }, 2000);
    }
  };
};
// 读取卡号
const readIcCard = () => {
  addIdentityCardVisible.value = true;
  // identityCardNum.value = "";
  Card();
};
const cancelAddIdentityCard = () => {
  addIdentityCardVisible.value = false;
};
// 重试 身份卡
const retry = () => {
  // identityCardNum.value = "";
  Card();
};
// 密码 （3333333333）
const checkInPassClick = (value) => {
  console.log(value);
};
// 随机八位数密码
const randomCipher = () => {
  console.log(Math.random());

  let len = "";
  if (parseInt(Math.random() * 9) > 4) {
    len = 8;
  } else {
    len = 6;
  }
  var pwd = "";
  for (var idx = 0; idx < len; idx++) {
    var seed = parseInt(Math.random() * 9);
    pwd = pwd + seed;
  }
  checkInRuleForm.pass = pwd;
};
// 确定入住 弹出支付页面
const checkInConfirm = () => {};
const cancelCheckIn = () => {
  checkInVisible.value = false;
};

//导出功能
const importExcel = lodash.debounce(async () => {
  let data = {
    ledgerParam: searchInput.keyWord,
    managerId: sessionStorage.getItem("token"),
  };
  if (searchInput.createTime) {
    data.payStartTime = searchInput.createTime[0];
    data.payEndTime = searchInput.createTime[1];
  }
  if (searchInput.status) {
    data.orderStatus = searchInput.status;
  }
  let res = await axios({
    method: "post",
    url: api.value + "/mhotel/booktoBookExcel.action",
    headers: {
      // token: sessionStorage.getItem("token"),
    },
    params: data,
  });
  console.log(res, "导出订单管理");
  if (res.data.code == 200) {
    var downloadPath = res.data.downurl;
    // window.open(downloadPath);
    window.location.href = downloadPath;
    var downloadLink = document.createElement("a");
    downloadLink.style.display = "none"; // 使其隐藏
    downloadLink.href = downloadPath;
    downloadLink.download = "";
    downloadLink.click();
    document.body.appendChild(downloadLink);
    document.body.removeChild(downloadLink);
    ElMessage({
      type: "success",
      showClose: true,
      message: res.data.message,
      center: true,
    });
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: res.data.message,
      center: true,
    });
  }
}, 1000);

// 表格斑马纹颜色修改
const tableRowClassName = ({ row, rowIndex }) => {
  if (rowIndex % 2 === 0) {
    return "even";
  } else if (rowIndex % 2 !== 0) {
    return "odd";
  }
  return "";
};
// 分页
const handleCurrentChange = (value) => {
  // console.log(value);
  currentPage.value = value;
  getList(changeIndex.value);
};

onBeforeMount(async () => {
  api.value = store.state.user.api;
});
onUnmounted(() => {
  // document.removeEventListener("keyup", Enters);
});
</script>

<style scoped lang="scss">
.content-box {
  width: 97.5%;
  height: calc(100vh - 105px);
  margin: 20px auto;
  background-color: #fff;
  color: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: 0px 3px 10px rgba(0, 97, 255, 0.2);

  .left {
    // width: calc(100wh - 40px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    margin: 0 30px;
    border-bottom: 1px solid #ccc;
    color: rgb(0, 0, 0);
    font-size: 18px;
    font-weight: 600;
    .gongneng {
      .el-dropdown {
        margin-left: 20px;
      }
    }
  }

  .middle {
    width: 96%;
    margin: 0 auto;

    color: #000;

    // border-bottom: 1px solid rgb(231, 231, 231);
    .filter {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      margin: 10px 0 0 0;

      .search {
        color: #fff;
      }

      .condition {
        display: flex;
        align-items: center;
        margin: 10px 30px 10px 0;
      }
    }
    .changeItems {
      display: flex;
      margin: 5px 0 15px 0;
      .changeItem {
        padding: 0 15px;
        height: 30px;
        background-color: rgba(230, 230, 230, 1);
        text-align: center;
        line-height: 30px;
        font-size: 14px;
        margin-right: 15px;
        border-radius: 3px;
        color: rgba(166, 166, 166, 1);
        cursor: pointer;
      }
      .changeItem_active {
        background-color: rgba(222, 234, 252, 1);
        color: rgba(0, 97, 255, 1);
      }
      .search {
        margin-right: 5px;
      }
    }

    .gongneng {
      margin: 10px 0 20px 0;

      span {
        color: #fff;
      }
    }

    :deep(.cont) {
      width: 60%;
      margin: 20px auto;
    }

    :deep(.download) {
      display: flex;
      align-items: center;
      margin: 10px;
    }

    :deep(.download span) {
      font-size: 16px;
      margin-left: 20px;
    }

    :deep(.cont .el-button) {
      margin-left: 60px;
      margin-bottom: 30px;
    }

    :deep(.cont .accomplish) {
      width: 100%;
      display: flex;
      justify-content: center;
    }

    :deep(.cont .accomplish .el-button) {
      width: 50%;
      margin: 0;
    }
  }

  .footer {
    width: 96%;
    height: calc(100vh - 308px);
    margin: 10px auto 20px;
    color: #000;
    overflow: auto;
    .floor {
      .title {
        margin: 8px 0;
        .t1 {
          font-weight: 600;
          margin-right: 10px;
        }
        .t2 {
          font-size: 13px;
          color: rgba(102, 102, 102, 1);
        }
      }
      .roomList {
        display: flex;
        flex-wrap: wrap;
        font-size: 14px;

        .room {
          width: 228px;
          height: 140px;
          opacity: 1;
          border-radius: 4px;
          background: rgba(240, 243, 247, 1);
          margin: 5px 18px 18px 0;
          // padding-left: 15px;
          .el-tooltip__trigger {
            height: 100%;
          }
          .roomNum {
            font-size: 16px;
            height: 55px;
            font-weight: 600;
            margin: 0 15px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            .status {
              // background-color: rgba(211, 219, 230, 1);
              background-color: rgba(41, 109, 227, 1);
              color: #fff;
              font-size: 12px;
              padding: 1px 5px;
              border-radius: 2px;
            }
          }
          .rLock {
            font-size: 12px;
            color: #000;
            margin: 0 15px;
            padding: 0 0 5px 0;
            display: flex;
            align-items: center;
            justify-content: space-between;
            img {
              cursor: pointer;
            }
          }
          .wifi {
            display: flex;
            align-items: center;
            padding: 10px 0 10px 15px;
            color: rgba(51, 51, 51, 1);
            img {
              width: 14px;
              padding-right: 5px;
            }
          }
        }
      }
    }
  }
  .footer::-webkit-scrollbar-track {
    background-color: #daeeff;
  }

  .footer::-webkit-scrollbar {
    background-color: #0888f8;
    height: 3px;
    width: 4px;
  }

  .footer::-webkit-scrollbar-thumb {
    background: #57b2ff;
    border-radius: 4px;
    height: 3px;
    width: 4px;
  }

  .pageSize {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 30px;

    span {
      color: #000;
    }

    .el-pagination {
      // width: 1600px;
      :deep(.el-pagination__total) {
        color: #000;
      }

      :deep(.el-pagination__goto) {
        color: #000;
      }

      :deep(.el-pagination__classifier) {
        color: #000;
      }

      :deep(.el-input__wrapper) {
        border: 1px solid rgba(0, 0, 0, 1);
        border-radius: 5px;
        box-shadow: none;
      }

      :deep(.el-pager li) {
        margin: 0 5px;
        border: 1px solid rgba(0, 0, 0, 1);
        border-radius: 5px;
        background-color: transparent;
      }

      :deep(.el-pager li.is-active) {
        background-color: rgba(111, 182, 184, 1);
      }

      :deep(.btn-prev) {
        margin-right: 5px;
        border: 1px solid rgba(0, 0, 0, 1);
        border-radius: 5px;
        background-color: transparent;
      }

      :deep(.btn-next) {
        margin-left: 5px;
        border: 1px solid rgba(0, 0, 0, 1);
        border-radius: 5px;
        background-color: transparent;
      }
    }
  }
}

.el-input {
  width: 192px;
}

// 弹出的信息框
.roominfoPopper {
  .roomInfo {
    // border: 1px solid red;
    color: #fff;
    font-size: 14px;
    .title {
      font-size: 16px;
      padding: 7.5px 0;
      border-bottom: 1px solid rgba(255, 255, 255, 0.5);
      display: flex;
      align-items: center;
      .i {
        display: inline-block;
        width: 208px;
      }
      .setAside {
        display: flex;
        align-items: center;
        margin-left: 16px;
        font-size: 14px;
        img {
          width: 16px;
          margin-right: 5px;
        }
      }
    }
    .content {
      display: flex;
      .lefts {
        border-right: 1px solid rgba(255, 255, 255, 0.5);
        span:nth-child(1) {
          text-align: left;
          display: inline-block;
          // width: 72px;
          margin: 5px 15px 5px 0;
        }
        span:nth-child(2) {
          text-align: left;
          display: inline-block;
          // width: 190px;
          padding-right: 20px;
        }
      }
      .rigths {
        // width: 140px;
        margin-left: 15px;
        div {
          display: flex;
          align-items: center;
          height: 33px;
          cursor: pointer;
          img {
            width: 18px;
            height: 18px;
            margin-right: 5px;
          }
          span {
            text-align: left;
            display: inline-block;
          }
          .deblocking {
            transform: translateX(3px);
          }
        }
        .roomType {
          margin: 30px 0 0 15px;
          .block {
            width: 49px;
            height: 49px;
            background-color: #fff;
            border-radius: 50%;
            color: rgba(30, 125, 251, 1);
            font-size: 24px;
            display: flex;
            justify-content: center;
            align-items: center;
          }
        }
      }
    }
  }
}
// 换房弹窗
:deep(.roomChangeDialog) {
  // height: 600px;
  overflow: hidden;
  border-radius: 11px;

  .el-dialog__header {
    border-radius: 11px 11px 0 0;
    background: rgba(237, 241, 245, 1);
    font-weight: 600;
    margin: 0;
    display: none;

    .el-dialog__headerbtn {
      outline: none;
    }
  }

  .el-dialog__body {
    // overflow: auto;
    // padding: 10px 20px 10px 20px;
    padding: 0;
    .titleHeader {
      height: 60px;
      border-top-right-radius: 10px;
      border-top-left-radius: 10px;
      background-color: rgb(237, 241, 245);
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0 20px;
      .title {
        span:nth-child(1) {
          font-size: 23px;
          font-weight: 700;
          color: #000;
        }
        span:nth-child(2) {
          color: #000;
        }
      }
      .cancel {
        width: 40px;
        height: 40px;
        line-height: 40px;
        text-align: center;
        cursor: pointer;
      }
    }
    .roomChangeBody {
      display: flex;
      height: 500px;
      margin-bottom: 50px;
      margin: 0 20px 50px;
      .middles {
        width: 150px;
        // margin: 0 auto;
        color: #000;
        //   切换  消息记录  操作记录
        .changeItemss {
          // margin: 20px 0;
          width: 130px;
          .changeNews {
            margin: 15px 0;
            height: 40px;
            background-color: rgba(230, 230, 230, 1);
            text-align: center;
            line-height: 40px;
            font-size: 14px;
            border-radius: 3px;
            color: rgba(166, 166, 166, 1);
            cursor: pointer;
          }
          .changeNews_active {
            background-color: rgba(222, 234, 252, 1);
            color: rgba(0, 97, 255, 1);
          }
        }
        // border-bottom: 1px solid rgb(231, 231, 231);
        .filter {
          display: flex;
          flex-wrap: wrap;
          align-items: center;
          margin: 10px 0 0 0;
          justify-content: start;

          .search {
            color: #fff;
          }

          .condition {
            display: flex;
            align-items: center;
            margin: 10px 30px 10px 0;

            :deep(.el-input .el-input__inner) {
              font-size: 14px;
            }

            // span {
            //   margin: 0 10px 0 0;
            // }
          }
        }

        .gongneng {
          margin: 10px 0 20px 0;

          span {
            color: #fff;
          }
        }

        :deep(.cont) {
          width: 60%;
          margin: 20px auto;
        }

        :deep(.download) {
          display: flex;
          align-items: center;
          margin: 10px;
        }

        :deep(.download span) {
          font-size: 16px;
          margin-left: 20px;
        }

        :deep(.cont .el-button) {
          margin-left: 60px;
          margin-bottom: 30px;
        }

        :deep(.cont .accomplish) {
          width: 100%;
          display: flex;
          justify-content: center;
        }

        :deep(.cont .accomplish .el-button) {
          width: 50%;
          margin: 0;
        }
      }
      .cards {
        flex: 1;
        overflow: auto;
        margin: 10px 0 0 0;
        .floor {
          .title {
            margin: 8px 0;
            .t1 {
              font-weight: 600;
              margin-right: 10px;
            }
            .t2 {
              font-size: 13px;
              color: rgba(102, 102, 102, 1);
            }
          }
          .roomList {
            display: flex;
            flex-wrap: wrap;
            font-size: 14px;

            .room {
              width: 228px;
              height: 140px;
              opacity: 1;
              border-radius: 4px;
              background: rgba(240, 243, 247, 1);
              margin: 5px 18px 18px 0;
              // padding-left: 15px;
              .el-tooltip__trigger {
                height: 100%;
              }
              .roomNum {
                font-size: 16px;
                height: 55px;
                font-weight: 600;
                margin: 0 15px;
                display: flex;
                align-items: center;
                justify-content: space-between;
                .status {
                  // background-color: rgba(211, 219, 230, 1);
                  background-color: rgba(41, 109, 227, 1);
                  color: #fff;
                  font-size: 12px;
                  padding: 1px 5px;
                  border-radius: 2px;
                }
              }
              .rLock {
                font-size: 12px;
                color: #000;
                margin: 0 15px;
                padding: 0 0 5px 0;
                display: flex;
                align-items: center;
                justify-content: space-between;
                img {
                  cursor: pointer;
                }
              }
              .wifi {
                display: flex;
                align-items: center;
                padding: 10px 0 10px 15px;
                color: rgba(51, 51, 51, 1);
                img {
                  width: 14px;
                  padding-right: 5px;
                }
              }
            }
          }
        }
      }
      .cards::-webkit-scrollbar-track {
        background-color: #daeeff;
      }

      .cards::-webkit-scrollbar {
        background-color: #0888f8;
        height: 3px;
        width: 4px;
      }

      .cards::-webkit-scrollbar-thumb {
        background: #57b2ff;
        border-radius: 4px;
        height: 3px;
        width: 4px;
      }

      .footers {
        width: 96%;
        // height: 402px;
        margin: 0 auto;

        .el-table--fit {
          height: 100%;

          .el-table__header-wrapper {
            background-color: #000;
            font-size: 15px;

            tr {
              color: #000;
            }
          }

          .el-table__row {
            height: 50px;
            font-size: 15px;
            color: #000;

            .orderNum {
              color: rgba(111, 182, 184, 1);
              cursor: pointer;
            }
          }

          .el-table__row:nth-child(2n) {
            .el-table-fixed-column--right {
              background-color: rgba(240, 243, 247, 1);
            }
          }

          .el-table__row td {
            padding: 0;
            border: 0;
          }

          .el-button--primary {
            margin-left: 5px;
          }

          .el-table__body .even2 {
            background-color: #fff;
          }

          .el-table__body .odd2 {
            background-color: rgba(240, 243, 247, 1);
          }
        }
      }
    }
    .roomChangeFooter {
      height: 150px;
      margin: 0 20px 0;
      .reason {
        display: flex;
        align-items: center;
        flex-direction: row-reverse;
        padding-bottom: 20px;
        border-bottom: 1px solid rgba(230, 230, 230, 1);
        .reason_ {
          color: #000;
          margin-right: 10px;
        }
      }
      .options {
        display: flex;
        align-items: center;
        flex-direction: row-reverse;
        margin: 30px 0 0 0;
        .title {
          margin: 0 10px;
        }
      }
    }
  }
}
// 预定弹窗
:deep(.reserveDialog) {
  // height: 600px;
  border-radius: 11px;
  .el-dialog__header {
    border-radius: 11px 11px 0 0;
    background: rgba(237, 241, 245, 1);
    font-weight: 600;
    margin: 0;
    display: none;

    .el-dialog__headerbtn {
      outline: none;
    }
  }
  .el-dialog__body {
    // overflow: auto;
    // padding: 10px 20px 10px 20px;
    padding: 0;
    .titleHeader {
      height: 60px;
      border-top-right-radius: 10px;
      border-top-left-radius: 10px;
      background-color: rgb(237, 241, 245);
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0 20px;
      .title {
        span:nth-child(1) {
          font-size: 23px;
          font-weight: 700;
          color: #000;
        }
        span:nth-child(2) {
          color: #000;
        }
      }
      .cancel {
        width: 40px;
        height: 40px;
        line-height: 40px;
        text-align: center;
        cursor: pointer;
      }
    }
    .roomChangeBody {
      margin: 0 20px 80px;
      .titles {
        color: rgba(0, 97, 255, 1);
        font-size: 16px;
        display: flex;
        align-items: center;
        margin: 15px 0;
        img {
          width: 22px;
          margin-right: 10px;
        }
      }
      .reserveRuleForm {
        display: flex;
        flex-wrap: wrap;
        .el-form-item {
          margin-right: 15px;
        }
      }
    }
    .roomChangeFooter {
      // height: 80px;
      margin: 0 20px 0;
      padding: 15px 0 20px 0;
      border-top: 1px solid rgba(230, 230, 230, 1);
      .options {
        display: flex;
        align-items: center;
        flex-direction: row-reverse;
        // margin: 30px 0 0 0;
      }
    }
  }
}
// 入住弹窗
:deep(.checkInDialog) {
  // height: 600px;
  border-radius: 11px;
  .el-dialog__header {
    border-radius: 11px 11px 0 0;
    background: rgba(237, 241, 245, 1);
    font-weight: 600;
    margin: 0;
    display: none;

    .el-dialog__headerbtn {
      outline: none;
    }
  }
  .el-dialog__body {
    // overflow: auto;
    // padding: 10px 20px 10px 20px;
    padding: 0;
    .titleHeader {
      height: 60px;
      border-top-right-radius: 10px;
      border-top-left-radius: 10px;
      background-color: rgb(237, 241, 245);
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0 20px;
      .title {
        span:nth-child(1) {
          font-size: 23px;
          font-weight: 700;
          color: #000;
        }
        span:nth-child(2) {
          color: #000;
        }
      }
      .cancel {
        width: 40px;
        height: 40px;
        line-height: 40px;
        text-align: center;
        cursor: pointer;
      }
    }
    .roomChangeBody {
      margin: 0 20px 80px;
      .titles {
        color: rgba(0, 97, 255, 1);
        font-size: 16px;
        display: flex;
        align-items: center;
        margin: 15px 0;
        img {
          width: 22px;
          margin-right: 10px;
        }
      }
      .operation {
        margin: 15px 0;
      }
      .tags {
        display: flex;
        margin: 15px 0;
        .changeItem {
          width: 85px;
          height: 30px;
          background-color: rgba(230, 230, 230, 1);
          text-align: center;
          line-height: 30px;
          font-size: 14px;
          margin-right: 15px;
          border-radius: 3px;
          color: rgba(166, 166, 166, 1);
          cursor: pointer;
        }
        .changeItem_active {
          background-color: rgba(222, 234, 252, 1);
          color: rgba(0, 97, 255, 1);
        }
      }
      .residentInfo {
        display: flex;
        .el-form-item {
          margin-right: 20px;
        }
      }
      .checkIn {
        display: flex;
        flex-wrap: wrap;
        .el-form-item {
          margin-right: 20px;
        }
      }
      .keys {
        .el-form-item {
          .el-input-group__append {
            background-color: rgba(222, 234, 252, 1);
            color: rgba(0, 97, 255, 1);
            cursor: pointer;
            user-select: none;
          }
        }
      }
      // .reserveRuleForm {
      //   display: flex;
      //   flex-wrap: wrap;
      //   .el-form-item {
      //     margin-right: 15px;
      //   }
      // }
    }
    .roomChangeFooter {
      // height: 80px;
      margin: 0 20px 0;
      padding: 15px 0 20px 0;
      border-top: 1px solid rgba(230, 230, 230, 1);
      .options {
        display: flex;
        align-items: center;
        flex-direction: row-reverse;
        // margin: 30px 0 0 0;
      }
    }
  }
}
// 确定入住 弹出支付页面弹窗
:deep(.checkInDialog) {
  // height: 600px;
  border-radius: 11px;
  .el-dialog__header {
    border-radius: 11px 11px 0 0;
    background: rgba(237, 241, 245, 1);
    font-weight: 600;
    margin: 0;
    display: none;

    .el-dialog__headerbtn {
      outline: none;
    }
  }
  .el-dialog__body {
    // overflow: auto;
    // padding: 10px 20px 10px 20px;
    padding: 0;
    .roomChangeBody {
      margin: 0 20px 80px;
      .titles {
        color: rgba(0, 97, 255, 1);
        font-size: 16px;
        display: flex;
        align-items: center;
        margin: 15px 0;
        img {
          width: 22px;
          margin-right: 10px;
        }
      }
      .operation {
        margin: 15px 0;
      }
    }
    .roomChangeFooter {
      // height: 80px;
      margin: 0 20px 0;
      padding: 15px 0 20px 0;
      border-top: 1px solid rgba(230, 230, 230, 1);
      .options {
        display: flex;
        align-items: center;
        flex-direction: row-reverse;
        // margin: 30px 0 0 0;
      }
    }
  }
}
// 身份证读取
:deep(.addIdentityCard) {
  //   height: 420px;
  border-radius: 11px;
  .el-dialog__header {
    border-radius: 11px 11px 0 0;
    background: rgba(237, 241, 245, 1);
    font-weight: 600;
    margin: 0;
    .el-dialog__headerbtn {
      outline: none;
    }
  }
  .el-dialog__body {
    padding: 30px 20px 10px 20px;
    height: 330px;
    font-size: 16px;
    font-weight: 600;
    color: #000;
    .el-steps {
      width: 600px;
      transform: translateX(90px);
      margin: 0 0 40px 0;
    }
    .title {
      text-align: center;
    }
    .icons {
      display: flex;
      justify-content: center;
      img {
        width: 70px;
        margin: 40px 0;
      }
      .loading {
        animation: move 3s linear;
      }
      @keyframes move {
        0% {
          transform: rotate(0);
        }
        100% {
          transform: rotate(360deg);
        }
      }
    }
    .retry {
      text-align: center;
      span {
        color: red;
        padding: 0 8px;
        cursor: pointer;
      }
    }
  }
}

// 指纹弹窗
:deep(.fingerprint) {
  width: 611px;
  height: 486px;
  border-radius: 11px;
  .el-dialog__header {
    border-radius: 11px 11px 0 0;
    background: rgba(237, 241, 245, 1);
    font-weight: 600;
    margin: 0;

    .el-dialog__headerbtn {
      outline: none;
    }
  }
  .el-dialog__body {
    padding: 0;
    .elbody {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 20px 20px;
      font-size: 18px;
      color: #000;
      border-bottom: 0.5px solid #ccc;

      i {
        cursor: pointer;
      }
    }
  }
  .el-dialog__footer {
    .el-button--primary {
      background: rgba(41, 109, 227, 1);
    }
  }
}
// 批量置脏房
:deep(.dialogClean) {
  // height: 540px;
  border-radius: 11px;

  .el-dialog__header {
    border-radius: 11px 11px 0 0;
    background: rgba(237, 241, 245, 1);
    font-weight: 600;
    margin: 0;

    .el-dialog__headerbtn {
      outline: none;
    }
  }

  .el-dialog__body {
    padding: 0;

    .trees {
      display: flex;
      justify-content: center;
      padding: 25px 0;
      border-bottom: 1px solid rgba(204, 204, 204, 1);
    }

    .tree {
      .tree-left {
        width: 316px;
        height: 44px;
        background: rgba(240, 243, 247, 1);
        border: 1px solid rgba(230, 230, 230, 1);
        box-sizing: border-box;
        display: flex;
        align-items: center;
      }
    }

    .el-tree {
      width: 316px;
      height: 324px;
      border: 1px solid rgba(230, 230, 230, 1);
      box-sizing: border-box;
      padding-left: 9px;
      overflow: auto;
    }

    ul {
      width: 316px;
      height: 324px;
      list-style: none;
      padding: 0;
      margin: 0;
      border: 1px solid rgba(230, 230, 230, 1);
      box-sizing: border-box;
      overflow: auto;

      li {
        display: flex;
        justify-content: space-between;
        padding-right: 17px;
        align-items: center;
        margin-top: 5px;

        .el-icon-close {
          cursor: pointer;
          width: 10px;
          height: 10px;
        }
      }
    }

    .options {
      width: 96%;
      display: flex;
      flex-direction: row-reverse;
      padding: 16px 0;

      .queding {
        margin-left: 20px;
        color: #fff;
      }
    }
  }
}
// 批量开关房
:deep(.roomCloseDilog) {
  // height: 540px;
  border-radius: 11px;

  .el-dialog__header {
    border-radius: 11px 11px 0 0;
    background: rgba(237, 241, 245, 1);
    font-weight: 600;
    margin: 0;

    .el-dialog__headerbtn {
      outline: none;
    }
  }

  .el-dialog__body {
    padding: 0;

    // 上一步页面样式
    .first {
      .trees {
        display: flex;
        justify-content: center;
        padding: 25px 0;
        border-bottom: 1px solid #e9eaed;
      }

      .tree {
        .tree-left {
          width: 316px;
          height: 44px;
          background: rgba(240, 243, 247, 1);
          border: 1px solid rgba(230, 230, 230, 1);
          box-sizing: border-box;
          display: flex;
          align-items: center;
        }
      }

      .el-tree {
        width: 316px;
        height: 324px;
        border: 1px solid rgba(230, 230, 230, 1);
        box-sizing: border-box;
        padding-left: 9px;
        overflow: auto;
      }

      ul {
        width: 316px;
        height: 324px;
        list-style: none;
        padding: 0;
        margin: 0;
        border: 1px solid rgba(230, 230, 230, 1);
        box-sizing: border-box;
        overflow: auto;

        li {
          display: flex;
          justify-content: space-between;
          padding-right: 17px;
          align-items: center;
          margin-top: 5px;

          .el-icon-close {
            cursor: pointer;
            width: 10px;
            height: 10px;
          }
        }
      }
    }

    .options {
      width: 96%;
      display: flex;
      flex-direction: row-reverse;
      padding: 16px 0;

      .queding {
        margin-left: 20px;
        color: #fff;
      }
    }

    // 下一步页面样式
    .last {
      .hint {
        background-color: #e6ecfa;
        border: 1px solid #053dc8;
        display: flex;
        align-items: center;
        padding: 6px 24px;
        color: #000;

        img {
          width: 16px;
          margin: 0 3px;
        }
      }

      .roomUl {
        display: flex;
        margin: 20px 0 0px;
        color: #000;

        // align-items: center;
        .title {
          width: 100px;
          height: 40px;
          text-align: right;
          line-height: 40px;
          color: #000;
          margin-right: 15px;
        }

        .delRoom {
          ul {
            width: 560px;
            list-style: none;
            border: none;
            display: flex;
            flex-wrap: wrap;
            margin: 0;
            padding: 0;

            li {
              width: 160px;
              height: 40px;
              border: 1px solid #e0e0e0;
              display: flex;
              justify-content: space-around;
              align-items: center;
              margin: 0 10px 10px 0;

              span {
                margin-right: 40px;
              }

              .del {
                width: 14px;
                height: 14px;
                background-image: url("@/assets/delete.png");
                background-size: 100%;
              }

              .del:hover {
                background-image: url("@/assets/delete_hover.png");
                cursor: pointer;
              }
            }
          }

          .el-radio-group {
            .el-radio__label {
              color: #000;
            }
          }
        }
      }

      .roomTime {
        margin: 10px 0;

        .delRoom {
          display: flex;
          align-items: center;
        }
      }

      .textarea {
        border-bottom: 1px solid #e9eaed;
        padding-bottom: 25px;

        .delRoom {
          width: 510px;
        }
      }
    }
  }
}
</style>
<style lang="scss">
.roominfoPopper {
  background: rgba(0, 0, 0, 0.8) !important;
  border: none !important;
  .el-popper__arrow::before {
    background: rgba(0, 0, 0, 0.8) !important;
  }
}
</style>
