Parcourir la source

房态按照条件搜索

gqx il y a 2 ans
Parent
commit
a6a86cf2dc
1 fichiers modifiés avec 145 ajouts et 10 suppressions
  1. 145 10
      src/views/room/fangtailive.vue

+ 145 - 10
src/views/room/fangtailive.vue

@@ -17,14 +17,14 @@
       <div style="width: 80%" class="course-week">
         <div style="display: flex; flex-direction: column">
           <div style="display: flex; gap: 5px; flex-flow: wrap">
-            <a-dropdown>
+            <a-dropdown :disabled="scheduleBtnDis">
               <a-menu slot="overlay" @click="scheduleClick">
                 <a-menu-item key="1"> 散客预定 </a-menu-item>
                 <a-menu-item key="2"> 团队预定</a-menu-item>
               </a-menu>
               <a-button type="danger"> 预定 <a-icon type="down" /> </a-button>
             </a-dropdown>
-            <a-dropdown>
+            <a-dropdown :disabled="checkInBtnDis">
               <a-menu slot="overlay" @click="handleMenuClick">
                 <a-menu-item key="1"> 散客入住 </a-menu-item>
                 <a-menu-item key="2"> 团队入住</a-menu-item>
@@ -35,35 +35,42 @@
             ><a-button
               style="margin-bottom: 10px"
               @click="handleAdd"
+              disabled
               type="danger"
               >置干净</a-button
             ><a-button
               style="margin-bottom: 10px"
               @click="handleAdd"
               type="danger"
+              disabled
               >置脏</a-button
             ><a-button
               style="margin-bottom: 10px"
               @click="handleAdd"
+              disabled
               type="danger"
               >置维修</a-button
             ><a-button
               style="margin-bottom: 10px"
               @click="handleAdd"
+              disabled
               type="danger"
               >锁房</a-button
             ><a-button
+              disabled
               style="margin-bottom: 10px"
               @click="handleAdd"
+              disabled
               type="danger"
               >联房</a-button
             ><a-button
+              disabled
               style="margin-bottom: 10px"
               @click="handleAdd"
               type="danger"
               >批量制卡</a-button
             >
-            <a-button style="margin-bottom: 10px" @click="toPage" type="danger"
+            <!-- <a-button style="margin-bottom: 10px" @click="toPage" type="danger"
               >查询散客详单</a-button
             >
             <a-button
@@ -71,7 +78,7 @@
               @click="toTeamPage"
               type="danger"
               >查询团队详单</a-button
-            >
+            > -->
           </div>
           <div class="week-top">
             <div class="w-choose-status">
@@ -428,7 +435,7 @@
             enter-button="搜索"
             v-model="keyWord"
             type="danger"
-            @search="handleAdd"
+            @search="checkChange"
           />
         </div>
         <p style="font-size: 16px; font-weight: 600; color: rgb(0, 186, 173)">
@@ -436,7 +443,7 @@
         </p>
         <a-tree-select
           style="width: 100%"
-          v-model="value"
+          v-model="checkedroomBuildingFloorList"
           :tree-data="roomBuildingFloorTree"
           tree-checkable
           :show-checked-strategy="SHOW_PARENT"
@@ -446,6 +453,7 @@
             key: 'id',
             value: 'id',
           }"
+          @change="checkChange"
         />
         <p
           style="
@@ -460,7 +468,7 @@
         <a-checkbox-group
           v-model="checkedRoomStatusList"
           :options="roomStatusList"
-          @change="onChange"
+          @change="checkChange"
         >
         </a-checkbox-group>
         <p
@@ -476,7 +484,7 @@
         <a-checkbox-group
           v-model="checkedCustomerSourceList"
           :options="customerSourceList"
-          @change="onChange"
+          @change="checkChange"
         >
         </a-checkbox-group>
         <p
@@ -492,7 +500,7 @@
         <a-checkbox-group
           v-model="checkedCesRoomLayoutList"
           :options="cesRoomLayoutList"
-          @change="onChange"
+          @change="checkChange"
         >
         </a-checkbox-group>
       </div>
@@ -772,7 +780,7 @@ export default {
       timeId: null,
       multipleRoom: false,
       keyWord: "",
-      value: [],
+      checkedroomBuildingFloorList: [],
       treeData,
       SHOW_PARENT,
       cardStatus: {
@@ -838,8 +846,11 @@ export default {
       roomBuildingFloorTree: [],
       roomStatusColorList: [],
       roomList: [],
+      oldRoomList: [],
       roomStatusList: [],
       checkedRoomStatusList: [],
+      scheduleBtnDis: false,
+      checkInBtnDis: false,
     };
   },
   watch: {
@@ -997,11 +1008,35 @@ export default {
             });
           });
         }
+
         if (roomLive.roomInfo.state !== 88) {
           roomLive.roomInfo.state = 88;
+          this.checkInBtnDis =
+            roomLive.livingData && roomLive.livingData.livingOrder;
+          this.scheduleBtnDis =
+            (roomLive.livingData && roomLive.livingData.livingOrder) ||
+            (roomLive.bookingData && roomLive.bookingData.bookingOrder);
         } else {
           roomLive.roomInfo.state = 0;
         }
+        if (this.multipleRoom) {
+          this.checkInBtnDis = false;
+          this.scheduleBtnDis = false;
+          this.roomList.forEach((item) => {
+            item.rooms.forEach((c) => {
+              if (c.roomInfo.state === 88) {
+                if (!this.checkInBtnDis) {
+                  this.checkInBtnDis = c.livingData && c.livingData.livingOrder;
+                }
+                if (!this.scheduleBtnDis) {
+                  this.scheduleBtnDis =
+                    (c.livingData && c.livingData.livingOrder) ||
+                    (c.bookingData && c.bookingData.bookingOrder);
+                }
+              }
+            });
+          });
+        }
         // 清除定时器
         clearTimeout(this.timeId);
       }, 100);
@@ -1047,6 +1082,103 @@ export default {
       });
     },
     onChange() {},
+    onCheck(value, label, extra) {
+      console.log("onCheck", value);
+      console.log(
+        "checkedroomBuildingFloorList",
+        this.checkedroomBuildingFloorList
+      );
+    },
+    checkChange(e) {
+      console.log("e", e);
+      console.log(
+        "checkedroomBuildingFloorList",
+        this.checkedroomBuildingFloorList
+      );
+      var list = this.oldRoomList;
+      if (this.checkedCesRoomLayoutList.length > 0) {
+        list = this.oldRoomList.reduce((acc, curr) => {
+          const rooms = curr.rooms.filter((room) =>
+            this.checkedCesRoomLayoutList.includes(room.layout.id)
+          );
+          acc.push({ ...curr, rooms });
+          return acc;
+        }, []);
+      }
+      if (this.checkedRoomStatusList.length > 0) {
+        list = list.reduce((acc, curr) => {
+          const rooms = curr.rooms.filter((room) =>
+            this.checkedRoomStatusList.includes(
+              room.roomInfo.roomStatus.toString()
+            )
+          );
+          acc.push({ ...curr, rooms });
+          return acc;
+        }, []);
+      }
+      if (this.checkedCustomerSourceList.length > 0) {
+        list = list.reduce((acc, curr) => {
+          const rooms = curr.rooms.filter((room) =>
+            room.livingData && room.livingData.livingOrder
+              ? this.checkedCustomerSourceList.includes(
+                  room.livingData.livingOrder.customerSource
+                )
+              : room.bookingData && room.bookingData.bookingOrder
+              ? this.checkedCustomerSourceList.includes(
+                  room.bookingData.bookingOrder.customerSource
+                )
+              : false
+          );
+          acc.push({ ...curr, rooms });
+          return acc;
+        }, []);
+      }
+      if (this.checkedroomBuildingFloorList.length > 0) {
+        list = list.filter(
+          (item) =>
+            this.checkedroomBuildingFloorList.includes(item.buildingId) ||
+            this.checkedroomBuildingFloorList.includes(item.id)
+        );
+      }
+      if (this.keyWord) {
+        //房号/姓名/手机号搜索
+        list = list.reduce((acc, curr) => {
+          const rooms = curr.rooms.filter(
+            (room) =>
+              room.roomInfo.name == this.keyWord ||
+              (room.livingData && room.livingData.livingCustomers
+                ? room.livingData.livingCustomers.customerName == this.keyWord
+                : room.bookingData && room.bookingData.bookingCustomer
+                ? room.bookingData.bookingCustomer.name == this.keyWord
+                : false) ||
+              (room.livingData && room.livingData.livingCustomers
+                ? room.livingData.livingCustomers.phone == this.keyWord
+                : room.bookingData && room.bookingData.bookingCustomer
+                ? room.bookingData.bookingCustomer.phone == this.keyWord
+                : false)
+          );
+          acc.push({ ...curr, rooms });
+          return acc;
+        }, []);
+      }
+      console.log("list2", list);
+      this.roomList = list;
+    },
+    // roomStatusChange(e) {
+    //   console.log("e", e);
+    //   var list = this.oldRoomList;
+    //   if (this.checkedRoomStatusList.length > 0) {
+    //     list = this.oldRoomList.reduce((acc, curr) => {
+    //       const rooms = curr.rooms.filter((room) =>
+    //       this.checkedRoomStatusList.includes(room.roomInfo.roomStatus.toString())
+    //       );
+    //       acc.push({ ...curr, rooms });
+    //       return acc;
+    //     }, []);
+    //   }
+    //   console.log("list2", list);
+    //   this.roomList = list;
+    // },
     collapseClick(row, value) {
       this.$set(row, "collapse", value);
     },
@@ -1117,12 +1249,15 @@ export default {
       });
     },
     loadData() {
+      this.checkInBtnDis = false;
+      this.scheduleBtnDis = false;
       getAction("/rooms/cesRooms/realtime-rooms", {}).then((res) => {
         if (res.success) {
           res.result.forEach((row) => {
             this.$set(row, "collapse", 1);
           });
           this.roomList = res.result;
+          this.oldRoomList = JSON.parse(JSON.stringify(res.result));
         }
       });
     },