|
@@ -0,0 +1,535 @@
|
|
|
+<template>
|
|
|
+ <div class="mianBox">
|
|
|
+ <van-row class="headerBox" >
|
|
|
+ <van-col class="returnWrap" @click="fanhuiBtn">
|
|
|
+ <van-image class="arrow-left"
|
|
|
+ :src="require('../../assets/image/left.png')"
|
|
|
+ />
|
|
|
+ <van-col class="return">返回</van-col>
|
|
|
+ </van-col>
|
|
|
+ <van-col class="title">{{title}}</van-col>
|
|
|
+ </van-row>
|
|
|
+ <van-row class="top">
|
|
|
+ <van-row class="timeType">
|
|
|
+ <van-col class="describe">今日{{type}}菜品推荐:<span class="time">(点餐时间:{{time}})</span></van-col>
|
|
|
+ </van-row>
|
|
|
+ <van-row class="RecommendedDishes" gutter="43">
|
|
|
+ <van-col span="12" v-for="(item,index) in RecommendedDishes" :key="index" class="dishes" >
|
|
|
+ <div class="name">{{item.name}}</div>
|
|
|
+ <div class="price">¥{{item.price}}</div>
|
|
|
+ </van-col>
|
|
|
+ </van-row>
|
|
|
+ <van-button type="danger" @click="diancan" class="button">去点餐</van-button>
|
|
|
+ </van-row>
|
|
|
+ <van-row class="bottom">
|
|
|
+ <van-row class="title">
|
|
|
+ <van-col span="12" class="describe">最近点餐:</van-col>
|
|
|
+ <van-col span="12" class="allOrder" @click="allOrder">
|
|
|
+ <span>所有订单</span>
|
|
|
+ <van-image :src="require('../../assets/image/right2.png')" class="right_icon" />
|
|
|
+ </van-col>
|
|
|
+ </van-row>
|
|
|
+ <van-row class="orderList">
|
|
|
+ <van-row span="24" v-for="(item,index) in order" :key="index" class="order" @click="orderOne(item)">
|
|
|
+ <van-col span="5" class="moneyText">下单金额:</van-col>
|
|
|
+ <van-col offset="1" span="18" class="money" >¥{{item.totalMoney}}</van-col>
|
|
|
+ <van-col span="5" class="moneyText">已点菜品:</van-col>
|
|
|
+ <van-col offset="1" span="18" class="money">{{item.dishes}}</van-col>
|
|
|
+ <van-col span="5" class="orderTimeText">下单时间:</van-col>
|
|
|
+ <van-col offset="1" span="18" class="orderTime">{{item.orderTime}}</van-col>
|
|
|
+ <van-col span="5" class="statusText">当前状态:</van-col>
|
|
|
+ <van-col offset="1" span="18" :class="item.orderStatus == '3' ? 'status' : 'status1'">
|
|
|
+ {{item.orderStatus == "0" ? "待接单" : item.orderStatus == "1" ? "配餐中" : item.orderStatus == "2" ? "送餐中" : "已完成"}}
|
|
|
+ </van-col>
|
|
|
+ <van-steps :active="item.orderStatus == '0' ? '-1' : item.orderStatus" v-if="item.orderStatus != '3'" active-color="#ee0a24" inactive-color="#999999">
|
|
|
+ <van-step>{{ item.orderStatus == 0 ? '待接单' : item.orderStatus == 1 ? '已接单' : item.orderStatus == 2 ? '已接单' : '接单' }}</van-step>
|
|
|
+ <van-step>{{ item.orderStatus == 1 ? '配餐中' : item.orderStatus == 2 ? '已配餐' : '配餐' }}</van-step>
|
|
|
+ <van-step>{{ item.orderStatus == 2 ? '送餐中' : '送餐' }}</van-step>
|
|
|
+ </van-steps>
|
|
|
+ </van-row>
|
|
|
+ <!-- <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="noData" v-if="over2">暂无点餐信息</van-col>
|
|
|
+ </van-row>
|
|
|
+ </van-row>
|
|
|
+ <van-dialog v-model="open" class="pcDialog">
|
|
|
+ <van-row class="orderDetails">
|
|
|
+ <van-col class="detailsTitle">点餐明细</van-col>
|
|
|
+ <van-col class="order" span="24">
|
|
|
+ <van-col span="7" style="margin-top:0">订餐人:</van-col>
|
|
|
+ <van-col offset="1" span="16" style="margin-top:0">{{orderDetails.orderUserName || '-'}}</van-col>
|
|
|
+ <van-col span="7">餐别:</van-col>
|
|
|
+ <van-col offset="1" span="16">{{orderDetails.mType || '-'}}</van-col>
|
|
|
+ <van-col span="7">手机号:</van-col>
|
|
|
+ <van-col offset="1" span="16">{{orderDetails.phone || '-'}}</van-col>
|
|
|
+ <van-col span="7">送餐地址:</van-col>
|
|
|
+ <van-col offset="1" span="16">{{orderDetails.address || "-"}}</van-col>
|
|
|
+ <van-col span="7">备注:</van-col>
|
|
|
+ <van-col offset="1" span="16">{{orderDetails.remark || '-'}}</van-col>
|
|
|
+ </van-col>
|
|
|
+ <van-col class="detailsText">已点菜品</van-col>
|
|
|
+ <van-col span="24" class="dishes">
|
|
|
+ <van-col span="24" v-for="(item,index) in dishes" :key="index" class="list">
|
|
|
+ <van-col span="12" class="name">{{item.mName}}</van-col>
|
|
|
+ <van-col span="12" class="num">{{item.mCount}}份</van-col>
|
|
|
+ </van-col>
|
|
|
+ </van-col>
|
|
|
+ <van-col class="statusSelect">
|
|
|
+ <van-col class="select gb" @click="close">
|
|
|
+ 关闭
|
|
|
+ </van-col>
|
|
|
+ </van-col>
|
|
|
+
|
|
|
+ </van-row>
|
|
|
+ </van-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import { getNowTime } from "@/assets/js/dataFormate.js";
|
|
|
+import Cookies from "js-cookie";
|
|
|
+import {
|
|
|
+ Dialog,
|
|
|
+ Toast,
|
|
|
+} from "vant";
|
|
|
+export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ dd:undefined,
|
|
|
+ status:false,
|
|
|
+ title:"自助点餐",
|
|
|
+ type:undefined,
|
|
|
+ time:undefined,
|
|
|
+ RecommendedDishes:[],
|
|
|
+ order:[],
|
|
|
+ over:false,//数据拉载完成
|
|
|
+ over2:false,
|
|
|
+ open:false,
|
|
|
+ orderDetails:{},
|
|
|
+ dishes:[],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ components: {
|
|
|
+ [Dialog.name]: Dialog,
|
|
|
+ [Toast.name]: Toast,
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ let nowTime = getNowTime().split(" ")[1].substring(0,2)
|
|
|
+ if(0 <= nowTime && nowTime < 9){
|
|
|
+ this.type = "早餐"
|
|
|
+ this.time = "00:00 - 09:00"
|
|
|
+ }
|
|
|
+ if(9<= nowTime && nowTime < 13){
|
|
|
+ this.type = "午餐"
|
|
|
+ this.time = "09:00 - 13:00"
|
|
|
+ }
|
|
|
+ if(13<= nowTime && nowTime < 19){
|
|
|
+ this.type = "晚餐"
|
|
|
+ this.time = "13:00 - 19:00"
|
|
|
+ }
|
|
|
+ if(19<= nowTime && nowTime < 24){
|
|
|
+ this.type = "宵夜"
|
|
|
+ this.time = "19:00 - 24:00"
|
|
|
+ }
|
|
|
+ if(this.$route.query.token){
|
|
|
+ this.getToken()
|
|
|
+ }else if(localStorage.getItem("tokenERP")){
|
|
|
+
|
|
|
+ }else{
|
|
|
+ Toast("没有获取token信息")
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ mounted(){
|
|
|
+ //获取菜单
|
|
|
+ axios.get(`https://smartpark.caih.com/dxapi/dreMenu/list?current=1&size=500&type=${this.type}&isRecommend=1`).then(res => {
|
|
|
+ const data = res.data.data.records
|
|
|
+ this.RecommendedDishes = data
|
|
|
+ })
|
|
|
+
|
|
|
+ document.title = '中国东信智慧园区'
|
|
|
+ let startTime = getNowTime().split(" ")[0] + " 00:00:00"
|
|
|
+ let endTime = getNowTime().split(" ")[0] + " 23:59:59"
|
|
|
+ //历史订单
|
|
|
+ axios.post(`https://smartpark.caih.com/dxapi/dreOrder/page`,{
|
|
|
+ current:1,
|
|
|
+ size:500,
|
|
|
+ orderUserName:Cookies.get("nickName57"),
|
|
|
+ startTime:startTime,
|
|
|
+ endTime:endTime,
|
|
|
+ }).then(res => {
|
|
|
+ const data = res.data.data.records
|
|
|
+ const arr = data.slice(0,5)
|
|
|
+ if(arr.length>0){
|
|
|
+ for(let a =0;a<arr.length;a++){
|
|
|
+ arr[a].dishes = ''
|
|
|
+ if(arr[a].dreOrderDetails && arr[a].dreOrderDetails.length>0){
|
|
|
+ for(let i =0;i<arr[a].dreOrderDetails.length;i++){
|
|
|
+ arr[a].dishes = arr[a].dishes + '、' + arr[a].dreOrderDetails[i].mName
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for(let i =0;i<arr.length;i++){
|
|
|
+ arr[i].dishes = arr[i].dishes.substr(1,arr[i].dishes.length - 1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.order = arr
|
|
|
+ if(this.order.length>0){
|
|
|
+ this.over = true
|
|
|
+ this.over2 = false
|
|
|
+ }else{
|
|
|
+ this.over = false
|
|
|
+ this.over2 = true
|
|
|
+ }
|
|
|
+ this.status = true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getToken(){
|
|
|
+ localStorage.setItem("tokenERP",this.$route.query.token)
|
|
|
+ axios({//查询信息
|
|
|
+ method: 'get',
|
|
|
+ url: 'https://smartpark.caih.com/zkxt/api/thirdparty/v1/user/getZkUserByCipher?cipher=' + this.$route.query.token,
|
|
|
+ timeout: 10000,
|
|
|
+ }).then(res =>{
|
|
|
+ if(res.data?.data?.id){
|
|
|
+ Cookies.set("nickName57", res.data.data.name, { expires: 300 });
|
|
|
+ localStorage.setItem("user_wt", res.data.data.id)
|
|
|
+ }
|
|
|
+ }).catch(err =>{
|
|
|
+ this.userNoAlert()
|
|
|
+ });
|
|
|
+ },
|
|
|
+ userNoAlert(){
|
|
|
+ Toast("当前账户初始流程中,请耐心等待或联系管理人员查询")
|
|
|
+ },
|
|
|
+ /**点餐 */
|
|
|
+ diancan(){
|
|
|
+ this.$router.push({ path: "/orderService"})
|
|
|
+ },
|
|
|
+ /**所有订单 */
|
|
|
+ allOrder(){
|
|
|
+ this.$router.push({ path: "/orderList"})
|
|
|
+ },
|
|
|
+ /** 返回上级或app目录页 */
|
|
|
+ fanhuiBtn(){
|
|
|
+ //this.$router.back()
|
|
|
+ this.$router.go(-1)
|
|
|
+ //this.$router.push({ path: "/home"})
|
|
|
+ },
|
|
|
+ orderOne(row){
|
|
|
+ this.open = true
|
|
|
+ this.orderDetails = row
|
|
|
+ this.dishes = row.dreOrderDetails
|
|
|
+ },
|
|
|
+ close(){
|
|
|
+ this.open = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.mianBox{
|
|
|
+ width:100%;
|
|
|
+ height:100%;
|
|
|
+ overflow: scroll;
|
|
|
+
|
|
|
+ background-color: #F9F9F9 !important;
|
|
|
+ .top{
|
|
|
+ .timeType{
|
|
|
+ padding:13px 16px;
|
|
|
+ text-align: left;
|
|
|
+ box-shadow: inset 0px -1px 0px 0px rgba(232,232,232,1);
|
|
|
+ .describe{
|
|
|
+ font-size: 15px;
|
|
|
+ font-weight: 700;
|
|
|
+ width:100%;
|
|
|
+ .time{
|
|
|
+ font-weight: 400;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ .RecommendedDishes{
|
|
|
+ margin:8px 0 24px;
|
|
|
+ padding:5px 15px 0px;
|
|
|
+ .dishes{
|
|
|
+ height:36px;
|
|
|
+ line-height: 36px;
|
|
|
+ font-size: 14px;
|
|
|
+ background-clip:content-box;
|
|
|
+ position: relative;
|
|
|
+ width:calc(50vw - 36px);
|
|
|
+ .name{
|
|
|
+ color:#666666;
|
|
|
+ text-align: left;
|
|
|
+ border-bottom:1px dashed #ccc;
|
|
|
+ width:66.7% !important;
|
|
|
+ display: inline-block;
|
|
|
+ position: absolute;
|
|
|
+ left:0;
|
|
|
+ //width:60px; //要加宽度 ,若是span等行内元素,加个display:inline-block;
|
|
|
+ white-space: nowrap;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ }
|
|
|
+ .price{
|
|
|
+ color:#999999;
|
|
|
+ text-align: right;
|
|
|
+ border-bottom:1px dashed #ccc;
|
|
|
+ width:33.3% !important;
|
|
|
+ display: inline-block;
|
|
|
+ position: absolute;
|
|
|
+ right:0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .dishes:nth-child(2n){
|
|
|
+ margin-left:42px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .button{
|
|
|
+ width:calc(100% - 30px);
|
|
|
+ margin:0px 15px 24px;
|
|
|
+ border-radius: 5px;
|
|
|
+ font-size: 17px;
|
|
|
+ height:44px;
|
|
|
+ line-height: 44px;
|
|
|
+ border:none;
|
|
|
+ background: #ee0a24;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .bottom{
|
|
|
+ background-color: #fff;
|
|
|
+ margin-top:8px;
|
|
|
+ .title{
|
|
|
+ padding:0px 15px;
|
|
|
+ box-shadow: inset 0px -1px 0px 0px rgba(232,232,232,1);
|
|
|
+ text-align: left;
|
|
|
+ height:48px;
|
|
|
+ line-height: 48px;
|
|
|
+ .describe{
|
|
|
+ font-size: 15px;
|
|
|
+ font-weight: 700;
|
|
|
+ }
|
|
|
+ .allOrder{
|
|
|
+ font-size: 14px;
|
|
|
+ font-weight: 400;
|
|
|
+ text-align: right;
|
|
|
+ color:#666;
|
|
|
+ .right_icon{
|
|
|
+ width:6px !important;
|
|
|
+ margin-left:5px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .orderList{
|
|
|
+ .order{
|
|
|
+ font-size: 14px;
|
|
|
+ padding:14px 15px 20px;
|
|
|
+ .moneyText,.orderTimeText,.statusText{
|
|
|
+ color:#999999;
|
|
|
+ text-align: left;
|
|
|
+ }
|
|
|
+ .money,.orderTime,.status{
|
|
|
+ color:#333;
|
|
|
+ text-align: right;
|
|
|
+ white-space: nowrap;
|
|
|
+ /* 超出隐藏 */
|
|
|
+ overflow: hidden;
|
|
|
+ /* 文本超出显示成... */
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ }
|
|
|
+ div{
|
|
|
+ font-size: 14px;
|
|
|
+ margin-top:8px;
|
|
|
+ line-height: 20px;
|
|
|
+ }
|
|
|
+ .status1{
|
|
|
+ color:#ee0a24;
|
|
|
+ text-align: right;
|
|
|
+ }
|
|
|
+ .van-steps{
|
|
|
+ width:100%;
|
|
|
+ background:transparent;
|
|
|
+ height:40px;
|
|
|
+ padding-bottom:20px;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .order:nth-child(odd){
|
|
|
+ background-color: #fff;
|
|
|
+ }
|
|
|
+ .order:nth-child(even){
|
|
|
+ background-color: #F9F9F9;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ .noMore{
|
|
|
+ background-color: #F0F0F0;
|
|
|
+ color:#999999;
|
|
|
+ text-align: center;
|
|
|
+ padding:20px 0;
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
+ .noData{
|
|
|
+ height:200px;
|
|
|
+ line-height: 200px;
|
|
|
+ color:#999999;
|
|
|
+ text-align: center;
|
|
|
+ font-size: 12px;
|
|
|
+ background-color: #ffffff;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .pcDialog{
|
|
|
+ border-radius: 5px;
|
|
|
+ width:85%;
|
|
|
+ padding:20px 0;
|
|
|
+ .orderDetails{
|
|
|
+ .detailsTitle{
|
|
|
+ font-size: 18px;
|
|
|
+ margin-top:0px;
|
|
|
+ text-align: center;
|
|
|
+ font-weight: 700;
|
|
|
+ width:100%;
|
|
|
+ }
|
|
|
+ .order{
|
|
|
+ padding:0px 16px 20px;
|
|
|
+ border-bottom:1px solid #F0F0F0;
|
|
|
+ div{
|
|
|
+ margin-top:8px;
|
|
|
+ line-height: 20px;
|
|
|
+ }
|
|
|
+ div:nth-child(odd){
|
|
|
+ text-align: left;
|
|
|
+ color:#999999;
|
|
|
+ }
|
|
|
+ div:nth-child(even){
|
|
|
+ text-align: right;
|
|
|
+ color:#333;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .detailsText,.jjPhone{
|
|
|
+ font-size: 15px;
|
|
|
+ margin:20px 16px 8px;
|
|
|
+ font-weight: 700;
|
|
|
+ }
|
|
|
+ .jjPhone{
|
|
|
+ margin:20px 16px 0;
|
|
|
+ }
|
|
|
+ .dishes{
|
|
|
+ max-height:calc(100vh - 550px);
|
|
|
+ overflow-y: scroll;
|
|
|
+ padding:0px 16px;
|
|
|
+ .list{
|
|
|
+ color:#333;
|
|
|
+ font-size: 15px;
|
|
|
+ height:40px;
|
|
|
+ line-height: 40px;
|
|
|
+ width:100%;
|
|
|
+ div:nth-child(odd){
|
|
|
+ text-align: left;
|
|
|
+ padding-left:10px;
|
|
|
+ }
|
|
|
+ div:nth-child(even){
|
|
|
+ text-align: right;
|
|
|
+ padding-right:10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .list:nth-child(odd){
|
|
|
+ background: #F9F9F9;
|
|
|
+ }
|
|
|
+ .list:nth-child(even){
|
|
|
+ background: #F0F0F0;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ .statusSelect{
|
|
|
+ margin:20px 0 0;
|
|
|
+ width:100%;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding:0 16px;
|
|
|
+ .select{
|
|
|
+ height:44px;
|
|
|
+ line-height: 44px;
|
|
|
+ font-size: 17px;
|
|
|
+ text-align: center;
|
|
|
+ border-radius: 5px;
|
|
|
+ width:100%;
|
|
|
+ }
|
|
|
+
|
|
|
+ .gb{
|
|
|
+ color: #fff;
|
|
|
+ background:#ee0a24;
|
|
|
+ border-radius: 5px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+</style>
|
|
|
+<style>
|
|
|
+.van-steps__items{
|
|
|
+ margin-top:-50px !important;
|
|
|
+ padding:0 14px;
|
|
|
+}
|
|
|
+.van-step__title{
|
|
|
+ position: absolute !important;
|
|
|
+ top:40px;
|
|
|
+ font-size: 12px !important;
|
|
|
+ left:-15px;
|
|
|
+ color:#333;
|
|
|
+}
|
|
|
+.van-step--horizontal:nth-child(2) .van-step__title{
|
|
|
+ width:68px;
|
|
|
+ text-align: right;
|
|
|
+}
|
|
|
+.van-step--horizontal:nth-child(3) .van-step__title{
|
|
|
+ width:75px;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+.van-step--finish .van-step__title{
|
|
|
+ margin-left:0px !important;
|
|
|
+}
|
|
|
+.van-step__circle{
|
|
|
+ width:8px;
|
|
|
+ height:8px;
|
|
|
+}
|
|
|
+
|
|
|
+.van-step--horizontal .van-step__circle-container{
|
|
|
+ padding:0;
|
|
|
+ left:0;
|
|
|
+ margin-top:1px;
|
|
|
+}
|
|
|
+.van-step--horizontal:last-child .van-step__title{
|
|
|
+ margin-left:-40px;
|
|
|
+}
|
|
|
+.van-step__line{
|
|
|
+ background:transparent !important;
|
|
|
+ border-bottom:1px dashed #ccc;
|
|
|
+}
|
|
|
+.van-step--finish .van-step__line{
|
|
|
+ background:#ee0a24 !important;
|
|
|
+ border:none;
|
|
|
+}
|
|
|
+.van-step--horizontal:last-child .van-step__circle-container{
|
|
|
+ right:12px !important;
|
|
|
+}
|
|
|
+.van-step--horizontal:last-child .van-step__circle-container{
|
|
|
+ right:12px !important;
|
|
|
+}
|
|
|
+.van-step__title--active{
|
|
|
+ color:#333 !important;
|
|
|
+}
|
|
|
+.van-step__icon--active{
|
|
|
+ background: #ee0a24;
|
|
|
+ width:8px;
|
|
|
+ height:8px;
|
|
|
+ border-radius: 50% !important;
|
|
|
+}
|
|
|
+.van-step--horizontal .van-step__icon{
|
|
|
+ font-size: 0;
|
|
|
+}
|
|
|
+
|
|
|
+</style>
|