预定餐时间判断

This commit is contained in:
zzyuan 2025-08-18 18:22:46 +08:00
parent c75a5314f9
commit 90a2e6bcb9
11 changed files with 96 additions and 19 deletions

View File

@ -9,7 +9,7 @@ module.exports = {
// baseUrl: 'http://192.168.0.244:38380',//测试
// baseUrl: 'http://sgwpdm.ah.sgcc.com.cn/canteen/dev-api',//测试d
// 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.0.44:58080',//董高文
// baseUrl: 'http://192.168.2.72:58080',//盛旭

View File

@ -308,7 +308,7 @@ export default {
this.$set(this.dashesData, 'dishesPrice', this.dashesData.dishesDetailList[0].dishesPrice)
this.$set(this.dashesData, 'prefPrice', this.dashesData.dishesDetailList[0].prefPrice)
this.$set(this.dashesData, 'dishesId', this.dashesData.dishesDetailList[0].dishesId)
this.$set(this.dashesData, 'ifReserve', true)
this.$set(this.dashesData, 'ifReserve', false)
this.$forceUpdate()
}
console.log(res,'获取菜品详情')
@ -372,14 +372,27 @@ export default {
if(currentDate!=this.newDate2){
let str = this.formatDate(new Date())+" "+food.reserveEndTime;
// let str = this.formatDate(new Date())+" 14:00:00";
console.log(str)
let currentTime = new Date().getTime();
let inputTime = new Date(str).getTime();
if (currentTime < inputTime) {
console.log("可以预定");
this.$set(this.dashesData, 'ifReserve', true)
} else {
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&&currentTime<endTime) {
console.log("可以预定");
this.$set(this.dashesData, 'ifReserve', true)
} else {
console.log("不可预定");
}
}
}
})

View File

@ -218,7 +218,7 @@ export default {
// canteenName: '/',
canteenType: '自取', // 1 2
isHandle:false,//
ifReserve:true//
ifReserve:false//
}
},
onLoad(options) {
@ -244,6 +244,7 @@ export default {
"stallId":this.stallId
}
const res = await getlistReserveDateAPI(param)
this.daysList=[]
res.data.forEach(item=>{
let obj = {
showDate:this.getNowFormatDate(item),
@ -253,6 +254,7 @@ export default {
})
this.newDate = this.daysList[0].showDate
this.newDate2 = this.daysList[0].paramDate
this.hIndex=0;
//
this.getMenuListData()
},
@ -303,7 +305,7 @@ export default {
this.$set(food, 'monthlySales', food.dishesDetailList[0].monthlySales)
this.$set(food, 'goodProbability', food.dishesDetailList[0].goodProbability)
this.$set(food, 'surplusNum', food.dishesDetailList[0].surplusNum)
this.$set(food, 'ifReserve', true)
this.$set(food, 'ifReserve', false)
let currentDate = this.formatDate(new Date()); //
if(currentDate!=this.newDate2){
let str = this.formatDate(new Date())+" "+food.reserveEndTime;
@ -313,10 +315,28 @@ export default {
let inputTime = new Date(str).getTime();
if (currentTime < inputTime) {
console.log("可以预定");
this.$set(food, 'ifReserve', true)
this.$set(this, 'ifReserve', true)
} else {
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&&currentTime<endTime) {
console.log("可以预定");
this.$set(food, 'ifReserve', true)
this.$set(this, 'ifReserve', true)
} else {
console.log("不可预定");
}
}
}
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, 'restrictNum', food.dishesDetailList[0].restrictNum)
this.$set(cartItem, 'prefPrice', food.dishesDetailList[0].prefPrice)
this.$set(cartItem, 'ifReserve', true)
this.$set(cartItem, 'ifReserve', false)
let currentDate = this.formatDate(new Date()); //
if(currentDate!=this.newDate2){
let str = this.formatDate(new Date())+" "+food.reserveEndTime;
// let str = this.formatDate(new Date())+" 14:00:00";
let currentTime = new Date().getTime();
let inputTime = new Date(str).getTime();
if (currentTime < inputTime) {} else {
this.$set(cartItem, 'ifReserve', false)
if (currentTime < inputTime) {
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&&currentTime<endTime) {
console.log("可以预定");
this.$set(cartItem, 'ifReserve', true)
} else {
console.log("不可预定");
}
}
}
if(cartItem.orderDate == this.newDate2){//
this.$set(food, 'quantity', cartItem.quantity)
this.$set(cartItem,'isDfficacy', 1) //

View File

@ -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() {
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