seeAicoList.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import api from "../../utils/api";
  2. Page({
  3. data: {
  4. notesInput: '',
  5. hotel_id:0,
  6. hotel_info:{},
  7. boomListInit:[],
  8. boomList:[]
  9. },
  10. onLoad: function (options) {
  11. this.setData({
  12. hotel_id:options.hotel_id
  13. })
  14. },
  15. onShow: function () {
  16. this.getRooms()
  17. },
  18. bindNotesInput: function (e) {
  19. this.setData({
  20. notesInput: e.detail.value
  21. });
  22. if (!this.data.notesInput ||this.data.notesInput.length ===0) {
  23. this.setData({
  24. boomList: this.data.boomListInit
  25. });
  26. }else{
  27. this.setData({
  28. boomList: this.data.boomListInit.filter(item => item.room_no.indexOf(this.data.notesInput) > -1)
  29. });
  30. }
  31. },
  32. onJump: function (e) {
  33. var room = e.currentTarget.dataset.room;
  34. if (room.nuc && room.nuc.online ==='yes'){
  35. wx.navigateTo({
  36. url: '/subpagesTwo/seeAlso/seeAico?room_id='+room.id+"&hotel_name="+this.data.hotel_info.hotel_name+"&room_name="+(room.room_no||'--')
  37. })
  38. }else{
  39. wx.showToast({
  40. icon: 'none',
  41. title: "房间异常请联系管理员!",
  42. });
  43. }
  44. },
  45. getRooms: function () {
  46. api.getRooms({
  47. params: {hotel_id: this.data.hotel_id},
  48. headers: { unionid: wx.getStorageSync("unionid")},
  49. })
  50. .then(data =>{
  51. if (data.code ===1){
  52. console.log(data.rooms)
  53. this.setData({
  54. hotel_info:data.data.hotel,
  55. boomList:data.data.rooms,
  56. boomListInit:data.data.rooms
  57. })
  58. }
  59. })
  60. .catch(err => console.error('IsManager Error:', err));
  61. },
  62. });