|
@@ -95,21 +95,21 @@ Page({ |
|
@@ -95,21 +95,21 @@ Page({ |
|
95
|
let rev_time=parseInt(nt)
|
95
|
let rev_time=parseInt(nt)
|
|
96
|
if(options.hasQuick==1){
|
96
|
if(options.hasQuick==1){
|
|
97
|
let rdate=options.ddate.split('-')
|
97
|
let rdate=options.ddate.split('-')
|
|
98
|
- if(rev_time<rdate[0] || rev_time>rdate[1]){
|
98
|
+ if(!(rev_time>=rdate[0] && rev_time<=rdate[1])){
|
|
99
|
rev_time=rdate[0]
|
99
|
rev_time=rdate[0]
|
|
100
|
}
|
100
|
}
|
|
|
|
101
|
+ await this.setDateStr(rev_time);
|
|
101
|
}
|
102
|
}
|
|
102
|
- await this.setDateStr(rev_time);
|
|
|
|
103
|
- this.sellerid = util.cache('enter_params')['seller_id'];
|
|
|
|
104
|
- let timePickerArray = await comm.getDayTimeSpace();
|
|
|
|
105
|
//判断hasUseDefDtime
|
103
|
//判断hasUseDefDtime
|
|
106
|
let hasUseDefDtime = true;
|
104
|
let hasUseDefDtime = true;
|
|
107
|
let mmii = util.unixtoTime(rev_time, 'HH:II');
|
105
|
let mmii = util.unixtoTime(rev_time, 'HH:II');
|
|
108
|
- console.log('initLoad',mmii,this.data.defDtime[this.data.form.time],this.data.defDtime)
|
|
|
|
109
|
- console.log('initLoad',mmii > this.data.defDtime[this.data.form.time])
|
|
|
|
110
|
if (mmii > this.data.defDtime[this.data.form.time]) {
|
106
|
if (mmii > this.data.defDtime[this.data.form.time]) {
|
|
111
|
hasUseDefDtime = false;
|
107
|
hasUseDefDtime = false;
|
|
112
|
}
|
108
|
}
|
|
|
|
109
|
+ console.log('initLoad::setDateStr',util.unixtoTime(rev_time,'YYYY-MM-DD HH:II'),this.data.defDtime[this.data.form.time])
|
|
|
|
110
|
+ await this.setDateStr(rev_time,hasUseDefDtime);
|
|
|
|
111
|
+ this.sellerid = util.cache('enter_params')['seller_id'];
|
|
|
|
112
|
+ let timePickerArray = await comm.getDayTimeSpace();
|
|
113
|
this.setData({
|
113
|
this.setData({
|
|
114
|
timePickerArray: timePickerArray,
|
114
|
timePickerArray: timePickerArray,
|
|
115
|
speciallist: speciallist,
|
115
|
speciallist: speciallist,
|
|
@@ -128,7 +128,12 @@ Page({ |
|
@@ -128,7 +128,12 @@ Page({ |
|
128
|
* @param d
|
128
|
* @param d
|
|
129
|
*
|
129
|
*
|
|
130
|
*/
|
130
|
*/
|
|
131
|
- async setDateStr(d = new Date() / 1000){
|
131
|
+ async setDateStr(d = new Date() / 1000,hasUseDefDtime=false){
|
|
|
|
132
|
+ if(hasUseDefDtime){//
|
|
|
|
133
|
+ let timestr=util.unixtoTime(d,'YYYY-MM-DD '+this.data.defDtime[this.data.form.time])
|
|
|
|
134
|
+ d=util.timetouUnix(timestr)
|
|
|
|
135
|
+ }
|
|
|
|
136
|
+ console.log('setDateStr',util.unixtoTime(d,'YYYY-MM-DD HH:II'),hasUseDefDtime)
|
|
132
|
this.year=util.unixtoTime(d,'YYYY');
|
137
|
this.year=util.unixtoTime(d,'YYYY');
|
|
133
|
let ns = new Date() / 1000;
|
138
|
let ns = new Date() / 1000;
|
|
134
|
let dateStr = [
|
139
|
let dateStr = [
|
|
@@ -141,8 +146,14 @@ Page({ |
|
@@ -141,8 +146,14 @@ Page({ |
|
141
|
|
146
|
|
|
142
|
let timeObj = await comm.getTimeSpaceIndexData(d);
|
147
|
let timeObj = await comm.getTimeSpaceIndexData(d);
|
|
143
|
//form.time=await comm.getTimeSpaceIndex(d);
|
148
|
//form.time=await comm.getTimeSpaceIndex(d);
|
|
144
|
- form.time = timeObj.timeIndex;
|
149
|
+ //如果小于默认时间,使用默认时间
|
|
|
|
150
|
+ let mmii = util.unixtoTime(d,'HH:II')
|
|
|
|
151
|
+ if (mmii < this.data.defDtime[timeObj.timeIndex]) {
|
|
|
|
152
|
+ let str=util.unixtoTime(d, 'YYYY-MM-DD '+this.data.defDtime[timeObj.timeIndex]+':00')
|
|
|
|
153
|
+ timeObj = await comm.getTimeSpaceIndexData(util.timetouUnix(str));
|
|
|
|
154
|
+ }
|
|
145
|
|
155
|
|
|
|
|
156
|
+ form.time = timeObj.timeIndex;
|
|
146
|
let ind = dateStr._indexOf(nowStr);
|
157
|
let ind = dateStr._indexOf(nowStr);
|
|
147
|
if (ind > -1) {
|
158
|
if (ind > -1) {
|
|
148
|
form.date = ind
|
159
|
form.date = ind
|
|
@@ -158,6 +169,7 @@ Page({ |
|
@@ -158,6 +169,7 @@ Page({ |
|
158
|
timePickerIndex: timePickerIndex,
|
169
|
timePickerIndex: timePickerIndex,
|
|
159
|
timeOpt: timeObj.timeOpt,
|
170
|
timeOpt: timeObj.timeOpt,
|
|
160
|
};
|
171
|
};
|
|
|
|
172
|
+
|
|
161
|
this.setData(obj)
|
173
|
this.setData(obj)
|
|
162
|
return obj;
|
174
|
return obj;
|
|
163
|
|
175
|
|
|
@@ -220,7 +232,7 @@ Page({ |
|
@@ -220,7 +232,7 @@ Page({ |
|
220
|
onShareAppMessage: function () {
|
232
|
onShareAppMessage: function () {
|
|
221
|
|
233
|
|
|
222
|
},
|
234
|
},
|
|
223
|
- selectedValue(e){
|
235
|
+ async selectedValueAsync(e){
|
|
224
|
console.log(e);
|
236
|
console.log(e);
|
|
225
|
let key = util.attr(e, 'key');
|
237
|
let key = util.attr(e, 'key');
|
|
226
|
let val;
|
238
|
let val;
|
|
@@ -302,6 +314,30 @@ Page({ |
|
@@ -302,6 +314,30 @@ Page({ |
|
302
|
sobj.timePickerMask = true;
|
314
|
sobj.timePickerMask = true;
|
|
303
|
}
|
315
|
}
|
|
304
|
}
|
316
|
}
|
|
|
|
317
|
+ //判断hasUseDefDtime
|
|
|
|
318
|
+ if ((key == 'time' || key == 'date') && !sobj.timePickerMask) {
|
|
|
|
319
|
+ sobj.hasUseDefDtime = true
|
|
|
|
320
|
+ let ntime = parseInt(new Date() / 1000)
|
|
|
|
321
|
+ let xtime =ntime
|
|
|
|
322
|
+ if(key == 'time'){
|
|
|
|
323
|
+ xtime=util.unixtoTime(new Date() / 1000, this.year+'-' + (this.data.dateStr[this.data.form.date].substr(0, 5)) + ' HH:II:SS');
|
|
|
|
324
|
+ xtime=util.timetouUnix(xtime)
|
|
|
|
325
|
+ //if 当前时间在区间内 hasUseDefDtime 为 false
|
|
|
|
326
|
+ let d_rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date],
|
|
|
|
327
|
+ this.data.form.time, null,null,this.year);
|
|
|
|
328
|
+ d_rdate=d_rdate.split('-');
|
|
|
|
329
|
+ if(d_rdate[0] <= ntime && ntime<=d_rdate[1]){
|
|
|
|
330
|
+ sobj.hasUseDefDtime=false
|
|
|
|
331
|
+ }
|
|
|
|
332
|
+ }
|
|
|
|
333
|
+ this.setDateStr(xtime,sobj.hasUseDefDtime);
|
|
|
|
334
|
+ }
|
|
|
|
335
|
+ if (this.data.form.date == 0) {//
|
|
|
|
336
|
+ let mmii = util.unixtoTime(new Date() / 1000, 'HH:II');
|
|
|
|
337
|
+ if (mmii > this.data.defDtime[key == 'time' ? val : this.data.form.time]) {
|
|
|
|
338
|
+ sobj.hasUseDefDtime = false;
|
|
|
|
339
|
+ }
|
|
|
|
340
|
+ }
|
|
305
|
if ('date,time,pnum,pnum_str,tabid'.indexOf(key) > -1) {
|
341
|
if ('date,time,pnum,pnum_str,tabid'.indexOf(key) > -1) {
|
|
306
|
if (!displayTimes) {
|
342
|
if (!displayTimes) {
|
|
307
|
//sobj.form.tid = []; //切换日期时间清空桌位
|
343
|
//sobj.form.tid = []; //切换日期时间清空桌位
|
|
@@ -309,13 +345,105 @@ Page({ |
|
@@ -309,13 +345,105 @@ Page({ |
|
309
|
this.getTables();
|
345
|
this.getTables();
|
|
310
|
}
|
346
|
}
|
|
311
|
if (key == 'date') {
|
347
|
if (key == 'date') {
|
|
312
|
- let xtime = util.unixtoTime(new Date() / 1000, 'YYYY-' + (this.data.dateStr[val].substr(0, 5)) + ' HH:II:SS');
|
|
|
|
313
|
- this.setDateStr(util.timetouUnix(xtime));
|
348
|
+ let xtime = util.unixtoTime(new Date() / 1000, this.year+'-' + (this.data.dateStr[val].substr(0, 5)) + ' HH:II:SS');
|
|
|
|
349
|
+ this.setDateStr(util.timetouUnix(xtime),sobj.hasUseDefDtime);
|
|
|
|
350
|
+ }
|
|
|
|
351
|
+ }
|
|
|
|
352
|
+
|
|
|
|
353
|
+ this.setData(sobj)
|
|
|
|
354
|
+ },
|
|
|
|
355
|
+ selectedValue(e){
|
|
|
|
356
|
+ console.log(e);
|
|
|
|
357
|
+ let key = util.attr(e, 'key');
|
|
|
|
358
|
+ let val;
|
|
|
|
359
|
+ let sobj = {};
|
|
|
|
360
|
+ if (key == 'date') {
|
|
|
|
361
|
+ this.year=util.unixtoTime(new Date() / 1000,'YYYY');
|
|
|
|
362
|
+ }
|
|
|
|
363
|
+ if (e.type == 'input' || e.type == 'confirm') {
|
|
|
|
364
|
+ val = util.val(e);
|
|
|
|
365
|
+ if (key == 'phone') {
|
|
|
|
366
|
+ var that = this;
|
|
|
|
367
|
+ if (e.detail.value != '' && e.detail.value.length >= 3) {
|
|
|
|
368
|
+ App.Reserve.GetReserveUser(
|
|
|
|
369
|
+ {
|
|
|
|
370
|
+ keywords: e.detail.value,
|
|
|
|
371
|
+ sid: this.sellerid
|
|
|
|
372
|
+ }
|
|
|
|
373
|
+ ).then(function (json) {
|
|
|
|
374
|
+ if (json.ret == 200 && json.data.length > 0) {
|
|
|
|
375
|
+ that.setData({
|
|
|
|
376
|
+ searchlist: json.data
|
|
|
|
377
|
+ })
|
|
|
|
378
|
+ } else {
|
|
|
|
379
|
+ that.setData({
|
|
|
|
380
|
+ searchlist: null
|
|
|
|
381
|
+ })
|
|
|
|
382
|
+ }
|
|
|
|
383
|
+ })
|
|
|
|
384
|
+ } else {
|
|
|
|
385
|
+ this.setData({
|
|
|
|
386
|
+ searchlist: null
|
|
|
|
387
|
+ })
|
|
|
|
388
|
+ }
|
|
|
|
389
|
+ }
|
|
|
|
390
|
+ if (key == 'pnum') {
|
|
|
|
391
|
+ sobj.pnumInputFocus = true;
|
|
|
|
392
|
+ }
|
|
|
|
393
|
+ } else {
|
|
|
|
394
|
+ val = util.attr(e, 'value');
|
|
|
|
395
|
+ }
|
|
|
|
396
|
+ if (key == 'time') {
|
|
|
|
397
|
+ if (this.data.timeOpt[val]) return;
|
|
|
|
398
|
+ }
|
|
|
|
399
|
+ if ((key == 'time' && this.data.form.time == val) || (key == 'date' && this.data.form.date == val)) {
|
|
|
|
400
|
+ if (util.attr(e, 'display') != 'block') {
|
|
|
|
401
|
+ return;
|
|
|
|
402
|
+ }
|
|
|
|
403
|
+ }
|
|
|
|
404
|
+ let form = this.data.form;
|
|
|
|
405
|
+
|
|
|
|
406
|
+ if (key == 'tid') {
|
|
|
|
407
|
+ let ts = this.data.tables;
|
|
|
|
408
|
+ if (ts[val].isselect) {
|
|
|
|
409
|
+ ts[val].isselect = false;
|
|
|
|
410
|
+ form.tid.remove(ts[val].id);
|
|
|
|
411
|
+ delete this.checkedTables[ts[val].id]
|
|
|
|
412
|
+ } else {
|
|
|
|
413
|
+ ts[val].isselect = true;
|
|
|
|
414
|
+ form.tid.push(ts[val].id);
|
|
|
|
415
|
+ this.checkedTables[ts[val].id]=ts[val].name
|
|
|
|
416
|
+ }
|
|
|
|
417
|
+ sobj.tables = ts;
|
|
|
|
418
|
+ } else {
|
|
|
|
419
|
+ form[key] = val;
|
|
|
|
420
|
+ }
|
|
|
|
421
|
+ console.log('ts', sobj.tables,this.checkedTables);
|
|
|
|
422
|
+ //console.log(e.type,key,val,form);
|
|
|
|
423
|
+ sobj.form = form;
|
|
|
|
424
|
+ sobj.buttonhide = this.data.buttonhide;
|
|
|
|
425
|
+ if (form.tid.length > 0 && form.rname.length > 0) {
|
|
|
|
426
|
+ sobj.buttonhide = false;
|
|
|
|
427
|
+ }else{
|
|
|
|
428
|
+ sobj.buttonhide = true;
|
|
|
|
429
|
+ }
|
|
|
|
430
|
+ let displayTimes = false;
|
|
|
|
431
|
+ if (key == 'time') {
|
|
|
|
432
|
+ if (util.attr(e, 'display') == 'block') {
|
|
|
|
433
|
+ displayTimes = true;
|
|
|
|
434
|
+ sobj.timePickerMask = true;
|
|
314
|
}
|
435
|
}
|
|
315
|
}
|
436
|
}
|
|
316
|
//判断hasUseDefDtime
|
437
|
//判断hasUseDefDtime
|
|
317
|
if ((key == 'time' || key == 'date') && !sobj.timePickerMask) {
|
438
|
if ((key == 'time' || key == 'date') && !sobj.timePickerMask) {
|
|
318
|
sobj.hasUseDefDtime = true
|
439
|
sobj.hasUseDefDtime = true
|
|
|
|
440
|
+ let ntime = parseInt(new Date() / 1000)
|
|
|
|
441
|
+ let xtime =ntime
|
|
|
|
442
|
+ if(key == 'time'){
|
|
|
|
443
|
+ xtime=util.unixtoTime(new Date() / 1000, this.year+'-' + (this.data.dateStr[this.data.form.date].substr(0, 5)) + ' HH:II:SS');
|
|
|
|
444
|
+ xtime=util.timetouUnix(xtime)
|
|
|
|
445
|
+ }
|
|
|
|
446
|
+ this.setDateStr(xtime,sobj.hasUseDefDtime);
|
|
319
|
}
|
447
|
}
|
|
320
|
if (this.data.form.date == 0) {//
|
448
|
if (this.data.form.date == 0) {//
|
|
321
|
let mmii = util.unixtoTime(new Date() / 1000, 'HH:II');
|
449
|
let mmii = util.unixtoTime(new Date() / 1000, 'HH:II');
|
|
@@ -323,6 +451,18 @@ Page({ |
|
@@ -323,6 +451,18 @@ Page({ |
|
323
|
sobj.hasUseDefDtime = false;
|
451
|
sobj.hasUseDefDtime = false;
|
|
324
|
}
|
452
|
}
|
|
325
|
}
|
453
|
}
|
|
|
|
454
|
+ if ('date,time,pnum,pnum_str,tabid'.indexOf(key) > -1) {
|
|
|
|
455
|
+ if (!displayTimes) {
|
|
|
|
456
|
+ //sobj.form.tid = []; //切换日期时间清空桌位
|
|
|
|
457
|
+ //sobj.buttonhide = true;
|
|
|
|
458
|
+ this.getTables();
|
|
|
|
459
|
+ }
|
|
|
|
460
|
+ if (key == 'date') {
|
|
|
|
461
|
+ let xtime = util.unixtoTime(new Date() / 1000, this.year+'-' + (this.data.dateStr[val].substr(0, 5)) + ' HH:II:SS');
|
|
|
|
462
|
+ this.setDateStr(util.timetouUnix(xtime),sobj.hasUseDefDtime);
|
|
|
|
463
|
+ }
|
|
|
|
464
|
+ }
|
|
|
|
465
|
+
|
|
326
|
this.setData(sobj)
|
466
|
this.setData(sobj)
|
|
327
|
},
|
467
|
},
|
|
328
|
async getTables(){
|
468
|
async getTables(){
|
|
@@ -518,7 +658,14 @@ Page({ |
|
@@ -518,7 +658,14 @@ Page({ |
|
518
|
//buttonhide: true,
|
658
|
//buttonhide: true,
|
|
519
|
})
|
659
|
})
|
|
520
|
console.log('cktime',cktime,util.unixtoTime(cktime,'YYYY-MM-DD'))
|
660
|
console.log('cktime',cktime,util.unixtoTime(cktime,'YYYY-MM-DD'))
|
|
521
|
- this.setDateStr(cktime == day0 ? new Date() / 1000 : cktime)
|
661
|
+ if(cktime == day0){//今天
|
|
|
|
662
|
+ this.setDateStr( new Date() / 1000 )
|
|
|
|
663
|
+ }else{
|
|
|
|
664
|
+ let xtime=util.unixtoTime(new Date() / 1000, event.detail.date + ' HH:II:SS');
|
|
|
|
665
|
+ xtime=util.timetouUnix(xtime)
|
|
|
|
666
|
+ this.setDateStr(xtime,true)
|
|
|
|
667
|
+ }
|
|
|
|
668
|
+
|
|
522
|
this.calendarClose();
|
669
|
this.calendarClose();
|
|
523
|
setTimeout(res=>{
|
670
|
setTimeout(res=>{
|
|
524
|
this.getTables();
|
671
|
this.getTables();
|
|
@@ -695,6 +842,7 @@ Page({ |
|
@@ -695,6 +842,7 @@ Page({ |
|
695
|
this.year=util.unixtoTime(options.ddate.substr(0,10),'YYYY');
|
842
|
this.year=util.unixtoTime(options.ddate.substr(0,10),'YYYY');
|
|
696
|
let form=this.data.form
|
843
|
let form=this.data.form
|
|
697
|
form.tid=[options.tid]
|
844
|
form.tid=[options.tid]
|
|
|
|
845
|
+
|
|
698
|
this.setData({
|
846
|
this.setData({
|
|
699
|
form: form,
|
847
|
form: form,
|
|
700
|
})
|
848
|
})
|