Commit d9e7e2d8cdc6c0b89903d58b3c023c4f9d2ee1d6

Authored by wangfan
1 parent 1cb3f8f0

快速预定

... ... @@ -26,7 +26,11 @@ Component({
className:{
type:String,
value:'',
}
},
ddate:{ //带入预定时间 time1-time2
type:String,
value:'',
},
},
/**
... ... @@ -62,9 +66,8 @@ Component({
case '订座':
wx.navigateTo({
url:'b_addnew?hasQuick=1&tid='+board.id
+'&tnum='+(board.most_pnum>board.table_pnum?board.most_pnum:board.table_pnum)
+'&time='+1
+'&date=',
+'&pnum='+(board.most_pnum>board.table_pnum?board.most_pnum:board.table_pnum)
+'&ddate='+this.data.ddate,
});
break;
}
... ... @@ -73,7 +76,13 @@ Component({
boardOpt(){
let itemList=[]
if(!this.data.board.reserve_id && this.data.board.enable==1){
itemList.push('订座')
if(this.data.ddate){
let t=new Date()/1000;
if(parseInt(this.data.ddate.substr(0,10))>t){
itemList.push('订座')
}
}
}
if(this.data.board.reserve_id>0){
itemList.push('查看详情')
... ... @@ -88,6 +97,7 @@ Component({
itemList:itemList,
})
this.selectComponent('#boardas').show();
console.log('this.data.board',this.data.board)
},
//桌位选择
boardChoose(){
... ...
... ... @@ -104,6 +104,8 @@ Page({
})
if (this.reserve_id > 0) {
this.initModify(this.reserve_id);
} else if(options.hasQuick==1){
this.initQuick(options);
} else {
this.getTables();
}
... ... @@ -648,4 +650,49 @@ Page({
[`calendar.nextNum`]: this.data.calendar.nextNum - 1
})
},
/**
* 快速预定初始化
* tid
* ddate
* pnum
*/
async initQuick(options){
try {
console.log('initQuick', options);
options.ddate=options.ddate.substr(0,10);
//设置日期
let obj = await this.setDateStr(options.ddate);
//设置时间
let nd = util.unixtoTime(options.ddate, 'HH:II');
let timePickerIndex = this.data.timePickerIndex
console.log('initQuick-', this.data.timePickerArray, obj.form.time, nd)
this.data.timePickerArray[obj.form.time].forEach((dd, ii) => {
console.log('initQuick-', nd, dd)
if (nd == dd) {
timePickerIndex[obj.form.time] = ii;
return true;
}
})
console.log('initQuick-timePickerIndex', timePickerIndex);
obj.form.pnum = options.pnum || 6;
obj.form.rname = "";
obj.form.phone = "";
obj.form.sex = 1;
obj.form.cusdem = "";
obj.form.rid = "";
obj.form.tid = [options.tid];
this.setData({
timePickerIndex: timePickerIndex,
form: obj.form,
hasUseDefDtime: false,
})
setTimeout(() => {
this.getTables();
}, 300)
} catch (e) {
console.log('initQuick', e)
}
},
})
\ No newline at end of file
... ...
... ... @@ -24,6 +24,7 @@ Page({
calendar:{
nextNum:0,
},
rdate:'',
},
regions:[],
sellerid:0,
... ... @@ -142,6 +143,7 @@ Page({
let rdate=await bookOrder.getTimeSpace(this.data.dateStr,time);
formdata.rdate=rdate;
formdata.status='1,2';
obj.rdate=rdate;
let tids={};
let reserves=await App.Reserve.GetReserveList(formdata);
if(reserves.data.length>0){
... ...
... ... @@ -35,6 +35,7 @@
<view class="items-disks flex-ll" style="flex-wrap: wrap"
wx:if="{{regions_active==item.name}}">
<board width="160" height="180" board="{{item}}"
ddate="{{rdate}}"
style="margin: 20rpx 0 0 20rpx"
bindboardEvent="boardEvent"
event="boardOpt"
... ...