/**
 * Note: 路由配置项
 *
 * path: '/path'                    // 路由路径
 * name:'router-name'               // 设定路由的名字，一定要填写不然使用<keep-alive>时会出现各种问题
 * meta : {
    title: 'title'                  // 设置该路由在侧边栏的名字
    icon: 'icon-name'                // 设置该路由的图标
    activeMenu: '/system/user'      // 当路由设置了该属性，则会高亮相对应的侧边栏。
    query: '{"id": 1}'             // 访问路由的默认传递参数
    hidden: true                   // 当设置 true 的时候该路由不会在侧边栏出现 
    hideTab: true                   //当设置 true 的时候该路由不会在多标签tab栏出现
  }
 */

import type { RouteRecordRaw } from 'vue-router'
import { PageEnum } from '@/enums/pageEnum'
import Layout from '@/layout/default/index.vue'

export const LAYOUT = () => Promise.resolve(Layout)

export const INDEX_ROUTE_NAME = Symbol()

export const constantRoutes: Array<RouteRecordRaw> = [
    {
        path: PageEnum.ERROR_404,
        component: () => import('@/views/error/404.vue')
    },
    {
        path: PageEnum.ERROR_403,
        component: () => import('@/views/error/403.vue')
    },
    {
        path: PageEnum.LOGIN,
        component: () => import('@/views/account/login.vue')
    },
    {
        path: '/user',
        component: LAYOUT,
        children: [
            {
                path: 'setting',
                name: Symbol(),
                component: () => import('@/views/user/setting.vue'),
                meta: {
                    title: '个人设置'
                }
            }
        ]
    },
    {
        path: '/dev_tools',
        component: LAYOUT,
        children: [
            {
                path: 'code/edit',
                component: () => import('@/views/dev_tools/code/edit.vue'),
                meta: {
                    title: '编辑数据表',
                    activeMenu: '/dev_tools/code'
                }
            }
        ]
    },
    {
        path: '/setting',
        component: LAYOUT,
        children: [
            {
                path: 'dict/data',
                component: () => import('@/views/setting/dict/data/index.vue'),
                meta: {
                    title: '数据管理',
                    activeMenu: '/setting/dict'
                }
            },
            {
                path: 'system/task/edit',
                component: () => import('@/views/setting/system/task/edit.vue'),
                meta: {
                    title: '新增任务',
                    activeMenu: '/setting/system/task'
                }
            }
        ]
    },
    {
        path: '/setting',
        component: LAYOUT,
        children: [
            {
                path: 'dict/data',
                component: () => import('@/views/setting/dict/data/index.vue'),
                meta: {
                    title: '数据管理',
                    activeMenu: '/setting/dict'
                }
            }
        ]
    },
    {
        path: '/service',
        component: LAYOUT,
        children: [
            {
                path: 'lists/edit',
                component: () => import('@/views/service/lists/edit.vue'),
                meta: {
                    title: '服务列表',
                    activeMenu: '/service/lists'
                }
            }
        ]
    },
    {
        path: '/service',
        component: LAYOUT,
        children: [
            {
                path: 'category/edit',
                component: () => import('@/views/service/category/edit.vue'),
                meta: {
                    title: '服务列表',
                    activeMenu: '/service/category'
                }
            }
        ]
    },
    {
        path: '/service',
        component: LAYOUT,
        children: [
            {
                path: 'time/edit',
                component: () => import('@/views/service/subscribe/edit.vue'),
                meta: {
                    title: '预约服务时间',
                    activeMenu: '/service/subscribe'
                }
            }
        ]
    },
    {
        path: '/service',
        component: LAYOUT,
        children: [
            {
                path: 'activity/form',
                component: () => import('@/views/service/activity/form.vue'),
                meta: {
                    title: '活动专区',
                    activeMenu: '/service/activity'
                }
            }
        ]
    },
    {
        path: '/user',
        component: LAYOUT,
        children: [
            {
                path: 'userList/detail',
                component: () => import('@/views/user/userList/detail.vue'),
                meta: {
                    title: '用户列表',
                    activeMenu: '/user/userList'
                }
            }
        ]
    },
    {
        path: '/master_worker',
        component: LAYOUT,
        children: [
            {
                path: 'edit',
                component: () => import('@/views/master_worker/edit.vue'),
                name: 'MasterWorkerEdit',
                meta: {
                    title: '添加师傅',
                    activeMenu: '/master_worker/index'
                }
            }
        ]
    },
    {
        path: '/order',
        component: LAYOUT,
        children: [
            {
                path: 'lists/detail',
                component: () => import('@/views/order/lists/detail.vue'),
                meta: {
                    title: '订单列表',
                    activeMenu: '/order/lists'
                }
            }
        ]
    },
    {
        path: '/setting',
        component: LAYOUT,
        children: [
            {
                path: 'payment/payment_way/edit',
                component: () => import('@/views/setting/payment/payment_way/edit.vue'),
                meta: {
                    title: '支付方式',
                    activeMenu: '/setting/payment/payment_way'
                }
            }
        ]
    },
    {
        path: '/marketing',
        component: LAYOUT,
        children: [
            {
                path: 'coupon/edit',
                component: () => import('@/views/application/coupon/edit.vue'),
                meta: {
                    title: '新增优惠券',
                    activeMenu: '/application/coupon/coupon'
                }
            }
        ]
    },
    // 分销管理
    {
        path: '/distributor',
        component: LAYOUT,
        children: [
            {
                path: 'add',
                component: () => import('@/views/distributor/edit.vue'),
                name: 'DistributorAdd',
                meta: {
                    title: '添加分销',
                    activeMenu: '/distributor/index'
                }
            }
        ]
    },
    {
        path: '/distributor',
        component: LAYOUT,
        children: [
            {
                path: 'edit',
                component: () => import('@/views/distributor/edit.vue'),
                name: 'DistributorEdit',
                meta: {
                    title: '编辑分销',
                    activeMenu: '/distributor/index'
                }
            }
        ]
    },
    {
        path: '/distributor',
        component: LAYOUT,
        children: [
            {
                path: 'register',
                component: () => import('@/views/distributor/register.vue'),
                name: 'DistributorRegister',
                meta: {
                    title: '查看用户',
                    activeMenu: '/distributor/index'
                }
            }
        ]
    },
    {
        path: '/distributor',
        component: LAYOUT,
        children: [
            {
                path: 'order',
                component: () => import('@/views/distributor/order.vue'),
                name: 'DistributorOrder',
                meta: {
                    title: '查看订单',
                    activeMenu: '/distributor/index'
                }
            }
        ]
    },
    {
        path: '/distributor',
        component: LAYOUT,
        children: [
            {
                path: 'register/detail',
                component: () => import('@/views/distributor/userDetail.vue'),
                name: 'DistributorRegisterDetail',
                meta: {
                    title: '用户详情',
                    activeMenu: '/distributor/index'
                }
            }
        ]
    },
    {
        path: '/marketing',
        component: LAYOUT,
        children: [
            {
                path: 'coupon/edit',
                component: () => import('@/views/application/coupon/edit.vue'),
                meta: {
                    title: '新增优惠券',
                    activeMenu: '/application/coupon/coupon'
                }
            }
        ]
    },
    {
        path: '/marketing',
        component: LAYOUT,
        children: [
            {
                path: 'coupon/detail',
                component: () => import('@/views/application/coupon/detail.vue'),
                name: 'CouponDetail',
                meta: {
                    title: '优惠券详情',
                    activeMenu: '/application/coupon/coupon'
                }
            }
        ]
    },
    {
        path: '/distributor',
        component: LAYOUT,
        children: [
            {
                path: 'coupon',
                component: () => import('@/views/distributor/coupon.vue'),
                name: 'DistributorCoupon',
                meta: {
                    title: '查看优惠券',
                    activeMenu: '/distributor/index'
                }
            }
        ]
    },
    {
        path: '/master_worker',
        component: LAYOUT,
        children: [
            {
                path: 'detail',
                component: () => import('@/views/master_worker/detail.vue'),
                meta: {
                    title: '师傅认证资料详情',
                    activeMenu: '/master_worker/apply'
                }
            }
        ]
    },
    {
        path: '/report/pdf',
        component: () => import('@/views/master_worker/components/previewPdf.vue'),
        meta: {
            title: '师傅体检报告'
        }
    },
    // {
    //     path: '/master_worker',
    //     component: LAYOUT,
    //     children: [
    //         {
    //             path: 'physical',
    //             component: () => import('@/views/master_worker/physical.vue'),
    //             meta: {
    //                 title: '师傅体检报告',
    //             }
    //         }
    //     ]
    // },
    {
        path: '/master_worker',
        component: LAYOUT,
        children: [
            {
                path: 'staff',
                component: () => import('@/views/master_worker/staff.vue'),
                meta: {
                    title: '师傅资料',
                    activeMenu: '/master_worker/apply'
                }
            }
        ]
    },

    {
        path: '/master_worker',
        component: LAYOUT,
        children: [
            {
                path: 'cancelOrderRule',
                component: () => import('@/views/master_worker/cancelOrder/rule.vue'),
                meta: {
                    title: '师傅退单规则',
                    activeMenu: '/master_worker/cancelOrder'
                }
            }
        ]
    },
    {
        path: '/user',
        component: LAYOUT,
        children: [
            {
                path: 'setting_rule',
                component: () => import('@/views/user/refund_rule/setting_rule.vue'),
                meta: {
                    title: '用户退单规则',
                    activeMenu: '/user/refund_rule_list'
                }
            }
        ]
    }
]

export const INDEX_ROUTE: RouteRecordRaw = {
    path: PageEnum.INDEX,
    component: LAYOUT,
    name: INDEX_ROUTE_NAME
}
