浏览代码

合并代码

DESKTOP-B78GIPM\admin 2 年之前
父节点
当前提交
9c95ea2f14
共有 6 个文件被更改,包括 448 次插入176 次删除
  1. 32 39
      components/header.vue
  2. 60 56
      pages/index/index.vue
  3. 42 33
      pages/roomOrders/roomOrders.vue
  4. 249 47
      pages/roomStateDiagram/roomStateDiagram.vue
  5. 2 1
      utils/api.js
  6. 63 0
      utils/customerOrder.js

+ 32 - 39
components/header.vue

@@ -1,7 +1,7 @@
 <template>
 <div style="background-color:#fff;overflow: hidden;" :style="{'border-bottom': borbtm?'1px solid':'none'}">
-    <u-navbar  title="" @rightClick="rightClick" :autoBack="!isSwitch" placeholder @leftClick="leftClick" :leftIcon="isSwitch? '' : 'arrow-left' ">
-        <div slot="center" style="width:80%;">
+    <u-navbar title="" @rightClick="rightClick" :autoBack="!isSwitch" placeholder @leftClick="leftClick" :leftIcon="isSwitch? '' : 'arrow-left' ">
+        <div slot="center" style="width:80%">
             <uni-data-select :clear="false" style="flex:1" v-model="hotelIds" :localdata="range" @change="change"></uni-data-select>
         </div>
     </u-navbar>
@@ -35,20 +35,12 @@ export default {
     },
     data() {
         return {
-            hotelIds: 0,
+            hotelIds: uni.getStorageSync(('hotelId') || ''),
             value: 0,
             range: [{
                     value: 0,
                     text: "全部"
-                },
-                {
-                    value: 1,
-                    text: "沙县大酒店"
-                },
-                {
-                    value: 2,
-                    text: "游泳"
-                },
+                }
             ],
         }
     },
@@ -59,6 +51,9 @@ export default {
             hotelId: state => state.hotelId
         })
     },
+    onShow(){
+        // this.hotelIds = uni.getStorageSync('hotelId')
+    },
     watch: {
         hotelIdList(newVal) {
             console.log('header', newVal);
@@ -68,41 +63,39 @@ export default {
                     text: item.name
                 }
             })
+            // this.hotelIds = newVal[0].id
+        },
+        hotelId(newVal, oldVal) {
+            console.log('header', newVal, oldVal);
+            if(newVal != oldVal){
+                this.hotelIds = newVal
+            }
+            this.$emit('change', this.hotelIds)
         }
     },
     async mounted() {
-        
+        let data = await getHotelList()
+        if (data.code == 200) {
+            this.$nextTick(() => {
+                this.$store.commit('setHotelIdList', data.result.records)
+                // this.hotelIds = data.result.records[0].id
+                if (uni.getStorageSync('hotelId')) {
+                    this.hotelIds = uni.getStorageSync('hotelId')
+                    this.$store.commit('setHotelId', uni.getStorageSync('hotelId'))
+                }else{
+                    this.hotelIds = data.result.records[0].id
+					uni.setStorageSync("hotelId",data.result.records[0].id)
+                    this.$store.commit('setHotelId', data.result.records[0].id)
+                }
+                this.$emit('change', this.hotelIds)
+            })
+        }
     },
     methods: {
-		async getHotels(cb) {
-			let data = await getHotelList()
-			if (data.code == 200) {
-			    this.$nextTick(() => {
-					this.$store.commit('setHotelIdList', data.result.records)
-					let cacheStore = uni.getStorageSync("hotelInfo")
-					if(cacheStore) {
-						this.hotelIds = cacheStore.id
-						this.$store.commit('setHotelId', cacheStore.id)
-					} else {
-						this.hotelIds = data.result.records[0].id
-						uni.setStorageSync("hotelInfo",data.result.records[0])
-						this.$store.commit('setHotelId', data.result.records[0].id)
-					}
-					if(cb) {
-						cb()
-					}
-					this.$emit('change',this.hotelIds)
-			    })
-			}
-		},
         change(e) {
             console.log(e)
             this.$store.commit('setHotelId', e)
-			let hotels = this.hotelIdList
-			let index = hotels.findIndex(s=>s.id == e) 
-			if(index > -1) {
-				uni.setStorageSync("hotelInfo",hotels[index])
-			}
+            uni.setStorageSync('hotelId', e)
             console.log(this.hotelId);
             this.$emit('change', e)
         },

+ 60 - 56
pages/index/index.vue

@@ -5,31 +5,28 @@
             <div class="select-top">
                 <uni-data-select style="border: none;flex: none;" iconColor="#FFF" :clear="false" v-model="hotelIds" :localdata="range" @change="change"></uni-data-select>
             </div>
-			<div class="grid-data">
-				<div>
-				    <div>今日总收款/元</div>
-				    <div style="font-size: 18px;">{{todayTotalIncome}}</div>
-				</div>
-				<div>
-				    <div>在住/空置</div>
-				    <div style="font-size: 18px;">{{roomData.checkInRoomData}}/{{roomData.allRoomData - roomData.checkInRoomData}}</div>
-				</div>
-				<div>
-				    <div>入住率</div>
-				    <div style="font-size: 18px;">{{(((roomData.checkInRoomData/roomData.allRoomData) || 0)*100).toFixed(2)}}%</div>
-				</div>
-			</div>
             <div class="grid-data">
-                
                 <div>
+                    <div>今日总收款/元</div>
+                    <div style="font-size: 18px;">{{todayTotalIncome}}</div>
+                </div>
+                <div>
+                    <div>在住/空置</div>
+                    <div style="font-size: 18px;">{{roomData.checkInRoomData}}/{{roomData.allRoomData - roomData.checkInRoomData}}</div>
+                </div>
+                <div>
+                    <div>入住率</div>
+                    <div style="font-size: 18px;">{{(((roomData.checkInRoomData/roomData.allRoomData) || 0).toFixed(2))*100}}%</div>
+                </div>
+                <div style="margin-top:10px;">
                     <div>今日总收入/元</div>
                     <div style="font-size: 18px;">{{todayIncome.reduce((pre, cur) => pre+cur.amount,0 ) || 0}}</div>
                 </div>
-                <div>
+                <div style="margin-top:10px;">
                     <div>平均房价/元</div>
                     <div style="font-size: 18px;">{{roomData.housingPrices}}</div>
                 </div>
-                <div>
+                <div style="margin-top:10px;">
                     <div>RevPAR</div>
                     <div v-if="roomData.checkInRoomData/roomData.allRoomData!=0 && roomData.allRoomData!=0" style="font-size: 18px;">{{((roomData.housingPrices*roomData.allRoomData)/(roomData.checkInRoomData/roomData.allRoomData).toFixed(2)).toFixed(2)}}</div>
                     <div v-else style="font-size: 18px;">{{0}}</div>
@@ -60,7 +57,7 @@
             </div>
         </div>
         <div class="grid-tabbar">
-            <div v-for="(item, index) in tabbarList" @click="handleToPage(item)" :key="index" style="display:flex;flex-direction:column;align-items:center">
+            <div v-for="(item, index) in tabbarList" @click="handleToPage(item)" :key="index" style="display:flex;flex-direction:column;align-items:center;width:20%;margin-top:10px;">
                 <image :src="item.icon" style="width:30px;height:30px;" />
                 <div class="tbr-name">{{item.name}}</div>
             </div>
@@ -332,7 +329,7 @@ export default {
                 }
             ],
             RevPAR: 0,
-            hotelIds: 0,
+            hotelIds: uni.getStorageSync('hotelId'),
             // housingPrices: 0, //平均房价
             todayIncome: [{
                     name: '押金',
@@ -422,7 +419,7 @@ export default {
         }),
         IncomeAndExpenditure(){
 
-        }
+        },
     },
     watch: {
         hotelIdList(newVal) {
@@ -431,15 +428,23 @@ export default {
                 value: item.id,
                 text: item.name
             }))
+        },
+        hotelIds(newVal, oldVal){
+            if (newVal != oldVal) {
+                this.onload()
+            }
         }
     },
+    onShow(){
+        console.log('newValhotelIdCopy',uni.getStorageSync('hotelId'));
+        this.hotelIds = uni.getStorageSync('hotelId')
+    },
     async mounted() {
         // this.onload()
+        await this.getHotel();
+        this.onload()
+
     },
-	 onShow() {
-		 this.getHotel();
-		
-	},
     methods: {
         //获取酒店数据
         async getHotel() {
@@ -447,13 +452,13 @@ export default {
             if (data.code == 200) {
                 this.$nextTick(() => {
                     this.$store.commit('setHotelIdList', data.result.records)
-					let cacheStore = uni.getStorageSync("hotelInfo")
+                    let cacheStore = uni.getStorageSync("hotelId")
 					if(cacheStore) {
-						this.hotelIds = cacheStore.id
-						this.$store.commit('setHotelId', cacheStore.id)
+						this.hotelIds = cacheStore
+						this.$store.commit('setHotelId', cacheStore)
 					} else {
 						this.hotelIds = data.result.records[0].id
-						uni.setStorageSync("hotelInfo",data.result.records[0])
+						uni.setStorageSync("hotelId",data.result.records[0].id)
 						this.$store.commit('setHotelId', data.result.records[0].id)
 					}
 					this.onload()
@@ -462,10 +467,11 @@ export default {
             return data
         },
         onload() {
-            let str = new Date()
+            let str = new Date().toLocaleDateString()
             //后一天
-            let end = new Date(new Date().getTime() + 24 * 60 * 60 * 1000)
-            
+            let end = new Date(new Date().getTime() + 24 * 60 * 60 * 1000).toLocaleDateString()
+            str = str.replace(/\//g, '-')
+            end = end.replace(/\//g, '-')
 
             // 房间数据统计
             getRevPAR().then(res => {
@@ -503,16 +509,16 @@ export default {
             })
 
             //今日总收款
-			console.log("nidayede ",str,end)
             getTodayTotalIncome({
-                startTime: str.format("yyyy-MM-dd"),
-                endTime: end.format("yyyy-MM-dd")
+                startTime: str,
+                endTime: end
+                // startTime: '2023-04-27',
+                // endTime: '2023-04-28'
             }).then(res => {
-				
+                this.todayTotalIncome = 0
                 if (res.code == 200 && res.result.records.length > 0) {
                     let brr = []
                     let data = res.result.records
-					this.todayTotalIncome = 0
                     data.forEach(item => {
                         let arr = []
                         arr = Object.keys(item).filter(items => items != 'department' && items != 'hotel_name')
@@ -593,13 +599,9 @@ export default {
         
         change(e) {
             console.log("e:", e);
-            this.hotelIds = e
-			let hotels = this.hotelIdList
-			let idx =  (hotels||[]).findIndex(s=>s.id == e)
-			if(idx > -1) {
-				uni.setStorageSync("hotelInfo",hotels[idx])
-			}
+            // this.hotelIds = e
             this.$store.commit('setHotelId', e)
+            uni.setStorageSync('hotelId', e)
             this.onload()
         },
         roomOrders(idx) {
@@ -742,19 +744,20 @@ page {
 }
 
 .grid-data {
+    // display: grid;
+    // grid-template-columns: repeat(3, 1fr);
+    // grid-template-rows: repeat(2, 1fr);
+    // grid-gap: 30px 10px;
     display: flex;
-    grid-template-columns: repeat(3, 1fr);
-    grid-template-rows: repeat(2, 1fr);
-    grid-gap: 30px 10px;
+    flex-wrap: wrap;
     color: #fff;
-	margin-top: 26rpx;
 }
 
 .grid-data>div {
     /* background-color: #fff; */
     /* border: 1px solid #eee; */
+    width: 33%;
     display: flex;
-	width: 100%; 
     justify-content: space-between;
     flex-direction: column;
     align-items: center;
@@ -763,21 +766,22 @@ page {
 }
 
 .grid-tabbar {
+    // display: grid;
+    // grid-template-columns: repeat(5, 1fr);
+    // grid-template-rows: repeat(3, 1fr);
+    // gap: 10px;
     display: flex;
-	flex-wrap: wrap;
-	justify-content: center;
-	align-items: center;
-    margin-top: 20px;
+    flex-wrap: wrap;
+    margin-top: 10px;
     background: #fff;
 }
 .tbr-name{
 	font-size: .8rem;
 }
-.grid-tabbar>div{
-	width: 20%;
-	margin: 10px 0;
-}
-
+// .grid-tabbar>div{
+// 	width: 20%;
+// 	margin: 10px 0;
+// }
 // .bgco {
 //     position: fixed;
 //     background-color: rgb(0, 186, 173);

+ 42 - 33
pages/roomOrders/roomOrders.vue

@@ -1,6 +1,6 @@
 <template>
 <view>
-    <Header ref="header" @change="switchChange">
+    <Header @change="switchChange">
         <template #search>
             <u--input v-model="keyWord" @change="searchWord" placeholder="房间号/姓名/手机号" border="surround" shape="circle" prefixIcon="search" prefixIconStyle="font-size: 22px;color: #909399" fontSize="12px" :customStyle="{border:'1px solid #e2e2e2',padding:'0 10px',margin:'0 10px',borderRadius:'20px'}">
             </u--input>
@@ -33,14 +33,14 @@
             <div v-for="item in roomList" :key="item.id">
                 <template v-if="item.rooms.length>0">
                     <div style="color:rgb(255, 141, 26);text-align:right;border-bottom:1px solid #00000030;line-height:30px">{{item.name}}:{{item.rooms.length}}间</div>
-                    <div v-for="(sItem, index) in item.rooms" :key="sItem.id" :style="{height:'60px',borderBottom:index!=item.rooms.length-1?'1px solid #00000030':'',}">
+                    <div @click="changeList(sItem.roomInfo.id)" v-for="(sItem, index) in item.rooms" :key="sItem.id" :class="{'list-active':sItem.roomInfo.id == curId}" :style="{height:'60px',borderBottom:index!=item.rooms.length-1?'1px solid #00000030':'',}">
                         <div style="margin-top:10px">
                             <span style="font-size: 16px; font-weight: bold;margin-right:10px;">{{sItem.roomInfo.name}}</span> <span style="font-size: 16px; font-weight: bold;">{{sItem.layout.name }}</span> <span style="margin-left:10px;">{{''}}</span>
                         </div>
                         <div class="day-detail-list" v-if="sItem.livingData.livingOrder">
                             <div style="width:35%;">{{sItem.livingData.livingCustomers.customerName}}/ {{sItem.livingData.livingCustomers.phone}}</div>
                             <div>{{sItem.livingData.livingOrder.dayCount}}天/{{sItem.livingData.livingOrder.arrivalTime.substr(5,5)}}</div>
-                            <div>¥{{sItem.layout.marketPrice}}/付0/余0</div>
+                            <div>¥{{sItem.layout.marketPrice}}/付{{sItem.livingData.livingOrder.shouKuan}}/余{{sItem.livingData.livingOrder.shouKuan - sItem.livingData.livingOrder.xiaoFei}}</div>
                         </div>
                     </div>
                 </template>
@@ -49,7 +49,11 @@
         </div>
     </template>
     <div class="btm-subsection">
-        <u-subsection :list="list1" mode="subsection" :current="current1" @change="bottomChange"></u-subsection>
+        <u-subsection v-if="current == 0" :list="list1" mode="subsection" :current="current1" @change="bottomChange"></u-subsection>
+        <div v-if="current == 1" class="btm-subsection-btn">
+            <div>续租缴费</div>
+            <div style="background:#409EFF;color:#fff;">退房结账</div>
+        </div>
     </div>
     <div style="width:100vw;height: 30px;"></div>
 </view>
@@ -106,6 +110,7 @@ export default {
              */
             cesRoomLayoutList: [],
             keyWord: '',
+            curId: null,
         };
     },
     onLoad(options) {
@@ -113,18 +118,10 @@ export default {
         if (options.current) {
             // this.sectionChange(options.current)
             this.current = options.current
-           
+
         }
+        this.getData()
     },
-	onShow(){
-		this.$nextTick(()=>{
-			this.$refs.header.getHotels(()=>{
-				setTimeout(()=>{
-					this.getData()
-				},500)
-			})
-		})
-	},
     filters: {},
     methods: {
         getData() {
@@ -154,6 +151,11 @@ export default {
             })
         },
 
+        changeList(idx){
+            console.log(idx);
+            this.curId = idx
+        },
+
         searchWord(){
             this.filter()
         },
@@ -162,7 +164,7 @@ export default {
          * @param {Array} type 房子状态数组
          */
         filter(type = [3, 4]) {
-            console.log(type);
+            // console.log(type);
             let arr = []
             // arr = this.roomListCopy.filter(item => {
             //     return item.rooms.filter(ele => {
@@ -175,7 +177,7 @@ export default {
                 })
             })
             arr = JSON.parse(JSON.stringify(this.roomListCopy))
-            console.log(typeof this.keyWord);
+            // console.log(typeof this.keyWord);
             if (this.keyWord) {
                 arr.forEach(item => {
                     item.rooms = item.rooms.filter(ele => {
@@ -193,9 +195,9 @@ export default {
                     })
                 })
             }
-            console.log('arrarrarrarr', arr);
+            // console.log('arrarrarrarr', arr);
             this.roomList = JSON.parse(JSON.stringify(arr))
-            console.log(this.roomList);
+            // console.log(this.roomList);
             if (this.roomList.length == 0) {
                 return
             }
@@ -206,7 +208,7 @@ export default {
                 })
             })
             this.roomTypeCount = this.count(nameList)
-            console.log(this.roomTypeCount);
+            // console.log(this.roomTypeCount);
             if (this.current == 1) {
                 nameList = []
                 this.roomList = this.filterLeave(this.roomList)
@@ -266,7 +268,7 @@ export default {
             array.forEach(ele => {
                 ele.rooms = ele.rooms.filter(item => {
                     //比较时间
-                    return item.livingData.livingOrder.dueOutTime == item.livingData.livingOrder.arrivalTime
+                    return item.livingData.livingOrder.dueOutTime == new Date().toISOString().slice(0, 10);
                 })
             })
             return array
@@ -331,9 +333,9 @@ export default {
             this.current1 = index
         },
         switchChange() {
-            this.$nextTick(() => {
+            // this.$nextTick(() => {
                 this.getData()
-            })
+            // })
         }
     }
 }
@@ -366,22 +368,15 @@ page {
 
 .card-day-btm {
     margin-top: 10px;
-    display: flex;
-	flex-wrap: wrap;
+    display: grid;
     grid-template-columns: repeat(2, 1fr);
     justify-content: space-between;
     gap: 10px;
-	text-align: center;
-	div{
-		width: 100%;
-		text-align: center;
-		
-	}
 
     // div为偶数时右对齐
-    // div:nth-child(even) {
-    //     text-align: right;
-    // }
+    div:nth-child(even) {
+        text-align: right;
+    }
 }
 
 .day-detail {
@@ -407,4 +402,18 @@ page {
 .btm-subsection {
     margin-top: 10px;
 }
+.list-active {
+    background: rgb(228, 240, 253);
+}
+.btm-subsection-btn{
+    display: flex;
+    width: 100vw;
+    align-items: center;
+    background: #fff;
+    >div{
+        flex: 1;
+        text-align: center;
+        line-height: 50px;
+    }
+}
 </style>

+ 249 - 47
pages/roomStateDiagram/roomStateDiagram.vue

@@ -1,6 +1,6 @@
 <template>
 <view>
-    <Header ref="header" @change="headerChange" :isSwitch="true">
+    <Header @change="headerChange" :isSwitch="true">
         <template #search>
             <!-- <u--input placeholder="房间号/姓名/手机号/身份证号" border="surround" shape="circle" prefixIcon="search" prefixIconStyle="font-size: 22px;color: #909399" fontSize="12px" :customStyle="{border:'1px solid #e2e2e2',padding:'0 10px',margin:'0 10px',borderRadius:'20px'}" @change="searchChange"></u--input> -->
         </template>
@@ -30,27 +30,46 @@
         <div style="margin-top:10px">
             <div class="room-state-detail" v-for="item in dataList" :key="item.id">
                 <div class="room-state-detail-title">{{item.name.includes('栋')? item.name : item.buildingName + item.name}}:{{item.rooms.length}}间</div>
-                <div class="ctner">
-					<div class="room-state-detail-grid">
-					    <div class="room-state-detail-card" v-for="sItem in item.rooms" :key="sItem.id" :style="{background: roomStatusColorList && roomStatusColorList.length > 0 ? getRoomStatusColor(sItem.roomInfo.roomStatus) : '',}">
-					        <div style="display:flex;justify-content: space-between;">
-					            <div><b>{{sItem.roomInfo.name}}</b></div>
-					            <div v-if="sItem.livingData.livingOrder" style="background:rgb(255, 141, 26);color:#fff;padding:1px 2px;border-radius:5px;">{{getCustomerSourceList(sItem.livingData.livingOrder.customerSource)}}</div>
-					        </div>
-					        <div v-if="sItem.livingData.livingOrder">
-					            <div style="width:100%;overflow: hidden;"><b>{{sItem.livingData.livingCustomers.customerName}}</b><span v-if="sItem.livingData.livingOrder.vipCustomerId" style="color:red; font-size: 12px;transform: scale(0.6);display:inline-block;">VIP</span></div>
-					            <div>{{sItem.livingData.livingOrder.dayCount}}天/{{ sItem.livingData.livingOrder.arrivalTime }}</div>
-					            <div style="width:100%;overflow: hidden;">¥{{sItem.livingData.price && sItem.livingData.price.length > 0  ? sItem.livingData.price[0].price : 0 }}/剩0</div>
-					        </div>
-					        <b v-else>
-					            {{sItem.layout.name}}
-					        </b>
-					    </div>
-					</div>
-				</div>
+                <div class="room-state-detail-grid">
+                    <div class="room-state-detail-card" @click="roomClick(sItem)" v-for="sItem in item.rooms" :key="sItem.id" :style="{background: roomStatusColorList && roomStatusColorList.length > 0 ? getRoomStatusColor(sItem.roomInfo.roomStatus) : '',}">
+                        <div style="display:flex;justify-content: space-between;">
+                            <div><b>{{sItem.roomInfo.name}}</b></div>
+                            <div v-if="sItem.livingData.livingOrder" style="background:rgb(255, 141, 26);color:#fff;padding:1px 2px;border-radius:5px;">{{getCustomerSourceList(sItem.livingData.livingOrder.customerSource)}}</div>
+                        </div>
+                        <div v-if="sItem.livingData.livingOrder">
+                            <div style="width:100%;overflow: hidden;"><b>{{sItem.livingData.livingCustomers.customerName}}</b><span v-if="sItem.livingData.livingOrder.vipCustomerId" style="color:red; font-size: 12px;transform: scale(0.6);display:inline-block;">VIP</span></div>
+                            <div>{{sItem.livingData.livingOrder.dayCount}}天/{{ sItem.livingData.livingOrder.arrivalTime }}</div>
+                            <div style="width:100%;overflow: hidden;">¥{{sItem.livingData.price && sItem.livingData.price.length > 0  ? sItem.livingData.price[0].price : 0 }}/ {{sItem.livingData.livingOrder.shouKuan - sItem.livingData.livingOrder.xiaoFei<0? `欠${sItem.livingData.livingOrder.shouKuan - sItem.livingData.livingOrder.xiaoFei}` : `剩${sItem.livingData.livingOrder.shouKuan - sItem.livingData.livingOrder.xiaoFei}` }}</div>
+                        </div>
+                        <b v-else>
+                            {{sItem.layout.name}}
+                        </b>
+                    </div>
+                </div>
             </div>
         </div>
     </div>
+    <u-action-sheet safeAreaInsetBottom :cancelText="'取消'" @close="show = false" :actions="listSheet" @select="selectClick" :title="'设置'" :show="show" v-if="selectData">
+        <div style="line-height:40px;" v-if="selectData.roomInfo.roomStatus === 2" @click="handleClean">置净</div>
+        <div style="line-height:40px;" v-else @click="handleDirty">置脏</div>
+        <div style="line-height:40px;" v-if="selectData.roomInfo.roomStatus === 6" @click="handleOffLock">解锁</div>
+        <div style="line-height:40px;" v-else @click="handleLock">锁定</div>
+        <div style="line-height:40px;" v-if="selectData.roomInfo.roomStatus === 5" @click="handleCompleteRepair">完成维修</div>
+        <div style="line-height:40px;" v-else @click="handleWx">维修</div>
+    </u-action-sheet>
+    <u-modal :show="showModal" closeOnClickOverlay @confirm="confirmWx" @close="showModal = false" :cancelText="'取消'" :title="'维修'">
+        <div>
+            <div style="display:flex;justify-content:center;align-items:center;">
+                维修时间 <div style="margin-left:10px" @click="showTime = true" class="calendar">{{`${startTime} ~ ${endTime}`}}</div>
+            </div>
+            <div style="display:flex;justify-content:center;align-items:center;">
+                维修原因 <u-input v-model="wxReason" placeholder="请输入维修原因"></u-input>
+            </div>
+        </div>
+    </u-modal>
+    <u-calendar closeOnClickOverlay :show="showTime" mode="range" @close="showTime=false" @confirm="confirmTime"></u-calendar>
+
+    <u-toast style="z-index:999999;position: relative;" ref="uToast"></u-toast>
 </view>
 </template>
 
@@ -60,7 +79,13 @@ import {
     getHotelRoomList,
     getRoomStatus,
     getCustomerSource,
-    getRoomType
+    getRoomType,
+    setDirty,
+    lockRoom,
+    unlockRoom,
+    setClean,
+    repairRoom,
+    finishRepair
 } from '../../utils/customerOrder'
 export default {
     components: {
@@ -90,23 +115,41 @@ export default {
              * 房型列表
              */
             cesRoomLayoutList: [],
+            //弹出框
+            show:false,
+            showModal:false,
+            showTime:false,
+            startTime: new Date().toISOString().slice(0, 10),
+            endTime: new Date(new Date().getTime()+ 24 * 60 * 60 * 1000 ).toISOString().slice(0, 10),
+            wxReason:'',
+            listSheet: [
+				{
+					name:'置脏'
+				},
+				{
+					name: '置净'
+				},
+                {
+                    name: '锁定'
+                },
+                {
+                    name: '解锁'
+                },
+                {
+                    name: '维修'
+                }
+			],
+            selectData:null,
         }
     },
     mounted() {
-        
-	
+        this.getData()
     },
-	onShow() {
-		this.$nextTick(()=>{
-			this.$refs.header.getHotels(()=>{
-				
-			})
-		})
-	},
     methods: {
         sectionChange(i) {
             console.log(i)
             this.current = i
+            this.filter()
         },
         searchChange(e) {
             console.log(e)
@@ -201,27 +244,67 @@ export default {
                     })
                 })
             }
+            //在住
+            if (this.current == 1) {
+                
+            }
+            //预离
+            if (this.current == 2) {
+                arr.forEach(ele => {
+                    ele.rooms = ele.rooms.filter(item => {
+                        return item.livingData && item.livingData.livingOrder && item.livingData.livingOrder.dueOutTime == new Date().toISOString().slice(0, 10);
+                    })
+                })
+            }
+            //欠费
+            if (this.current == 3) {
+                arr.forEach(ele => {
+                    ele.rooms = ele.rooms.filter(item => {
+                        return item.livingData && item.livingData.livingOrder && item.livingData.livingOrder.shouKuan - item.livingData.livingOrder.xiaoFei<0
+                    })
+                })
+            }
+            //钟点
+            if (this.current == 4) {
+                arr.forEach(ele => {
+                    ele.rooms = ele.rooms.filter(item=>{
+                        return item.livingData && item.livingData.livingOrder && item.livingData.livingOrder.livingType == 2
+                    })
+                })
+            }
+            //团队
+            if (this.current == 5) {
+                arr.forEach(ele => {
+                    ele.rooms = ele.rooms.filter(item=>{
+                        return item.livingData && item.livingData.livingOrder && item.livingData.livingOrder.isTeam
+                    })
+                })
+            }
+            //散客
+            if (this.current == 6) {
+                // arr.forEach(ele => {
+                //     ele.rooms = ele.rooms.filter(item=>{
+                        
+                //     })
+                // })
+            }
+            //联房
+            if (this.current == 7) {
+                
+            }
+            //脏房
+            if (this.current == 8) {
+                
+            }
             console.log('arrarrarrarr', arr);
             this.dataList = JSON.parse(JSON.stringify(arr))
-            // console.log(this.roomList);
-            // if (this.roomList.length == 0) {
-            //     return
-            // }
-            // let nameList = []
-            // this.roomList.forEach(ele => {
-            //     ele.rooms.forEach(item => {
-            //         nameList.push(item.layout.name)
-            //     })
-            // })
-            // this.roomTypeCount = this.count(nameList)
-            // console.log(this.roomTypeCount);
             return arr
         },
         getCustomerSourceList(customerSource, first) {
             console.log(customerSource);
             var find = this.customerSourceList.find((t) => t.id == customerSource);
-            console.log(find);
-            console.log(this.customerSourceList);
+            // console.log(find);
+            // console.log(this.customerSourceList);
             if (find) {
                 // return first ? find.label.substr(0, 1) : find.label;
                 return find.itemText.substr(0, 1);
@@ -250,6 +333,123 @@ export default {
             })
             return count
         },
+        selectClick(e){
+            console.log(e);
+        },
+        roomClick(data){
+            console.log(data);
+            this.selectData = data
+            this.show = true
+        },
+        //置脏
+        handleDirty(){
+            if (this.selectData!=null) {
+                setDirty(this.selectData.roomInfo.id).then(res=>{
+                    console.log(res);
+                    if (res.success) {
+                        this.getData(uni.getStorageSync('hotelId'))
+                    }
+                    this.show = false
+                })
+            }
+        },
+        //置净
+        handleClean(){
+            let selectRoom = [];
+            selectRoom.push({ roomId: this.selectData.roomInfo.id, roomNo: this.selectData.roomInfo.name })
+            if (this.selectData!=null) {
+                setClean({roomCleanList:selectRoom,waiterId:' ',hotelId:uni.getStorageSync('hotelId')}).then(res=>{
+                    console.log(res);
+                    if (res.success) {
+                        this.getData(uni.getStorageSync('hotelId'))
+                    }
+                    this.show = false
+                })
+            }
+        },
+        //锁房
+        handleLock(){
+            let selectRoom = [];
+            selectRoom.push({ roomId: this.selectData.roomInfo.id, roomNo: this.selectData.roomInfo.name })
+            if (this.selectData!=null) {
+                lockRoom({roomLockList:selectRoom,remark:'',hotelId:uni.getStorageSync('hotelId')}).then(res=>{
+                    console.log(res);
+                    if (res.success) {
+                        this.getData(uni.getStorageSync('hotelId'))
+                    }
+                    this.show = false
+                })
+            }
+        },
+        //解锁
+        handleOffLock(){
+            if (this.selectData!=null) {
+                unlockRoom(this.selectData.roomInfo.id).then(res=>{
+                    console.log(res);
+                    if (res.success) {
+                        this.getData(uni.getStorageSync('hotelId'))
+                    }
+                    this.show = false
+                })
+            }
+        },
+        //维修
+        handleWx(){
+            this.show = false
+            this.showModal = true
+        },
+        //完成维修
+        handleCompleteRepair(){
+            if (this.selectData!=null) {
+                finishRepair(this.selectData.roomInfo.id).then(res=>{
+                    console.log(res);
+                    if (res.success) {
+                        this.getData(uni.getStorageSync('hotelId'))
+                        this.$refs.uToast.show({
+                            type:"success",
+                            message:'成功'
+                        })
+                    }else{
+                        this.$refs.uToast.show({
+                            type:"error",
+                            message:'出错了'
+                        })
+                    }
+                    this.show = false
+                })
+            }
+        },
+        confirmWx(){
+            if (this.wxReason == '') {
+                this.$refs.uToast.show({
+                    type:"error",
+                    message:'维修原因不能为空'
+                })
+                return
+            }
+            let selectRoom = [];
+            selectRoom.push({ roomId: this.selectData.roomInfo.id, roomNo: this.selectData.roomInfo.name })
+            if (this.selectData!=null) {
+                repairRoom({roomRepairList:selectRoom,remark:this.wxReason,hotelId:uni.getStorageSync('hotelId'),startDate:this.startTime,endDate:this.endTime,dateRange:[this.startDate,this.endTime]}).then(res=>{
+                    console.log(res);
+                    if (res.success) {
+                        this.getData(uni.getStorageSync('hotelId'))
+                        this.$refs.uToast.show({
+                            type:"success",
+                            message:'成功'
+                        })
+                    }
+                    this.show = false
+                })
+            }
+            this.showModal = false
+        },
+        confirmTime(e){
+            console.log(e);
+            this.startTime = e[0]
+            this.endTime = e[e.length - 1]
+            this.showTime = false
+        }
     }
 }
 </script>
@@ -295,9 +495,6 @@ page {
 	justify-content: start;
 	width: 96vw;
 	margin: 0 auto;
-    // grid-template-columns: repeat(4, 1fr);
-    // grid-gap: 10px;
-    // padding: 10px;
 }
 
 .room-state-detail-card {
@@ -305,7 +502,7 @@ page {
     height: calc(30vw );
     font-size: 12px;
     border-radius: 8px;
-	margin: 1vw;
+    margin: 1vw;
     // background: red;
     color: #fff;
     padding: 1vw 1vw;
@@ -335,4 +532,9 @@ page {
         border-right: 1px solid rgb(60, 156, 255);
     }
 }
+.calendar {
+    border: 1px solid;
+    padding: 5px 10px;
+    border-radius: 5px;
+}
 </style>

+ 2 - 1
utils/api.js

@@ -1,6 +1,7 @@
 import request from './request.js'
 const pre = 'http://118.195.195.200:8080/jeecg-boot'
-// const pre = 'http://192.168.2.9:8080/jeecg-boot'
+// const pre = '/api/jeecg-boot'
+
 /**
  * 登录
  * @param {*} data 

+ 63 - 0
utils/customerOrder.js

@@ -51,4 +51,67 @@ export function getRoomType(data) {
             pageNo: 1,
         }
     })
+}
+
+/**
+ * 置脏
+ */
+export function setDirty(id) {
+    return request({
+        url: pre + `/rooms/cesRooms/dirtyRoom?roomIds=${id}`,
+        method: 'POST',
+    })
+}
+
+/**
+ * 置净
+ */
+export function setClean(data) {
+    return request({
+        url: pre + `/fw/fwRoomClean/add`,
+        method: 'POST',
+        data
+    })
+}
+
+/**
+ * 锁房
+ */
+export function lockRoom(data) {
+    return request({
+        url: pre + `/fw/fwRoomLock/add`,
+        method: 'POST',
+        data
+    })
+}
+
+/**
+ * 解锁
+ */
+export function unlockRoom(id) {
+    return request({
+        url: pre + `/fw/fwRoomLock/offLockRoom?roomIds=${id}`,
+        method: 'POST',
+    })
+}
+
+/**
+ * 维修
+ */
+export function repairRoom(data) {
+    return request({
+        url: pre + `/fw/fwRoomRepair/add`,
+        method: 'POST',
+        data
+    })
+}
+
+/**
+ * 完成维修
+ */
+export function finishRepair(id) {
+    return request({
+        url: pre + `/fw/fwRoomRepair/completeRepairRoom?roomIds=${id}`,
+        method: 'POST',
+    })
 }