You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

579 lines
24 KiB

<template>
<div :class="{ 'has-logo': showLogo }">
<logo v-if="showLogo" :collapse="isCollapse" />
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-menu :default-active="$route.path" :background-color="variables.menuBg" :text-color="variables.menuText"
:unique-opened="false" :active-text-color="variables.menuActiveText" :collapse-transition="false"
mode="vertical">
<sidebar-item v-for="route in routes" :key="route.path" :item="route" :base-path="route.path" />
</el-menu>
</el-scrollbar>
</div>
</template>
<script>
import {
mapGetters
} from 'vuex'
import Logo from './Logo'
import SidebarItem from './SidebarItem'
import variables from '@/styles/variables.scss'
import {
getrolemenus,
loginDetails
} from '@/api/system/Role/role.js'
import {
getStorage
} from '@/utils/auth'
export default {
components: {
SidebarItem,
Logo
},
data() {
return {
YongHuid: [],
// routes: [],
params: {
sourceSid: '',
userSid: ''
},
routes: [
// {
// alwaysShow: true,
// component: 'userInfo',
// meta: {
// icon: 'el-icon-menu',
// title: '用户信息'
// },
// name: '/userInfo/index',
// path: '/userInfo/index'
// },
{
alwaysShow: true,
component: 'pms',
meta: {
icon: 'el-icon-menu',
title: '商品管理'
},
name: '/pms',
path: '/pms',
children: [
// {
// alwaysShow: true,
// component: 'product',
// meta: {
// icon: 'el-icon-help',
// title: '商品列表'
// },
// name: '/pms/product',
// path: '/pms/product'
// },
// {
// path: '/pms/addProduct',
// name: '/pms/addProduct',
// component: 'addProduct',
// meta: {
// title: '添加商品',
// icon: 'el-icon-help'
// }
// },
{
alwaysShow: true,
component: 'brand',
meta: {
icon: 'el-icon-help',
title: '品牌管理'
},
name: '/pms/brand',
path: '/pms/brand'
}, {
alwaysShow: true,
component: 'productCate',
meta: {
icon: 'el-icon-help',
title: '商品分类'
},
name: '/pms/productCate',
path: '/pms/productCate'
}
// , {
// alwaysShow: true,
// component: 'productAttr',
// meta: {
// icon: 'el-icon-help',
// title: '商品类型'
// },
// name: '/pms/productAttr',
// path: '/pms/productAttr'
// }
]
},
// {
// alwaysShow: true,
// component: 'marketingCard',
// meta: {
// icon: 'el-icon-menu',
// title: '营销卡设置'
// },
// name: '/marketingCard',
// path: '/marketingCard',
// children: [{
// alwaysShow: true,
// component: 'index',
// meta: {
// icon: 'el-icon-help',
// title: '小程序礼包设置'
// },
// name: '/marketingCard/applet',
// path: '/marketingCard/applet'
// },
// {
// alwaysShow: true,
// component: 'index',
// meta: {
// icon: 'el-icon-help',
// title: '新人推荐礼包设置'
// },
// name: '/marketingCard/newUserGift',
// path: '/marketingCard/newUserGift'
// },
// {
// alwaysShow: true,
// component: 'index',
// meta: {
// icon: 'el-icon-help',
// title: '礼包设置'
// },
// name: '/marketingCard/index',
// path: '/marketingCard/index'
// },
// {
// alwaysShow: true,
// component: 'pickupCardSet',
// meta: {
// icon: 'el-icon-help',
// title: '个人卡设置'
// },
// name: '/marketingCard/pickupCardSet',
// path: '/marketingCard/pickupCardSet'
// },
// {
// alwaysShow: true,
// component: 'corporateCardSet',
// meta: {
// icon: 'el-icon-help',
// title: '企业卡设置'
// },
// name: '/marketingCard/corporateCardSet',
// path: '/marketingCard/corporateCardSet'
// }
// // {
// // alwaysShow: true,
// // component: "grantRecords",
// // meta: {
// // icon: "el-icon-help",
// // title: "发放记录",
// // },
// // name: "/marketingCard/grantRecords",
// // path: "/marketingCard/grantRecords",
// // },
// // {
// // alwaysShow: true,
// // component: "carList",
// // meta: {
// // icon: "el-icon-help",
// // title: "提货卡列表",
// // },
// // name: "/marketingCard/carList",
// // path: "/marketingCard/carList",
// // },
// ]
// },
// {
// alwaysShow: true,
// component: 'carManage',
// meta: {
// icon: 'el-icon-menu',
// title: '营销卡管理'
// },
// name: '/cardManage',
// path: '/cardManage',
// children: [
// {
// alwaysShow: true,
// component: 'person',
// meta: {
// icon: 'el-icon-help',
// title: '个人卡统计'
// },
// name: '/cardManage/person',
// path: '/cardManage/person'
// },
// {
// alwaysShow: true,
// component: 'enterprise',
// meta: {
// icon: 'el-icon-help',
// title: '企业卡统计'
// },
// name: '/cardManage/enterprise',
// path: '/cardManage/enterprise'
// }, {
// alwaysShow: true,
// component: 'giftCard',
// meta: {
// icon: 'el-icon-help',
// title: '福利卡统计'
// },
// name: '/cardManage/giftCard',
// path: '/cardManage/giftCard'
// }
// ]
// },
{
alwaysShow: true,
component: 'pickupPoint',
meta: {
icon: 'el-icon-menu',
title: '提货地点'
},
name: '/pickupPoint/index',
path: '/pickupPoint/index'
},
// {
// alwaysShow: true,
// component: 'coupon',
// meta: {
// icon: 'el-icon-menu',
// title: '优惠券管理'
// },
// name: '/coupon/index',
// path: '/coupon/index'
// },
// {
// alwaysShow: true,
// component: 'network',
// meta: {
// icon: 'el-icon-menu',
// title: '支行管理'
// },
// name: '/network/index',
// path: '/network/index'
// },
{
alwaysShow: true,
component: 'commodity',
meta: {
icon: 'el-icon-menu',
title: '商品信息'
},
name: '/commodity/index',
path: '/commodity/index'
},
// {
// alwaysShow: true,
// component: 'order',
// meta: {
// icon: 'el-icon-menu',
// title: '订单管理'
// },
// name: '/order',
// path: '/order',
// children: [{
// alwaysShow: true,
// component: 'index',
// meta: {
// icon: 'el-icon-help',
// title: '订单统计'
// },
// name: '/order/index',
// path: '/order/index'
// },
// {
// alwaysShow: true,
// component: 'distributionCount',
// meta: {
// icon: 'el-icon-help',
// title: '网点配货统计'
// },
// name: '/order/distributionCount',
// path: '/order/distributionCount'
// },
// {
// alwaysShow: true,
// component: 'subBranch',
// meta: {
// icon: 'el-icon-help',
// title: '支行配货统计'
// },
// name: '/order/subBranch',
// path: '/order/subBranch'
// },
// {
// alwaysShow: true,
// component: 'allDistributionCount',
// meta: {
// icon: 'el-icon-help',
// title: '总配货统计'
// },
// name: '/order/allDistributionCount',
// path: '/order/allDistributionCount'
// }
// ]
// },
{
alwaysShow: true,
component: 'orderreserve',
meta: {
icon: 'el-icon-menu',
title: '预约提货单'
},
name: '/orderreserve',
path: '/orderreserve',
children: [{
alwaysShow: true,
component: 'index',
meta: {
icon: 'el-icon-help',
title: '预约单统计'
},
name: '/orderreserve/index',
path: '/orderreserve/index'
},
{
alwaysShow: true,
component: 'distributionCount',
meta: {
icon: 'el-icon-help',
title: '网点配货统计'
},
name: '/orderreserve/distributionCount',
path: '/orderreserve/distributionCount'
},
{
alwaysShow: true,
component: 'subBranch',
meta: {
icon: 'el-icon-help',
title: '支行配货统计'
},
name: '/orderreserve/subBranch',
path: '/orderreserve/subBranch'
},
{
alwaysShow: true,
component: 'allDistributionCount',
meta: {
icon: 'el-icon-help',
title: '总配货统计'
},
name: '/orderreserve/allDistributionCount',
path: '/orderreserve/allDistributionCount'
}
]
},
// {
// alwaysShow: true,
// component: "order",
// meta: {
// icon: "el-icon-menu",
// title: "订单信息",
// },
// name: "/order/index",
// path: "/order/index"
// },
// {
// alwaysShow: true,
// component: 'print',
// meta: {
// icon: 'el-icon-menu',
// title: '电子卡管理'
// },
// name: '/print',
// path: '/print',
// children: [{
// alwaysShow: true,
// component: 'index',
// meta: {
// icon: 'el-icon-help',
// title: '打印电子卡'
// },
// name: '/print/index',
// path: '/print/index'
// },
// {
// alwaysShow: true,
// component: 'print',
// meta: {
// icon: 'el-icon-menu',
// title: '打印企业卡'
// },
// name: '/print/enterpriseCrad',
// path: '/print/enterpriseCrad'
// }
// ]
// },
{
alwaysShow: true,
component: 'applet',
meta: {
icon: 'el-icon-menu',
title: '小程序设置'
},
name: '/applet',
path: '/applet',
children: [{
alwaysShow: true,
component: 'appletNotice',
meta: {
icon: 'el-icon-menu',
title: '小程序通告'
},
name: '/appletNotice/index',
path: '/appletNotice/index'
}, {
alwaysShow: true,
component: 'appletBanner',
meta: {
icon: 'el-icon-menu',
title: '小程序轮播图'
},
name: '/appletBanner/index',
path: '/appletBanner/index'
},
{
alwaysShow: true,
component: 'appletBanner',
meta: {
icon: 'el-icon-menu',
title: '企业认证审核'
},
name: '/authentication/index',
path: '/authentication/index'
},
{
alwaysShow: true,
component: 'appletBanner',
meta: {
icon: 'el-icon-menu',
title: '发票申请审核'
},
name: '/invoiceReview/index',
path: '/invoiceReview/index'
},
// {
// alwaysShow: true,
// component: 'OrdertoolsIndex',
// meta: {
// icon: 'el-icon-menu',
// title: '订单发货导出工具'
// },
// name: '/ordertools/index',
// path: '/ordertools/index'
// }
]
}
]
}
},
computed: {
...mapGetters(['sidebar']),
// routes() {
// f4d2e507-c4ed-451c-b364-04c08f962045
// console.log('78979789', this.$router.options.routes)
// return this.$router.options.routes
// },
activeMenu() {
// const route = this.$route
// const {
// meta,
// path
// } = route
// // if set path, the sidebar will highlight the path you set
// if (meta.activeMenu) {
// return meta.activeMenu
// }
return '/index'
},
showLogo() {
return this.$store.state.settings.sidebarLogo
},
variables() {
return variables
},
isCollapse() {
return !this.sidebar.opened
}
},
created() {
this.postHuoquyonghu()
},
methods: {
// 获取用户信息
postHuoquyonghu() {
// var token = getStorage()
// loginDetails(token).then((response) => {
// console.log('resss', response)
// if (response.code === '200') {
// this.YongHuid = response.data
// this.params.userSid = this.YongHuid.sid
// getrolemenus(this.params).then((res) => {
// const userRoles = this.resRouter(res.data)
this.routes.push({
path: '*',
redirect: '/404',
hidden: true
})
console.log('左侧菜单', this.routes)
return this.routes
// })
// }
// })
},
resRouter(menus) {
// 递归,将后台传来数组
for (var i = 0; i < menus.length; i++) {
if (menus[i].children && menus[i].children.length != 0) {
this.resRouter(menus[i].children)
}
if (menus[i].children.length == 0) {
delete menus[i].children
delete menus[i].redirect
}
if (menus[i].component == '') {
console.log('55555', menus[i])
menus[i] = {
path: menus[i].path,
component: '',
redirect: menus[i].path,
children: [menus[i]]
}
} else {
// menus[i] = {
// path: menus[i].path,
// component: '',
// redirect: menus[i].path,
// children: [menus[i]],
// }
}
}
this.routes = menus
console.log('左侧菜单', this.routes)
return menus
}
}
}
</script>