remind.js 1.44 KB
// pages/customer/remind.js
import util from '../../utils/util';
import App from '../../utils/api';
const {regeneratorRuntime} = global
Page({

  /**
   * 页面的初始数据
   */
  data: {
    reminds:[
        {val:0,label:'不提醒'},
        {val:30,label:'30分钟前'},
        {val:60,label:'1小时前'},
        {val:120,label:'2小时前'},
        {val:24*60,label:'1天前'},
        {val:48*60,label:'2天前'},
    ],
  },
    remind_date:0,
    id:null,
    rdate:0,
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log('onLoad',options);
    this.id=options.id;
    this.rdate=options.rdate;
  },

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

  },

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

  },

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

  },

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

  },
    radioChange(e){
      let val=util.val(e);
      console.log(val);
        this.remind_date=0;
      if(val>0){
        this.remind_date=parseInt(this.rdate)-parseInt(val*60);
      }
    },
    remind(){
        App.Reserve.SetRelaSuccess({
            rid:this.id,
            openid:getApp().openid,
            remind_date:this.remind_date,
            is_agree:1
        }).then(res=>{
            wx.navigateBack()
        })
    }
})