Browse Source

时间转换

wangtao 2 years ago
parent
commit
c99673ab83

+ 49 - 1
src/assets/js/dataFormate.js

@@ -251,6 +251,52 @@ function getMonthStartAndEnd(AddMonthCount) {
     //返回  
     //返回  
     return startStop;
     return startStop;
 }
 }
+// /**时间戳为10位需*1000,时间戳为13位的话不需乘1000 */
+// function timestampToTime(cjsj) {
+//     var date = new Date(cjsj * 1000);
+//     var Y = date.getFullYear() + '-';
+//     var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
+//     var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
+//     var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
+//     var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
+//     var s = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
+//     return Y + M + D + h + m + s;
+// }
+// 中国标准时间转年月日时分秒
+function timestampToTime(timestamp) {
+    // var chinaStandard=Mon Jul 19 2021 11:11:55 GMT+0800 (中国标准时间);
+    var date = new Date(timestamp * 1000);
+    var y = date.getFullYear();
+    var m = date.getMonth() + 1;
+    m = m < 10 ? ('0' + m) : m;
+    var d = date.getDate();
+    d = d < 10 ? ('0' + d) : d;
+    var h = date.getHours();
+    h = h < 10 ? ('0' + h) : h;
+    var minute = date.getMinutes();
+    minute = minute < 10 ? ('0' + minute) : minute;
+    var second = date.getSeconds();
+    second = second < 10 ? ('0' + second) : second;
+    let time = y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
+    return time
+}
+/** 月 日 特殊处理*/
+function monthDay(time) {
+    let timeS = new Date(Date.parse(time.replace(/-/g, '/'))).getTime() / 1000
+    let h = time.substring(10, 13)
+    if (h >= 19) {
+        timeS = timeS + 86400
+        let t = timestampToTime(timeS)
+        let y = Number(t.substring(5, 7)) + "月"
+        let d = Number(t.substring(8, 10)) + "日"
+        return y + d
+    } else {
+        let t = timestampToTime(timeS)
+        let y = Number(t.substring(5, 7)) + "月"
+        let d = Number(t.substring(8, 10)) + "日"
+        return y + d
+    }
+}
 export {
 export {
     getWeekStartAndEnd,
     getWeekStartAndEnd,
     getMonthStartAndEnd,
     getMonthStartAndEnd,
@@ -270,5 +316,7 @@ export {
     getQuarterEndDate,
     getQuarterEndDate,
     getNowTime,
     getNowTime,
     getDateStrNowDay,
     getDateStrNowDay,
-    GetDateStr
+    GetDateStr,
+    timestampToTime,
+    monthDay
 }
 }

+ 36 - 23
src/views/catering/index.vue

@@ -99,7 +99,7 @@
 <script>
 <script>
 import { Toast } from "vant";
 import { Toast } from "vant";
 import Cookies from "js-cookie";
 import Cookies from "js-cookie";
-import { getNowTime } from "@/assets/js/dataFormate.js";
+import { getNowTime ,monthDay } from "@/assets/js/dataFormate.js";
 export default {
 export default {
   data() {
   data() {
     return {
     return {
@@ -119,22 +119,8 @@ export default {
   },
   },
   mounted(){
   mounted(){
     document.title = '中国东信智慧园区'
     document.title = '中国东信智慧园区'
-    this.orderStatus()
     if(this.$route.query.id){
     if(this.$route.query.id){
-        this.orderStatus2()
-        setTimeout(()=>{
-            for(let i =0;i<this.order.length;i++){
-                if(this.order[i].id == this.$route.query.id){
-                    if(this.order[i].orderStatus == '1' || this.order[i].orderStatus == '2'|| this.order[i].orderStatus == '0'){
-                        this.active= 0
-                    }else{
-                        this.active= 1
-                    }
-                    this.orderOne(this.order[i])
-                }
-            }
-        },1000)
-        
+        this.orderStatusAll()
     }else{
     }else{
         this.orderStatus()
         this.orderStatus()
     }
     }
@@ -180,25 +166,51 @@ export default {
        
        
       
       
     },
     },
-    //订单查询
-    orderStatus2(){
+    
+    //所有订单查询
+    orderStatusAll(){
         let data = {
         let data = {
             current:1,
             current:1,
             size:500,
             size:500,
             orderStatus:undefined,
             orderStatus:undefined,
-            statusList:[0,1,2,3]
         }
         }
             //历史订单
             //历史订单
         axios.post(`https://smartpark.caih.com/dxapi/dreOrder/page`,data).then(res => { 
         axios.post(`https://smartpark.caih.com/dxapi/dreOrder/page`,data).then(res => { 
             const data = res.data.data.records
             const data = res.data.data.records
-            this.number = data.length
+            for(let i =0;i<data.length;i++){
+                if(data[i].id == this.$route.query.id){
+                    if(data[i].orderStatus != '3'){
+                        this.active = 0
+                    }else{
+                        this.active= 1
+                    }
+                    this.orderOne(data[i])
+                }
+                
+            }
+            let arr = []
+            if(this.active== 0){
+                for(let i =0;i<data.length;i++){
+                    if(data[i].orderStatus != '3'){
+                        arr.push(data[i])
+                    }
+                }
+            }
+            if(this.active==1){
+                for(let i =0;i<data.length;i++){
+                    if(data[i].orderStatus == '3'){
+                        arr.push(data[i])
+                    }
+                }
+            }
+            this.order = arr
+            this.number = arr.length
             if(this.number == "0"){
             if(this.number == "0"){
                 this.number = undefined
                 this.number = undefined
             }
             }
             if(data.length>99){
             if(data.length>99){
                 this.number = data.length
                 this.number = data.length
             }
             }
-            this.order  = data
             this.status = true
             this.status = true
         })
         })
       
       
@@ -211,9 +223,10 @@ export default {
             this.orderStatus(3)
             this.orderStatus(3)
         }
         }
     },
     },
-    //订单详情
+    //订单菜品详情
     orderOne(row){
     orderOne(row){
-        this.orderDetails = row
+        this.orderDetails = JSON.parse(JSON.stringify(row))
+        this.orderDetails.mType = monthDay(this.orderDetails.orderTime) + " " + this.orderDetails.mType
         axios.get(`https://smartpark.caih.com/dxapi/system/config/configKey/dre_urgency_phone`).then(res => { 
         axios.get(`https://smartpark.caih.com/dxapi/system/config/configKey/dre_urgency_phone`).then(res => { 
             this.orderDetails.jjPhone  = res.data.data
             this.orderDetails.jjPhone  = res.data.data
             //订单详情
             //订单详情

+ 7 - 1
src/views/orderingFood/address/index.vue

@@ -115,7 +115,7 @@ export default {
       }
       }
   },
   },
   mounted() {
   mounted() {
-    document.title = '中国东信智慧园区'
+    //document.title = '中国东信智慧园区'
   },
   },
   methods: {
   methods: {
     fanhuiBtn() {
     fanhuiBtn() {
@@ -163,6 +163,12 @@ export default {
           return
           return
         }
         }
       }
       }
+      //  Dialog.confirm({
+      //         title: '系统信息',
+      //         message: '您的点餐已进入配餐流程,请耐心等候,谢谢!',
+      //       }).then(() => {
+      //         this.$router.go(-2)
+      //       });
       axios.get("https://smartpark.caih.com/dxapi/dxtop/staff/one",{
       axios.get("https://smartpark.caih.com/dxapi/dxtop/staff/one",{
         params:{
         params:{
           id: localStorage.getItem("user_wt")
           id: localStorage.getItem("user_wt")

+ 102 - 43
src/views/orderingFood/index.vue

@@ -12,13 +12,14 @@
     <van-row class="top">
     <van-row class="top">
         <van-row class="timeType">
         <van-row class="timeType">
             <van-col class="describe" v-if="hasFood">今日{{type}}菜品推荐:<span class="time">(点餐时间:{{time}})</span></van-col>
             <van-col class="describe" v-if="hasFood">今日{{type}}菜品推荐:<span class="time">(点餐时间:{{time}})</span></van-col>
-            <van-col class="describe" v-if="!hasFood">今日点餐时间已结束</van-col>
+            <van-col class="describe" v-if="!hasFood">明日早餐菜品推荐:<span class="time">(点餐时间:{{time}})</span></van-col>
         </van-row>
         </van-row>
         <van-row class="RecommendedDishes" gutter="43">
         <van-row class="RecommendedDishes" gutter="43">
           <van-col  span="12" v-for="(item,index) in RecommendedDishes" :key="index" class="dishes" >
           <van-col  span="12" v-for="(item,index) in RecommendedDishes" :key="index" class="dishes" >
             <div class="name">{{item.name}}</div>
             <div class="name">{{item.name}}</div>
             <div class="price">¥{{Number(item.price).toFixed(2)}}</div>
             <div class="price">¥{{Number(item.price).toFixed(2)}}</div>
           </van-col>
           </van-col>
+          <van-col span="24" class="noData2" v-if="tjcp">暂无推荐菜品</van-col>
         </van-row>
         </van-row>
         <van-button  type="danger" @click="diancan" class="button">去点餐</van-button>
         <van-button  type="danger" @click="diancan" class="button">去点餐</van-button>
     </van-row>
     </van-row>
@@ -49,7 +50,7 @@
              </van-steps>
              </van-steps>
           </van-row>
           </van-row>
           <!-- <van-col span="24" class="noMore" v-if="over">{{dd}}</van-col> -->
           <!-- <van-col span="24" class="noMore" v-if="over">{{dd}}</van-col> -->
-           <van-col span="24" class="noMore" v-if="over">没有更多数据了</van-col>
+          <van-col span="24" class="noMore" v-if="over">没有更多数据了</van-col>
           <van-col span="24" class="noData" v-if="over2">暂无点餐信息</van-col>
           <van-col span="24" class="noData" v-if="over2">暂无点餐信息</van-col>
         </van-row>
         </van-row>
     </van-row>
     </van-row>
@@ -86,7 +87,7 @@
   </div>
   </div>
 </template>
 </template>
 <script>
 <script>
-import { getNowTime, GetDateStr } from "@/assets/js/dataFormate.js";
+import { getNowTime, GetDateStr , monthDay } from "@/assets/js/dataFormate.js";
 import Cookies from "js-cookie";
 import Cookies from "js-cookie";
 import {
 import {
   Dialog,
   Dialog,
@@ -107,6 +108,8 @@ export default {
       open:false,
       open:false,
       orderDetails:{},
       orderDetails:{},
       dishes:[],
       dishes:[],
+      hasFood:undefined,
+      tjcp:false,
     };
     };
   },
   },
   components: {
   components: {
@@ -114,57 +117,104 @@ export default {
     [Toast.name]: Toast,
     [Toast.name]: Toast,
   },
   },
   created() {
   created() {
-    let nowTime = getNowTime().split(" ")[1].substring(0,2)
-    if(0 <= nowTime && nowTime < 9){
-      this.type = "早餐"
-      this.hasFood = true
-      this.time = "00:00 - 09:00"
-    }
-    if(9<= nowTime  && nowTime < 13){
-      this.type = "午餐"
-      this.hasFood = true
-      this.time = "09:00 - 13:00"
-    }
-    if(13<= nowTime && nowTime < 19){
-      this.type = "晚餐"
-      this.hasFood = true
-      this.time = "13:00 - 19:00"
-    }
-    if(19<= nowTime){
-      this.type = "休业"
-      this.hasFood = false
-      this.time = "00:00 - 09:00"
-    }
-    if(this.$route.query.token){
-      this.getToken()
-    }else if(localStorage.getItem("tokenERP")){
-      
-    }else{
-      Toast("没有获取token信息")
-    }
+    
+    
     
     
   },
   },
   mounted(){
   mounted(){
-    //获取菜单
-    axios.get(`https://smartpark.caih.com/dxapi/dreMenu/list?current=1&size=500&type=${this.type}&isRecommend=1&status=0`).then(res => { 
-     const data = res.data.data.records
-     this.RecommendedDishes  = data
+    //获取服务器时间
+    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(0 <= nowTime && nowTime < 9){
+        this.type = "早餐"
+        this.hasFood = true
+        this.time = "00:00 - 09:00"
+        startTime = res.data.data.split(" ")[0] + " 00:00:00"
+        endTime = res.data.data.split(" ")[0] + " 18:59:59"
+      }
+      if(9<= nowTime  && nowTime < 13){
+        this.type = "午餐"
+        this.hasFood = true
+        this.time = "09:00 - 13:00"
+        startTime = res.data.data.split(" ")[0] + " 00:00:00"
+        endTime = res.data.data.split(" ")[0] + " 18:59:59"
+      }
+      if(13<= nowTime && nowTime < 19){
+        this.type = "晚餐"
+        this.hasFood = true
+        this.time = "13:00 - 19:00"
+        startTime = res.data.data.split(" ")[0] + " 00:00:00"
+        endTime = res.data.data.split(" ")[0] + " 18:59:59"
+      }
+      if(19<= nowTime && nowF<=59){
+        this.type = "早餐"
+        this.hasFood = false
+        this.time = "19:00 - 23:59"
+        startTime = res.data.data.split(" ")[0] + " 19:00:00"
+        endTime = res.data.data.split(" ")[0] + " 23:00:00"
+      }
+      if(this.$route.query.token){
+        this.getToken()
+      }else if(localStorage.getItem("tokenERP")){
+        
+      }else{
+        Toast("没有获取token信息")
+      }
+      //获取菜单
+      axios.get(`https://smartpark.caih.com/dxapi/dreMenu/list?current=1&size=500&type=${this.type}&isRecommend=1&status=0&startTime=${startTime}&endTime=${endTime}`).then(res => { 
+        const data = res.data.data.records
+        const arr = []
+        for(let i =0; i<data.length;i++){
+          if(startTime.split(" ")[0] == data[i].createTime.split(" ")[0]){
+            if(!this.hasFood){
+              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.RecommendedDishes  = arr
+        if(this.RecommendedDishes.length == 0){
+          this.tjcp = true
+        }
+      })
     })
     })
-
-    document.title = '中国东信智慧园区'
-    let startTime = getNowTime().split(" ")[0] + " 19:00:00"
-    let endTime = getNowTime().split(" ")[0] + " 23:59:59"
-    // console.log(GetDateStr(1))
+    
+    // document.title = '中国东信智慧园区'
+    let startTime = GetDateStr(-1) + " 19:00:00"
+    let endTime = GetDateStr(1) + " 19:00:00"
     //历史订单
     //历史订单
       axios.post(`https://smartpark.caih.com/dxapi/dreOrder/page`,{
       axios.post(`https://smartpark.caih.com/dxapi/dreOrder/page`,{
         current:1,
         current:1,
         size:500,
         size:500,
+        statusList:[0,1,2],
+        //orderUserName:"王卫",
         orderUserName:Cookies.get("nickName57"),
         orderUserName:Cookies.get("nickName57"),
         startTime:startTime,
         startTime:startTime,
         endTime:endTime,
         endTime:endTime,
-      }).then(res => { 
+      }).then(res => {
         const data = res.data.data.records
         const data = res.data.data.records
-        const arr = data.slice(0,5)
+        const arr = data
         if(arr.length>0){
         if(arr.length>0){
           for(let a =0;a<arr.length;a++){
           for(let a =0;a<arr.length;a++){
             arr[a].dishes = ''
             arr[a].dishes = ''
@@ -225,7 +275,8 @@ export default {
     },
     },
     orderOne(row){
     orderOne(row){
       this.open = true
       this.open = true
-      this.orderDetails = row
+      this.orderDetails = JSON.parse(JSON.stringify(row))
+      this.orderDetails.mType = monthDay(this.orderDetails.orderTime) + " " + this.orderDetails.mType
       this.dishes = row.dreOrderDetails
       this.dishes = row.dreOrderDetails
     },
     },
     close(){
     close(){
@@ -292,6 +343,14 @@ export default {
             .dishes:nth-child(2n){
             .dishes:nth-child(2n){
               margin-left:42px;
               margin-left:42px;
             }
             }
+            .noData2{
+              height:50px;
+              line-height: 50px;
+              color:#999999;
+              text-align: center;
+              font-size: 12px;
+              background-color: #ffffff;
+            }
         }
         }
         .button{
         .button{
             width:calc(100% - 30px);
             width:calc(100% - 30px);

+ 5 - 3
src/views/orderingFood/orderList/index.vue

@@ -61,6 +61,7 @@
 </template>
 </template>
 <script>
 <script>
 import Cookies from "js-cookie";
 import Cookies from "js-cookie";
+import { monthDay } from "@/assets/js/dataFormate.js";
 export default {
 export default {
   data() {
   data() {
     return {
     return {
@@ -75,15 +76,15 @@ export default {
     };
     };
   },
   },
   mounted(){
   mounted(){
-    document.title = '中国东信智慧园区'
     //历史订单
     //历史订单
       axios.post(`https://smartpark.caih.com/dxapi/dreOrder/page`,{
       axios.post(`https://smartpark.caih.com/dxapi/dreOrder/page`,{
         current:1,
         current:1,
         size:500,
         size:500,
+        //orderUserName:"王卫",
         orderUserName:Cookies.get("nickName57")
         orderUserName:Cookies.get("nickName57")
       }).then(res => { 
       }).then(res => { 
         const data = res.data.data.records
         const data = res.data.data.records
-        const arr = data.slice(0,5)
+        const arr = data
         if(arr.length>0){
         if(arr.length>0){
           for(let a =0;a<arr.length;a++){
           for(let a =0;a<arr.length;a++){
             arr[a].dishes = ''
             arr[a].dishes = ''
@@ -114,7 +115,8 @@ export default {
       },
       },
       orderOne(row){
       orderOne(row){
         this.open = true
         this.open = true
-        this.orderDetails = row
+        this.orderDetails = JSON.parse(JSON.stringify(row))
+        this.orderDetails.mType = monthDay(this.orderDetails.orderTime) + " " + this.orderDetails.mType
         this.dishes = row.dreOrderDetails
         this.dishes = row.dreOrderDetails
       },
       },
     close(){
     close(){

+ 142 - 47
src/views/orderingFood/orderService/index.vue

@@ -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>

+ 2 - 4
src/views/record/index.vue

@@ -144,7 +144,7 @@ export default {
       minDate: new Date(2020, 1, 1),
       minDate: new Date(2020, 1, 1),
       page1:1,
       page1:1,
       page2:1,
       page2:1,
-      current:20,
+      current:500,
       isref:true,
       isref:true,
       starTime:undefined,
       starTime:undefined,
       endTime:undefined,
       endTime:undefined,
@@ -201,10 +201,8 @@ export default {
       this.finished = true
       this.finished = true
     }
     }
   },
   },
-
-  
   methods: {
   methods: {
-     handleTouchstart(event){
+    handleTouchstart(event){
       this.startTime = Date.now()
       this.startTime = Date.now()
       // this.startX = event.changedTouches[0].clientX
       // this.startX = event.changedTouches[0].clientX
       // this.startY = event.changedTouches[0].clientY
       // this.startY = event.changedTouches[0].clientY