import {
  createRouter,
  createWebHashHistory,
  createWebHistory,
  RouteRecordRaw,
} from "vue-router";

const routes: Array<RouteRecordRaw> = [
  {
    path: "/login",
    name: "登陆",
    component: () => import("@/pages/login/login.vue"),
  },
  {
    path: "/:cathAll(.*)",
    name: "未找到",
    component: () => import("@/pages/404/404.vue"),
  },
  {
    path: "/",
    name: "主页",
    redirect: "main",
    component: () => import("@/layout/index.vue"),
    children: [
      {
        path: "/main",
        name: "首页",
        meta: {
          icon: {
            type: "elem",
            value: "House",
          },
        },
        component: () => import("@/pages/main/index.vue"),
      },
      {
        path: "/system",
        name: "系统设置",
        meta: {
          icon: {
            type: "elem",
            value: "Setting",
          },
        },
        children: [
          {
            path: "/account",
            name: "用户管理",
            meta: {
              icon: {
                type: "elem",
                value: "User",
              },
            },
            component: () => import("@/pages/system/user/index.vue"),
          },
          {
            path: "/role",
            name: "角色管理",
            meta: {
              icon: {
                type: "elem",
                value: "Avatar",
              },
            },
            component: () => import("@/pages/system/role/index.vue"),
          },
          {
            path: "/menue",
            name: "菜单管理",
            meta: {
              icon: {
                type: "elem",
                value: "Menu",
              },
            },
            component: () => import("@/pages/system/menue/index.vue"),
          },
          {
            path: "/personal",
            name: "个人中心",
            meta: {
              icon: {
                type: "elem",
                value: "UserFilled",
              },
            },
            component: () => import("@/pages/system/user/personal.vue"),
          },
        ],
      },
      {
        path: "/serviceList",
        name: "服务项目",
        meta: {
          icon: {
            type: "elem",
          },
        },
        component: () => import("@/pages/serviceList/serviceList.vue"),
      },
      {
        path: "/funeralRetail",
        name: "殡仪零售",
        meta: {
          icon: {
            type: "svg",
            value: "零售",
          },
        },
        component: () => import("@/pages/funeralRetail/funeralRetail.vue"),
      },
      {
        path: "/funeralServices",
        name: "殡仪服务",
        meta: {
          icon: {
            type: "svg",
            value: "服务.svg",
          },
        },
        component: () => import("@/pages/funeralServices/funeralServices.vue"),
      },
      {
        path: "/checkout",
        name: "结账处理",
        meta: {
          icon: {
            type: "svg",
            value: "结账.svg",
          },
        },
        component: () => import("@/pages/checkout/checkout.vue"),
      },
      {
        path: "/invalidReview",
        name: "作废审核",
        meta: {
          icon: {
            type: "svg",
            value: "作废.svg",
          },
        },
        component: () => import("@/pages/invalidReview/invalidReview.vue"),
      },
      {
        path: "/funeralRetail",
        name: "零售管理",
        meta: {
          icon: {
            type: "svg",
            value: "零售.svg",
          },
        },
        component: () => import("@/pages/funeralRetail/funeralRetail.vue"),
        children: [
          {
            path: "/departedSaint",
            name: "逝者零售管理",
            meta: {
              icon: {
                type: "svg",
                value: "零售管理.svg",
              },
            },
            component: () =>
              import("@/pages/funeralRetail/departedSaint/departedSaint.vue"),
          },
          {
            path: "/noDepartedSaint",
            name: "无逝者零售登记",
            meta: {
              icon: {
                type: "svg",
                value: "登记.svg",
              },
            },
            component: () =>
              import(
                "@/pages/funeralRetail/noDepartedSaint/noDepartedSaint.vue"
              ),
          },
          {
            path: "/saintCheckout",
            name: "零售结算",
            meta: {
              icon: {
                type: "svg",
                value: "结算.svg",
              },
            },
            component: () =>
              import("@/pages/funeralRetail/saintCheckout/saintCheckout.vue"),
          },
        ],
      },

      {
        path: "/statistics",
        name: "后台统计",
        meta: {
          icon: {
            type: "svg",
            value: "统计.svg",
          },
        },
        children: [
          {
            path: "/sales",
            name: "销售统计报表",
            meta: {
              icon: {
                type: "svg",
                value: "销售统计.svg",
              },
            },
            component: () => import("@/pages/statistics/sales/sales.vue"),
          },
          {
            path: "/saleDetail",
            name: "公司销售明细",
            meta: {
              icon: {
                type: "svg",
                value: "销售明细.svg",
              },
            },
            component: () =>
              import("@/pages/statistics/saleDetail/saleDetail.vue"),
          },
          // {
          //   path: "/guideDetail",
          //   name: "引导员销售统计表",
          //   meta: {
          //     icon: {
          //       type: "elem",
          //       value: "Menu",
          //     },
          //   },
          //   component: () =>
          //     import("@/pages/statistics/guideDetail/guideDetail.vue"),
          // },
          {
            path: "/dayIncome",
            name: "公司日收入统计表",
            meta: {
              icon: {
                type: "svg",
                value: "日收入.svg",
              },
            },
            component: () =>
              import("@/pages/statistics/dayIncome/dayIncome.vue"),
          },
        ],
      },
    ],
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
