remind.js
2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// 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天前'},
],
remindtime:0,
},
remind_date:0,
id:null,
ddate:0,
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log('onLoad',options);
this.id=options.id;
this.ddate=options.ddate;
if(options.remindtime=='NaN'){
options.remindtime=0;
}
this.remind_date=options.remindtime;
if(new Date()/1000+1800>parseInt(options.ddate)){
this.setData({
reminds:[{val:0,label:'不提醒'}]
})
}else{
if(parseInt(options.remindtime)>0){
this.setData({
remindtime:(parseInt(options.ddate)-parseInt(options.remindtime))/60
})
}
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
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.ddate)-parseInt(val*60);
}
},
remind(){
let userInfo = util.cache('userInfo');
if (userInfo) {
userInfo = JSON.stringify({
openid: getApp().openid,
avatar: userInfo.avatarUrl,
nickname: userInfo.nickName,
gender: userInfo.gender
})
}
App.Reserve.SetRelaSuccess({
rid:this.id,
openid:getApp().openid,
remind_date:this.remind_date,
is_agree:1,
userinfo:userInfo,
}).then(res=>{
App.Reserve.Detail({
openid: getApp().openid,
rid: this.id
},'clear')
wx.navigateBack()
})
}
})