|
@@ -20,7 +20,8 @@ Page({ |
|
@@ -20,7 +20,8 @@ Page({ |
|
20
|
*/
|
20
|
*/
|
|
21
|
data: {
|
21
|
data: {
|
|
22
|
type:1, // type 1/2/3 新增/修改/桌位
|
22
|
type:1, // type 1/2/3 新增/修改/桌位
|
|
23
|
- time:0,//当前时间戳,或修改到店,或桌位预订时间
|
23
|
+ time:0,//组件最终构造的到店时间
|
|
|
|
24
|
+ runTime:0,//当前时间戳,或修改到店,或桌位预订时间
|
|
24
|
form: JSON.parse(JSON.stringify(formTpl)),
|
25
|
form: JSON.parse(JSON.stringify(formTpl)),
|
|
25
|
tables: [],
|
26
|
tables: [],
|
|
26
|
grand: [
|
27
|
grand: [
|
|
@@ -59,14 +60,15 @@ Page({ |
|
@@ -59,14 +60,15 @@ Page({ |
|
59
|
this.getCustomRemark();
|
60
|
this.getCustomRemark();
|
|
60
|
if(options.id>0){
|
61
|
if(options.id>0){
|
|
61
|
//修改
|
62
|
//修改
|
|
62
|
- return;
|
63
|
+ this.reserve_id=options.id
|
|
|
|
64
|
+ return this.initModify();
|
|
63
|
}
|
65
|
}
|
|
64
|
- if(options.tid){
|
66
|
+ if(options.hasQuick==1){
|
|
65
|
//桌位预订
|
67
|
//桌位预订
|
|
66
|
- return;
|
68
|
+ return this.initQuick();
|
|
67
|
}
|
69
|
}
|
|
68
|
this.setData({
|
70
|
this.setData({
|
|
69
|
- time:parseInt(new Date()/1000),
|
71
|
+ runTime:parseInt(new Date()/1000),
|
|
70
|
type:1
|
72
|
type:1
|
|
71
|
})
|
73
|
})
|
|
72
|
},
|
74
|
},
|
|
@@ -405,7 +407,7 @@ Page({ |
|
@@ -405,7 +407,7 @@ Page({ |
|
405
|
} catch (e) {}
|
407
|
} catch (e) {}
|
|
406
|
|
408
|
|
|
407
|
form.ddate = this.time;
|
409
|
form.ddate = this.time;
|
|
408
|
- form.ddate_solt=this.ddate_solt
|
410
|
+ form.ddate_solt=parseInt(this.ddate_solt)+1
|
|
409
|
form.is_set_ddate=1
|
411
|
form.is_set_ddate=1
|
|
410
|
App.Reserve.SetReserveInfo(form).then(res => {
|
412
|
App.Reserve.SetReserveInfo(form).then(res => {
|
|
411
|
if (res.ret == 200) {
|
413
|
if (res.ret == 200) {
|
|
@@ -414,7 +416,8 @@ Page({ |
|
@@ -414,7 +416,8 @@ Page({ |
|
414
|
this.setData({
|
416
|
this.setData({
|
|
415
|
form: JSON.parse(JSON.stringify(formTpl)),
|
417
|
form: JSON.parse(JSON.stringify(formTpl)),
|
|
416
|
tables: [],
|
418
|
tables: [],
|
|
417
|
- timePickerIndex: [0, 0, 0],
|
419
|
+ runTime:parseInt(new Date()/1000),
|
|
|
|
420
|
+ type:1
|
|
418
|
})
|
421
|
})
|
|
419
|
this.checkedTables={};
|
422
|
this.checkedTables={};
|
|
420
|
App.Reserve.Detail({rid: _id, openid: ''}, 'clear')
|
423
|
App.Reserve.Detail({rid: _id, openid: ''}, 'clear')
|
|
@@ -428,4 +431,54 @@ Page({ |
|
@@ -428,4 +431,54 @@ Page({ |
|
428
|
} catch (e) {
|
431
|
} catch (e) {
|
|
429
|
}
|
432
|
}
|
|
430
|
},
|
433
|
},
|
|
|
|
434
|
+
|
|
|
|
435
|
+ /**
|
|
|
|
436
|
+ * 修改初始化
|
|
|
|
437
|
+ */
|
|
|
|
438
|
+ async initModify(){
|
|
|
|
439
|
+ try {
|
|
|
|
440
|
+ let res = await App.Reserve.Detail({rid: this.options.id, openid: ''});
|
|
|
|
441
|
+ let form=this.data.form
|
|
|
|
442
|
+ form.pnum = res.data.pnum || 6;
|
|
|
|
443
|
+ form.rname = res.data.rname;
|
|
|
|
444
|
+ form.phone = res.data.phone || "";
|
|
|
|
445
|
+ form.sex = res.data.sex;
|
|
|
|
446
|
+ form.cusdem = res.data.cusdem;
|
|
|
|
447
|
+ form.rid = this.options.id;
|
|
|
|
448
|
+ form.tid = [];
|
|
|
|
449
|
+ let tablesed = [];
|
|
|
|
450
|
+ res.data.tables.forEach((t, ti) => {
|
|
|
|
451
|
+ form.tid.push(t.id)
|
|
|
|
452
|
+ if (ti >= 3) return;
|
|
|
|
453
|
+ t.isselect = true
|
|
|
|
454
|
+ t["isselected"] = 1
|
|
|
|
455
|
+ tablesed.push(t);
|
|
|
|
456
|
+ this.checkedTables[t.id]=t.name;
|
|
|
|
457
|
+ })
|
|
|
|
458
|
+ this.setData({
|
|
|
|
459
|
+ type:2,//修改
|
|
|
|
460
|
+ runTime: res.data.ddate,//到店时间
|
|
|
|
461
|
+ ddate_solt:res.data.ddate_solt,
|
|
|
|
462
|
+ form: form,
|
|
|
|
463
|
+ })
|
|
|
|
464
|
+ } catch (e) {
|
|
|
|
465
|
+ console.log('initModify', e)
|
|
|
|
466
|
+ }
|
|
|
|
467
|
+ },
|
|
|
|
468
|
+ /**
|
|
|
|
469
|
+ * 快速预订初始化
|
|
|
|
470
|
+ * tid
|
|
|
|
471
|
+ * tname
|
|
|
|
472
|
+ * ddate
|
|
|
|
473
|
+ * pnum
|
|
|
|
474
|
+ */
|
|
|
|
475
|
+ initQuick(){
|
|
|
|
476
|
+ let options=this.options
|
|
|
|
477
|
+ this.checkedTables[options.tid]=options.tname
|
|
|
|
478
|
+ this.setData({
|
|
|
|
479
|
+ [`form.tid`]: [options.tid],
|
|
|
|
480
|
+ runTime:options.ddate.substr(0,10),
|
|
|
|
481
|
+ type:3
|
|
|
|
482
|
+ })
|
|
|
|
483
|
+ },
|
|
431
|
}) |
484
|
}) |