445 lines
10 KiB
Vue
Raw Normal View History

2023-11-22 18:30:06 +08:00
<template>
2023-11-24 19:32:45 +08:00
<div class="headers">
<div class="logo">
</div>
2023-12-11 18:35:55 +08:00
<div class="tab" v-if="role != 1">
2023-11-25 18:35:23 +08:00
<div class="tab-li">
2024-01-06 18:32:20 +08:00
<img @click="showFn(0, '/')" class="tab-img" v-if="show[0]" style="width: 6vw;height:2vh;"
src="/static/index/SY.png" alt="">
<img @click="showFn(0, '/')" class="tab-img" v-else style="width: 7vw; height: 3vh;"
src="/static/index/SYXZ.png" alt="">
2023-11-25 18:35:23 +08:00
</div>
<div class="tab-li">
<img @click="showFn(1, '/commodity')" class="tab-img" v-if="show[1]" style="width: 6vw;height:2vh;"
2024-01-06 18:32:20 +08:00
src="/static/index/SP.png" alt="">
<img @click="showFn(1, '/commodity')" class="tab-img" v-else style="width: 7vw;height:3vh;"
src="/static/index/SPXZ.png" alt="">
2023-11-25 18:35:23 +08:00
</div>
2023-12-11 18:35:55 +08:00
2023-11-25 18:35:23 +08:00
<div class="tab-li">
<img @click="showFn(2, '/Businesses')" class="tab-img" v-if="show[2]" style="width: 6vw;height:2vh;"
2024-01-06 18:32:20 +08:00
src="/static/index/SH.png" alt="">
2023-11-25 18:35:23 +08:00
<img @click="showFn(2, '/Businesses')" class="tab-img" v-else style="width: 7vw;height:3vh;"
2024-01-06 18:32:20 +08:00
src="/static/index/SHXZ.png" alt="">
2023-11-25 18:35:23 +08:00
</div>
<div class="tab-li">
<img @click="showFn(3, '/order')" class="tab-img" v-if="show[3]" style="width: 6vw;height:2vh;"
2024-01-06 18:32:20 +08:00
src="/static/index/DD.png" alt="">
<img @click="showFn(3, '/order')" class="tab-img" v-else style="width: 7vw;height:3vh;"
src="/static/index/DDXZ.png" alt="">
2023-11-24 19:32:45 +08:00
2023-11-25 18:35:23 +08:00
</div>
<div class="tab-li">
<img @click="showFn(4, '/finance')" class="tab-img" v-if="show[4]" style="width: 6vw;height:2vh;"
2024-01-06 18:32:20 +08:00
src="/static/index/CW.png" alt="">
<img @click="showFn(4, '/finance')" class="tab-img" v-else style="width: 7vw;height:3vh;"
src="/static/index/CWXZ.png" alt="">
2023-11-24 19:32:45 +08:00
2023-11-25 18:35:23 +08:00
</div>
2023-12-07 19:05:27 +08:00
<div class="tab-li" v-if="route.path == '/storeLogin'" @click="router.replace('/Businesses')">
<img @click="showFn(4, '/finance')" class="tab-img" v-if="show[4]" style="width: 6vw;height:2vh;"
2024-01-06 18:32:20 +08:00
src="/static/index/FH.png" alt="">
2023-12-07 19:05:27 +08:00
</div>
2023-11-24 19:32:45 +08:00
</div>
2023-12-11 18:35:55 +08:00
<div class="tab" v-else>
<div class="tab-li">
<img @click="showFn(2, '/storeLogin')" class="tab-img" v-if="show[2]" style="width: 6vw;height:2vh;"
2024-01-06 18:32:20 +08:00
src="/static/index/SH.png" alt="">
2023-12-11 18:35:55 +08:00
<img @click="showFn(2, '/storeLogin')" class="tab-img" v-else style="width: 7vw;height:3vh;"
2024-01-06 18:32:20 +08:00
src="/static/index/SHXZ.png" alt="">
2023-12-11 18:35:55 +08:00
</div>
</div>
2023-11-24 19:32:45 +08:00
<div class="right">
2023-12-19 19:39:39 +08:00
<datePicker></datePicker>
2023-12-11 18:35:55 +08:00
<div class="rigth-li" @click="choseAreaFn"> <img style="width: 1VW;height:1VW;margin-right: 0.5vw;"
2024-01-09 18:34:29 +08:00
src="/static/index/DW.png" alt=""> {{ areaStore.area.name||"泸县" }}
2023-11-27 18:34:57 +08:00
</div>
2024-01-08 18:32:35 +08:00
<areaList :choseArea="choseArea" @offAreaList="offAreaList" style="left: 12vw;" :key="areaStore.area.areaCode">
</areaList>
2023-11-24 19:32:45 +08:00
<div class="right-line">
2024-01-08 18:32:35 +08:00
<span>
</span>
2023-11-24 19:32:45 +08:00
<span></span>
</div>
2023-12-19 19:39:39 +08:00
<div class="rigth-li" id="time">15:33:26</div>
<div class="right-line"> <span></span>
2023-11-24 19:32:45 +08:00
<span></span>
</div>
2023-12-19 19:39:39 +08:00
<div class="rigth-li" id="days">2023-11-28</div>
<div class="right-line">
2023-11-24 19:32:45 +08:00
<span></span>
<span></span>
</div>
2024-01-06 18:32:20 +08:00
<div class="rigth-li" @click="out"><img style="width: 1VW;height:1VW;margin-right: 0.5vw;"
src="/static/index/GJ.png" alt=""></div>
2023-11-24 19:32:45 +08:00
<div class="right-line">
<span></span>
<span></span>
</div>
2023-11-23 19:39:47 +08:00
</div>
2023-11-22 18:30:06 +08:00
</div>
</template>
2023-12-11 18:35:55 +08:00
2023-11-28 15:26:40 +08:00
<script setup>
2023-12-07 19:05:27 +08:00
import { ref, reactive, onMounted, watch } from "vue"
2023-11-28 15:26:40 +08:00
import areaList from "./areaList.vue";
2023-12-07 19:05:27 +08:00
import { useRouter, useRoute } from 'vue-router'
2023-12-11 18:35:55 +08:00
import { areaObj } from "@/store/index.js"
import datePicker from "@/components/datePicker.vue"
2024-01-06 18:32:20 +08:00
import { globalEventBus } from '@/common/eventBus'
2023-12-11 18:35:55 +08:00
const areaStore = areaObj()
2024-01-08 18:32:35 +08:00
let area = ref(areaStore.area.name || '')
2023-12-11 18:35:55 +08:00
let userinfo = JSON.parse(localStorage.getItem('TRADE_USER'))
let role = ref(userinfo.role)
2024-01-06 18:32:20 +08:00
2023-12-07 19:05:27 +08:00
const router = useRouter()
const route = useRoute()
2023-11-24 19:32:45 +08:00
// 标题
const show = reactive([false, true, true, true, true])
const showFn = (index, src) => {
show.forEach((item, i) => {
show[i] = true
})
show[index] = !show[index]
2023-12-07 19:05:27 +08:00
if (src) {
2023-12-11 18:35:55 +08:00
if (areaStore.area.streetCode && src == '/') {
router.push("/townDetail?code=510524102")
return
}
2023-12-07 19:05:27 +08:00
router.replace(src)
}
2023-11-23 19:39:47 +08:00
}
2024-01-08 18:32:35 +08:00
const changeArea = (name, code) => {
areaStore.changeArea({
areaCode: code,
streetCode: null,
name,
})
// router.go(0)
router.replace('/')
2024-01-09 18:34:29 +08:00
console.log(areaStore.area.name)
2024-01-08 18:32:35 +08:00
}
2023-12-07 19:05:27 +08:00
watch(
() => route.path,
(value, oldValue) => {
2023-12-11 22:33:50 +08:00
2023-12-19 19:39:39 +08:00
2023-12-11 18:35:55 +08:00
if (value == '/index') {
2023-12-07 19:05:27 +08:00
showFn(0)
2024-01-08 18:32:35 +08:00
area.value = areaStore.area.name || '泸县'
2023-12-07 19:05:27 +08:00
}
2023-12-11 18:35:55 +08:00
if (value == '/townDetail') {
showFn(0)
}
2023-12-07 19:05:27 +08:00
if (value == '/commodity') {
showFn(1)
}
2023-12-11 18:35:55 +08:00
if (value == '/Businesses' || value == '/storeLogin') {
2023-12-07 19:05:27 +08:00
showFn(2)
}
if (value == '/order') {
showFn(3)
}
if (value == '/finance') {
showFn(4)
}
2023-12-11 18:35:55 +08:00
if (value == '/finance') {
showFn(4)
}
}, {
deep: true,
immediate: true
}
2023-12-07 19:05:27 +08:00
)
2023-12-11 18:35:55 +08:00
const choseAreaFn = () => {
2023-12-07 19:05:27 +08:00
2023-12-11 18:35:55 +08:00
if (role.value == 2) {
choseArea.value = true
}
}
2023-12-07 19:05:27 +08:00
2023-11-24 19:32:45 +08:00
// 选额镇
2023-11-28 15:26:40 +08:00
const choseArea = ref(false)
// 关闭
2023-12-07 19:05:27 +08:00
const offAreaList = (name) => {
2023-11-28 15:26:40 +08:00
choseArea.value = false
2024-01-09 18:34:29 +08:00
// area.value = name
2023-11-28 15:26:40 +08:00
}
const out = () => {
2023-12-11 18:35:55 +08:00
localStorage.removeItem('TRADE_USER')
2023-12-08 18:51:02 +08:00
router.replace('/login')
2023-11-28 15:26:40 +08:00
}
const updateTime = () => {
var date = new Date();
var hours = date.getHours();
var minutes = date.getMinutes();
var seconds = date.getSeconds();
var years = date.getFullYear()
var month = date.getMonth()
var days = date.getDate()
// alert(days)
// 添加前导零
hours = (hours < 10 ? "0" : "") + hours;
minutes = (minutes < 10 ? "0" : "") + minutes;
seconds = (seconds < 10 ? "0" : "") + seconds;
var currentTime = hours + ":" + minutes + ":" + seconds;
2023-12-07 19:05:27 +08:00
var currentDays = years + '-' + (month >= 10 ? month + 1 : "0" + (month + 1)) + "-" + (days >= 10 ? days : "0" + days)
2023-11-28 15:26:40 +08:00
// alert(days)
2023-11-24 19:32:45 +08:00
2023-11-28 15:26:40 +08:00
// 将时间显示在指定的DOM元素中
document.getElementById("time").innerHTML = currentTime;
document.getElementById("days").innerHTML = currentDays;
2023-11-23 19:39:47 +08:00
}
2024-01-08 18:32:35 +08:00
const SCREEN_TYPE=JSON.parse(localStorage.getItem('SCREEN_TYPE'))
2023-11-28 15:26:40 +08:00
onMounted(() => {
setInterval(updateTime, 1000)
2024-01-08 18:32:35 +08:00
localStorage.setItem("SCREEN_TYPE",JSON.stringify(route.query)||'' )
2023-12-07 19:05:27 +08:00
2023-11-28 15:26:40 +08:00
})
2024-01-07 22:19:35 +08:00
globalEventBus.on('compheader1', data => {
2024-01-09 18:34:29 +08:00
showFn(0, '/')
2024-01-08 18:32:35 +08:00
if (SCREEN_TYPE.type == 'r') {
showFn(0, '/')
}
2024-01-07 22:19:35 +08:00
})
globalEventBus.on('compheader2', data => {
2024-01-09 18:34:29 +08:00
showFn(1, '/commodity')
2024-01-08 18:32:35 +08:00
if (SCREEN_TYPE.type == 'r'){
showFn(1, '/commodity')
}
2024-01-07 22:19:35 +08:00
})
globalEventBus.on('compheader3', data => {
2024-01-09 18:34:29 +08:00
showFn(2, '/Businesses')
2024-01-08 18:32:35 +08:00
if (SCREEN_TYPE.type == 'r'){
showFn(2, '/Businesses')
}
2024-01-07 22:19:35 +08:00
})
globalEventBus.on('compheader4', data => {
2024-01-08 18:32:35 +08:00
2024-01-09 18:34:29 +08:00
showFn(3, '/order')
2024-01-08 18:32:35 +08:00
if (SCREEN_TYPE.type == 'r'){
showFn(3, '/order')
}
2024-01-07 22:19:35 +08:00
})
2024-01-08 18:32:35 +08:00
2024-01-07 22:19:35 +08:00
globalEventBus.on('compheader5', data => {
2024-01-09 18:34:29 +08:00
showFn(4, '/finance')
2024-01-08 18:32:35 +08:00
if (SCREEN_TYPE.type == 'r'){
showFn(4, '/finance')
}
2024-01-07 22:19:35 +08:00
})
2024-01-08 18:32:35 +08:00
globalEventBus.on('choserArea', data => {
changeArea(data.name, data.code)
2024-01-09 18:34:29 +08:00
2024-01-08 18:32:35 +08:00
})
2023-11-24 19:32:45 +08:00
</script>
2023-12-11 18:35:55 +08:00
<style lang="scss" >
.popperClass {
// background-color: red;
color: red;
border: none;
}
2023-11-24 19:32:45 +08:00
.headers {
display: flex;
color: #B0C7D1;
height: 6vh;
align-items: center;
justify-content: space-between;
2023-11-25 18:35:23 +08:00
background-image: url('/static/index/LOGO.png');
2023-11-24 19:32:45 +08:00
background-color: #000C14;
background-size: cover;
.logo {
width: 20vw;
// margin-right: 30px;
height: 40px;
align-items: center;
}
.tab {
display: flex;
align-items: center;
margin-left: 120px;
2023-12-11 18:35:55 +08:00
width: auto;
2023-11-25 18:35:23 +08:00
height: 100%;
// background-color: white;
2023-11-24 19:32:45 +08:00
.tab-li {
2023-11-25 18:35:23 +08:00
width: 8vw;
border-left: 1px solid #4AB9D0;
text-align: center;
2023-11-24 19:32:45 +08:00
cursor: pointer;
2023-11-25 18:35:23 +08:00
height: 1.5vh;
position: relative;
// background-color: red;
.tab-img {
position: absolute;
top: 50%;
left: 50%;
transform: (translate(-50%, -50%));
}
2023-11-24 19:32:45 +08:00
}
}
.right {
display: flex;
font-size: 15px;
margin-right: 30px;
2023-11-23 19:39:47 +08:00
position: relative;
2023-12-11 18:35:55 +08:00
align-items: center;
2023-11-24 19:32:45 +08:00
.address {
left: 1vw;
top: 18px;
2023-11-23 19:39:47 +08:00
position: absolute;
2023-11-24 19:32:45 +08:00
width: 8vw;
height: 18vh;
background-color: #001E32;
color: #C7DBE3;
z-index: 9999;
overflow-y: auto;
box-sizing: border-box;
padding: 5px;
.address-li {
padding: 2px 5px;
cursor: pointer;
border-bottom: 0.1px solid #0E293C;
}
}
.address::-webkit-scrollbar {
width: 10px;
background-color: #153041;
}
.address::-webkit-scrollbar-track {
background-color: #153041;
}
::-webkit-scrollbar-thumb {
background-color: #4AB9D0;
border-radius: 5px;
}
.rigth-li {
height: 15px;
line-height: 15px;
padding: 0 10px;
cursor: pointer;
2023-11-27 18:34:57 +08:00
display: flex;
align-items: center;
2023-11-24 19:32:45 +08:00
}
.right-line {
width: 1px;
height: 15px;
display: flex;
flex-direction: column;
justify-content: space-between;
span {
width: 1px;
height: 7px;
background-color: #4BB9D0;
}
2023-11-23 19:39:47 +08:00
}
}
}
2023-11-24 19:32:45 +08:00
.v-enter-active,
.v-leave-active {
transition: opacity 0.5s ease;
2023-11-23 19:39:47 +08:00
}
2023-11-24 19:32:45 +08:00
.v-enter-from,
.v-leave-to {
opacity: 0;
}
</style>