b_addnew.js 1.77 KB
// pages/book/b_addnew.js
import util from '../../../utils/util';
import App from '../../../utils/api';
Page({
  /**
   * 页面的初始数据
   */
  data: {
    nowtime:0,//当前时间戳,或修改到店,或桌位预订时间
    date:'',//当前选择的日期
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: async function (options) {
    this.options=options
    if(options.id>0){
      //修改
      return;
    }
    if(options.tid){
      //桌位预订
      return;
    }
    this.setData({
      nowtime:parseInt(new Date()/1000)
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  //日期选择通知
  addDateEvent(e){
    //console.log('addDateEvent',e.detail)
    //{checked: 1, checkedTime: 123456790}
    this.setData({
      date:util.unixtoTime(e.detail.checkedTime,'YYYY-MM-DD')
    })
  },
  //时段选择通知
  addTimeDurEvent(e){
    //console.log('addTimeDurEvent',e.detail)
    //{ddate_solt: 1, list: Array(9), listIndex: 4}
  },
  //到店时间选择通知
  addTimeDurItemsEvent(e){
    //{time: 1577689200, ddate_solt: 1}
    //console.log('addTimeDurItemsEvent',e.detail)
    this.setData({
      ...e.detail,
    })
  },
})