|
@@ -16,7 +16,7 @@
|
|
:src="require('../../../assets/image/cj.png')"
|
|
:src="require('../../../assets/image/cj.png')"
|
|
class="cj"
|
|
class="cj"
|
|
/>
|
|
/>
|
|
- <span class="describe">{{ typeValue }}菜单</span>
|
|
|
|
|
|
+ <span class="describe">{{ day }}{{ typeValue }}菜单</span>
|
|
</van-col>
|
|
</van-col>
|
|
<van-col class="type" :span="11" @click="downStatus">
|
|
<van-col class="type" :span="11" @click="downStatus">
|
|
<van-col class="name" :span="24" >{{typeSelect}}<van-image
|
|
<van-col class="name" :span="24" >{{typeSelect}}<van-image
|
|
@@ -43,8 +43,14 @@
|
|
</van-col>
|
|
</van-col>
|
|
</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="typeList" v-for="(item,index) in typeList" :key="index" @click="change(item.name,index)">
|
|
- <van-col :span="24" :class="index >= overTime ? 'name' : 'noName'" >{{item.name}}</van-col>
|
|
|
|
|
|
+ <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>
|
|
</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-popup>
|
|
</van-row>
|
|
</van-row>
|
|
</van-row>
|
|
</van-row>
|
|
@@ -79,6 +85,7 @@
|
|
</van-col>
|
|
</van-col>
|
|
</van-col>
|
|
</van-col>
|
|
</van-row>
|
|
</van-row>
|
|
|
|
+ <van-col span="24" class="noData" v-if="noData">当前时段无菜品</van-col>
|
|
</van-row>
|
|
</van-row>
|
|
<van-row class="bottom">
|
|
<van-row class="bottom">
|
|
<van-row class="settlement">
|
|
<van-row class="settlement">
|
|
@@ -120,6 +127,10 @@ export default {
|
|
// { name: "宵夜" },
|
|
// { name: "宵夜" },
|
|
],
|
|
],
|
|
overTime:undefined,
|
|
overTime:undefined,
|
|
|
|
+ day:undefined,
|
|
|
|
+ time1:undefined,
|
|
|
|
+ time2:undefined,
|
|
|
|
+ noData:false,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
components: {
|
|
components: {
|
|
@@ -131,40 +142,87 @@ export default {
|
|
})
|
|
})
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
- document.title = '中国东信智慧园区'
|
|
|
|
|
|
+ //document.title = '中国东信智慧园区'
|
|
//时段判断
|
|
//时段判断
|
|
- let nowTime = getNowTime().split(" ")[1].substring(0,2)
|
|
|
|
- console.log(this.$store.state.canbie)
|
|
|
|
- if(this.$store.state.canbie){
|
|
|
|
- this.typeValue = this.$store.state.canbie
|
|
|
|
- if(0<=nowTime && nowTime < 9){
|
|
|
|
- this.overTime = 0
|
|
|
|
- }else if( 9<= nowTime && nowTime < 13){
|
|
|
|
- this.overTime = 1
|
|
|
|
- }else if( 13<= nowTime && nowTime < 19){
|
|
|
|
- this.overTime = 2
|
|
|
|
|
|
+ //获取服务器时间
|
|
|
|
+ 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)
|
|
|
|
+ // // nowTime = "20"
|
|
|
|
+ // // nowF = 59
|
|
|
|
+ // startTime = getNowTime().split(" ")[0] + " 00:00:00"
|
|
|
|
+ // endTime = getNowTime().split(" ")[0] + " 18:59:59"
|
|
|
|
+
|
|
|
|
+ //服务器时间
|
|
|
|
+ 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"
|
|
|
|
+
|
|
|
|
+ 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{
|
|
}else{
|
|
- this.overTime = 3
|
|
|
|
|
|
+ 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"
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }else{
|
|
|
|
- if(nowTime < 9){
|
|
|
|
- this.typeValue = "早餐"
|
|
|
|
- this.overTime = 0
|
|
|
|
- }else if( 9<= nowTime && nowTime < 13){
|
|
|
|
- this.typeValue = "午餐"
|
|
|
|
- this.overTime = 1
|
|
|
|
- }else if( 13<= nowTime && nowTime < 19){
|
|
|
|
- this.typeValue = "晚餐"
|
|
|
|
- this.overTime = 2
|
|
|
|
|
|
+ this.time1 = startTime
|
|
|
|
+ this.time2 = endTime
|
|
|
|
+ if(JSON.stringify(this.footStoreData) != '[]'){
|
|
|
|
+ this.foodList = this.footStoreData
|
|
}else{
|
|
}else{
|
|
-
|
|
|
|
|
|
+ this.foodMenu(this.typeValue,startTime,endTime)
|
|
}
|
|
}
|
|
- }
|
|
|
|
- if(JSON.stringify(this.footStoreData) != '[]'){
|
|
|
|
- this.foodList = this.footStoreData
|
|
|
|
- }else{
|
|
|
|
- this.foodMenu(this.typeValue)
|
|
|
|
- }
|
|
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
|
|
//餐单信息判断
|
|
//餐单信息判断
|
|
this.money = 0;
|
|
this.money = 0;
|
|
@@ -221,33 +279,63 @@ export default {
|
|
|
|
|
|
},
|
|
},
|
|
/** 菜单 */
|
|
/** 菜单 */
|
|
- foodMenu(id){
|
|
|
|
|
|
+ foodMenu(id,startTime,endTime){
|
|
this.foodList = []
|
|
this.foodList = []
|
|
- 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&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 => {
|
|
const data = res.data.data.records
|
|
const data = res.data.data.records
|
|
- for(let i = 0;i<data.length;i++){
|
|
|
|
|
|
+ const arr = []
|
|
|
|
+ for(let i =0; i<data.length;i++){
|
|
data[i].num = 0
|
|
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])
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.foodList = arr
|
|
|
|
+ if(this.foodList.length==0){
|
|
|
|
+ this.noData = true
|
|
}
|
|
}
|
|
- this.foodList = data
|
|
|
|
})
|
|
})
|
|
},
|
|
},
|
|
/** 餐别确定 */
|
|
/** 餐别确定 */
|
|
determine(){
|
|
determine(){
|
|
this.money = 0
|
|
this.money = 0
|
|
- if(this.typeColor == undefined){
|
|
|
|
- Toast("请选择餐别")
|
|
|
|
|
|
+ if(this.day == "明日"){
|
|
|
|
+ if(this.typeColor != "早餐"){
|
|
|
|
+ Toast("请选择餐别")
|
|
|
|
+ }else{
|
|
|
|
+ this.determineShow()
|
|
|
|
+ }
|
|
}else{
|
|
}else{
|
|
- this.show = false
|
|
|
|
- this.typeValue = this.typeColor
|
|
|
|
- for(let i = 0; i<this.typeList.length;i++){
|
|
|
|
- if(this.typeColor == this.typeList[i].id){
|
|
|
|
- this.typeValue = this.typeList[i].name
|
|
|
|
- this.typeSelect = this.typeValue
|
|
|
|
- }
|
|
|
|
|
|
+ if(this.typeColor == undefined){
|
|
|
|
+ Toast("请选择餐别")
|
|
|
|
+ }else{
|
|
|
|
+ this.determineShow()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ /** 餐别确认渲染 */
|
|
|
|
+ determineShow(){
|
|
|
|
+ this.show = false
|
|
|
|
+ this.typeValue = this.typeColor
|
|
|
|
+ for(let i = 0; i<this.typeList.length;i++){
|
|
|
|
+ if(this.typeColor == this.typeList[i].id){
|
|
|
|
+ this.typeValue = this.typeList[i].name
|
|
|
|
+ this.typeSelect = this.typeValue
|
|
}
|
|
}
|
|
- this.typeSelect = this.typeValue
|
|
|
|
- this.foodMenu(this.typeValue)
|
|
|
|
}
|
|
}
|
|
|
|
+ this.typeSelect = this.typeValue
|
|
|
|
+ this.foodMenu(this.typeValue,this.time1,this.time2)
|
|
},
|
|
},
|
|
/** 餐别取消 */
|
|
/** 餐别取消 */
|
|
cancel(){
|
|
cancel(){
|
|
@@ -428,5 +516,12 @@ export default {
|
|
.van-stepper__minus::after, .van-stepper__minus::before, .van-stepper__plus::after, .van-stepper__plus::before{
|
|
.van-stepper__minus::after, .van-stepper__minus::before, .van-stepper__plus::after, .van-stepper__plus::before{
|
|
background-color: #ee0a24;
|
|
background-color: #ee0a24;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ .noData{
|
|
|
|
+ height:200px;
|
|
|
|
+ line-height: 200px;
|
|
|
|
+ color:#999999;
|
|
|
|
+ text-align: center;
|
|
|
|
+ font-size: 12px;
|
|
|
|
+ background-color: #ffffff;
|
|
|
|
+}
|
|
</style>
|
|
</style>
|