// pages/hotel/hotel.js const app = getApp() var host = app.globalData.host; Page({ /** * 页面的初始数据 */ data: { info:{}, aid:'', data:{}, date:'' }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { wx.showNavigationBarLoading(); options.id=1; options.conference_id=1; this.setData({ aid: Number(options.aid) }) wx.request({ url: host + '/api/signup/hotel', method: 'GET', data: { id: options.id }, success: res => { wx.hideNavigationBarLoading(); this.setData({ info: res.data.data, data: res.data.data.rooms[0] }) }, fail: function () { wx.hideLoading(); wx.showToast({ title: '服务器开小差啦!', icon: 'none' }) } }) }, order:function(e){ var data={}; data.hotel_id=this.data.info.id; data.room_id=e.target.dataset.id; data.id = this.data.aid wx.request({ url: host + '/api/user/signup', method: 'PUT', data: data, success: (res => { if (res.data.code == 0) { wx.showToast({ title: '预定成功', }) } else { wx.showToast({ title: '提交失败', icon: 'none' }) } }) }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })