import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);
import Layout from "@/layout";
const routes = [
  {
    path: "/login",
    component: () => import("@/views/login/index"),
    hidden: true
  },
  {
    path: "/register",
    name: "register",
    component: () => import("@/views/register/index"),
    hidden: true
  },
  {
    path: "/",
    component: Layout,
    redirect: "/home",
    children: [
      {
        path: "home",
        name: "home",
        component: () => import("@/views/home"),
        meta: { title: "首页", icon: "user" }
      },
      {
        path: "Operationmanual",
        component: () => import("@/views/home/Operationmanual"),
        name: "Operationmanual",
        meta: {
          title: "操作手册",
          noCache: true,
          activeMenu: "/Operationmanual"
        },
        hidden: true
      }
    ]
  },
  {
    path: "/user",
    component: Layout,
    hidden: true,
    children: [
      {
        path: "user",
        name: "user",
        component: () => import("@/views/user"),
        meta: { title: "修改密码", icon: "user" }
      }
    ]
  },
  {
    path: "/Commoditymanagement",
    component: Layout,
    alwaysShow: true, // 一直显示根路由
    meta: { title: "商品管理", icon: "el-icon-setting" },
    redirect: "/Commoditymanagement/Commoditylist",
    children: [
      {
        path: "Commoditylist",
        name: "Commoditylist",
        component: () => import("@/views/Commoditymanagement/Commoditylist"),
        meta: { title: "商品列表" },
        hidden: true
      },
      {
        path: "Editlist",
        component: () => import("@/views/Commoditymanagement/Editlist"),
        name: "Editlist",
        meta: {
          title: "商品信息",
          noCache: true,
          activeMenu: "/Commoditymanagement/Editlist"
        },
        hidden: true
      },
      // 多级套餐列表
      {
        path: "moreLevel",
        component: () => import("@/views/Commoditymanagement/moreLevel/index"),
        name: "CommoditymanagementMoreLevel",
        meta: {
          title: "多级套餐商品列表",
        },
      },
      {
        path: "MoreLevelEditlist",
        component: () => import("@/views/Commoditymanagement/MoreLevelEditlist/index"),
        name: "MoreLevelEditlist",
        meta: {
          title: "多级套餐商品信息",
          // noCache: true,
          activeMenu: "/Commoditymanagement/MoreLevelEditlist"
        },
        hidden: true
      },
    ]
  },
  {
    path: "/Ordermanagement",
    component: Layout,
    redirect: "/Ordermanagement/Orderlist",
    name: "Ordermanagement",
    alwaysShow: true, // 一直显示根路由
    meta: { title: "订单管理", icon: "el-icon-tickets" },
    children: [
      {
        path: "Orderlist",
        name: "Orderlist",
        component: () => import("@/views/Ordermanagement/Orderlist"),
        meta: { title: "订单列表" }
      },
      {
        path: "details",
        name: "details",
        component: () => import("@/views/Ordermanagement/components/details"),
        meta: { title: "查看订单详情" },
        hidden: true
      },
      {
        path: "logistics",
        name: "logistics",
        component: () => import("@/views/Ordermanagement/components/logistics"),
        meta: { title: "查看物流详情" },
        hidden: true
      },
      {
        path: "errorList",
        name: "errorList",
        component: () => import("@/views/Ordermanagement/components/errorList"),
        meta: { title: "物流错误信息" },
        hidden: true
      }
    ]
  },
  {
    path: "/Storemanagement",
    component: Layout,
    redirect: "/Storemanagement/Storehome",
    name: "Storemanagement",
    alwaysShow: true, // 一直显示根路由
    meta: { title: "店铺管理", icon: "el-icon-s-goods" },
    children: [
      {
        path: "Storehome",
        name: "Storehome",
        component: () => import("@/views/Storemanagement/Storehome"),
        meta: { title: "店铺首页管理" }
      }
    ]
  },
  // {
  //   path: "/test",
  //   component: Layout,
  //   redirect: "/test/test",
  //   name: "test",
  //   alwaysShow: true, // 一直显示根路由
  //   meta: { title: "测试", icon: "el-icon-s-goods" },
  //   children: [
  //     { 
  //       path: "test",
  //       name: "test",
  //       component: () => import("@/views/test/test"),
  //       meta: { title: "供应商管理" }
  //     }
  //   ]
  // },
  // 404页必须放在末尾！！！
  { path: "*", redirect: "/404", hidden: true }
];

const router = new VueRouter({
  routes
});

export default router;
