ソースを参照

快捷预定/入住

gqx 2 年 前
コミット
35daf205a4
共有3 個のファイルを変更した127 個の追加93 個の削除を含む
  1. 53 64
      src/views/room/fangtailive.vue
  2. 31 19
      src/views/room/modules/checkIn/BillRoomForm.vue
  3. 43 10
      src/views/room/modules/schedule/ScheduleRoomForm.vue

+ 53 - 64
src/views/room/fangtailive.vue

@@ -399,7 +399,10 @@
                             >
                           </template>
                         </div>
-                        <a-menu slot="overlay" @click="onMenuClick">
+                        <a-menu
+                          slot="overlay"
+                          @click="(e) => onMenuClick(e, roomLive)"
+                        >
                           <a-menu-item key="1"> 入住 </a-menu-item>
                           <a-menu-item key="2"> 预定</a-menu-item>
                           <a-menu-item key="3"> 置脏 </a-menu-item>
@@ -890,14 +893,7 @@ export default {
         this.roomStatusList = list;
       }
     });
-    getAction("/rooms/cesRooms/realtime-rooms", {}).then((res) => {
-      if (res.success) {
-        res.result.forEach((row) => {
-          this.$set(row, "collapse", 1);
-        });
-        this.roomList = res.result;
-      }
-    });
+    this.loadData();
   },
   mounted() {
     // this.handleBillInfo();
@@ -923,14 +919,7 @@ export default {
     },
     tabsClick(e) {
       if (e == "1") {
-        getAction("/rooms/cesRooms/realtime-rooms", {}).then((res) => {
-          if (res.success) {
-            res.result.forEach((row) => {
-              this.$set(row, "collapse", 1);
-            });
-            this.roomList = res.result;
-          }
-        });
+        this.loadData();
       }
     },
     getRoomStatusColor(roomStatus) {
@@ -964,26 +953,14 @@ export default {
     },
     scheduleClick(e) {
       var selectRoom = [];
-      this.planList2.forEach((t) => {
-        t.child.forEach((c) => {
-          c.schedule.forEach((s) => {
-            if (s.detail.check === 1) {
-              selectRoom.push(s);
-            }
-          });
+      this.roomList.forEach((t) => {
+        t.rooms.forEach((c) => {
+          if (c.roomInfo.state === 88) {
+            c.roomInfo.marketPrice = c.layout.marketPrice;
+            selectRoom.push(c.roomInfo);
+          }
         });
       });
-      // if (selectRoom.length === 0) {
-      //   this.$message.warning("请先选择房间");
-      //   return;
-      // }
-      // if (e.key == "1") {
-      //   this.$refs.ModalScheduleRoom.addList(selectRoom);
-      //   this.$refs.ModalScheduleRoom.title = "预定登记";
-      //   this.$refs.ModalScheduleRoom.disableSubmit = false;
-      // } else {
-      //   this.addScheduleTeam();
-      // }
       this.$refs.ModalScheduleRoom.addList(selectRoom, e.key);
       this.$refs.ModalScheduleRoom.title =
         e.key == "1" ? "散客预定登记" : "团队预定登记";
@@ -992,19 +969,14 @@ export default {
     handleMenuClick(e) {
       console.log("click", e);
       var selectRoom = [];
-      this.planList2.forEach((t) => {
-        t.child.forEach((c) => {
-          c.schedule.forEach((s) => {
-            if (s.detail.check === 1) {
-              selectRoom.push(s);
-            }
-          });
+      this.roomList.forEach((t) => {
+        t.rooms.forEach((c) => {
+          if (c.roomInfo.state === 88) {
+            c.roomInfo.marketPrice = c.layout.marketPrice;
+            selectRoom.push(c.roomInfo);
+          }
         });
       });
-      // if (selectRoom.length === 0) {
-      //   this.$message.warning("请先选择房间");
-      //   return;
-      // }
       this.$refs.ModalBillRoomForm.addList(selectRoom, e.key);
       this.$refs.ModalBillRoomForm.title =
         e.key == "1" ? "散客入住登记" : "团队入住登记";
@@ -1083,14 +1055,32 @@ export default {
       this.$refs.modalForm.title = "维修";
       this.$refs.modalForm.disableSubmit = false;
     },
-    onMenuClick(e) {
-      console.log(e);
+    onMenuClick(e, row) {
+      console.log("e", e);
+      console.log("row", row);
+      var that = this;
       if (e.key == "1") {
-        this.$refs.ModalBillRoomForm.addList([], e.key);
-        this.$refs.ModalBillRoomForm.title = "散客入住登记";
-        this.$refs.ModalBillRoomForm.disableSubmit = false;
+        if (row.bookingData && row.bookingData.bookingOrder) {
+          this.$confirm({
+            title: "提示",
+            content: "此房间有预定是否预定转入住?",
+            onOk: function () {
+              that.$router.push({
+                name: "room-scheduledetail",
+                params: {
+                  id: row.bookingData.bookingOrder.bookingOrdersNo,
+                },
+              });
+            },
+          });
+        } else {
+          row.roomInfo.marketPrice = row.layout.marketPrice;
+          this.$refs.ModalBillRoomForm.addList([row.roomInfo], 1);
+          this.$refs.ModalBillRoomForm.title = "散客入住登记";
+          this.$refs.ModalBillRoomForm.disableSubmit = false;
+        }
       } else if (e.key == "2") {
-        this.$refs.ModalScheduleRoom.addList([], e.key);
+        this.$refs.ModalScheduleRoom.addList([row.roomInfo], 1);
         this.$refs.ModalScheduleRoom.title = "散客预定登记";
         this.$refs.ModalScheduleRoom.disableSubmit = false;
       } else {
@@ -1100,6 +1090,7 @@ export default {
       }
     },
     modalBillRoomFormOk(e) {
+      this.loadData();
       console.log("e", e);
       this.$refs.ModalBillRoomInfo.add(e);
       this.$refs.ModalBillRoomInfo.title = "账单";
@@ -1107,7 +1098,7 @@ export default {
     },
     modalFormOk(e) {
       console.log("e", e);
-      // this.loadData();
+      this.loadData();
       this.$router.push({
         // path: "/room/scheduledetail",
         // query: { id: e },
@@ -1117,7 +1108,7 @@ export default {
     },
     modalTeamFormOk(e) {
       console.log("e", e);
-      // this.loadData();
+      this.loadData();
       this.$router.push({
         // path: "/room/scheduledetail",
         // query: { id: e },
@@ -1126,16 +1117,14 @@ export default {
       });
     },
     loadData() {
-      // var _info = JSON.parse(localStorage.getItem("storeInfo"));
-      // getAction("/business/busMeetingRoomSchedule/fetch", {
-      //   startDate: this.startDate,
-      //   endDate: this.endDate,
-      //   hotelId: _info.id,
-      // }).then((res) => {
-      //   if (res.success) {
-      //     this.planList2 = res.result;
-      //   }
-      // });
+      getAction("/rooms/cesRooms/realtime-rooms", {}).then((res) => {
+        if (res.success) {
+          res.result.forEach((row) => {
+            this.$set(row, "collapse", 1);
+          });
+          this.roomList = res.result;
+        }
+      });
     },
   },
 };

+ 31 - 19
src/views/room/modules/checkIn/BillRoomForm.vue

@@ -925,6 +925,7 @@ export default {
       columns2,
       wakeList: [{}],
       // model: { rooms: panes, data: data, data2: data2 },
+      modelDefault: {},
       model: {
         // data: data,
         orderInfo: {
@@ -1058,13 +1059,6 @@ export default {
         this.depositRule = res.result;
       }
     });
-    getAction("/rooms/cesRoomLayout/list", { pageSize: 99999, pageNo: 1 }).then(
-      (res) => {
-        if (res.success) {
-          this.roomLayoutList = res.result.records;
-        }
-      }
-    );
     getAction("/business/busMemberCard/list", {
       pageSize: 99999,
       pageNo: 1,
@@ -1091,14 +1085,26 @@ export default {
         this.loadRooms();
       }
     );
+    //  this.getcesRoomLayout();
   },
   methods: {
+    async getcesRoomLayout() {
+      await getAction("/rooms/cesRoomLayout/list", {
+        pageSize: 99999,
+        pageNo: 1,
+      }).then((res) => {
+        if (res.success) {
+          this.roomLayoutList = res.result.records;
+          console.log("roomLayoutList");
+        }
+      });
+    },
     roomPriceSlnIdChange(e) {
       this.model.orderInfo.vipCustomerId = e;
     },
     loadRooms() {
-      this.model.roomPrices = [];
-      this.model.roomIds = [];
+      // this.model.roomPrices = [];
+      // this.model.roomIds = [];
       this.amount = 0;
       getAction("/rooms/cesRooms/can-user-rooms", {
         startOf:
@@ -1350,17 +1356,10 @@ export default {
     },
     add2(roomLive) {
       this.modelDefault = Object.assign({}, this.modelDefault, {
-        rooms: [roomLive],
+        roomIds: [roomLive],
       });
       this.edit(this.modelDefault);
     },
-    addList(roomLiveList, key) {
-      // this.modelDefault = Object.assign({}, this.modelDefault, {
-      //   rooms: roomLiveList,
-      // });
-      this.modelDefault.orderInfo.bookingOrdersType = key;
-      this.edit(this.modelDefault);
-    },
     editTabs(e) {
       console.log("editTabs", e);
       var index = this.model.roomIds.findIndex((t) => t.id == e);
@@ -1391,9 +1390,22 @@ export default {
       }
       return deposit;
     },
-    edit(record) {
-      this.model = Object.assign({}, record);
+    addList(roomLiveList, key) {
+      console.log("roomLiveList", roomLiveList);
+      this.modelDefault = Object.assign({}, this.modelDefault, {
+        roomIds: roomLiveList,
+      });
+      this.modelDefault.orderInfo.bookingOrdersType = key;
+      this.edit(this.modelDefault);
+    },
+    async edit(record) {
+      console.log("edit");
       this.visible = true;
+      this.model = Object.assign({}, record);
+      console.log("this.model", this.model);
+      if (this.roomLayoutList.length === 0) {
+        await this.getcesRoomLayout();
+      }
       if (this.model.roomIds && this.model.roomIds.length > 0) {
         this.activeKey = this.model.roomIds[0].id;
 

+ 43 - 10
src/views/room/modules/schedule/ScheduleRoomForm.vue

@@ -323,6 +323,7 @@
                 <span style="padding-left: 10px">总价:{{ amount }}</span>
               </p>
               <a-table
+                v-if="canUserRoomsShow"
                 :columns="columns"
                 :data-source="canUserRooms"
                 :pagination="false"
@@ -490,6 +491,7 @@ export default {
   },
   data() {
     return {
+      canUserRoomsShow: true,
       visible: true,
       columns,
       model: {
@@ -654,8 +656,8 @@ export default {
     rowKey(record) {
       return record.layout.id;
     },
-    loadRooms() {
-      getAction("/rooms/cesRooms/can-user-rooms", {
+    async loadRooms() {
+      await getAction("/rooms/cesRooms/can-user-rooms", {
         startOf:
           this.model.orderInfo.arrivalTime2 +
           " " +
@@ -669,10 +671,13 @@ export default {
       }).then((res) => {
         if (res.success) {
           res.result.forEach((t) => {
-            t.layout = Object.assign({}, t.layout, {
-              presetNum: 0,
-              oldTags: t.layout.canUseCount,
-            });
+            // t.layout = Object.assign({}, t.layout, {
+            //   presetNum: 0,
+            //   oldTags: t.layout.canUseCount,
+            // });
+            this.$set(t.layout, "presetNum", 0);
+            this.$set(t.layout, "oldTags", t.layout.canUseCount);
+            this.$set(t, "rooms", []);
             t.buildingRooms.forEach((b) => {
               b.floorRooms.forEach((f) => {
                 this.$set(f, "check", 0);
@@ -864,15 +869,43 @@ export default {
       this.edit(this.modelDefault);
     },
     addList(roomLiveList, key) {
-      // this.modelDefault = Object.assign({}, this.modelDefault, {
-      //   rooms: roomLiveList,
-      // });
+      console.log('roomLiveList',roomLiveList)
+      this.modelDefault = Object.assign({}, this.modelDefault, {
+        rooms: roomLiveList,
+      });
       this.modelDefault.orderInfo.bookingOrdersType = key;
       this.edit(this.modelDefault);
     },
-    edit(record) {
+    async edit(record) {
       this.model = Object.assign({}, record);
       this.visible = true;
+      await this.loadRooms();
+      console.log("this.canUserRooms", this.canUserRooms);
+      const dataSource = JSON.parse(JSON.stringify(this.canUserRooms));
+      if (this.model.rooms && this.model.rooms.length > 0) {
+        this.model.rooms.forEach((item) => {
+          var findIndex = dataSource.findIndex(
+            (t) => t.layout.id == item.layoutId
+          );
+          if (findIndex >= 0) {
+            const target = dataSource[findIndex];
+            if (target && target.layout) {
+              target.layout["presetNum"] += 1;
+              target.layout["canUseCount"] = this.canUserRooms[findIndex].layout.canUseCount - target.layout["presetNum"];
+              target.buildingRooms.forEach((b) => {
+                var room = b.floorRooms.find((f) => f.id == item.id);
+                if (room) {
+                  room.check = 1;
+                  target.rooms.push(room);
+                }
+              });
+            }
+          }
+        });
+      }
+      setTimeout(() => {
+        this.canUserRooms = dataSource;
+      }, 500);
     },
     submitForm() {
       const that = this;