import Vue from 'vue' import Router from 'vue-router' Vue.use(Router) /* Layout */ import Layout from '@/layout' /* 所有角色可以访问/没有权限要求的基页 */ import codemenu from './modules/codemenu' export const constantRoutes = [{ path: '/', redirect: 'login' }, { path: '/login', component: () => import('@/views/login/login.vue'), name: 'login' }, // { // path: '/', // redirect: 'userInfo/index' // }, // { // path: '/index', // component: () => import('@/views/userInfo/index.vue'), // name: 'index' // }, { path: '/index', component: Layout, redirect: '/index', children: [{ path: '/index', component: () => import('@/views/index.vue'), name: 'index', meta: { title: '主页', noCache: true, affix: true } }] }, { path: '/userInfo', component: Layout, redirect: null, meta: { title: '用户信息' }, children: [{ path: '/userInfo/index', component: () => import('@/views/userInfo/index.vue'), name: 'index', meta: { title: '用户信息列表' } }, ] }, { path: '/pms', component: Layout, redirect: null, meta: { title: '商品管理' }, children: [{ path: 'product', name: 'product', component: () => import('@/views/pms/product/index'), meta: { title: '商品列表', icon: 'product-list' } }, { path: 'addProduct', name: 'addProduct', component: () => import('@/views/pms/product/add'), meta: { title: '添加商品', icon: 'product-add' } }, { path: 'updateProduct', name: 'updateProduct', component: () => import('@/views/pms/product/update'), meta: { title: '修改商品', icon: 'product-add' }, hidden: true }, { path: 'productRecycle', name: 'productRecycle', component: () => import('@/views/pms/product/index'), meta: { title: '商品回收站', icon: 'product-recycle' }, hidden: true }, { path: 'brand', component: () => import('@/views/pms/brand/index.vue'), name: 'brand', meta: { title: '品牌管理' } }, { path: 'addBrand', name: 'addBrand', component: () => import('@/views/pms/brand/add'), meta: { title: '添加品牌' }, hidden: true }, { path: 'updateBrand', name: 'updateBrand', component: () => import('@/views/pms/brand/update'), meta: { title: '编辑品牌' }, hidden: true }, { path: 'productCate', component: () => import('@/views/pms/productCate/index'), name: 'productCate', meta: { title: '商品分类' } }, { path: 'addProductCate', name: 'addProductCate', component: () => import('@/views/pms/productCate/add'), meta: { title: '添加商品分类' }, hidden: true }, { path: 'updateProductCate', name: 'updateProductCate', component: () => import('@/views/pms/productCate/update'), meta: { title: '修改商品分类' }, hidden: true }, { path: 'unit', component: () => import('@/views/pms/unit/index'), name: 'Unit', meta: { title: '商品单位' } }, { path: 'addUnit', name: 'addUnit', component: () => import('@/views/pms/unit/add'), meta: { title: '添加商品单位' }, hidden: true }, { path: 'updateUnit', name: 'updateUnit', component: () => import('@/views/pms/unit/update'), meta: { title: '修改商品单位' }, hidden: true }, { path: 'productAttr', component: () => import('@/views/pms/productAttr/index'), name: 'giftCard', meta: { title: '商品类型' } }, ] }, { path: '/marketingCard', component: Layout, redirect: '/marketingCard/applet', children: [ { path: '/marketingCard/applet', component: () => import('@/views/marketingCard/applet.vue'), name: 'applet', meta: { title: '小程序礼包设置', noCache: true } }, { path: '/marketingCard/newUserGift', component: () => import('@/views/marketingCard/newUserGift.vue'), name: 'newUserGift', meta: { title: '新人推荐礼包设置', noCache: true } }, { path: '/marketingCard/index', component: () => import('@/views/marketingCard/index.vue'), name: 'index', meta: { title: '礼包设置', noCache: true } }, { path: '/marketingCard/pickupCardSet', component: () => import('@/views/marketingCard/pickupCardSet.vue'), name: 'pickupCardSet', meta: { title: '个人卡设置', noCache: true } }, { path: '/marketingCard/corporateCardSet', component: () => import('@/views/marketingCard/corporateCardSet.vue'), name: 'corporateCardSet', meta: { title: '企业卡设置', noCache: true } }, // { // path: '/marketingCard/grantRecords', // component: () => import('@/views/marketingCard/grantRecords.vue'), // name: 'grantRecords', // meta: { // title: '发放记录', // noCache: true // } // }, // { // path: '/marketingCard/carList', // component: () => import('@/views/marketingCard/carList.vue'), // name: 'carList', // meta: { // title: '提货卡列表', // noCache: true // } // }, ] }, { path: '/cardManage', component: Layout, redirect: '/cardManage/person', children: [{ path: '/cardManage/person', component: () => import('@/views/cardManage/person.vue'), name: 'person', meta: { title: '个人卡统计', noCache: true } }, { path: '/cardManage/enterprise', component: () => import('@/views/cardManage/enterprise.vue'), name: 'enterprise', meta: { title: '企业卡统计', noCache: true } }, { path: '/cardManage/giftCard', component: () => import('@/views/cardManage/giftCard.vue'), name: 'giftCard', meta: { title: '福利卡统计', noCache: true } }, ] }, { path: '/pickupPoint', component: Layout, redirect: '/pickupPoint/index', children: [{ path: '/pickupPoint/index', component: () => import('@/views/pickupPoint/index.vue'), name: 'index', meta: { title: '提货点信息' } }, ] }, { path: '/coupon', component: Layout, redirect: '/coupon/index', children: [{ path: '/coupon/index', component: () => import('@/views/coupon/index.vue'), name: 'index', meta: { title: '优惠券管理' } }, { path: '/coupon/add', component: () => import('@/views/coupon/add.vue'), name: 'index', meta: { title: '优惠券管理' } }] }, { path: '/network', component: Layout, redirect: '/network/index', children: [{ path: '/network/index', component: () => import('@/views/network/index.vue'), name: 'index', meta: { title: '区域管理' } }, ] }, { path: '/commodity', component: Layout, redirect: '/commodity/index', children: [{ path: '/commodity/index', component: () => import('@/views/commodity/index.vue'), name: 'index', meta: { title: '商品信息' } }, ] }, { path: '/preSaleOrder', component: Layout, redirect: '/preSaleOrder/index', children: [{ path: '/preSaleOrder/index', component: () => import('@/views/preSaleOrder/index.vue'), name: 'index', meta: { title: '预售订单' } }, ] }, { path: '/order', component: Layout, redirect: '/order/index', children: [{ path: '/order/index', component: () => import('@/views/order/index.vue'), name: 'index', meta: { title: '订单统计' } }, { path: '/order/distributionCount', component: () => import('@/views/order/distributionCount.vue'), name: 'distributionCount', meta: { title: '网点配货统计' } }, { path: '/order/subBranch', component: () => import('@/views/order/subBranch.vue'), name: 'subBranch', meta: { title: '区域配货统计' } }, { path: '/order/allDistributionCount', component: () => import('@/views/order/allDistributionCount.vue'), name: 'allDistributionCount', meta: { title: '总配货统计' } } ] }, { path: '/orderreserve', component: Layout, redirect: '/orderreserve/index', children: [{ path: '/orderreserve/index', component: () => import('@/views/orderreserve/index.vue'), name: 'OrderreserveIndex', meta: { title: '预约提货单统计' } }, { path: '/orderreserve/distributionCount', component: () => import('@/views/orderreserve/distributionCount.vue'), name: 'OrderreserveDistributionCount', meta: { title: '网点配货统计' } }, { path: '/orderreserve/subBranch', component: () => import('@/views/orderreserve/subBranch.vue'), name: 'OrderreserveSubBranch', meta: { title: '区域配货统计' } }, { path: '/orderreserve/allDistributionCount', component: () => import('@/views/orderreserve/allDistributionCount.vue'), name: 'OrderreserveAllDistributionCount', meta: { title: '总配货统计' } } ] }, { path: '/statisticalReport', component: Layout, redirect: '/statisticalReport/index', children: [{ path: '/statisticalReport/index', component: () => import('@/views/statisticalReport/index.vue'), name: 'index', meta: { title: '提货卡汇总', noCache: true } }, { path: '/statisticalReport/collectionSummary', component: () => import('@/views/statisticalReport/collectionSummary.vue'), name: 'collectionSummary', meta: { title: '提货汇总', noCache: true } }, { path: '/statisticalReport/deliveryDetails', component: () => import('@/views/statisticalReport/deliveryDetails.vue'), name: 'deliveryDetails', meta: { title: '客户提货明细', noCache: true } } ] }, { path: '/print', component: Layout, redirect: '/print/index', children: [{ path: '/print/index', component: () => import('@/views/print/index.vue'), name: 'index', meta: { title: '打印电子卡' } }, { path: '/print/enterpriseCrad', component: () => import('@/views/print/enterpriseCrad.vue'), name: 'enterpriseCrad', meta: { title: '打印企业卡' } }, ] }, { path: '/appletNotice', component: Layout, redirect: '/appletNotice/index', children: [{ path: '/appletNotice/index', component: () => import('@/views/appletNotice/index.vue'), name: 'index', meta: { title: '小程序通告' } }, ] }, { path: '/appletBanner', component: Layout, redirect: '/appletBanner/index', children: [{ path: '/appletBanner/index', component: () => import('@/views/appletBanner/index.vue'), name: 'AppletBannerIndex', meta: { title: '小程序轮播图' } }, ] }, { path: '/authentication', component: Layout, redirect: '/authentication/index', children: [{ path: '/authentication/index', component: () => import('@/views/authentication/index.vue'), name: 'AuthenticationIndex', meta: { title: '企业认证审核' } }, ] }, { path: '/invoiceReview', component: Layout, redirect: '/invoiceReview/index', children: [{ path: '/invoiceReview/index', component: () => import('@/views/invoiceReview/index.vue'), name: 'AuthenticationIndex', meta: { title: '发票申请审核' } }, ] }, // { // path: '/ordertools', // component: Layout, // redirect: '/ordertools/index', // children: [{ // path: '/ordertools/index', // component: () => // import('@/views/ordertools/index.vue'), // name: 'OrdertoolsIndex', // meta: { // title: '订单发货导出工具' // } // }, ] // }, ...codemenu, { path: '/404', component: () => import('@/views/404'), hidden: true } // 404 page must be placed at the end !!! // { path: '*', redirect: '/404', hidden: true } ] const createRouter = () => new Router({ // mode: 'history', // require service support scrollBehavior: () => ({ y: 0 }), routes: constantRoutes }) const router = createRouter() // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465 export function resetRouter() { const newRouter = createRouter() router.matcher = newRouter.matcher // reset router } export default router