|
...
|
...
|
@@ -20,7 +20,8 @@ Page({ |
|
|
|
*/
|
|
|
|
data: {
|
|
|
|
type:1, // type 1/2/3 新增/修改/桌位
|
|
|
|
time:0,//当前时间戳,或修改到店,或桌位预订时间
|
|
|
|
time:0,//组件最终构造的到店时间
|
|
|
|
runTime:0,//当前时间戳,或修改到店,或桌位预订时间
|
|
|
|
form: JSON.parse(JSON.stringify(formTpl)),
|
|
|
|
tables: [],
|
|
|
|
grand: [
|
|
...
|
...
|
@@ -59,14 +60,15 @@ Page({ |
|
|
|
this.getCustomRemark();
|
|
|
|
if(options.id>0){
|
|
|
|
//修改
|
|
|
|
return;
|
|
|
|
this.reserve_id=options.id
|
|
|
|
return this.initModify();
|
|
|
|
}
|
|
|
|
if(options.tid){
|
|
|
|
if(options.hasQuick==1){
|
|
|
|
//桌位预订
|
|
|
|
return;
|
|
|
|
return this.initQuick();
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
time:parseInt(new Date()/1000),
|
|
|
|
runTime:parseInt(new Date()/1000),
|
|
|
|
type:1
|
|
|
|
})
|
|
|
|
},
|
|
...
|
...
|
@@ -405,7 +407,7 @@ Page({ |
|
|
|
} catch (e) {}
|
|
|
|
|
|
|
|
form.ddate = this.time;
|
|
|
|
form.ddate_solt=this.ddate_solt
|
|
|
|
form.ddate_solt=parseInt(this.ddate_solt)+1
|
|
|
|
form.is_set_ddate=1
|
|
|
|
App.Reserve.SetReserveInfo(form).then(res => {
|
|
|
|
if (res.ret == 200) {
|
|
...
|
...
|
@@ -414,7 +416,8 @@ Page({ |
|
|
|
this.setData({
|
|
|
|
form: JSON.parse(JSON.stringify(formTpl)),
|
|
|
|
tables: [],
|
|
|
|
timePickerIndex: [0, 0, 0],
|
|
|
|
runTime:parseInt(new Date()/1000),
|
|
|
|
type:1
|
|
|
|
})
|
|
|
|
this.checkedTables={};
|
|
|
|
App.Reserve.Detail({rid: _id, openid: ''}, 'clear')
|
|
...
|
...
|
@@ -428,4 +431,54 @@ Page({ |
|
|
|
} catch (e) {
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 修改初始化
|
|
|
|
*/
|
|
|
|
async initModify(){
|
|
|
|
try {
|
|
|
|
let res = await App.Reserve.Detail({rid: this.options.id, openid: ''});
|
|
|
|
let form=this.data.form
|
|
|
|
form.pnum = res.data.pnum || 6;
|
|
|
|
form.rname = res.data.rname;
|
|
|
|
form.phone = res.data.phone || "";
|
|
|
|
form.sex = res.data.sex;
|
|
|
|
form.cusdem = res.data.cusdem;
|
|
|
|
form.rid = this.options.id;
|
|
|
|
form.tid = [];
|
|
|
|
let tablesed = [];
|
|
|
|
res.data.tables.forEach((t, ti) => {
|
|
|
|
form.tid.push(t.id)
|
|
|
|
if (ti >= 3) return;
|
|
|
|
t.isselect = true
|
|
|
|
t["isselected"] = 1
|
|
|
|
tablesed.push(t);
|
|
|
|
this.checkedTables[t.id]=t.name;
|
|
|
|
})
|
|
|
|
this.setData({
|
|
|
|
type:2,//修改
|
|
|
|
runTime: res.data.ddate,//到店时间
|
|
|
|
ddate_solt:res.data.ddate_solt,
|
|
|
|
form: form,
|
|
|
|
})
|
|
|
|
} catch (e) {
|
|
|
|
console.log('initModify', e)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 快速预订初始化
|
|
|
|
* tid
|
|
|
|
* tname
|
|
|
|
* ddate
|
|
|
|
* pnum
|
|
|
|
*/
|
|
|
|
initQuick(){
|
|
|
|
let options=this.options
|
|
|
|
this.checkedTables[options.tid]=options.tname
|
|
|
|
this.setData({
|
|
|
|
[`form.tid`]: [options.tid],
|
|
|
|
runTime:options.ddate.substr(0,10),
|
|
|
|
type:3
|
|
|
|
})
|
|
|
|
},
|
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|