|
...
|
...
|
@@ -58,15 +58,17 @@ Page({ |
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
reserve_id:'',
|
|
|
|
onLoad: async function (options) {
|
|
|
|
this.setDateStr();
|
|
|
|
this.reserve_id=options.id||'';
|
|
|
|
this.setDateStr();
|
|
|
|
this.sellerid=util.cache('sellerid');
|
|
|
|
let timePickerArray= await comm.getDayTimeSpace();
|
|
|
|
this.setData({
|
|
|
|
timePickerArray: timePickerArray,
|
|
|
|
})
|
|
|
|
if(options.id>0){
|
|
|
|
this.initModify(options.id);
|
|
|
|
if(this.reserve_id>0){
|
|
|
|
this.initModify(this.reserve_id);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
/**
|
|
...
|
...
|
@@ -101,7 +103,9 @@ Page({ |
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
*/
|
|
|
|
onShow: function () {
|
|
|
|
this.getTables();
|
|
|
|
if(!this.reserve_id || util.cache('tableid').length>0){
|
|
|
|
this.getTables();
|
|
|
|
}
|
|
|
|
setTimeout(()=>{
|
|
|
|
this.setData({
|
|
|
|
calendarMaskLoad:true,
|
|
...
|
...
|
@@ -145,7 +149,7 @@ Page({ |
|
|
|
|
|
|
|
},
|
|
|
|
selectedValue(e){
|
|
|
|
//console.log(e);
|
|
|
|
console.log(e);
|
|
|
|
let key=util.attr(e,'key');
|
|
|
|
let val;
|
|
|
|
if(e.type=='input' || e.type=='confirm'){
|
|
...
|
...
|
@@ -194,20 +198,27 @@ Page({ |
|
|
|
}else{
|
|
|
|
form[key]=val;
|
|
|
|
}
|
|
|
|
console.log('ts',sobj.tables);
|
|
|
|
//console.log(e.type,key,val,form);
|
|
|
|
sobj.form=form;
|
|
|
|
sobj.buttonhide=true;
|
|
|
|
if(form.tid.length>0 && form.rname.length>0){
|
|
|
|
sobj.buttonhide=false;
|
|
|
|
}
|
|
|
|
this.setData(sobj)
|
|
|
|
|
|
|
|
if('date,time,pnum_str,tabid'.indexOf(key)>-1){
|
|
|
|
this.getTables();
|
|
|
|
sobj.form.tid=[];
|
|
|
|
this.getTables();
|
|
|
|
}
|
|
|
|
this.setData(sobj)
|
|
|
|
},
|
|
|
|
async getTables(){
|
|
|
|
let form=this.data.form;
|
|
|
|
let tableid=util.cache('tableid');
|
|
|
|
console.log('getTables-tableid',tableid.length,this.reserve_id);
|
|
|
|
if(tableid.length<1 && this.reserve_id){
|
|
|
|
tableid=this.data.form.tid;
|
|
|
|
}
|
|
|
|
console.log('getTables-tableid',tableid,tableid.length);
|
|
|
|
try{
|
|
|
|
let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time);
|
|
|
|
console.log('rdate',this.data.dateStr[this.data.form.date],rdate);
|
|
...
|
...
|
@@ -216,17 +227,33 @@ Page({ |
|
|
|
pnum_str:form.pnum_str,
|
|
|
|
rdate:rdate,
|
|
|
|
tid:form.tabid,
|
|
|
|
rid:this.reserve_id,
|
|
|
|
}).then(res=>{
|
|
|
|
let tables=[];
|
|
|
|
let tablesLength=0;
|
|
|
|
res.data.forEach(p=>{
|
|
|
|
//if(tables.length>=3) return true;
|
|
|
|
p.list.forEach(t=>{
|
|
|
|
tablesLength++;
|
|
|
|
if(tables.length>=3) return true;
|
|
|
|
tables.push(t);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
if(tableid.length>0){
|
|
|
|
res.data.forEach(p=>{
|
|
|
|
//if(tables.length>=3) return true;
|
|
|
|
p.list.forEach(t=>{
|
|
|
|
tablesLength++;
|
|
|
|
if(tables.length>=3) return true;
|
|
|
|
if(tableid._indexOf(t.id)>-1){
|
|
|
|
t.isselect=true;
|
|
|
|
tables.push(t);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
wx.removeStorage({key:'tableid'})
|
|
|
|
}else{
|
|
|
|
res.data.forEach(p=>{
|
|
|
|
//if(tables.length>=3) return true;
|
|
|
|
p.list.forEach(t=>{
|
|
|
|
tablesLength++;
|
|
|
|
if(tables.length>=3) return true;
|
|
|
|
tables.push(t);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
this.tablesLength=tablesLength;
|
|
|
|
this.setData({
|
|
|
|
tables:tables,
|
|
...
|
...
|
@@ -319,6 +346,8 @@ Page({ |
|
|
|
console.log(this.data.form)
|
|
|
|
wx.navigateTo({
|
|
|
|
url:'b_desk?rdate='+rdate+'&tid='+this.data.form.tabid+'&pnum_str='+this.data.form.pnum_str
|
|
|
|
+'&checked_tids='+this.data.form.tid
|
|
|
|
+'&rid='+this.reserve_id
|
|
|
|
})
|
|
|
|
},
|
|
|
|
conditionInfo:function(){
|
|
...
|
...
|
@@ -374,16 +403,18 @@ Page({ |
|
|
|
obj.form.tid=[];
|
|
|
|
let tablesed=[];
|
|
|
|
res.data.tables.forEach((t,ti)=>{
|
|
|
|
obj.form.tid.push(t.id)
|
|
|
|
if(ti>=3) return;
|
|
|
|
t.isselect=true
|
|
|
|
obj.form.tid.push(t.id)
|
|
|
|
t["isselected"]=1
|
|
|
|
tablesed.push(t);
|
|
|
|
})
|
|
|
|
this.setData({
|
|
|
|
timePickerIndex:timePickerIndex,
|
|
|
|
form:obj.form,
|
|
|
|
tablesed:tablesed,
|
|
|
|
//tablesed:tablesed,
|
|
|
|
})
|
|
|
|
this.getTables();
|
|
|
|
}catch (e){
|
|
|
|
console.log('initModify',e)
|
|
|
|
}
|
...
|
...
|
|