预定餐时间判断
This commit is contained in:
parent
c75a5314f9
commit
90a2e6bcb9
|
|
@ -9,7 +9,7 @@ module.exports = {
|
||||||
// baseUrl: 'http://192.168.0.244:38380',//测试
|
// baseUrl: 'http://192.168.0.244:38380',//测试
|
||||||
// baseUrl: 'http://sgwpdm.ah.sgcc.com.cn/canteen/dev-api',//测试d
|
// baseUrl: 'http://sgwpdm.ah.sgcc.com.cn/canteen/dev-api',//测试d
|
||||||
// baseUrl: 'http://192.168.0.176:58080',//测试
|
// baseUrl: 'http://192.168.0.176:58080',//测试
|
||||||
// baseUrl: 'http://192.168.2.56:58080',//张天强
|
// baseUrl: 'http://192.168.2.53:58080',//张天强
|
||||||
// baseUrl: 'http://192.168.2.69:58080',//董高文
|
// baseUrl: 'http://192.168.2.69:58080',//董高文
|
||||||
// baseUrl: 'http://192.168.0.44:58080',//董高文
|
// baseUrl: 'http://192.168.0.44:58080',//董高文
|
||||||
// baseUrl: 'http://192.168.2.72:58080',//盛旭
|
// baseUrl: 'http://192.168.2.72:58080',//盛旭
|
||||||
|
|
|
||||||
|
|
@ -308,7 +308,7 @@ export default {
|
||||||
this.$set(this.dashesData, 'dishesPrice', this.dashesData.dishesDetailList[0].dishesPrice)
|
this.$set(this.dashesData, 'dishesPrice', this.dashesData.dishesDetailList[0].dishesPrice)
|
||||||
this.$set(this.dashesData, 'prefPrice', this.dashesData.dishesDetailList[0].prefPrice)
|
this.$set(this.dashesData, 'prefPrice', this.dashesData.dishesDetailList[0].prefPrice)
|
||||||
this.$set(this.dashesData, 'dishesId', this.dashesData.dishesDetailList[0].dishesId)
|
this.$set(this.dashesData, 'dishesId', this.dashesData.dishesDetailList[0].dishesId)
|
||||||
this.$set(this.dashesData, 'ifReserve', true)
|
this.$set(this.dashesData, 'ifReserve', false)
|
||||||
this.$forceUpdate()
|
this.$forceUpdate()
|
||||||
}
|
}
|
||||||
console.log(res,'获取菜品详情')
|
console.log(res,'获取菜品详情')
|
||||||
|
|
@ -372,14 +372,27 @@ export default {
|
||||||
if(currentDate!=this.newDate2){
|
if(currentDate!=this.newDate2){
|
||||||
let str = this.formatDate(new Date())+" "+food.reserveEndTime;
|
let str = this.formatDate(new Date())+" "+food.reserveEndTime;
|
||||||
// let str = this.formatDate(new Date())+" 14:00:00";
|
// let str = this.formatDate(new Date())+" 14:00:00";
|
||||||
console.log(str)
|
|
||||||
let currentTime = new Date().getTime();
|
let currentTime = new Date().getTime();
|
||||||
let inputTime = new Date(str).getTime();
|
let inputTime = new Date(str).getTime();
|
||||||
if (currentTime < inputTime) {
|
if (currentTime < inputTime) {
|
||||||
console.log("可以预定");
|
console.log("可以预定");
|
||||||
|
this.$set(this.dashesData, 'ifReserve', true)
|
||||||
} else {
|
} else {
|
||||||
console.log("不可预定");
|
console.log("不可预定");
|
||||||
this.$set(this.dashesData, 'ifReserve', false)
|
}
|
||||||
|
}else{
|
||||||
|
if(food.startTime&&food.endTime){
|
||||||
|
let startStr = this.formatDate(new Date())+" "+food.startTime;
|
||||||
|
let endStr = this.formatDate(new Date())+" "+food.endTime;
|
||||||
|
let currentTime = new Date().getTime();
|
||||||
|
let startTime = new Date(startStr).getTime();
|
||||||
|
let endTime = new Date(endStr).getTime();
|
||||||
|
if (currentTime>startTime&¤tTime<endTime) {
|
||||||
|
console.log("可以预定");
|
||||||
|
this.$set(this.dashesData, 'ifReserve', true)
|
||||||
|
} else {
|
||||||
|
console.log("不可预定");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,7 @@ export default {
|
||||||
// canteenName: '宏源工业园/本周菜谱',
|
// canteenName: '宏源工业园/本周菜谱',
|
||||||
canteenType: '自取', // 1 自取 2 外卖
|
canteenType: '自取', // 1 自取 2 外卖
|
||||||
isHandle:false,//重复点击校验
|
isHandle:false,//重复点击校验
|
||||||
ifReserve:true//是否在可预订时间范围内
|
ifReserve:false//是否在可预订时间范围内
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
|
|
@ -244,6 +244,7 @@ export default {
|
||||||
"stallId":this.stallId
|
"stallId":this.stallId
|
||||||
}
|
}
|
||||||
const res = await getlistReserveDateAPI(param)
|
const res = await getlistReserveDateAPI(param)
|
||||||
|
this.daysList=[]
|
||||||
res.data.forEach(item=>{
|
res.data.forEach(item=>{
|
||||||
let obj = {
|
let obj = {
|
||||||
showDate:this.getNowFormatDate(item),
|
showDate:this.getNowFormatDate(item),
|
||||||
|
|
@ -253,6 +254,7 @@ export default {
|
||||||
})
|
})
|
||||||
this.newDate = this.daysList[0].showDate
|
this.newDate = this.daysList[0].showDate
|
||||||
this.newDate2 = this.daysList[0].paramDate
|
this.newDate2 = this.daysList[0].paramDate
|
||||||
|
this.hIndex=0;
|
||||||
//获取预定餐菜谱
|
//获取预定餐菜谱
|
||||||
this.getMenuListData()
|
this.getMenuListData()
|
||||||
},
|
},
|
||||||
|
|
@ -303,7 +305,7 @@ export default {
|
||||||
this.$set(food, 'monthlySales', food.dishesDetailList[0].monthlySales)
|
this.$set(food, 'monthlySales', food.dishesDetailList[0].monthlySales)
|
||||||
this.$set(food, 'goodProbability', food.dishesDetailList[0].goodProbability)
|
this.$set(food, 'goodProbability', food.dishesDetailList[0].goodProbability)
|
||||||
this.$set(food, 'surplusNum', food.dishesDetailList[0].surplusNum)
|
this.$set(food, 'surplusNum', food.dishesDetailList[0].surplusNum)
|
||||||
this.$set(food, 'ifReserve', true)
|
this.$set(food, 'ifReserve', false)
|
||||||
let currentDate = this.formatDate(new Date()); // 获取当前时间
|
let currentDate = this.formatDate(new Date()); // 获取当前时间
|
||||||
if(currentDate!=this.newDate2){
|
if(currentDate!=this.newDate2){
|
||||||
let str = this.formatDate(new Date())+" "+food.reserveEndTime;
|
let str = this.formatDate(new Date())+" "+food.reserveEndTime;
|
||||||
|
|
@ -313,10 +315,28 @@ export default {
|
||||||
let inputTime = new Date(str).getTime();
|
let inputTime = new Date(str).getTime();
|
||||||
if (currentTime < inputTime) {
|
if (currentTime < inputTime) {
|
||||||
console.log("可以预定");
|
console.log("可以预定");
|
||||||
|
this.$set(food, 'ifReserve', true)
|
||||||
|
this.$set(this, 'ifReserve', true)
|
||||||
} else {
|
} else {
|
||||||
console.log("不可预定");
|
console.log("不可预定");
|
||||||
this.$set(food, 'ifReserve', false)
|
}
|
||||||
this.$set(this, 'ifReserve', false)
|
}else{
|
||||||
|
if(food.startTime&&food.endTime){
|
||||||
|
let startStr = this.formatDate(new Date())+" "+food.startTime;
|
||||||
|
let endStr = this.formatDate(new Date())+" "+food.endTime;
|
||||||
|
let currentTime = new Date().getTime();
|
||||||
|
let startTime = new Date(startStr).getTime();
|
||||||
|
let endTime = new Date(endStr).getTime();
|
||||||
|
console.log(currentTime)
|
||||||
|
console.log(startTime)
|
||||||
|
console.log(endTime)
|
||||||
|
if (currentTime>startTime&¤tTime<endTime) {
|
||||||
|
console.log("可以预定");
|
||||||
|
this.$set(food, 'ifReserve', true)
|
||||||
|
this.$set(this, 'ifReserve', true)
|
||||||
|
} else {
|
||||||
|
console.log("不可预定");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.$set(food, 'restrictNum', food.dishesDetailList[0].restrictNum)
|
this.$set(food, 'restrictNum', food.dishesDetailList[0].restrictNum)
|
||||||
|
|
@ -472,18 +492,36 @@ export default {
|
||||||
this.$set(cartItem, 'surplusNum', food.dishesDetailList[0].surplusNum)
|
this.$set(cartItem, 'surplusNum', food.dishesDetailList[0].surplusNum)
|
||||||
this.$set(cartItem, 'restrictNum', food.dishesDetailList[0].restrictNum)
|
this.$set(cartItem, 'restrictNum', food.dishesDetailList[0].restrictNum)
|
||||||
this.$set(cartItem, 'prefPrice', food.dishesDetailList[0].prefPrice)
|
this.$set(cartItem, 'prefPrice', food.dishesDetailList[0].prefPrice)
|
||||||
this.$set(cartItem, 'ifReserve', true)
|
this.$set(cartItem, 'ifReserve', false)
|
||||||
let currentDate = this.formatDate(new Date()); // 获取当前时间
|
let currentDate = this.formatDate(new Date()); // 获取当前时间
|
||||||
if(currentDate!=this.newDate2){
|
if(currentDate!=this.newDate2){
|
||||||
let str = this.formatDate(new Date())+" "+food.reserveEndTime;
|
let str = this.formatDate(new Date())+" "+food.reserveEndTime;
|
||||||
// let str = this.formatDate(new Date())+" 14:00:00";
|
// let str = this.formatDate(new Date())+" 14:00:00";
|
||||||
let currentTime = new Date().getTime();
|
let currentTime = new Date().getTime();
|
||||||
let inputTime = new Date(str).getTime();
|
let inputTime = new Date(str).getTime();
|
||||||
if (currentTime < inputTime) {} else {
|
if (currentTime < inputTime) {
|
||||||
this.$set(cartItem, 'ifReserve', false)
|
this.$set(cartItem, 'ifReserve', true)
|
||||||
|
} else {
|
||||||
|
console.log("不可预定");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(food.startTime&&food.endTime){
|
||||||
|
let startStr = this.formatDate(new Date())+" "+food.startTime;
|
||||||
|
let endStr = this.formatDate(new Date())+" "+food.endTime;
|
||||||
|
let currentTime = new Date().getTime();
|
||||||
|
let startTime = new Date(startStr).getTime();
|
||||||
|
let endTime = new Date(endStr).getTime();
|
||||||
|
console.log(currentTime)
|
||||||
|
console.log(startTime)
|
||||||
|
console.log(endTime)
|
||||||
|
if (currentTime>startTime&¤tTime<endTime) {
|
||||||
|
console.log("可以预定");
|
||||||
|
this.$set(cartItem, 'ifReserve', true)
|
||||||
|
} else {
|
||||||
|
console.log("不可预定");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cartItem.orderDate == this.newDate2){//存在且时间一致
|
if(cartItem.orderDate == this.newDate2){//存在且时间一致
|
||||||
this.$set(food, 'quantity', cartItem.quantity)
|
this.$set(food, 'quantity', cartItem.quantity)
|
||||||
this.$set(cartItem,'isDfficacy', 1) //有效
|
this.$set(cartItem,'isDfficacy', 1) //有效
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1"><title>智慧后勤</title><script src=https://res.wx.qq.com/open/js/jweixin-1.1.0.js></script><script>document.addEventListener('DOMContentLoaded', function() {
|
<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1"><title>智慧后勤</title><script src=https://res.wx.qq.com/open/js/jweixin-1.1.0.js></script><script>document.addEventListener('DOMContentLoaded', function() {
|
||||||
document.documentElement.style.fontSize = document.documentElement.clientWidth / 20 + 'px'
|
document.documentElement.style.fontSize = document.documentElement.clientWidth / 20 + 'px'
|
||||||
})</script><link rel=stylesheet href=./static/index.97465e7b.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=./static/js/chunk-vendors.6b868f1e.js></script><script src=./static/js/index.2c0e0065.js></script></body></html>
|
})</script><link rel=stylesheet href=./static/index.97465e7b.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=./static/js/chunk-vendors.6b868f1e.js></script><script src=./static/js/index.6791e0a8.js></script></body></html>
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue