|
1
|
// pages/book/b_addnew.js
|
1
|
// pages/book/b_addnew.js
|
|
2
|
import util from '../../../utils/util';
|
2
|
import util from '../../../utils/util';
|
|
3
|
-import comm from '../../../utils/bookCommon';
|
|
|
|
4
|
import App from '../../../utils/api';
|
3
|
import App from '../../../utils/api';
|
|
5
|
-const {regeneratorRuntime} = global
|
|
|
|
6
|
const formTpl = {
|
4
|
const formTpl = {
|
|
7
|
rid: '',
|
5
|
rid: '',
|
|
8
|
- date: 0,
|
|
|
|
9
|
- time: 0,
|
|
|
|
10
|
- //pnum_str:'1-4',
|
|
|
|
11
|
pnum: 6,
|
6
|
pnum: 6,
|
|
12
|
tabid: 0,
|
7
|
tabid: 0,
|
|
13
|
|
8
|
|
|
@@ -17,16 +12,16 @@ const formTpl = { |
|
@@ -17,16 +12,16 @@ const formTpl = { |
|
17
|
cusdem: '',
|
12
|
cusdem: '',
|
|
18
|
|
13
|
|
|
19
|
tid: [],
|
14
|
tid: [],
|
|
20
|
- is_set_ddate:0,
|
|
|
|
21
|
|
15
|
|
|
22
|
}
|
16
|
}
|
|
23
|
Page({
|
17
|
Page({
|
|
24
|
-
|
|
|
|
25
|
/**
|
18
|
/**
|
|
26
|
* 页面的初始数据
|
19
|
* 页面的初始数据
|
|
27
|
*/
|
20
|
*/
|
|
28
|
data: {
|
21
|
data: {
|
|
29
|
- dateStr: [],
|
22
|
+ type:1, // type 1/2/3 新增/修改/桌位
|
|
|
|
23
|
+ time:0,//组件最终构造的到店时间
|
|
|
|
24
|
+ runTime:0,//当前时间戳,或修改到店,或桌位预订时间
|
|
30
|
form: JSON.parse(JSON.stringify(formTpl)),
|
25
|
form: JSON.parse(JSON.stringify(formTpl)),
|
|
31
|
tables: [],
|
26
|
tables: [],
|
|
32
|
grand: [
|
27
|
grand: [
|
|
@@ -47,148 +42,35 @@ Page({ |
|
@@ -47,148 +42,35 @@ Page({ |
|
47
|
}
|
42
|
}
|
|
48
|
],
|
43
|
],
|
|
49
|
buttonhide: true,
|
44
|
buttonhide: true,
|
|
50
|
-
|
|
|
|
51
|
- calendarMaskLoad: false,
|
|
|
|
52
|
- calendarMask: false,
|
|
|
|
53
|
- dayStyle: [
|
|
|
|
54
|
- {month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5'},
|
|
|
|
55
|
- {month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5'}
|
|
|
|
56
|
- ],
|
|
|
|
57
|
- timePickerArray: [
|
|
|
|
58
|
- [],
|
|
|
|
59
|
- [],
|
|
|
|
60
|
- [],
|
|
|
|
61
|
- ],
|
|
|
|
62
|
- timePickerIndex: [0, 0, 0],
|
|
|
|
63
|
tablesLength: 0,
|
45
|
tablesLength: 0,
|
|
64
|
-
|
|
|
|
65
|
- timePickerMask: false,
|
|
|
|
66
|
pnumInputFocus: false,
|
46
|
pnumInputFocus: false,
|
|
67
|
pageMarginBottom: 0,
|
47
|
pageMarginBottom: 0,
|
|
68
|
speciallist: [],
|
48
|
speciallist: [],
|
|
69
|
- calendar: {
|
|
|
|
70
|
- nextNum: 0,
|
|
|
|
71
|
- },
|
|
|
|
72
|
- defDtime: ['', '12:00', '18:30'],
|
|
|
|
73
|
- hasUseDefDtime: true,
|
|
|
|
74
|
CustomRemark:[],
|
49
|
CustomRemark:[],
|
|
75
|
CustomRemarkMoreMask:false,
|
50
|
CustomRemarkMoreMask:false,
|
|
76
|
},
|
51
|
},
|
|
|
|
52
|
+ reserve_id: '',
|
|
|
|
53
|
+ checkedTables:{},//已选中的桌子集合
|
|
77
|
/**
|
54
|
/**
|
|
78
|
* 生命周期函数--监听页面加载
|
55
|
* 生命周期函数--监听页面加载
|
|
79
|
*/
|
56
|
*/
|
|
80
|
- reserve_id: '',
|
|
|
|
81
|
- checkedTables:{},//已选中的桌子集合
|
|
|
|
82
|
- year:util.unixtoTime(new Date() / 1000,'YYYY'),
|
|
|
|
83
|
onLoad: async function (options) {
|
57
|
onLoad: async function (options) {
|
|
84
|
this.options=options
|
58
|
this.options=options
|
|
85
|
- this.initLoad(options)
|
59
|
+ this.sellerid = util.cache('enter_params')['seller_id'];
|
|
86
|
this.getCustomRemark();
|
60
|
this.getCustomRemark();
|
|
87
|
- },
|
|
|
|
88
|
- async initLoad(options = {}){
|
|
|
|
89
|
- let nt = new Date() / 1000;
|
|
|
|
90
|
- let speciallist = [
|
|
|
|
91
|
- {date: util.unixtoTime(nt, 'YYYY-MM-DD'), background: '', text: '今 天'},
|
|
|
|
92
|
- {date: util.unixtoTime(nt + 86400, 'YYYY-MM-DD'), background: '', text: '明 天'},
|
|
|
|
93
|
- {date: util.unixtoTime(nt + 86400 * 2, 'YYYY-MM-DD'), background: '', text: '后 天'},
|
|
|
|
94
|
- ];
|
|
|
|
95
|
- this.reserve_id = options.id || '';
|
|
|
|
96
|
- let rev_time=parseInt(nt)
|
|
|
|
97
|
- if(options.hasQuick==1){
|
|
|
|
98
|
- let rdate=options.ddate.split('-')
|
|
|
|
99
|
- if(!(rev_time>=rdate[0] && rev_time<=rdate[1])){
|
|
|
|
100
|
- rev_time=rdate[0]
|
|
|
|
101
|
- }
|
|
|
|
102
|
- await this.setDateStr(rev_time);
|
61
|
+ if(options.id>0){
|
|
|
|
62
|
+ //修改
|
|
|
|
63
|
+ this.reserve_id=options.id
|
|
|
|
64
|
+ return this.initModify();
|
|
103
|
}
|
65
|
}
|
|
104
|
- //判断hasUseDefDtime
|
|
|
|
105
|
- let hasUseDefDtime = true;
|
|
|
|
106
|
- let mmii = util.unixtoTime(rev_time, 'HH:II');
|
|
|
|
107
|
- if (mmii > this.data.defDtime[this.data.form.time]) {
|
|
|
|
108
|
- hasUseDefDtime = false;
|
66
|
+ if(options.hasQuick==1){
|
|
|
|
67
|
+ //桌位预订
|
|
|
|
68
|
+ return this.initQuick();
|
|
109
|
}
|
69
|
}
|
|
110
|
- console.log('initLoad::setDateStr',util.unixtoTime(rev_time,'YYYY-MM-DD HH:II'),this.data.defDtime[this.data.form.time])
|
|
|
|
111
|
- await this.setDateStr(rev_time,hasUseDefDtime);
|
|
|
|
112
|
- this.sellerid = util.cache('enter_params')['seller_id'];
|
|
|
|
113
|
- let timePickerArray = await comm.getDayTimeSpace();
|
|
|
|
114
|
this.setData({
|
70
|
this.setData({
|
|
115
|
- timePickerArray: timePickerArray,
|
|
|
|
116
|
- speciallist: speciallist,
|
|
|
|
117
|
- hasUseDefDtime: hasUseDefDtime,
|
71
|
+ runTime:parseInt(new Date()/1000),
|
|
|
|
72
|
+ type:1
|
|
118
|
})
|
73
|
})
|
|
119
|
- if (this.reserve_id > 0) {
|
|
|
|
120
|
- this.initModify(this.reserve_id);
|
|
|
|
121
|
- } else if(options.hasQuick==1){
|
|
|
|
122
|
- this.initQuick(options);
|
|
|
|
123
|
- } else {
|
|
|
|
124
|
- this.getTables();
|
|
|
|
125
|
- }
|
|
|
|
126
|
- },
|
|
|
|
127
|
-
|
|
|
|
128
|
- hasInTimeSpace(hhii,timeIndex){
|
|
|
|
129
|
- if(this.data.timePickerArray.length)return false
|
|
|
|
130
|
- let timePickerArray=this.data.timePickerArray[timeIndex];
|
|
|
|
131
|
- let tl=timePickerArray.length
|
|
|
|
132
|
- if(tl<1) return false
|
|
|
|
133
|
- console.log('hasInTimeSpace',hhii,timePickerArray[0],timePickerArray[tl-1],hhii>=timePickerArray[0] && hhii<=timePickerArray[tl-1])
|
|
|
|
134
|
- if(hhii>=timePickerArray[0] && hhii<=timePickerArray[tl-1]) return true
|
|
|
|
135
|
- return false
|
|
|
|
136
|
- },
|
|
|
|
137
|
- async setDateStr(d = new Date() / 1000,hasUseDefDtime=false,fouceTime=-1){
|
|
|
|
138
|
- fouceTime=fouceTime>-1?fouceTime:this.data.form.time
|
|
|
|
139
|
- hasUseDefDtime=this.hasInTimeSpace(this.data.defDtime[fouceTime],fouceTime)
|
|
|
|
140
|
- if(hasUseDefDtime){//
|
|
|
|
141
|
- let timestr=util.unixtoTime(d,'YYYY-MM-DD '+this.data.defDtime[this.data.form.time])
|
|
|
|
142
|
- d=util.timetouUnix(timestr)
|
|
|
|
143
|
- }
|
|
|
|
144
|
- console.log('setDateStr',util.unixtoTime(d,'YYYY-MM-DD HH:II'),hasUseDefDtime)
|
|
|
|
145
|
- this.year=util.unixtoTime(d,'YYYY');
|
|
|
|
146
|
- let ns = new Date() / 1000;
|
|
|
|
147
|
- let dateStr = [
|
|
|
|
148
|
- util.unixtoTime(ns, 'MM-DD `DAY/周WW`'),
|
|
|
|
149
|
- util.unixtoTime(parseInt(ns) + 86400, 'MM-DD `DAY/周WW`'),
|
|
|
|
150
|
- ];
|
|
|
|
151
|
- //let dateStr=this.data.dateStr;
|
|
|
|
152
|
- let nowStr = util.unixtoTime(d, 'MM-DD `DAY/周WW`')
|
|
|
|
153
|
- let form = this.data.form;
|
|
|
|
154
|
-
|
|
|
|
155
|
- let timeObj = await comm.getTimeSpaceIndexData(d);
|
|
|
|
156
|
- if(fouceTime!=timeObj.timeIndex && fouceTime>0){
|
|
|
|
157
|
- timeObj.timeIndex=fouceTime
|
|
|
|
158
|
- }
|
|
|
|
159
|
- //form.time=await comm.getTimeSpaceIndex(d);
|
|
|
|
160
|
- //如果小于默认时间,使用默认时间
|
|
|
|
161
|
- let mmii = util.unixtoTime(d,'HH:II')
|
|
|
|
162
|
- if (mmii < this.data.defDtime[timeObj.timeIndex]) {
|
|
|
|
163
|
- hasUseDefDtime=this.hasInTimeSpace(this.data.defDtime[timeObj.timeIndex],timeObj.timeIndex)
|
|
|
|
164
|
- if(hasUseDefDtime) {
|
|
|
|
165
|
- let str = util.unixtoTime(d, 'YYYY-MM-DD ' + this.data.defDtime[timeObj.timeIndex] + ':00')
|
|
|
|
166
|
- timeObj = await comm.getTimeSpaceIndexData(util.timetouUnix(str));
|
|
|
|
167
|
- }
|
|
|
|
168
|
- }
|
|
|
|
169
|
-
|
|
|
|
170
|
- form.time = timeObj.timeIndex;
|
|
|
|
171
|
- let ind = dateStr._indexOf(nowStr);
|
|
|
|
172
|
- if (ind > -1) {
|
|
|
|
173
|
- form.date = ind
|
|
|
|
174
|
- } else {
|
|
|
|
175
|
- dateStr.push(nowStr.substr(0, 5));
|
|
|
|
176
|
- form.date = 2;
|
|
|
|
177
|
- }
|
|
|
|
178
|
- let timePickerIndex = this.data.timePickerIndex;
|
|
|
|
179
|
- timePickerIndex[timeObj.timeIndex] = timeObj.timeMatchIndex;
|
|
|
|
180
|
- form.is_set_ddate = this.is_set_ddate
|
|
|
|
181
|
- let obj = {
|
|
|
|
182
|
- dateStr: dateStr,
|
|
|
|
183
|
- form: form,
|
|
|
|
184
|
- timePickerIndex: timePickerIndex,
|
|
|
|
185
|
- timeOpt: timeObj.timeOpt,
|
|
|
|
186
|
- hasUseDefDtime:hasUseDefDtime
|
|
|
|
187
|
- };
|
|
|
|
188
|
-
|
|
|
|
189
|
- this.setData(obj)
|
|
|
|
190
|
- return obj;
|
|
|
|
191
|
-
|
|
|
|
192
|
},
|
74
|
},
|
|
193
|
|
75
|
|
|
194
|
/**
|
76
|
/**
|
|
@@ -202,16 +84,7 @@ Page({ |
|
@@ -202,16 +84,7 @@ Page({ |
|
202
|
* 生命周期函数--监听页面显示
|
84
|
* 生命周期函数--监听页面显示
|
|
203
|
*/
|
85
|
*/
|
|
204
|
onShow: function () {
|
86
|
onShow: function () {
|
|
205
|
- //if(!this.reserve_id || util.cache('tableid').length>0){
|
|
|
|
206
|
- //if (util.cache('tableid').length > 0) {
|
|
|
|
207
|
- this.getTables();
|
|
|
|
208
|
- //}
|
|
|
|
209
|
- setTimeout(() => {
|
|
|
|
210
|
- this.setData({
|
|
|
|
211
|
- calendarMaskLoad: true,
|
|
|
|
212
|
- })
|
|
|
|
213
|
- }, 1000);
|
|
|
|
214
|
- this.conditionInfo()
|
87
|
+
|
|
215
|
},
|
88
|
},
|
|
216
|
|
89
|
|
|
217
|
/**
|
90
|
/**
|
|
@@ -248,239 +121,71 @@ Page({ |
|
@@ -248,239 +121,71 @@ Page({ |
|
248
|
onShareAppMessage: function () {
|
121
|
onShareAppMessage: function () {
|
|
249
|
|
122
|
|
|
250
|
},
|
123
|
},
|
|
251
|
- async selectedValueAsync(e){
|
|
|
|
252
|
- console.log(e);
|
|
|
|
253
|
- let key = util.attr(e, 'key');
|
|
|
|
254
|
- let val;
|
|
|
|
255
|
- let sobj = {};
|
|
|
|
256
|
- if (key == 'date') {
|
|
|
|
257
|
- this.year=util.unixtoTime(new Date() / 1000,'YYYY');
|
|
|
|
258
|
- }
|
|
|
|
259
|
- if (e.type == 'input' || e.type == 'confirm') {
|
|
|
|
260
|
- val = util.val(e);
|
|
|
|
261
|
- if (key == 'phone') {
|
|
|
|
262
|
- var that = this;
|
|
|
|
263
|
- if (e.detail.value != '' && e.detail.value.length >= 3) {
|
|
|
|
264
|
- App.Reserve.GetReserveUser(
|
|
|
|
265
|
- {
|
|
|
|
266
|
- keywords: e.detail.value,
|
|
|
|
267
|
- sid: this.sellerid
|
|
|
|
268
|
- }
|
|
|
|
269
|
- ).then(function (json) {
|
|
|
|
270
|
- if (json.ret == 200 && json.data.length > 0) {
|
|
|
|
271
|
- that.setData({
|
|
|
|
272
|
- searchlist: json.data
|
|
|
|
273
|
- })
|
|
|
|
274
|
- } else {
|
|
|
|
275
|
- that.setData({
|
|
|
|
276
|
- searchlist: null
|
|
|
|
277
|
- })
|
|
|
|
278
|
- }
|
|
|
|
279
|
- })
|
|
|
|
280
|
- } else {
|
|
|
|
281
|
- this.setData({
|
|
|
|
282
|
- searchlist: null
|
|
|
|
283
|
- })
|
|
|
|
284
|
- }
|
|
|
|
285
|
- }
|
|
|
|
286
|
- if (key == 'pnum') {
|
|
|
|
287
|
- sobj.pnumInputFocus = true;
|
|
|
|
288
|
- }
|
|
|
|
289
|
- } else {
|
|
|
|
290
|
- val = util.attr(e, 'value');
|
|
|
|
291
|
- }
|
|
|
|
292
|
- if (key == 'time') {
|
|
|
|
293
|
- if (this.data.timeOpt[val]) return;
|
|
|
|
294
|
- }
|
|
|
|
295
|
- if ((key == 'time' && this.data.form.time == val) || (key == 'date' && this.data.form.date == val)) {
|
|
|
|
296
|
- if (util.attr(e, 'display') != 'block') {
|
|
|
|
297
|
- return;
|
|
|
|
298
|
- }
|
|
|
|
299
|
- }
|
|
|
|
300
|
- let form = this.data.form;
|
|
|
|
301
|
-
|
|
|
|
302
|
- if (key == 'tid') {
|
|
|
|
303
|
- let ts = this.data.tables;
|
|
|
|
304
|
- if (ts[val].isselect) {
|
|
|
|
305
|
- ts[val].isselect = false;
|
|
|
|
306
|
- form.tid.remove(ts[val].id);
|
|
|
|
307
|
- delete this.checkedTables[ts[val].id]
|
|
|
|
308
|
- } else {
|
|
|
|
309
|
- ts[val].isselect = true;
|
|
|
|
310
|
- form.tid.push(ts[val].id);
|
|
|
|
311
|
- this.checkedTables[ts[val].id]=ts[val].name
|
|
|
|
312
|
- }
|
|
|
|
313
|
- sobj.tables = ts;
|
|
|
|
314
|
- } else {
|
|
|
|
315
|
- form[key] = val;
|
|
|
|
316
|
- }
|
|
|
|
317
|
- console.log('ts', sobj.tables,this.checkedTables);
|
|
|
|
318
|
- //console.log(e.type,key,val,form);
|
|
|
|
319
|
- sobj.form = form;
|
|
|
|
320
|
- sobj.buttonhide = this.data.buttonhide;
|
|
|
|
321
|
- if (form.tid.length > 0 && form.rname.length > 0) {
|
|
|
|
322
|
- sobj.buttonhide = false;
|
|
|
|
323
|
- }else{
|
|
|
|
324
|
- sobj.buttonhide = true;
|
|
|
|
325
|
- }
|
|
|
|
326
|
- let displayTimes = false;
|
|
|
|
327
|
- if (key == 'time') {
|
|
|
|
328
|
- if (util.attr(e, 'display') == 'block') {
|
|
|
|
329
|
- displayTimes = true;
|
|
|
|
330
|
- sobj.timePickerMask = true;
|
|
|
|
331
|
- }
|
|
|
|
332
|
- }
|
|
|
|
333
|
- //判断hasUseDefDtime
|
|
|
|
334
|
- if ((key == 'time' || key == 'date') && !sobj.timePickerMask) {
|
|
|
|
335
|
- sobj.hasUseDefDtime = true
|
|
|
|
336
|
- let ntime = parseInt(new Date() / 1000)
|
|
|
|
337
|
- let xtime =ntime
|
|
|
|
338
|
- if(key == 'time'){
|
|
|
|
339
|
- xtime=util.unixtoTime(new Date() / 1000, this.year+'-' + (this.data.dateStr[this.data.form.date].substr(0, 5)) + ' HH:II:SS');
|
|
|
|
340
|
- xtime=util.timetouUnix(xtime)
|
|
|
|
341
|
- //if 当前时间在区间内 hasUseDefDtime 为 false
|
|
|
|
342
|
- let d_rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date],
|
|
|
|
343
|
- this.data.form.time, null,null,this.year);
|
|
|
|
344
|
- d_rdate=d_rdate.split('-');
|
|
|
|
345
|
- if(d_rdate[0] <= ntime && ntime<=d_rdate[1]){
|
|
|
|
346
|
- sobj.hasUseDefDtime=false
|
124
|
+ //到店时间选择通知
|
|
|
|
125
|
+ addTimeDurItemsEvent(e){
|
|
|
|
126
|
+ //{time: 1577788200, ddate_solt: 2, timeDur: "1577786400-1577804400"}
|
|
|
|
127
|
+ console.log('addTimeDurItemsEvent',e.detail,util.unixtoTime(e.detail.time))
|
|
|
|
128
|
+ this.time=e.detail.time
|
|
|
|
129
|
+ this.ddate_solt=e.detail.ddate_solt
|
|
|
|
130
|
+ this.timeDur=e.detail.timeDur//预订所在时段区间时间戳
|
|
|
|
131
|
+ this.hasManual=e.detail.hasManual//手动设置时间
|
|
|
|
132
|
+ this.setData({
|
|
|
|
133
|
+ ...e.detail,
|
|
|
|
134
|
+ })
|
|
|
|
135
|
+ this.getTables();
|
|
|
|
136
|
+ },
|
|
|
|
137
|
+ getCustomRemark(){
|
|
|
|
138
|
+ App.User.GetCustomRemark({
|
|
|
|
139
|
+ uid:util.cache('enter_params')['manager_id'],
|
|
|
|
140
|
+ }).then(res=>{
|
|
|
|
141
|
+ let CustomRemark=[];
|
|
|
|
142
|
+ res.data.forEach(r=>{
|
|
|
|
143
|
+ if(r.often_use){
|
|
|
|
144
|
+ CustomRemark.push(r);
|
|
347
|
}
|
145
|
}
|
|
348
|
- }
|
|
|
|
349
|
- this.setDateStr(xtime,sobj.hasUseDefDtime,sobj.form.time);
|
|
|
|
350
|
- }
|
|
|
|
351
|
- if (this.data.form.date == 0) {//
|
|
|
|
352
|
- let mmii = util.unixtoTime(new Date() / 1000, 'HH:II');
|
|
|
|
353
|
- if (mmii > this.data.defDtime[key == 'time' ? val : this.data.form.time]) {
|
|
|
|
354
|
- sobj.hasUseDefDtime = false;
|
|
|
|
355
|
- }
|
|
|
|
356
|
- }
|
|
|
|
357
|
- if ('date,time,pnum,pnum_str,tabid'.indexOf(key) > -1) {
|
|
|
|
358
|
- if (!displayTimes) {
|
|
|
|
359
|
- //sobj.form.tid = []; //切换日期时间清空桌位
|
|
|
|
360
|
- //sobj.buttonhide = true;
|
|
|
|
361
|
- this.getTables();
|
|
|
|
362
|
- }
|
|
|
|
363
|
- if (key == 'date') {
|
|
|
|
364
|
- let xtime = util.unixtoTime(new Date() / 1000, this.year+'-' + (this.data.dateStr[val].substr(0, 5)) + ' HH:II:SS');
|
|
|
|
365
|
- this.setDateStr(util.timetouUnix(xtime),sobj.hasUseDefDtime);
|
|
|
|
366
|
- }
|
|
|
|
367
|
- }
|
|
|
|
368
|
-
|
|
|
|
369
|
- this.setData(sobj)
|
146
|
+ })
|
|
|
|
147
|
+ this.setData({
|
|
|
|
148
|
+ CustomRemark:CustomRemark,
|
|
|
|
149
|
+ })
|
|
|
|
150
|
+ })
|
|
370
|
},
|
151
|
},
|
|
371
|
- selectedValue(e){
|
|
|
|
372
|
- console.log(e);
|
|
|
|
373
|
- let key = util.attr(e, 'key');
|
|
|
|
374
|
- let val;
|
|
|
|
375
|
- let sobj = {};
|
|
|
|
376
|
- if (key == 'date') {
|
|
|
|
377
|
- this.year=util.unixtoTime(new Date() / 1000,'YYYY');
|
|
|
|
378
|
- }
|
|
|
|
379
|
- if (e.type == 'input' || e.type == 'confirm') {
|
|
|
|
380
|
- val = util.val(e);
|
|
|
|
381
|
- if (key == 'phone') {
|
|
|
|
382
|
- var that = this;
|
|
|
|
383
|
- if (e.detail.value != '' && e.detail.value.length >= 3) {
|
|
|
|
384
|
- App.Reserve.GetReserveUser(
|
|
|
|
385
|
- {
|
|
|
|
386
|
- keywords: e.detail.value,
|
|
|
|
387
|
- sid: this.sellerid
|
|
|
|
388
|
- }
|
|
|
|
389
|
- ).then(function (json) {
|
|
|
|
390
|
- if (json.ret == 200 && json.data.length > 0) {
|
|
|
|
391
|
- that.setData({
|
|
|
|
392
|
- searchlist: json.data
|
|
|
|
393
|
- })
|
|
|
|
394
|
- } else {
|
|
|
|
395
|
- that.setData({
|
|
|
|
396
|
- searchlist: null
|
|
|
|
397
|
- })
|
|
|
|
398
|
- }
|
|
|
|
399
|
- })
|
|
|
|
400
|
- } else {
|
|
|
|
401
|
- this.setData({
|
|
|
|
402
|
- searchlist: null
|
|
|
|
403
|
- })
|
152
|
+ oftenUse(e){
|
|
|
|
153
|
+ let id=util.attr(e,'id');
|
|
|
|
154
|
+ let val=util.attr(e,'value');
|
|
|
|
155
|
+ let CustomRemark=this.data.CustomRemark;
|
|
|
|
156
|
+ let form=this.data.form;
|
|
|
|
157
|
+ CustomRemark.forEach(r=>{
|
|
|
|
158
|
+ if(id==r.id){
|
|
|
|
159
|
+ if(r.active){
|
|
|
|
160
|
+ form.cusdem=form.cusdem.replace(val+'、','')
|
|
|
|
161
|
+ }
|
|
|
|
162
|
+ r.active=!r.active
|
|
|
|
163
|
+ if(r.active){
|
|
|
|
164
|
+ form.cusdem+=val+'、'
|
|
404
|
}
|
165
|
}
|
|
405
|
}
|
166
|
}
|
|
406
|
- if (key == 'pnum') {
|
|
|
|
407
|
- sobj.pnumInputFocus = true;
|
|
|
|
408
|
- }
|
|
|
|
409
|
- } else {
|
|
|
|
410
|
- val = util.attr(e, 'value');
|
|
|
|
411
|
- }
|
|
|
|
412
|
- if (key == 'time') {
|
|
|
|
413
|
- if (this.data.timeOpt[val]) return;
|
|
|
|
414
|
- }
|
|
|
|
415
|
- if ((key == 'time' && this.data.form.time == val) || (key == 'date' && this.data.form.date == val)) {
|
|
|
|
416
|
- if (util.attr(e, 'display') != 'block') {
|
|
|
|
417
|
- return;
|
|
|
|
418
|
- }
|
|
|
|
419
|
- }
|
|
|
|
420
|
- let form = this.data.form;
|
|
|
|
421
|
-
|
|
|
|
422
|
- if (key == 'tid') {
|
|
|
|
423
|
- let ts = this.data.tables;
|
|
|
|
424
|
- if (ts[val].isselect) {
|
|
|
|
425
|
- ts[val].isselect = false;
|
|
|
|
426
|
- form.tid.remove(ts[val].id);
|
|
|
|
427
|
- delete this.checkedTables[ts[val].id]
|
|
|
|
428
|
- } else {
|
|
|
|
429
|
- ts[val].isselect = true;
|
|
|
|
430
|
- form.tid.push(ts[val].id);
|
|
|
|
431
|
- this.checkedTables[ts[val].id]=ts[val].name
|
|
|
|
432
|
- }
|
|
|
|
433
|
- sobj.tables = ts;
|
|
|
|
434
|
- } else {
|
|
|
|
435
|
- form[key] = val;
|
|
|
|
436
|
- }
|
|
|
|
437
|
- console.log('ts', sobj.tables,this.checkedTables);
|
|
|
|
438
|
- //console.log(e.type,key,val,form);
|
|
|
|
439
|
- sobj.form = form;
|
|
|
|
440
|
- sobj.buttonhide = this.data.buttonhide;
|
167
|
+ })
|
|
|
|
168
|
+ this.setData({
|
|
|
|
169
|
+ CustomRemark:CustomRemark,
|
|
|
|
170
|
+ form:form,
|
|
|
|
171
|
+ })
|
|
|
|
172
|
+ this.conditionInfo()
|
|
|
|
173
|
+ },
|
|
|
|
174
|
+ CustomRemarkMore(){
|
|
|
|
175
|
+ this.setData({
|
|
|
|
176
|
+ CustomRemarkMoreMask:!this.data.CustomRemarkMoreMask
|
|
|
|
177
|
+ })
|
|
|
|
178
|
+ },
|
|
|
|
179
|
+ conditionInfo: function () {
|
|
|
|
180
|
+ var form = this.data.form
|
|
441
|
if (form.tid.length > 0 && form.rname.length > 0) {
|
181
|
if (form.tid.length > 0 && form.rname.length > 0) {
|
|
442
|
- sobj.buttonhide = false;
|
|
|
|
443
|
- }else{
|
|
|
|
444
|
- sobj.buttonhide = true;
|
|
|
|
445
|
- }
|
|
|
|
446
|
- let displayTimes = false;
|
|
|
|
447
|
- if (key == 'time') {
|
|
|
|
448
|
- if (util.attr(e, 'display') == 'block') {
|
|
|
|
449
|
- displayTimes = true;
|
|
|
|
450
|
- sobj.timePickerMask = true;
|
|
|
|
451
|
- }
|
|
|
|
452
|
- }
|
|
|
|
453
|
- //判断hasUseDefDtime
|
|
|
|
454
|
- if ((key == 'time' || key == 'date') && !sobj.timePickerMask) {
|
|
|
|
455
|
- sobj.hasUseDefDtime = true
|
|
|
|
456
|
- let ntime = parseInt(new Date() / 1000)
|
|
|
|
457
|
- let xtime =ntime
|
|
|
|
458
|
- if(key == 'time'){
|
|
|
|
459
|
- xtime=util.unixtoTime(new Date() / 1000, this.year+'-' + (this.data.dateStr[this.data.form.date].substr(0, 5)) + ' HH:II:SS');
|
|
|
|
460
|
- xtime=util.timetouUnix(xtime)
|
|
|
|
461
|
- }
|
|
|
|
462
|
- this.setDateStr(xtime,sobj.hasUseDefDtime);
|
|
|
|
463
|
- }
|
|
|
|
464
|
- if (this.data.form.date == 0) {//
|
|
|
|
465
|
- let mmii = util.unixtoTime(new Date() / 1000, 'HH:II');
|
|
|
|
466
|
- if (mmii > this.data.defDtime[key == 'time' ? val : this.data.form.time]) {
|
|
|
|
467
|
- sobj.hasUseDefDtime = false;
|
|
|
|
468
|
- }
|
|
|
|
469
|
- }
|
|
|
|
470
|
- if ('date,time,pnum,pnum_str,tabid'.indexOf(key) > -1) {
|
|
|
|
471
|
- if (!displayTimes) {
|
|
|
|
472
|
- //sobj.form.tid = []; //切换日期时间清空桌位
|
|
|
|
473
|
- //sobj.buttonhide = true;
|
|
|
|
474
|
- this.getTables();
|
|
|
|
475
|
- }
|
|
|
|
476
|
- if (key == 'date') {
|
|
|
|
477
|
- let xtime = util.unixtoTime(new Date() / 1000, this.year+'-' + (this.data.dateStr[val].substr(0, 5)) + ' HH:II:SS');
|
|
|
|
478
|
- this.setDateStr(util.timetouUnix(xtime),sobj.hasUseDefDtime);
|
|
|
|
479
|
- }
|
182
|
+ this.data.buttonhide = false;
|
|
480
|
}
|
183
|
}
|
|
481
|
-
|
|
|
|
482
|
- this.setData(sobj)
|
184
|
+ this.setData({
|
|
|
|
185
|
+ buttonhide: this.data.buttonhide
|
|
|
|
186
|
+ })
|
|
483
|
},
|
187
|
},
|
|
|
|
188
|
+
|
|
484
|
async getTables(){
|
189
|
async getTables(){
|
|
485
|
let form = this.data.form;
|
190
|
let form = this.data.form;
|
|
486
|
let tableid = util.cache('tableid');
|
191
|
let tableid = util.cache('tableid');
|
|
@@ -491,16 +196,14 @@ Page({ |
|
@@ -491,16 +196,14 @@ Page({ |
|
491
|
}
|
196
|
}
|
|
492
|
console.log('getTables-tableid', tableid, tableid.length);
|
197
|
console.log('getTables-tableid', tableid, tableid.length);
|
|
493
|
try {
|
198
|
try {
|
|
494
|
- let rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date], this.data.form.time,null,null,this.year);
|
|
|
|
495
|
- console.log('rdate', this.data.dateStr[this.data.form.date], rdate);
|
|
|
|
496
|
App.Reserve.GetTableList({
|
199
|
App.Reserve.GetTableList({
|
|
497
|
sid: util.cache('enter_params')['seller_id'],
|
200
|
sid: util.cache('enter_params')['seller_id'],
|
|
498
|
//pnum_str:form.pnum_str,
|
201
|
//pnum_str:form.pnum_str,
|
|
499
|
pnum: form.pnum,
|
202
|
pnum: form.pnum,
|
|
500
|
- rdate: util.unixtoTime(rdate.substr(0,10),'YYYYMMDD'),
|
203
|
+ rdate: util.unixtoTime(this.time,'YYYYMMDD'),
|
|
501
|
tid: form.tabid,
|
204
|
tid: form.tabid,
|
|
502
|
rid: this.reserve_id,
|
205
|
rid: this.reserve_id,
|
|
503
|
- ddate_solt:parseInt(form.time)+1
|
206
|
+ ddate_solt:this.ddate_solt
|
|
504
|
}).then(res => {
|
207
|
}).then(res => {
|
|
505
|
let tables = [];
|
208
|
let tables = [];
|
|
506
|
let tablesLength = 0;
|
209
|
let tablesLength = 0;
|
|
@@ -569,17 +272,108 @@ Page({ |
|
@@ -569,17 +272,108 @@ Page({ |
|
569
|
})
|
272
|
})
|
|
570
|
}
|
273
|
}
|
|
571
|
},
|
274
|
},
|
|
|
|
275
|
+ selectphone: function (e) {
|
|
|
|
276
|
+ this.data.form.phone = e.detail.phone;
|
|
|
|
277
|
+ this.data.form.rname = e.detail.rname;
|
|
|
|
278
|
+ this.data.form.cusdem = e.detail.cusdem;
|
|
|
|
279
|
+ var form = this.data.form
|
|
|
|
280
|
+ this.data.form.sex = e.detail.sex;
|
|
|
|
281
|
+ this.setData({
|
|
|
|
282
|
+ form: this.data.form,
|
|
|
|
283
|
+ searchlist: null
|
|
|
|
284
|
+ })
|
|
|
|
285
|
+ this.conditionInfo();
|
|
|
|
286
|
+ },
|
|
|
|
287
|
+ selectdesk(){
|
|
|
|
288
|
+ wx.navigateTo({
|
|
|
|
289
|
+ url: 'b_desk?rdate=' + this.time + '&tid=' + this.data.form.tabid
|
|
|
|
290
|
+ //+'&pnum_str='+this.data.form.pnum_str
|
|
|
|
291
|
+ + '&pnum=' + this.data.form.pnum
|
|
|
|
292
|
+ + '&checked_tids=' + this.data.form.tid
|
|
|
|
293
|
+ + '&rid=' + this.reserve_id
|
|
|
|
294
|
+ + '&ddate_solt='+this.ddate_solt
|
|
|
|
295
|
+ })
|
|
|
|
296
|
+ },
|
|
|
|
297
|
+ selectedValue(e){
|
|
|
|
298
|
+ console.log(e);
|
|
|
|
299
|
+ let key = util.attr(e, 'key');
|
|
|
|
300
|
+ let val;
|
|
|
|
301
|
+ let sobj = {};
|
|
|
|
302
|
+ if (e.type == 'input' || e.type == 'confirm') {
|
|
|
|
303
|
+ val = util.val(e);
|
|
|
|
304
|
+ if (key == 'phone') {
|
|
|
|
305
|
+ var that = this;
|
|
|
|
306
|
+ if (e.detail.value != '' && e.detail.value.length >= 3) {
|
|
|
|
307
|
+ App.Reserve.GetReserveUser(
|
|
|
|
308
|
+ {
|
|
|
|
309
|
+ keywords: e.detail.value,
|
|
|
|
310
|
+ sid: this.sellerid
|
|
|
|
311
|
+ }
|
|
|
|
312
|
+ ).then(function (json) {
|
|
|
|
313
|
+ if (json.ret == 200 && json.data.length > 0) {
|
|
|
|
314
|
+ that.setData({
|
|
|
|
315
|
+ searchlist: json.data
|
|
|
|
316
|
+ })
|
|
|
|
317
|
+ } else {
|
|
|
|
318
|
+ that.setData({
|
|
|
|
319
|
+ searchlist: null
|
|
|
|
320
|
+ })
|
|
|
|
321
|
+ }
|
|
|
|
322
|
+ })
|
|
|
|
323
|
+ } else {
|
|
|
|
324
|
+ this.setData({
|
|
|
|
325
|
+ searchlist: null
|
|
|
|
326
|
+ })
|
|
|
|
327
|
+ }
|
|
|
|
328
|
+ }
|
|
|
|
329
|
+ if (key == 'pnum') {
|
|
|
|
330
|
+ sobj.pnumInputFocus = true;
|
|
|
|
331
|
+ }
|
|
|
|
332
|
+ } else {
|
|
|
|
333
|
+ val = util.attr(e, 'value');
|
|
|
|
334
|
+ }
|
|
|
|
335
|
+
|
|
|
|
336
|
+
|
|
|
|
337
|
+ let form = this.data.form;
|
|
|
|
338
|
+
|
|
|
|
339
|
+ if (key == 'tid') {
|
|
|
|
340
|
+ let ts = this.data.tables;
|
|
|
|
341
|
+ if (ts[val].isselect) {
|
|
|
|
342
|
+ ts[val].isselect = false;
|
|
|
|
343
|
+ form.tid.remove(ts[val].id);
|
|
|
|
344
|
+ delete this.checkedTables[ts[val].id]
|
|
|
|
345
|
+ } else {
|
|
|
|
346
|
+ ts[val].isselect = true;
|
|
|
|
347
|
+ form.tid.push(ts[val].id);
|
|
|
|
348
|
+ this.checkedTables[ts[val].id]=ts[val].name
|
|
|
|
349
|
+ }
|
|
|
|
350
|
+ sobj.tables = ts;
|
|
|
|
351
|
+ } else {
|
|
|
|
352
|
+ form[key] = val;
|
|
|
|
353
|
+ }
|
|
|
|
354
|
+ console.log('ts', sobj.tables,this.checkedTables);
|
|
|
|
355
|
+ //console.log(e.type,key,val,form);
|
|
|
|
356
|
+ sobj.form = form;
|
|
|
|
357
|
+ sobj.buttonhide = this.data.buttonhide;
|
|
|
|
358
|
+ if (form.tid.length > 0 && form.rname.length > 0){
|
|
|
|
359
|
+ sobj.buttonhide = false;
|
|
|
|
360
|
+ }else{
|
|
|
|
361
|
+ sobj.buttonhide = true;
|
|
|
|
362
|
+ }
|
|
|
|
363
|
+ let displayTimes = false;
|
|
|
|
364
|
+
|
|
|
|
365
|
+ if ('pnum,pnum_str,tabid'.indexOf(key) > -1) {
|
|
|
|
366
|
+ if (!displayTimes) {
|
|
|
|
367
|
+ this.getTables();
|
|
|
|
368
|
+ }
|
|
|
|
369
|
+ }
|
|
|
|
370
|
+
|
|
|
|
371
|
+ this.setData(sobj)
|
|
|
|
372
|
+ },
|
|
|
|
373
|
+
|
|
572
|
async formsubmit(){
|
374
|
async formsubmit(){
|
|
573
|
if (this.data.buttonhide) return;
|
375
|
if (this.data.buttonhide) return;
|
|
574
|
try {
|
376
|
try {
|
|
575
|
- let d_stimestr = this.data.timePickerArray[this.data.form.time][this.data.timePickerIndex[this.data.form.time]];
|
|
|
|
576
|
- let d_rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date],
|
|
|
|
577
|
- this.data.form.time, d_stimestr,null,this.year);
|
|
|
|
578
|
- let stimestr = this.data.timePickerArray[this.data.form.time][this.data.timePickerIndex[0]];
|
|
|
|
579
|
- let rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date],
|
|
|
|
580
|
- this.data.form.time, stimestr,null,this.year);
|
|
|
|
581
|
- console.log('stimestr', stimestr, this.data.form.time, this.data.timePickerIndex);
|
|
|
|
582
|
- console.log('rdate', rdate);
|
|
|
|
583
|
this.setData({
|
377
|
this.setData({
|
|
584
|
buttonhide: true,
|
378
|
buttonhide: true,
|
|
585
|
})
|
379
|
})
|
|
@@ -589,6 +383,9 @@ Page({ |
|
@@ -589,6 +383,9 @@ Page({ |
|
589
|
let tid = new Set(form.tid);//tid 去重
|
383
|
let tid = new Set(form.tid);//tid 去重
|
|
590
|
form.tid = [...tid].toString();
|
384
|
form.tid = [...tid].toString();
|
|
591
|
}
|
385
|
}
|
|
|
|
386
|
+ if(this.ddate_solt<1){
|
|
|
|
387
|
+ return util.toast('请选择时段', 'none');
|
|
|
|
388
|
+ }
|
|
592
|
if (!form.tid) {
|
389
|
if (!form.tid) {
|
|
593
|
return util.toast('请选择桌子', 'none');
|
390
|
return util.toast('请选择桌子', 'none');
|
|
594
|
}
|
391
|
}
|
|
@@ -596,7 +393,7 @@ Page({ |
|
@@ -596,7 +393,7 @@ Page({ |
|
596
|
return util.toast('请填写预订人', 'none');
|
393
|
return util.toast('请填写预订人', 'none');
|
|
597
|
}
|
394
|
}
|
|
598
|
form.sid = this.sellerid;
|
395
|
form.sid = this.sellerid;
|
|
599
|
- form.rdate = rdate
|
396
|
+ form.rdate = this.timeDur
|
|
600
|
|
397
|
|
|
601
|
try {
|
398
|
try {
|
|
602
|
let enter_params = util.cache('enter_params');
|
399
|
let enter_params = util.cache('enter_params');
|
|
@@ -610,26 +407,24 @@ Page({ |
|
@@ -610,26 +407,24 @@ Page({ |
|
610
|
form.note_name = note_name || '';
|
407
|
form.note_name = note_name || '';
|
|
611
|
} catch (e) {}
|
408
|
} catch (e) {}
|
|
612
|
|
409
|
|
|
613
|
- form.ddate = d_rdate.substr(0, 10);
|
|
|
|
614
|
- if (this.data.hasUseDefDtime && this.data.form.time > 0) {//转为默认时间
|
|
|
|
615
|
- let ddateStr = util.unixtoTime(form.ddate, "YYYY-MM-DD " + this.data.defDtime[this.data.form.time] + ":00");
|
|
|
|
616
|
- form.ddate = util.timetouUnix(ddateStr);
|
410
|
+ form.ddate = this.time;
|
|
|
|
411
|
+ form.ddate_solt=this.ddate_solt
|
|
|
|
412
|
+ if(this.hasManual){
|
|
|
|
413
|
+ form.is_set_ddate=1
|
|
617
|
}
|
414
|
}
|
|
618
|
- //App.Customer.SetReserveInfoById
|
|
|
|
619
|
- form.ddate_solt=parseInt(form.time)+1
|
|
|
|
620
|
- App.Customer.SetReserveInfoById(form).then(res => {
|
415
|
+ App.Reserve.SetReserveInfo(form).then(res => {
|
|
621
|
if (res.ret == 200) {
|
416
|
if (res.ret == 200) {
|
|
622
|
this.getCustomRemark()
|
417
|
this.getCustomRemark()
|
|
623
|
let _id = (res.data.id || res.data)
|
418
|
let _id = (res.data.id || res.data)
|
|
624
|
this.setData({
|
419
|
this.setData({
|
|
625
|
form: JSON.parse(JSON.stringify(formTpl)),
|
420
|
form: JSON.parse(JSON.stringify(formTpl)),
|
|
626
|
tables: [],
|
421
|
tables: [],
|
|
627
|
- timePickerIndex: [0, 0, 0],
|
422
|
+ runTime:parseInt(new Date()/1000),
|
|
|
|
423
|
+ type:1
|
|
628
|
})
|
424
|
})
|
|
629
|
- this.initLoad();
|
|
|
|
630
|
this.checkedTables={};
|
425
|
this.checkedTables={};
|
|
631
|
App.Reserve.Detail({rid: _id, openid: ''}, 'clear')
|
426
|
App.Reserve.Detail({rid: _id, openid: ''}, 'clear')
|
|
632
|
- wx.redirectTo({
|
427
|
+ wx.navigateTo({
|
|
633
|
url: util.http_build_query({id:_id,tplid:1},'b_invitation'),
|
428
|
url: util.http_build_query({id:_id,tplid:1},'b_invitation'),
|
|
634
|
});
|
429
|
});
|
|
635
|
} else {
|
430
|
} else {
|
|
@@ -639,138 +434,25 @@ Page({ |
|
@@ -639,138 +434,25 @@ Page({ |
|
639
|
} catch (e) {
|
434
|
} catch (e) {
|
|
640
|
}
|
435
|
}
|
|
641
|
},
|
436
|
},
|
|
642
|
- selectphone: function (e) {
|
|
|
|
643
|
- this.data.form.phone = e.detail.phone;
|
|
|
|
644
|
- this.data.form.rname = e.detail.rname;
|
|
|
|
645
|
- this.data.form.cusdem = e.detail.cusdem;
|
|
|
|
646
|
- var form = this.data.form
|
|
|
|
647
|
- this.data.form.sex = e.detail.sex;
|
|
|
|
648
|
- this.setData({
|
|
|
|
649
|
- form: this.data.form,
|
|
|
|
650
|
- searchlist: null
|
|
|
|
651
|
- })
|
|
|
|
652
|
- this.conditionInfo();
|
|
|
|
653
|
- },
|
|
|
|
654
|
- calendarShow(){
|
|
|
|
655
|
- this.setData({
|
|
|
|
656
|
- calendarMask: true
|
|
|
|
657
|
- })
|
|
|
|
658
|
- },
|
|
|
|
659
|
- dateChange(event){
|
|
|
|
660
|
- console.log(event);
|
|
|
|
661
|
- //let cktime=util.timetouUnix(event.detail.year+'/'+event.detail.month+'/'+event.detail.day)
|
|
|
|
662
|
- let cktime = util.timetouUnix(event.detail.date)
|
|
|
|
663
|
- this.year=event.detail.date.substr(0, 4);
|
|
|
|
664
|
- console.log('this.year',this.year);
|
|
|
|
665
|
- let day0 = parseInt(new Date(new Date().setHours(0, 0, 0, 0)) / 1000);
|
|
|
|
666
|
- // if (cktime < day0) {
|
|
|
|
667
|
- // util.toast('请选择有效日期', 'none');
|
|
|
|
668
|
- // return;
|
|
|
|
669
|
- // }
|
|
|
|
670
|
- let clickDay = event.detail.date.substr(8, 2);
|
|
|
|
671
|
- let changeDay = `dayStyle[1].day`;
|
|
|
|
672
|
- let changeBg = `dayStyle[1].background`;
|
|
|
|
673
|
- this.setData({
|
|
|
|
674
|
- [changeDay]: clickDay,
|
|
|
|
675
|
- [changeBg]: "#84e7d0",
|
|
|
|
676
|
- //[`form.tid`]: [], //切换日期时间清空桌位
|
|
|
|
677
|
- //buttonhide: true,
|
|
|
|
678
|
- })
|
|
|
|
679
|
- console.log('cktime',cktime,util.unixtoTime(cktime,'YYYY-MM-DD'))
|
|
|
|
680
|
- if(cktime == day0){//今天
|
|
|
|
681
|
- this.setDateStr( new Date() / 1000 )
|
|
|
|
682
|
- }else{
|
|
|
|
683
|
- let xtime=util.unixtoTime(new Date() / 1000, event.detail.date + ' HH:II:SS');
|
|
|
|
684
|
- xtime=util.timetouUnix(xtime)
|
|
|
|
685
|
- this.setDateStr(xtime,true)
|
|
|
|
686
|
- }
|
|
|
|
687
|
-
|
|
|
|
688
|
- this.calendarClose();
|
|
|
|
689
|
- setTimeout(res=>{
|
|
|
|
690
|
- this.getTables();
|
|
|
|
691
|
- },10)
|
|
|
|
692
|
-
|
|
|
|
693
|
- },
|
|
|
|
694
|
- calendarClose(){
|
|
|
|
695
|
- this.setData({
|
|
|
|
696
|
- calendarMask: false,
|
|
|
|
697
|
- timePickerMask: false,
|
|
|
|
698
|
- })
|
|
|
|
699
|
- },
|
|
|
|
700
|
- async selectdesk(){
|
|
|
|
701
|
- let rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date], this.data.form.time,null,null,this.year);
|
|
|
|
702
|
- console.log(this.data.form)
|
|
|
|
703
|
- wx.navigateTo({
|
|
|
|
704
|
- url: 'b_desk?rdate=' + rdate + '&tid=' + this.data.form.tabid
|
|
|
|
705
|
- //+'&pnum_str='+this.data.form.pnum_str
|
|
|
|
706
|
- + '&pnum=' + this.data.form.pnum
|
|
|
|
707
|
- + '&checked_tids=' + this.data.form.tid
|
|
|
|
708
|
- + '&rid=' + this.reserve_id
|
|
|
|
709
|
- + '&ddate_solt='+(this.data.form.time+1)
|
|
|
|
710
|
- })
|
|
|
|
711
|
- },
|
|
|
|
712
|
- conditionInfo: function () {
|
|
|
|
713
|
- var form = this.data.form
|
|
|
|
714
|
- if (form.tid.length > 0 && form.rname.length > 0) {
|
|
|
|
715
|
- this.data.buttonhide = false;
|
|
|
|
716
|
- }
|
|
|
|
717
|
- this.setData({
|
|
|
|
718
|
- buttonhide: this.data.buttonhide
|
|
|
|
719
|
- })
|
|
|
|
720
|
- },
|
|
|
|
721
|
- /**
|
|
|
|
722
|
- * 选中时间区域
|
|
|
|
723
|
- */
|
|
|
|
724
|
- bindTimePickerChange(e){
|
|
|
|
725
|
- let timeIndex = util.attr(e, 'timeIndex');
|
|
|
|
726
|
- if (timeIndex < 0) return;
|
|
|
|
727
|
- let timePickerIndex = this.data.timePickerIndex;
|
|
|
|
728
|
- //timePickerIndex[timeIndex]=util.val(e);
|
|
|
|
729
|
- timePickerIndex[timeIndex] = util.attr(e, 'val');
|
|
|
|
730
|
|
437
|
|
|
731
|
- console.log(e, timeIndex, util.attr(e, 'val'));
|
|
|
|
732
|
- this.setData({
|
|
|
|
733
|
- timePickerIndex: timePickerIndex,
|
|
|
|
734
|
- hasUseDefDtime: false,
|
|
|
|
735
|
- [`form.is_set_ddate`]:1,
|
|
|
|
736
|
- })
|
|
|
|
737
|
- },
|
|
|
|
738
|
/**
|
438
|
/**
|
|
739
|
* 修改初始化
|
439
|
* 修改初始化
|
|
740
|
*/
|
440
|
*/
|
|
741
|
- is_set_ddate:0,
|
|
|
|
742
|
- async initModify(id){
|
441
|
+ async initModify(){
|
|
743
|
try {
|
442
|
try {
|
|
744
|
- let res = await App.Reserve.Detail({rid: id, openid: ''});
|
|
|
|
745
|
- this.is_set_ddate=res.data.is_set_ddate
|
|
|
|
746
|
- console.log('initModify', res);
|
|
|
|
747
|
- //设置日期
|
|
|
|
748
|
- let obj = await this.setDateStr(res.data.ddate,null,res.data.ddate_solt-1);
|
|
|
|
749
|
- //设置时间
|
|
|
|
750
|
- let nd = util.unixtoTime(res.data.ddate, 'HH:II');
|
|
|
|
751
|
- let timePickerIndex = this.data.timePickerIndex
|
|
|
|
752
|
- console.log('initModify-', this.data.timePickerArray, obj.form.time, nd)
|
|
|
|
753
|
- this.data.timePickerArray[obj.form.time].forEach((dd, ii) => {
|
|
|
|
754
|
- console.log('initModify-', nd, dd)
|
|
|
|
755
|
- if (nd == dd) {
|
|
|
|
756
|
- timePickerIndex[obj.form.time] = ii;
|
|
|
|
757
|
- return true;
|
|
|
|
758
|
- }
|
|
|
|
759
|
- })
|
|
|
|
760
|
-
|
|
|
|
761
|
- console.log('initModify-timePickerIndex', timePickerIndex);
|
|
|
|
762
|
- //obj.form.pnum_str=res.data.pnum_str;
|
|
|
|
763
|
- obj.form.pnum = res.data.pnum || 6;
|
|
|
|
764
|
- obj.form.rname = res.data.rname;
|
|
|
|
765
|
- obj.form.phone = res.data.phone || "";
|
|
|
|
766
|
- obj.form.sex = res.data.sex;
|
|
|
|
767
|
- obj.form.cusdem = res.data.cusdem;
|
|
|
|
768
|
- obj.form.is_set_ddate=res.data.is_set_ddate
|
|
|
|
769
|
- obj.form.rid = id;
|
|
|
|
770
|
- obj.form.tid = [];
|
443
|
+ let res = await App.Reserve.Detail({rid: this.options.id, openid: ''});
|
|
|
|
444
|
+ let form=this.data.form
|
|
|
|
445
|
+ form.pnum = res.data.pnum || 6;
|
|
|
|
446
|
+ form.rname = res.data.rname;
|
|
|
|
447
|
+ form.phone = res.data.phone || "";
|
|
|
|
448
|
+ form.sex = res.data.sex;
|
|
|
|
449
|
+ form.cusdem = res.data.cusdem;
|
|
|
|
450
|
+ form.rid = this.options.id;
|
|
|
|
451
|
+ form.tid = [];
|
|
|
|
452
|
+ form.is_set_ddate=res.data.is_set_ddate
|
|
771
|
let tablesed = [];
|
453
|
let tablesed = [];
|
|
772
|
res.data.tables.forEach((t, ti) => {
|
454
|
res.data.tables.forEach((t, ti) => {
|
|
773
|
- obj.form.tid.push(t.id)
|
455
|
+ form.tid.push(t.id)
|
|
774
|
if (ti >= 3) return;
|
456
|
if (ti >= 3) return;
|
|
775
|
t.isselect = true
|
457
|
t.isselect = true
|
|
776
|
t["isselected"] = 1
|
458
|
t["isselected"] = 1
|
|
@@ -778,79 +460,15 @@ Page({ |
|
@@ -778,79 +460,15 @@ Page({ |
|
778
|
this.checkedTables[t.id]=t.name;
|
460
|
this.checkedTables[t.id]=t.name;
|
|
779
|
})
|
461
|
})
|
|
780
|
this.setData({
|
462
|
this.setData({
|
|
781
|
- timePickerIndex: timePickerIndex,
|
|
|
|
782
|
- form: obj.form,
|
|
|
|
783
|
- //tablesed:tablesed,
|
|
|
|
784
|
- hasUseDefDtime: false,
|
463
|
+ type:2,//修改
|
|
|
|
464
|
+ runTime: res.data.ddate,//到店时间
|
|
|
|
465
|
+ ddate_solt:res.data.ddate_solt,
|
|
|
|
466
|
+ form: form,
|
|
785
|
})
|
467
|
})
|
|
786
|
- setTimeout(() => {
|
|
|
|
787
|
- this.getTables();
|
|
|
|
788
|
- }, 300)
|
|
|
|
789
|
-
|
|
|
|
790
|
} catch (e) {
|
468
|
} catch (e) {
|
|
791
|
console.log('initModify', e)
|
469
|
console.log('initModify', e)
|
|
792
|
}
|
470
|
}
|
|
793
|
},
|
471
|
},
|
|
794
|
- pnumInputFocusEvent(e){
|
|
|
|
795
|
- console.log(e);
|
|
|
|
796
|
- this.setData({
|
|
|
|
797
|
- pnumInputFocus: 'focus' == e.type
|
|
|
|
798
|
- })
|
|
|
|
799
|
- },
|
|
|
|
800
|
- inputFocusTime: 0,
|
|
|
|
801
|
- blurTime: 0,
|
|
|
|
802
|
- inputFocus(e){
|
|
|
|
803
|
- console.log(e, this.inputFocusTime);
|
|
|
|
804
|
- return;
|
|
|
|
805
|
- if (e.timeStamp > this.inputFocusTime) {
|
|
|
|
806
|
- this.inputFocusTime = e.timeStamp;
|
|
|
|
807
|
- if (e.type == 'focus' && this.data.pageMarginBottom == 0) {
|
|
|
|
808
|
- this.setData({
|
|
|
|
809
|
- pageMarginBottom: 300
|
|
|
|
810
|
- })
|
|
|
|
811
|
- setTimeout(res => {
|
|
|
|
812
|
- this.pageScrollToBottom();
|
|
|
|
813
|
- }, 100)
|
|
|
|
814
|
- } else {
|
|
|
|
815
|
- if (this.blurTime > 5) {
|
|
|
|
816
|
- this.blurTime = 0;
|
|
|
|
817
|
- this.setData({
|
|
|
|
818
|
- pageMarginBottom: 0
|
|
|
|
819
|
- })
|
|
|
|
820
|
- } else {
|
|
|
|
821
|
- setTimeout(res => {
|
|
|
|
822
|
- this.blurTime += 1;
|
|
|
|
823
|
- this.inputFocus(e);
|
|
|
|
824
|
- }, 300)
|
|
|
|
825
|
- }
|
|
|
|
826
|
-
|
|
|
|
827
|
- }
|
|
|
|
828
|
-
|
|
|
|
829
|
- }
|
|
|
|
830
|
- },
|
|
|
|
831
|
- pageScrollToBottom: function () {
|
|
|
|
832
|
- wx.createSelectorQuery().select('#j_page').boundingClientRect(function (rect) {
|
|
|
|
833
|
- // 使页面滚动到底部
|
|
|
|
834
|
- wx.pageScrollTo({
|
|
|
|
835
|
- scrollTop: rect.bottom
|
|
|
|
836
|
- })
|
|
|
|
837
|
- }).exec()
|
|
|
|
838
|
- },
|
|
|
|
839
|
- gotoday(e){
|
|
|
|
840
|
- this.setData({
|
|
|
|
841
|
- [`calendar.nextNum`]: 0
|
|
|
|
842
|
- })
|
|
|
|
843
|
- },
|
|
|
|
844
|
- nextMonth(e){
|
|
|
|
845
|
- this.setData({
|
|
|
|
846
|
- [`calendar.nextNum`]: this.data.calendar.nextNum + 1
|
|
|
|
847
|
- })
|
|
|
|
848
|
- },
|
|
|
|
849
|
- prevMonth(e){
|
|
|
|
850
|
- this.setData({
|
|
|
|
851
|
- [`calendar.nextNum`]: this.data.calendar.nextNum - 1
|
|
|
|
852
|
- })
|
|
|
|
853
|
- },
|
|
|
|
854
|
/**
|
472
|
/**
|
|
855
|
* 快速预订初始化
|
473
|
* 快速预订初始化
|
|
856
|
* tid
|
474
|
* tid
|
|
@@ -858,64 +476,13 @@ Page({ |
|
@@ -858,64 +476,13 @@ Page({ |
|
858
|
* ddate
|
476
|
* ddate
|
|
859
|
* pnum
|
477
|
* pnum
|
|
860
|
*/
|
478
|
*/
|
|
861
|
- async initQuick(options){
|
|
|
|
862
|
- try {
|
|
|
|
863
|
- console.log('initQuick', options);
|
|
|
|
864
|
- this.checkedTables[options.tid]=options.tname
|
|
|
|
865
|
- this.year=util.unixtoTime(options.ddate.substr(0,10),'YYYY');
|
|
|
|
866
|
- let form=this.data.form
|
|
|
|
867
|
- form.tid=[options.tid]
|
|
|
|
868
|
-
|
|
|
|
869
|
- this.setData({
|
|
|
|
870
|
- form: form,
|
|
|
|
871
|
- })
|
|
|
|
872
|
- setTimeout(() => {
|
|
|
|
873
|
- this.getTables();
|
|
|
|
874
|
- }, 300)
|
|
|
|
875
|
- } catch (e) {
|
|
|
|
876
|
- console.log('initQuick', e)
|
|
|
|
877
|
- }
|
|
|
|
878
|
- },
|
|
|
|
879
|
- getCustomRemark(){
|
|
|
|
880
|
- App.User.GetCustomRemark({
|
|
|
|
881
|
- uid:util.cache('enter_params')['manager_id'],
|
|
|
|
882
|
- }).then(res=>{
|
|
|
|
883
|
- let CustomRemark=[];
|
|
|
|
884
|
- res.data.forEach(r=>{
|
|
|
|
885
|
- if(r.often_use){
|
|
|
|
886
|
- CustomRemark.push(r);
|
|
|
|
887
|
- }
|
|
|
|
888
|
- })
|
|
|
|
889
|
- this.setData({
|
|
|
|
890
|
- CustomRemark:CustomRemark,
|
|
|
|
891
|
- })
|
|
|
|
892
|
- })
|
|
|
|
893
|
- },
|
|
|
|
894
|
- oftenUse(e){
|
|
|
|
895
|
- let id=util.attr(e,'id');
|
|
|
|
896
|
- let val=util.attr(e,'value');
|
|
|
|
897
|
- let CustomRemark=this.data.CustomRemark;
|
|
|
|
898
|
- let form=this.data.form;
|
|
|
|
899
|
- CustomRemark.forEach(r=>{
|
|
|
|
900
|
- if(id==r.id){
|
|
|
|
901
|
- if(r.active){
|
|
|
|
902
|
- form.cusdem=form.cusdem.replace(val+'、','')
|
|
|
|
903
|
- }
|
|
|
|
904
|
- r.active=!r.active
|
|
|
|
905
|
- if(r.active){
|
|
|
|
906
|
- form.cusdem+=val+'、'
|
|
|
|
907
|
- }
|
|
|
|
908
|
- }
|
|
|
|
909
|
- })
|
479
|
+ initQuick(){
|
|
|
|
480
|
+ let options=this.options
|
|
|
|
481
|
+ this.checkedTables[options.tid]=options.tname
|
|
910
|
this.setData({
|
482
|
this.setData({
|
|
911
|
- CustomRemark:CustomRemark,
|
|
|
|
912
|
- form:form,
|
483
|
+ [`form.tid`]: [options.tid],
|
|
|
|
484
|
+ runTime:options.ddate.substr(0,10),
|
|
|
|
485
|
+ type:3
|
|
913
|
})
|
486
|
})
|
|
914
|
- this.conditionInfo()
|
|
|
|
915
|
},
|
487
|
},
|
|
916
|
- CustomRemarkMore(){
|
|
|
|
917
|
- this.setData({
|
|
|
|
918
|
- CustomRemarkMoreMask:!this.data.CustomRemarkMoreMask
|
|
|
|
919
|
- })
|
|
|
|
920
|
- }
|
|
|
|
921
|
}) |
488
|
}) |