import api from "../../utils/api"; Page({ data: { notesInput: '', hotel_id:0, hotel_info:{}, boomListInit:[], boomList:[] }, onLoad: function (options) { this.setData({ hotel_id:options.hotel_id }) }, onShow: function () { this.getRooms() }, bindNotesInput: function (e) { this.setData({ notesInput: e.detail.value }); if (!this.data.notesInput ||this.data.notesInput.length ===0) { this.setData({ boomList: this.data.boomListInit }); }else{ this.setData({ boomList: this.data.boomListInit.filter(item => item.room_no.indexOf(this.data.notesInput) > -1) }); } }, onJump: function (e) { var room = e.currentTarget.dataset.room; if (room.nuc && room.nuc.online ==='yes'){ wx.navigateTo({ url: '/subpagesTwo/seeAlso/seeAico?room_id='+room.id+"&hotel_name="+this.data.hotel_info.hotel_name+"&room_name="+(room.room_no||'--') }) }else{ wx.showToast({ icon: 'none', title: "房间异常请联系管理员!", }); } }, getRooms: function () { api.getRooms({ params: {hotel_id: this.data.hotel_id}, headers: { unionid: wx.getStorageSync("unionid")}, }) .then(data =>{ if (data.code ===1){ console.log(data.rooms) this.setData({ hotel_info:data.data.hotel, boomList:data.data.rooms, boomListInit:data.data.rooms }) } }) .catch(err => console.error('IsManager Error:', err)); }, });