|
@@ -43,14 +43,9 @@
|
|
|
</van-col>
|
|
|
</van-col>
|
|
|
<van-col :span="24" class="typeList" v-for="(item,index) in typeList" :key="index" @click="change(item.name,index)">
|
|
|
- <van-col :span="24" :class="index >= overTime ? 'name' : 'noName'" v-if="day=='今日'">{{item.name}}</van-col>
|
|
|
- <van-col :span="24" :class="index == 0 ? 'name' : 'noName'" v-if="day=='明日'">{{item.name}}</van-col>
|
|
|
+ <van-col :span="24" :class="index >= overTime ? 'name' : 'noName'" >{{item.name}}</van-col>
|
|
|
+ <!-- <van-col :span="24" :class="index == 0 ? 'name' : 'noName'" v-if="day=='明日'">{{item.name}}</van-col> -->
|
|
|
</van-col>
|
|
|
- <!-- <van-col :span="24" class="typeList" v-for="(item,index) in typeList" :key="index" @click="change(item.name,index)">
|
|
|
- <van-col :span="24" :class="overTime == 0 ? 'name' : 'noName'" >早餐</van-col>
|
|
|
- <van-col :span="24" :class="overTime == 1 ? 'name' : 'noName'" >午餐</van-col>
|
|
|
- <van-col :span="24" :class="overTime == 2 ? 'name' : 'noName'" >晚餐</van-col>
|
|
|
- </van-col> -->
|
|
|
</van-popup>
|
|
|
</van-row>
|
|
|
</van-row>
|
|
@@ -130,6 +125,8 @@ export default {
|
|
|
day:undefined,
|
|
|
time1:undefined,
|
|
|
time2:undefined,
|
|
|
+ time3:undefined,
|
|
|
+ time4:undefined,
|
|
|
noData:false,
|
|
|
};
|
|
|
},
|
|
@@ -148,8 +145,6 @@ export default {
|
|
|
axios.get(`https://smartpark.caih.com/dxapi/dreMenu/mDate`).then(res => {
|
|
|
let nowTime = undefined
|
|
|
let nowF = undefined
|
|
|
- let startTime = undefined
|
|
|
- let endTime = undefined
|
|
|
//本地时间测试
|
|
|
// nowTime = getNowTime().split(" ")[1].substring(0,2)
|
|
|
// nowF = getNowTime().split(" ")[1].substring(3,5)
|
|
@@ -159,67 +154,51 @@ export default {
|
|
|
// endTime = getNowTime().split(" ")[0] + " 18:59:59"
|
|
|
|
|
|
//服务器时间
|
|
|
+ let nowDay = new Date(Date.parse(res.data.data.split(" ")[0].replace(/-/g, '/'))).getTime() / 1000 //当天零点
|
|
|
nowTime = res.data.data.split(" ")[1].substring(0,2)
|
|
|
nowF = res.data.data.split(" ")[1].substring(3,5)
|
|
|
- startTime = res.data.data.split(" ")[0] + " 00:00:00"
|
|
|
- endTime = res.data.data.split(" ")[0] + " 18:59:59"
|
|
|
+ this.time1 = nowDay - 60*60*5 //前天19点
|
|
|
+ this.time2 = nowDay + 60*60*19 - 1 //今天19点
|
|
|
+ this.time3 = nowDay + 60*60*43 -1 //明天19点
|
|
|
|
|
|
if(this.$store.state.canbie){
|
|
|
this.typeValue = this.$store.state.canbie
|
|
|
if(0<=nowTime && nowTime < 9){
|
|
|
this.overTime = 0
|
|
|
this.day = "今日"
|
|
|
- startTime = res.data.data.split(" ")[0] + " 00:00:00"
|
|
|
- endTime = res.data.data.split(" ")[0] + " 18:59:59"
|
|
|
}else if( 9<= nowTime && nowTime < 13){
|
|
|
this.overTime = 1
|
|
|
this.day = "今日"
|
|
|
- startTime = res.data.data.split(" ")[0] + " 00:00:00"
|
|
|
- endTime = res.data.data.split(" ")[0] + " 18:59:59"
|
|
|
}else if( 13<= nowTime && nowTime < 19){
|
|
|
this.overTime = 2
|
|
|
this.day = "今日"
|
|
|
- startTime = res.data.data.split(" ")[0] + " 00:00:00"
|
|
|
- endTime = res.data.data.split(" ")[0] + " 18:59:59"
|
|
|
}else{
|
|
|
this.overTime = 0
|
|
|
this.day = "明日"
|
|
|
- startTime = res.data.data.split(" ")[0] + " 19:00:00"
|
|
|
- endTime = res.data.data.split(" ")[0] + " 23:59:59"
|
|
|
}
|
|
|
}else{
|
|
|
if(nowTime < 9){
|
|
|
this.typeValue = "早餐"
|
|
|
this.overTime = 0
|
|
|
this.day = "今日"
|
|
|
- startTime = res.data.data.split(" ")[0] + " 00:00:00"
|
|
|
- endTime = res.data.data.split(" ")[0] + " 18:59:59"
|
|
|
}else if( 9<= nowTime && nowTime < 13){
|
|
|
this.typeValue = "午餐"
|
|
|
this.overTime = 1
|
|
|
this.day = "今日"
|
|
|
- startTime = res.data.data.split(" ")[0] + " 00:00:00"
|
|
|
- endTime = res.data.data.split(" ")[0] + " 18:59:59"
|
|
|
}else if( 13<= nowTime && nowTime < 19){
|
|
|
this.typeValue = "晚餐"
|
|
|
this.overTime = 2
|
|
|
this.day = "今日"
|
|
|
- startTime = res.data.data.split(" ")[0] + " 00:00:00"
|
|
|
- endTime = res.data.data.split(" ")[0] + " 18:59:59"
|
|
|
}else{
|
|
|
this.typeValue = "早餐"
|
|
|
this.overTime = 0
|
|
|
this.day = "明日"
|
|
|
- startTime = res.data.data.split(" ")[0] + " 19:00:00"
|
|
|
- endTime = res.data.data.split(" ")[0] + " 23:59:59"
|
|
|
}
|
|
|
}
|
|
|
- this.time1 = startTime
|
|
|
- this.time2 = endTime
|
|
|
if(JSON.stringify(this.footStoreData) != '[]'){
|
|
|
this.foodList = this.footStoreData
|
|
|
}else{
|
|
|
- this.foodMenu(this.typeValue,startTime,endTime)
|
|
|
+ this.foodMenu(this.typeValue)
|
|
|
}
|
|
|
})
|
|
|
|
|
@@ -279,25 +258,22 @@ export default {
|
|
|
|
|
|
},
|
|
|
/** 菜单 */
|
|
|
- foodMenu(id,startTime,endTime){
|
|
|
+ foodMenu(id,startTime){
|
|
|
this.foodList = []
|
|
|
- axios.get(`https://smartpark.caih.com/dxapi/dreMenu/list?current=1&size=500&type=${id}&status=0&status=0&startTime=${startTime}&endTime=${endTime}`).then(res => {
|
|
|
- //axios.get(`https://smartpark.caih.com/dxapi/dreMenu/list?current=1&size=500&type=${id}&status=0`).then(res => {
|
|
|
+ axios.get(`https://smartpark.caih.com/dxapi/dreMenu/list?current=1&size=500&type=${id}&status=0&status=0`).then(res => {
|
|
|
const data = res.data.data.records
|
|
|
+ this.time4 = new Date(Date.parse(data[0].createTime.replace(/-/g, '/'))).getTime() / 1000//创建时间
|
|
|
const arr = []
|
|
|
for(let i =0; i<data.length;i++){
|
|
|
data[i].num = 0
|
|
|
- if(startTime.split(" ")[0] == data[i].createTime.split(" ")[0]){
|
|
|
- if(this.day == "明日"){
|
|
|
- if(data[i].createTime.split(" ")[1].split(":")[0] >= 19){
|
|
|
- arr.push(data[i])
|
|
|
- }
|
|
|
- }else{
|
|
|
- if(data[i].createTime.split(" ")[1].split(":")[0] < 19){
|
|
|
- arr.push(data[i])
|
|
|
- }
|
|
|
+ if(this.day == "明日"){
|
|
|
+ if(this.time2<=this.time4 && this.time4 <= this.time3){
|
|
|
+ arr.push(data[i])
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(this.time1<=this.time4 && this.time4 <= this.time2){
|
|
|
+ arr.push(data[i])
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
this.foodList = arr
|
|
@@ -309,20 +285,11 @@ export default {
|
|
|
/** 餐别确定 */
|
|
|
determine(){
|
|
|
this.money = 0
|
|
|
- if(this.day == "明日"){
|
|
|
- if(this.typeColor != "早餐"){
|
|
|
- Toast("请选择餐别")
|
|
|
- }else{
|
|
|
- this.determineShow()
|
|
|
- }
|
|
|
+ if(this.typeColor == undefined){
|
|
|
+ Toast("请选择餐别")
|
|
|
}else{
|
|
|
- if(this.typeColor == undefined){
|
|
|
- Toast("请选择餐别")
|
|
|
- }else{
|
|
|
- this.determineShow()
|
|
|
- }
|
|
|
+ this.determineShow()
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
/** 餐别确认渲染 */
|
|
|
determineShow(){
|
|
@@ -335,7 +302,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
this.typeSelect = this.typeValue
|
|
|
- this.foodMenu(this.typeValue,this.time1,this.time2)
|
|
|
+ this.foodMenu(this.typeValue)
|
|
|
},
|
|
|
/** 餐别取消 */
|
|
|
cancel(){
|