|
...
|
...
|
@@ -34,6 +34,7 @@ Page({ |
|
|
|
themeColor:'',
|
|
|
|
textColor:'',
|
|
|
|
navColor:'',
|
|
|
|
isOrder:false,// 是否可以下单(超过该预订的餐段截止时间,不可以下单)(true 超过了 false 在时间内,可以预订)
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
...
|
...
|
@@ -56,8 +57,7 @@ Page({ |
|
|
|
console.log('options', {
|
|
|
|
...obj
|
|
|
|
});
|
|
|
|
this.getCheckCookList(obj)
|
|
|
|
this.getDetail()
|
|
|
|
this.getDetail(obj)
|
|
|
|
},
|
|
|
|
// 获取点菜列表
|
|
|
|
getCheckCookList(options) {
|
|
...
|
...
|
@@ -74,7 +74,7 @@ Page({ |
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getDetail() {
|
|
|
|
getDetail(obj) {
|
|
|
|
App.Reserve.Detail({
|
|
|
|
openid: getApp().openid,
|
|
|
|
rid: this.data.options.rid
|
|
...
|
...
|
@@ -97,18 +97,49 @@ Page({ |
|
|
|
} else {
|
|
|
|
dateSmart = util.unixtoTime(reserev.ddate, this.data.tpls[this.data.current].timeStr)
|
|
|
|
}
|
|
|
|
let daily=reserev.seller.daily;
|
|
|
|
let time;
|
|
|
|
switch (reserev.ddate_solt) {
|
|
|
|
case '1':
|
|
|
|
time=daily.morning.split("-")[1];
|
|
|
|
break;
|
|
|
|
case '2':
|
|
|
|
time=daily.noon.split("-")[1];
|
|
|
|
break;
|
|
|
|
case '3':
|
|
|
|
time=daily.night.split("-")[1];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
let timeHour=time.split(":")[0];//预订日期--预订餐段的截止时间--小时
|
|
|
|
let timeMinute=time.split(":")[1];//预订日期--预订餐段的截止时间--分钟
|
|
|
|
const date = new Date(reserev.ddate*1000);
|
|
|
|
const year = date.getFullYear();
|
|
|
|
const month = date.getMonth() + 1;
|
|
|
|
const day = date.getDate();
|
|
|
|
// 是否可以下单(超过该预订的餐段截止时间,不可以下单)
|
|
|
|
let isOrder=this.isCurrentTimeGreaterThan(year,month,day,timeHour*1,timeMinute*1)
|
|
|
|
this.setData({
|
|
|
|
seller: {
|
|
|
|
soltName: reserev.soltName,
|
|
|
|
date: dateSmart,
|
|
|
|
tableNum,
|
|
|
|
tablesText
|
|
|
|
}
|
|
|
|
},
|
|
|
|
isOrder
|
|
|
|
})
|
|
|
|
setTimeout(() => {
|
|
|
|
this.getCheckCookList(obj)
|
|
|
|
},100)
|
|
|
|
}).catch(res => {
|
|
|
|
console.log(res, '详情请求失败');
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 判断是否超过该预订的餐段截止时间
|
|
|
|
isCurrentTimeGreaterThan(year, month, day, hour, minute) {
|
|
|
|
const currentTime = new Date();
|
|
|
|
const targetTime = new Date(year, month - 1, day, hour, minute);
|
|
|
|
return currentTime > targetTime;
|
|
|
|
},
|
|
|
|
// 过滤数据
|
|
|
|
formatCookList(list) {
|
|
|
|
// 获取所有的规格
|
|
...
|
...
|
@@ -312,7 +343,7 @@ Page({ |
|
|
|
console.log(cookbooklist);
|
|
|
|
this.setData({
|
|
|
|
cookbooklist,
|
|
|
|
noData:(num*1)>0?false:true,
|
|
|
|
noData:((num*1)>0 && !this.data.isOrder)?false:true,//菜品数量大于0 && 在当前预订的餐段时间内
|
|
|
|
probablyPrice,
|
|
|
|
vipProbablyPrice
|
|
|
|
})
|
...
|
...
|
|