Prechádzať zdrojové kódy

切换钟点房 自用房时费用调整

DESKTOP-B78GIPM\admin 2 rokov pred
rodič
commit
2e070cda98

+ 99 - 1
src/views/room/modules/checkIn/BillRoomForm.vue

@@ -991,6 +991,7 @@ import MemberCardModal from "./MemberCardModal";
 import AgreementUnitModal from "./AgreementUnitModal";
 import AgreementUnitModal from "./AgreementUnitModal";
 import AgreementUnitModalTable from "./AgreementUnitModalTable";
 import AgreementUnitModalTable from "./AgreementUnitModalTable";
 import HistoryModal from "./HistoryModal";
 import HistoryModal from "./HistoryModal";
+import { set } from 'vue';
 const columns = [
 const columns = [
   // {
   // {
   //     title: "",
   //     title: "",
@@ -1192,6 +1193,7 @@ export default {
       ruZhuHistoryList: [],
       ruZhuHistoryList: [],
       remenmberPayState: null,
       remenmberPayState: null,
       loadRemenmberPayState: false,
       loadRemenmberPayState: false,
+      roomListCopy:[]
     };
     };
   },
   },
   computed: {
   computed: {
@@ -1288,6 +1290,59 @@ export default {
     },
     },
   },
   },
   watch: {
   watch: {
+    'model.orderInfo.bookingType'(val,old){
+      debugger
+      if (val) {
+        this.model.orderInfo.dayCount = this.daysBetween(this.model.orderInfo.arrivalTime2, this.model.orderInfo.dueOutTime2)
+      }
+      if(old == 2 && val == 3 || val == 4){
+        this.editPriceData.forEach(item=>{
+          let arr = {}
+          arr = this.roomListCopy.filter(t=>t.roomId == item.roomId)[0]
+          item.marketPrice = arr.marketPrice
+          item.prefPrice = 0
+          item.roomFee = 0
+        })
+        this.editPriceOk()
+      }
+      if (val == 3 || val == 4) {
+        this.editPriceData.forEach(item=>{
+          item.edit.forEach((ele) => {
+            ele.price = 0;
+          });
+        })
+        this.editPriceOk()
+      }
+      if (val == 1 || val == 5) {
+        this.editPriceData.forEach(item=>{
+          let arr = {}
+          arr = this.roomListCopy.filter(t=>t.roomId == item.roomId)[0]
+          console.log(arr);
+          item.marketPrice = arr.marketPrice
+          item.prefPrice = item.marketPrice
+          item.roomFee = item.marketPrice
+          item.edit.forEach((ele) => {
+            ele.price = item.prefPrice;
+          });
+        })
+        this.editPriceOk()
+      }
+      if (val == 2) {
+        console.log(this.hourRoomRuleList);
+        let obj = this.hourRoomRuleList.filter(item=>item.id == this.model.orderInfo.hourRoomId)[0]
+        this.editPriceData.forEach(item=>{
+          item.marketPrice = obj.afterOpenRoomPay
+          item.prefPrice = obj.afterOpenRoomPay
+          item.roomFee = obj.afterOpenRoomPay
+          if (item.edit) {
+            item.edit.forEach((ele) => {
+              ele.price = item.prefPrice;
+            });
+          }
+        })
+        this.editPriceOk()
+      }
+    },
     otherRoomSync(value) {
     otherRoomSync(value) {
       if (!value) {
       if (!value) {
         if (this.modelDefault.roomIds && this.modelDefault.roomIds.length > 0) {
         if (this.modelDefault.roomIds && this.modelDefault.roomIds.length > 0) {
@@ -2050,6 +2105,18 @@ export default {
             "HH:mm"
             "HH:mm"
           );
           );
         }
         }
+        let obj = this.hourRoomRuleList.filter(item=>item.id == this.model.orderInfo.hourRoomId)[0]
+        this.editPriceData.forEach(item=>{
+          item.marketPrice = obj.afterOpenRoomPay
+          item.prefPrice = obj.afterOpenRoomPay
+          item.roomFee = obj.afterOpenRoomPay
+          if (item.edit) {
+            item.edit.forEach((ele) => {
+              ele.price = item.prefPrice;
+            });
+          }
+        })
+        this.editPriceOk()
       }
       }
       this.loadRooms();
       this.loadRooms();
     },
     },
@@ -2421,7 +2488,7 @@ export default {
       console.log("e", e);
       console.log("e", e);
       this.model.roomPrices = this.model.roomPrices.filter((t) =>
       this.model.roomPrices = this.model.roomPrices.filter((t) =>
         e.some((r) => r.id == t.roomId)
         e.some((r) => r.id == t.roomId)
-      );
+      );      
       this.model.orderFees = this.model.orderFees.filter((t) =>
       this.model.orderFees = this.model.orderFees.filter((t) =>
         e.some((r) => r.id == t.roomId)
         e.some((r) => r.id == t.roomId)
       );
       );
@@ -2667,6 +2734,37 @@ export default {
           // roomIndex++;
           // roomIndex++;
         });
         });
         this.model.roomPrices = [...this.model.roomPrices, ...roomPrices];
         this.model.roomPrices = [...this.model.roomPrices, ...roomPrices];
+        if (this.roomListCopy.length==0) {
+          this.roomListCopy = JSON.parse(JSON.stringify(this.model.roomPrices));
+        }else{
+          this.roomListCopy = [...this.roomListCopy,...roomPrices]
+        }
+        // let type = JSON.parse(JSON.stringify(this.model.orderInfo.bookingType))
+        // this.model.orderInfo.bookingType = 9999
+        // setTimeout(() => {
+        //   this.model.orderInfo.bookingType = type
+        // }, 100);
+        if(this.model.orderInfo.bookingType==3 || this.model.orderInfo.bookingType==4){
+          this.model.roomPrices.forEach(ele=>{
+              ele.prefPrice = 0
+              ele.roomFee = 0
+          })
+          this.editPriceOk()
+        }
+        if (this.model.orderInfo.bookingType == 2) {
+          let obj = this.hourRoomRuleList.filter(item=>item.id == this.model.orderInfo.hourRoomId)[0]
+          this.editPriceData.forEach(item=>{
+            item.marketPrice = obj.afterOpenRoomPay
+            item.prefPrice = obj.afterOpenRoomPay
+            item.roomFee = obj.afterOpenRoomPay
+            if (item.edit) {
+              item.edit.forEach((ele) => {
+                ele.price = item.prefPrice;
+              });
+            }
+          })
+          this.editPriceOk()
+        }
         if (this.model.roomPrices && this.model.roomPrices.length > 2) {
         if (this.model.roomPrices && this.model.roomPrices.length > 2) {
           var mainRoom = this.model.roomPrices[0];
           var mainRoom = this.model.roomPrices[0];
           var sortRooms = this.model.roomPrices
           var sortRooms = this.model.roomPrices