| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- 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));
- },
- });
|