gqx 2 vuotta sitten
vanhempi
commit
e38789e002

+ 122 - 86
src/views/room/modules/scheduleTeam/EdiBatchScheduleRoomForm.vue

@@ -257,7 +257,6 @@
                   prop="contactName"
                 >
                   <a-auto-complete
-                    :disabled="disabled"
                     v-model="model.contactName"
                     placeholder="联系人"
                     @search="handleSearch"
@@ -267,7 +266,7 @@
                       <a-select-option
                         v-for="item in customerList"
                         :key="item.id"
-                        >{{ item }}</a-select-option
+                        >{{ item.name }}-{{ item.phone }}</a-select-option
                       >
                     </template>
                   </a-auto-complete>
@@ -586,7 +585,7 @@ export default {
   components: { EditableCell, SelectRoomFormModal },
   props: {
     //表单禁用
-    disabled: {
+    disabled2: {
       type: Boolean,
       default: false,
       required: false,
@@ -598,6 +597,7 @@ export default {
   },
   data() {
     return {
+      disabled: false,
       visible: true,
       columns,
       columns2: [
@@ -701,7 +701,7 @@ export default {
       },
       url: {
         add: "/business/busRoomBookingOrders/add",
-        edit: "/business/busRoomBookingOrders/edit",
+        edit: "/business/busRoomBookingOrders/add",
         getBookingOrderInfo:
           "/business/busRoomBookingOrders/getBookingOrderInfo",
       },
@@ -739,91 +739,126 @@ export default {
     },
   },
   created() {
-    var _info = JSON.parse(localStorage.getItem("storeInfo"));
-    if (_info) {
-      this.model.hotelId = _info.id;
-    }
-    //备份model原始值
-    this.modelDefault = JSON.parse(JSON.stringify(this.model));
-
-    getAction("/business/busDictItem/list", {
-      hotelId: _info.id,
-      dictId: "1639538915239743490",
-    }).then((res) => {
-      if (res.success) {
-        this.customerSourceList = res.result.records;
-      }
-    });
-    getAction("/business/busDictItem/list", {
-      hotelId: _info.id,
-      dictId: "1639544187093995521",
-    }).then((res) => {
-      if (res.success) {
-        this.bookingdicWayList = res.result.records;
-      }
-    });
-    getAction("/business/busSalesPerson/list", {
-      hotelId: _info.id,
-      pageNo: 1,
-      pageSize: 100,
-    }).then((res) => {
-      if (res.success) {
-        this.warranterList = res.result.records;
+    this.load();
+  },
+  methods: {
+    deleteOrder() {
+      deleteAction("/business/busRoomBookingOrders/delete", {
+        id: this.model.orderInfo.id,
+      }).then((res) => {
+        if (res.success) {
+          this.$message.success(res.message);
+          this.$router.go(-1);
+        } else {
+          this.$message.warning(res.message);
+        }
+      });
+    },
+    setOrderStatus(status) {
+      postAction(
+        "/business/busRoomBookingOrders/set-batch-order-status?id=" +
+          this.model.orderInfo.id +
+          "&bookingStatus=" +
+          status,
+        {
+          id: this.model.orderInfo.id,
+          bookingStatus: status,
+        }
+      ).then((res) => {
+        if (res.success) {
+          this.$message.success(res.message);
+          this.getBookingOrderInfo();
+        } else {
+          this.$message.warning(res.message);
+        }
+      });
+    },
+    load() {
+      this.disabled = this.disabled2;
+      var _info = JSON.parse(localStorage.getItem("storeInfo"));
+      if (_info) {
+        this.model.hotelId = _info.id;
       }
-    });
+      //备份model原始值
+      this.modelDefault = JSON.parse(JSON.stringify(this.model));
 
-    getAction("/rooms/cesHourRoomRule/list", {
-      pageNo: 1,
-      pageSize: 100,
-    }).then((res) => {
-      if (res.success) {
-        this.hourRoomRuleList = res.result.records;
-      }
-    });
-    postAction("/rooms/cesAllDayPriceRule/fetch", { hotelId: _info.id }).then(
-      (res) => {
+      getAction("/business/busDictItem/list", {
+        hotelId: _info.id,
+        dictId: "1639538915239743490",
+      }).then((res) => {
         if (res.success) {
-          if (
-            res.result &&
-            res.result.cesAllDayPriceRule &&
-            res.result.cesAllDayPriceRule.leaveTime
-          ) {
-            this.model.orderInfo.dueOutTimeSpan = moment(
-              res.result.cesAllDayPriceRule.leaveTime,
-              "HH:mm"
-            );
-          }
+          this.customerSourceList = res.result.records;
         }
+      });
+      getAction("/business/busDictItem/list", {
+        hotelId: _info.id,
+        dictId: "1639544187093995521",
+      }).then((res) => {
+        if (res.success) {
+          this.bookingdicWayList = res.result.records;
+        }
+      });
+      getAction("/business/busSalesPerson/list", {
+        hotelId: _info.id,
+        pageNo: 1,
+        pageSize: 100,
+      }).then((res) => {
+        if (res.success) {
+          this.warranterList = res.result.records;
+        }
+      });
 
-        // this.loadRooms();
-      }
-    );
+      getAction("/rooms/cesHourRoomRule/list", {
+        pageNo: 1,
+        pageSize: 100,
+      }).then((res) => {
+        if (res.success) {
+          this.hourRoomRuleList = res.result.records;
+        }
+      });
+      postAction("/rooms/cesAllDayPriceRule/fetch", { hotelId: _info.id }).then(
+        (res) => {
+          if (res.success) {
+            if (
+              res.result &&
+              res.result.cesAllDayPriceRule &&
+              res.result.cesAllDayPriceRule.leaveTime
+            ) {
+              this.model.orderInfo.dueOutTimeSpan = moment(
+                res.result.cesAllDayPriceRule.leaveTime,
+                "HH:mm"
+              );
+            }
+          }
 
-    // getAction(this.url.getBookingOrderInfo, {
-    //   bookingNo: this.id,
-    // }).then((res) => {
-    //   if (res.success) {
-    //     this.model = res.result;
-    //     this.model.orderInfo.arrivalTime2 = moment(
-    //       this.model.orderInfo.arrivalTime
-    //     ).format("YYYY-MM-DD");
-    //     this.model.orderInfo.dueOutTime2 = moment(
-    //       this.model.orderInfo.dueOutTime
-    //     ).format("YYYY-MM-DD");
-    //     this.model.orderInfo.arrivalTimeSpan = moment(
-    //       this.model.orderInfo.arrivalTime.substr(11, 15),
-    //       "HH:mm"
-    //     );
-    //     this.model.orderInfo.dueOutTimeSpan = moment(
-    //       this.model.orderInfo.dueOutTime.substr(11, 15),
-    //       "HH:mm"
-    //     );
-    //     this.getbusCustomer();
-    //   }
-    // });
-    this.getBookingOrderInfo();
-  },
-  methods: {
+          // this.loadRooms();
+        }
+      );
+
+      // getAction(this.url.getBookingOrderInfo, {
+      //   bookingNo: this.id,
+      // }).then((res) => {
+      //   if (res.success) {
+      //     this.model = res.result;
+      //     this.model.orderInfo.arrivalTime2 = moment(
+      //       this.model.orderInfo.arrivalTime
+      //     ).format("YYYY-MM-DD");
+      //     this.model.orderInfo.dueOutTime2 = moment(
+      //       this.model.orderInfo.dueOutTime
+      //     ).format("YYYY-MM-DD");
+      //     this.model.orderInfo.arrivalTimeSpan = moment(
+      //       this.model.orderInfo.arrivalTime.substr(11, 15),
+      //       "HH:mm"
+      //     );
+      //     this.model.orderInfo.dueOutTimeSpan = moment(
+      //       this.model.orderInfo.dueOutTime.substr(11, 15),
+      //       "HH:mm"
+      //     );
+      //     this.getbusCustomer();
+      //   }
+      // });
+      this.getBookingOrderInfo();
+    },
     setMain(id) {
       postAction("/business/busBookingRooms/set-main", { id: id }).then(
         (res) => {
@@ -892,7 +927,8 @@ export default {
             this.model.orderInfo.dueOutTime.substr(11, 15),
             "HH:mm"
           );
-
+          this.$set(this.model, "phone", "");
+          this.$set(this.model, "contactName", "");
           this.getbusCustomer();
           this.loadRooms();
         }
@@ -1152,8 +1188,8 @@ export default {
             httpurl += this.url.add;
             method = "post";
           } else {
-            httpurl += this.url.edit;
-            method = "put";
+            httpurl = "/business/busRoomBookingOrders/add-batch";
+            method = "post";
           }
           httpAction(httpurl, this.model, method)
             .then((res) => {

+ 50 - 7
src/views/room/scheduleteamdetail.vue

@@ -96,9 +96,12 @@
               >
                 <div>
                   <a-tag color="#2db7f5"> 预定中 </a-tag>
-                  <span>批次{{ index + 1 }}(2间)</span>
+                  <span
+                    >批次{{ index + 1 }}({{ item.roomIds.length }}间)</span
+                  >
                 </div>
-                <div>{{ busRoomBookingOrders.phone }}</div>
+                <!-- <div>{{ busRoomBookingOrders.phone }}</div> -->
+                <div>{{ findCustomer(item.contactId) }}</div>
               </div>
             </div>
           </a-collapse-panel>
@@ -131,8 +134,9 @@
           <a-tab-pane key="1">
             <span slot="tab"> 详单 </span>
             <edi-batch-schedule-room-form
+              ref="EdiBatchScheduleRoomForm"
               :id="batchId"
-              :disabled="true"
+              :disabled2="true"
             ></edi-batch-schedule-room-form>
           </a-tab-pane>
           <a-tab-pane key="2">
@@ -153,6 +157,7 @@
 import EditScheduleRoomFormMain from "./modules/scheduleTeam/EditScheduleRoomFormMain.vue";
 import EdiBatchScheduleRoomForm from "./modules/scheduleTeam/EdiBatchScheduleRoomForm.vue";
 import AddBatchScheduleRoomModal from "./modules/schedule/ScheduleRoomModal";
+import { httpAction, getAction, postAction } from "@/api/manage";
 export default {
   components: {
     EditScheduleRoomFormMain,
@@ -178,11 +183,13 @@ export default {
       batchRoomsList: [],
       busRoomBookingOrders: {},
       bookingOrdersId: "",
+      customerList: [],
     };
   },
   created() {
     this.id = this.$route.query.id;
     console.log("created", this.id);
+    this.getbusCustomer();
   },
   // beforeRouteEnter(to, from, next) {
   //   console.log("to", to.query.id);
@@ -204,16 +211,53 @@ export default {
     this.isShow = false;
   },
   methods: {
+    findCustomer(id) {
+      if (this.customerList && this.customerList.length) {
+        var find = this.customerList.find((t) => t.id == id);
+        if (find) {
+          return find.phone;
+        } else {
+          return this.busRoomBookingOrders.phone;
+        }
+      }
+    },
+    getbusCustomer() {
+      getAction("/bus/busCustomer/list", {}).then((res) => {
+        if (res.success) {
+          this.customerList = res.result.records;
+        }
+      });
+    },
     addPatch() {
       this.$refs.modalAddBatchScheduleRoom.add();
       this.$refs.modalAddBatchScheduleRoom.title = "添加批次";
       this.$refs.modalAddBatchScheduleRoom.disableSubmit = false;
     },
-    modalFormOk(e) {},
+    modalFormOk(e) {
+      console.log("modalFormOk");
+      this.isShow = false;
+      setTimeout(() => {
+        this.isShow = true;
+      }, 100);
+    },
     selectBatch(item) {
-      item.check = item.check == 1 ? 0 : 1;
+      this.batchRoomsList.forEach((t) => {
+        if (t.check === 1 && t != item) {
+          t.check = 0;
+        }
+      });
+      if (item.check === 0) {
+        item.check = 1;
+      } else {
+        item.check = 0;
+      }
       this.selectMain = item.check == 0;
       this.batchId = item.id;
+      if (!this.selectMain) {
+        setTimeout(() => {
+          this.$refs.EdiBatchScheduleRoomForm.load();
+        }, 100);
+      }
     },
     getCallback(e) {
       console.log("getCallback", e);
@@ -223,8 +267,7 @@ export default {
       this.batchRoomsList.forEach((t) => {
         this.$set(t, "check", 0);
       });
-      this.bookingOrdersId =
-        this.busRoomBookingOrders.orderInfo.id;
+      this.bookingOrdersId = this.busRoomBookingOrders.orderInfo.id;
       console.log("bookingOrdersId", this.bookingOrdersId);
     },
     onChange(checkedValues) {