import Layout from '@/layout'

const productRouter = {
  path: '/product',
  component: Layout,
  redirect: '/product/product',
  alwaysShow: true, // will always show the root menu
  name: 'ProductSetting', // name必须和后台配置一致，不然匹配不到
  meta: { title: '商品设置', icon: 'component' },
  children: [
    {
      path: 'product',
      component: () => import('@/views/index'),
      redirect: '/product/product/list',
      name: 'ProductManage',
      meta: { title: '商品管理', icon: 'documentation' },
      children: [
        {
          path: 'list',
          hidden: true,
          component: () => import('@/views/product/product/list.vue'),
          name: 'ProductList',
          meta: { title: '商品列表', activeMenu: '/product/product' }
        },
        {
          path: 'edit',
          hidden: true,
          component: () => import('@/views/product/product/form.vue'),
          name: 'ProductEdit',
          meta: { title: '编辑商品', noCache: true, activeMenu: '/product/product' }
        },
        {
          path: 'add',
          hidden: true,
          component: () => import('@/views/product/product/form.vue'),
          name: 'ProductEdit',
          meta: { title: '添加商品', noCache: true, activeMenu: '/product/product' }
        }
      ]
    },
    {
      path: 'classify',
      component: () => import('@/views/index'),
      redirect: '/product/classify/list',
      name: 'ClassifyManage',
      meta: { title: '分类管理', icon: 'documentation' },
      children: [
        {
          path: 'list',
          hidden: true,
          component: () => import('@/views/product/classify/list.vue'),
          name: 'ClassifyList',
          meta: { title: '分类列表', activeMenu: '/product/classify' }
        },
        {
          path: 'edit',
          hidden: true,
          component: () => import('@/views/product/classify/form.vue'),
          name: 'ClassifyEdit',
          meta: { title: '编辑分类', noCache: true, activeMenu: '/product/classify' }
        },
        {
          path: 'add',
          hidden: true,
          component: () => import('@/views/product/classify/form.vue'),
          name: 'ClassifyEdit',
          meta: { title: '添加分类', noCache: true, activeMenu: '/product/classify' }
        }
      ]
    }
  ]
}
export default productRouter
