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