/**
 * @author https://github.com/zxwk1998/vue-admin-better （不想保留author可删除）
 * @description router全局配置，如有必要可分文件抽离，其中asyncRoutes只有在intelligence模式下才会用到，vip文档中已提供路由的基础图标与小清新图标的配置方案，请仔细阅读
 */

import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/layouts'
import EmptyLayout from '@/layouts/EmptyLayout'
import { publicPath, routerMode } from '@/config'

Vue.use(VueRouter)
export const constantRoutes = [
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true,
  },
  {
    path: '/register',
    component: () => import('@/views/register/index'),
    hidden: true,
  },
  {
    path: '/401',
    name: '401',
    component: () => import('@/views/401'),
    hidden: true,
  },
  {
    path: '/404',
    name: '404',
    component: () => import('@/views/404'),
    hidden: true,
  },
]

export const asyncRoutes = [
  {
    path: '/',
    component: Layout,
    redirect: '/index',
    children: [
      {
        path: 'index',
        
        name: 'Index',
        component: () => import('@/views/index/index'),
        meta: {
          title: '首页',
          icon: 'home',
          affix: true,
        },
      },
    ],
  },
  {
    path: '/mall',
    component: Layout,
    redirect: 'noRedirect',
    name: 'Mall',
    meta: {
      title: '预约数据',
      icon: 'book',
      permissions: ['admin'],
    },

    children: [
      {
        path: 'pay',
        name: 'Pay',
        component: () => import('@/views/mall/pay/index'),
        meta: {
          title: '洗护订单管理',
          noKeepAlive: true,
        },
        children: null,
      },
        {
        path: 'doorOrder',
        name: 'doorOrder',
        component: () => import('@/views/mall/doorOrder/index'),
        meta: {
          title: '上门订单管理',
          noKeepAlive: true,
        },
        children: null,
      },
        {
        path: 'registerUser',
        name: 'registerUser',
        component: () => import('@/views/mall/registerUser/index'),
        meta: {
          title: '注册用户',
          noKeepAlive: true,
        },
        children: null,
      },

      {
        path: 'goodsList',
        name: 'GoodsList',
        component: () => import('@/views/mall/goodsList/index'),
        meta: {
          title: '钱包管理',
        },
      }, 
       {
        path: 'points',
        name: 'points',
        component: () => import('@/views/mall/points/index'),
        meta: {
          title: '积分管理',
        },
      }, 
      {
        path: 'member',
        name: 'Member',
        component: () => import('@/views/mall/member/index'),
        meta: {
          title: '会员管理',
        },
        
      },
        {
        path: 'time',
        name: 'time',
        component: () => import('@/views/mall/time/index'),
        meta: {
          title: '时段管理',
        },
        
      },
       {
        path: 'additional',
        name: 'Additional',
        component: () => import('@/views/mall/additional/index'),
        meta: {
          title: '附加项管理',
        },
      },
       {
        path: 'archive',
        name: 'Archive',
        component: () => import('@/views/mall/archive/index'),
        meta: {
          title: '宠物档案管理',
        },
      },
    ],
  },
   {
    path: '/coupon',
    component: Layout,
    redirect: 'noRedirect',
    name: 'Coupon',
    meta: {
      title: '券管理',
      icon: 'cog',
      permissions: ['admin'],
    },
    children: [
      //  {
      //   path: 'couponlist',
      //   name: 'Couponlist',
      //   component: () => import('@/views/Coupon/couponlist/index'),
      //   meta: {
      //     title: '券包',
      //   },
      // },
      //    {
      //   path: 'distribution',
      //   name: 'distribution',
      //   component: () => import('@/views/Coupon/distribution/index'),
      //   meta: {
      //     title: '优惠券',
      //   },
      // },
       {
        path: 'redemption',
        name: 'redemption',
        component: () => import('@/views/Coupon/redemption/index'),
        meta: {
          title: '兑换码',
        },
      },
       {
        path: 'distribute',
        name: 'Distribute',
        component: () => import('@/views/Coupon/distribute/index'),
        meta: {
          title: '派券管理',
        },
      },
      {
        path: 'record',
        name: 'Record',
        component: () => import('@/views/Coupon/record/index'),
        meta: {
          title: '派券记录',
        },
      },
      
    ],
  },

   {
    path: '/careManagement',
    component: Layout,
    redirect: 'careManagement',
    name: 'Comment',  
    meta: {
      title: '洗护管理',
      icon: 'sleigh',
      permissions: ['admin'],
    },
    children: [
      {
        path: 'therapist',
        name: 'therapist',
        component: () => import('@/views/careManagement/therapist/index'),
        meta: {
          title: '洗护师管理',
        },
      },
        {
        path: 'vehicle',
        name: 'vehicle',
        component: () => import('@/views/careManagement/vehicle/index'),
        meta: {
          title: '车辆洗护师关系绑定',
        },
      }
    ],
  },
    {
    path: '/publicWelfare',
    component: Layout,
    redirect: 'publicWelfare',
    name: 'Comment',
    meta: {
      title: '公益管理',
      icon: 'bahai',
      permissions: ['admin'],
    },
    children: [
      {
        path: 'adopt',
        name: 'adopt',
        component: () => import('@/views/publicWelfare/adopt/index'),
        meta: {
          title: '领养宠物管理',
        },
      },
        {
        path: 'points',
        name: 'points',
        component: () => import('@/views/publicWelfare/points/index'),
        meta: {
          title: '积分捐助管理',
        },
      },
       {
        path: 'public',
        name: 'public',
        component: () => import('@/views/publicWelfare/public/index'),
        meta: {
          title: '公益行管理',
        },
      }
    ],
  },

    {
    path: '/franchisee',
    component: Layout,
    redirect: 'franchisee',
    name: 'Comment',
    meta: {
      title: '加盟商管理',
      icon: 'book-reader',
      permissions: ['admin'],
    },
    children: [
      {
        path: 'xiaowa',
        name: 'Xiaowa',
        component: () => import('@/views/xiaowa/index'),
        meta: {
          title: '小哇管理',
        },
      },
        {
        path: 'vehicle',
        name: 'Vehicle',
        component: () => import('@/views/vehicle/index'),
        meta: {
          title: '车辆管理',
        },
      },
      //  {
      //   path: 'order',
      //   name: 'Order',
      //   component: () => import('@/views/order/index'),
      //   meta: {
      //     title: '订单管理',
      //   },
      // },
       {
        path: 'information',
        name: 'Information',
        component: () => import('@/views/information/index'),
        
        meta: {
          title: '信息管理',
           permissions: ['admin', ],
        },
      },

    ],
  },
   {
    path: '/administrator',
    component: Layout,
    redirect: 'administrator',
    name: 'Comment',
    meta: {
      title: '管理员权限管理',
      icon: 'paper-plane',
      permissions: ['admin'],
    },
    children: [
      {
        path: 'role',
        name: 'role',
        component: () => import('@/views/administrator/role/index'),
        meta: {
          title: '角色管理',
        },
      },
        {
        path: 'user',
        name: 'user',
        component: () => import('@/views/administrator/user/index'),
        meta: {
          title: '用户列表',
        },
      }
    ],
  },
   {
    path: '/pricing',
    component: Layout,
    redirect: 'pricing',
    name: 'Comment',
    meta: {
      title: '定价管理',
      icon: 'pen-square',
      permissions: ['admin'],
    },
    children: [
      {
        path: 'care',
        name: 'care',
        component: () => import('@/views/pricing/care/index'),
        meta: {
          title: '洗护价格列表',
        },
      },
        {
        path: 'commission',
        name: 'commission',
        component: () => import('@/views/pricing/commission/index'),
        meta: {
          title: '佣金列表',
        },
      }
    ],
  },
   {
    path: '/commodity',
    component: Layout,
    redirect: 'noRedirect',
    name: 'commodity',
    meta: {
      title: '商城管理',
      icon: 'comment-dots',
      permissions: ['admin'],
    },
    children: [
      {
        path: 'malllist',
        name: 'malllist',
        component: () => import('@/views/commodity/malllist/index'),
        meta: {
          title: '商品列表',
        },
      },
      {
        path: 'orderlist',
        name: 'orderlist',
        component: () => import('@/views/commodity/orderlist/index'),
        meta: {
          title: '商城订单',
        },
      },
    ],
  },
  {
    path: '/comment',
    component: Layout,
    redirect: 'noRedirect',
    name: 'Comment',
    meta: {
      title: '评论管理',
      icon: 'comment-dots',
      permissions: ['admin'],
    },
    children: [
      {
        path: 'comment',
        name: 'Comment',
        component: () => import('@/views/comment/index'),
        meta: {
          title: '评论列表',
        },
      },
    ],
  },

   {
    path: '/payment',
    component: Layout,
    redirect: 'payment',
    name: 'Comment',
    meta: {
      title: '支付管理',
      icon: 'comment-dots',
      permissions: ['admin'],
    },
    children: [
      {
        path: 'paymentList',
        name: 'paymentList',
        component: () => import('@/views/payment/paymentList/index'),
        meta: {
          title: '支付列表',
        },
      }
    ],
  },

   {
    path: '/settlement',
    component: Layout,
    redirect: 'settlement',
    name: 'Comment',
    meta: {
      title: '结算管理',
      icon: 'comment-dots',
      permissions: ['admin'],
    },
    children: [
      {
        path: 'sett',
        name: 'sett',
        component: () => import('@/views/settlement/sett/index'),
        meta: {
          title: '结算列表',
        },
      }
    ],
  },

   {
    path: '/certificate',
    component: Layout,
    redirect: 'certificate',
    name: 'Comment',
    meta: {
      title: '证书管理',
      icon: 'comment-dots',
      permissions: ['admin'],
    },
    children: [
      {
        path: 'ficate',
        name: 'ficate',
        component: () => import('@/views/certificate/ficate/index'),
        meta: {
          title: '证书列表',
        },
      }
    ],
  },

   {
    path: '/holidays',
    component: Layout,
    redirect: 'holidays',
    name: 'Comment',
    meta: {
      title: '节假日管理',
      icon: 'comment-dots',
      permissions: ['admin'],
    },
    children: [
      {
        path: 'day',
        name: 'day',
        component: () => import('@/views/holidays/day/index'),
        meta: {
          title: '节假日列表',
        },
      }
    ],
  },
 
  {
    path: '*',
    redirect: '/404',
    hidden: true,
  },
]

const router = new VueRouter({
  base: publicPath,
  mode: routerMode,
  scrollBehavior: () => ({
    y: 0,
  }),
  routes: constantRoutes,
})

export function resetRouter() {
  location.reload()
}

export default router
