cashier_desktop/src/components/leftMenu.vue

256 lines
6.0 KiB
Vue

<template>
<div class="left_menu_wrap">
<div class="item first" :class="{ online: socketStore.online }" @click="connectWsHandle">
<el-icon class="icon">
<Monitor />
</el-icon>
<el-text :type="socketStore.online ? 'success' : 'danger'">
<template v-if="socketStore.online">
在线
</template>
<template v-else>
离线
</template>
</el-text>
</div>
<router-link class="item" :class="{ active: route.path == item.path }" v-for="item in menus" :key="item.path"
:to="item.path">
<el-icon class="icon">
<component :is="item.icon" />
</el-icon>
<el-text class="text">{{ item.label }}</el-text>
</router-link>
<div class="item" @click="workRef.show()">
<el-icon class="icon">
<component is="SwitchButton" />
</el-icon>
<el-text class="text">交班</el-text>
</div>
<div class="item more" @click="moreref.show()">
<el-icon class="icon">
<Operation />
</el-icon>
<el-text class="text">更多</el-text>
</div>
</div>
<!-- 交班 -->
<work ref="workRef" />
<!-- 更多 -->
<more ref="moreref" @openCall="openCall"></more>
<!-- 叫号 -->
<callNumber ref="callNumberRef" />
</template>
<script setup>
import { ref } from 'vue'
import { useRoute } from 'vue-router'
import { useSocket } from '@/store/socket.js'
import more from '@/components/more.vue'
import callNumber from './callNumber.vue'
import work from '@/views/work/index.vue'
const socketStore = useSocket()
const route = useRoute()
const moreref = ref(null)
const callNumberRef = ref(null)
const workRef = ref(null)
const menus = ref([
{
label: '收银',
path: '/',
icon: 'ShoppingCartFull'
},
{
label: '台桌',
path: '/table',
icon: 'Reading'
},
{
label: '团购',
path: '/group_buy',
icon: 'Handbag'
},
{
label: '订单',
path: '/order',
icon: 'Tickets'
},
// {
// label: '网络',
// path: '/internat',
// icon: 'Paperclip'
// },
{
label: '会员',
path: '/member',
icon: 'User'
},
{
label: '排队',
path: '/queue',
icon: 'Timer'
},
// {
// label: '交班',
// path: '/work',
// icon: 'SwitchButton'
// }
])
// 更新叫号记录
function updateCallNumber() {
callNumberRef.value.getsendMessageAjax()
}
function openCall() {
callNumberRef.value.show()
}
// 手动重新连接ws
function connectWsHandle() {
// if (socketStore.online) return
location.reload()
}
defineExpose({
updateCallNumber
})
</script>
<style scoped lang="scss">
.drawerbox {
:deep(.el-drawer__body) {
background: #1c1d1f !important;
}
.drawerbox_box {
color: #fff;
.drawerbox_bo_top {
padding: 20px 0;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #ccc;
.drawerbox_bo_top_left {
display: flex;
flex-direction: column;
}
.drawerbox_bo_top_ring {
display: flex;
align-items: center;
.drawerbox_bo_top_ring_tb {
display: flex;
flex-direction: column;
border: 1px solid #ccc;
border-radius: 6px;
padding: 6px 10px;
span {
width: 80px;
margin-top: 5px;
text-align: center;
}
}
}
}
.drawerbox_bo_box {
width: 100%;
.drawerbox_bo_box_itemb_felx {
display: flex;
justify-content: flex-start;
padding: 0 20px;
.drawerbox_bo_box_itembox:nth-child(1) {
margin-left: 0px;
}
.drawerbox_bo_box_itembox {
width: 20%;
display: flex;
flex-direction: column;
align-items: center;
margin-left: 40px;
.drawerbox_bo_box_icon {
border-radius: 6px;
background: #2196f3;
width: 100px;
height: 100px;
}
.drawerbox_bo_box_icontext {
margin-top: 10px;
}
}
}
}
}
}
.left_menu_wrap {
height: 100vh;
width: 60px;
background-color: #555;
display: flex;
flex-direction: column;
.item {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-decoration: none;
/* 去除下划线 */
color: inherit;
/* 继承父元素的颜色 */
cursor: pointer;
/* 修改鼠标指针样式 */
border: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-webkit-tap-highlight-color: transparent;
&.online {
.icon,
.text {
color: var(--el-color-success);
}
}
&.active {
background-color: #333;
.icon,
.text {
color: #fff;
}
}
&.more {
margin-top: 90px;
}
.icon {
color: #999;
font-size: 22px;
margin-bottom: 4px;
}
.text {
color: #999;
font-size: var(--el-font-size-base);
}
}
}
</style>