|
...
|
...
|
@@ -350,130 +350,6 @@ Page({ |
|
|
|
return true;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
let form=this.data.form;
|
|
|
|
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);
|
|
|
|
App.Reserve.GetTableList({
|
|
|
|
sid:this.sellerid,
|
|
|
|
pnum_str:form.pnum_str,
|
|
|
|
rdate:rdate,
|
|
|
|
tid:form.tabid,
|
|
|
|
}).then(res=>{
|
|
|
|
let tables=[];
|
|
|
|
res.data.forEach(p=>{
|
|
|
|
if(tables.length>=3) return true;
|
|
|
|
p.list.forEach(t=>{
|
|
|
|
if(tables.length>=3) return true;
|
|
|
|
tables.push(t);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
this.tablesAll=res.data;
|
|
|
|
this.setData({
|
|
|
|
tables:tables
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}catch (e){
|
|
|
|
this.setData({
|
|
|
|
tables:[]
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
async formsubmit(){
|
|
|
|
if(this.data.buttonhide) return;
|
|
|
|
try {
|
|
|
|
let rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date], this.data.form.time);
|
|
|
|
console.log('rdate', rdate);
|
|
|
|
this.setData({
|
|
|
|
buttonhide: true,
|
|
|
|
})
|
|
|
|
let form = this.data.form;
|
|
|
|
form.tid = form.tid.toString();
|
|
|
|
form.sid = this.sellerid;
|
|
|
|
form.rdate =rdate
|
|
|
|
App.Reserve.SetReserveInfo(form).then(res => {
|
|
|
|
if(res.ret==200){
|
|
|
|
wx.navigateTo({
|
|
|
|
url:'b_detail?id='+res.data.id,
|
|
|
|
});
|
|
|
|
}else{
|
|
|
|
util.toast(res.msg,'none')
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}catch (e){}
|
|
|
|
},
|
|
|
|
selectphone:function(e){
|
|
|
|
this.data.form.phone=e.detail.phone;
|
|
|
|
this.data.form.rname=e.detail.rname;
|
|
|
|
this.data.form.cusdem=e.detail.cusdem;
|
|
|
|
var form=this.data.form
|
|
|
|
this.data.form.sex=e.detail.sex;
|
|
|
|
this.setData({
|
|
|
|
form:this.data.form,
|
|
|
|
searchlist:null,
|
|
|
|
|
|
|
|
})
|
|
|
|
this.conditionInfo();
|
|
|
|
},
|
|
|
|
calendarShow(){
|
|
|
|
this.setData({
|
|
|
|
calendarMask:true
|
|
|
|
})
|
|
|
|
},
|
|
|
|
dateChange(event){
|
|
|
|
console.log(event);
|
|
|
|
let clickDay = event.detail.day;
|
|
|
|
let changeDay = `dayStyle[1].day`;
|
|
|
|
let changeBg = `dayStyle[1].background`;
|
|
|
|
this.setData({
|
|
|
|
[changeDay]: clickDay,
|
|
|
|
[changeBg]: "#199095"
|
|
|
|
})
|
|
|
|
this.setDateStr(util.timetouUnix(event.detail.year+'/'+event.detail.month+'/'+event.detail.day))
|
|
|
|
this.getTables()
|
|
|
|
},
|
|
|
|
calendarClose(){
|
|
|
|
this.setData({
|
|
|
|
calendarMask:false
|
|
|
|
})
|
|
|
|
},
|
|
|
|
async selectdesk(){
|
|
|
|
let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time);
|
|
|
|
console.log(this.data.form)
|
|
|
|
wx.navigateTo({
|
|
|
|
url:'b_desk?rdate='+rdate+'&tid='+this.data.form.tabid+'&pnum_str='+this.data.form.pnum_str
|
|
|
|
})
|
|
|
|
},
|
|
|
|
conditionInfo:function(){
|
|
|
|
var form=this.data.form
|
|
|
|
if(form.tid.length>0 && form.rname.length>0){
|
|
|
|
this.data.buttonhide=false;
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
buttonhide:this.data.buttonhide
|
|
|
|
})
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 修改初始化
|
|
|
|
*/
|
|
|
|
async initModify(id){
|
|
|
|
try{
|
|
|
|
let res= await App.Reserve.Detail({rid:id,openid:''});
|
|
|
|
|
|
|
|
console.log('initModify',res);
|
|
|
|
//设置日期
|
|
|
|
let obj = await this.setDateStr(res.data.rdate);
|
|
|
|
//设置时间
|
|
|
|
let nd=util.unixtoTime(res.data.rdate,'HH:II');
|
|
|
|
let timePickerIndex=this.data.timePickerIndex
|
|
|
|
console.log('initModify-',this.data.timePickerArray,obj.form.time)
|
|
|
|
this.data.timePickerArray[obj.form.time].forEach((dd,ii)=>{
|
|
|
|
console.log('initModify-',nd,dd)
|
|
|
|
if(nd==dd){
|
|
|
|
timePickerIndex[obj.form.time]=ii;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
console.log('initModify-timePickerIndex',timePickerIndex);
|
|
|
|
obj.form.pnum_str=res.data.pnum_str;
|
|
...
|
...
|
@@ -483,19 +359,20 @@ conditionInfo:function(){ |
|
|
|
obj.form.cusdem=res.data.cusdem;
|
|
|
|
obj.form.rid=id;
|
|
|
|
obj.form.tid=[];
|
|
|
|
let tablesed=[];
|
|
|
|
res.data.tables.forEach((t,ti)=>{
|
|
|
|
if(ti>=3) return;
|
|
|
|
t.isselect=true
|
|
|
|
res.data.tables[ti]=t;
|
|
|
|
obj.form.tid.push(t.id)
|
|
|
|
})
|
|
|
|
obj.form.tid.push(t.id)
|
|
|
|
tablesed.push(t);
|
|
|
|
})
|
|
|
|
this.setData({
|
|
|
|
timePickerIndex:timePickerIndex,
|
|
|
|
form:obj.form,
|
|
|
|
tablesed:res.data.tables,
|
|
|
|
tablesed:tablesed,
|
|
|
|
})
|
|
|
|
}catch (e){
|
|
|
|
console.log('initModify',e)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|