import Vue from 'vue'
import Router from 'vue-router'
/* Layout */
import Layout from '@/layout'

Vue.use(Router)

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
 roles: ['admin','editor']    control the page roles (you can set multiple roles)
 title: 'title'               the name show in sidebar and breadcrumb (recommend set)
 icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
 breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
 activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
 }
 */

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */
export const constantRoutes = [
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },

  {
    path: '/404',
    component: () => import('@/views/404'),
    hidden: true
  },
  {
    path: '/test',
    component: Layout,
    children: [
      {
        path: 'test',
        component: () => import('@/views/test/index'),
        name: '示例',
        meta: { title: '示例', icon: 'table' }
      }
    ]
  },
  {
    path: '/',
    name: '/',
    component: Layout,
    redirect: '/Homepage',
    meta: { title: '统计面板', icon: 'form' },
    children: [
      {
        path: 'Homepage',
        component: () => import('@/views/Homepage/Homepage/index'),
        name: 'Homepage',
        meta: { title: '统计面板' }
      }

    ]
  },
  {
    path: '/user',
    name: 'user',
    component: Layout,
    redirect: '/user/userList',
    meta: { title: '会员列表', icon: 'form' },
    children: [
      {
        path: 'userList',
        component: () => import('@/views/user/userList/index'),
        name: 'userList',
        meta: { title: '会员列表' }
      },
       {
        path: 'userLevel',
        component: () => import('@/views/user/userLevel/index'),
        name: 'userLevel',
        meta: { title: '会员等级' }
      },
        {
        path: 'userLoginLog',
        component: () => import('@/views/user/userLoginLog/index'),
        name: 'userLoginLog',
        meta: { title: '用户登录日志' }
      }

    ]
  },
  {
    path: '/chamber',
    name: 'chamber',
    component: Layout,
    redirect: '/chamber/room',
    meta: { title: '房间管理', icon: 'form' },
    children: [
      {
        path: 'room',
        component: () => import('@/views/chamber/room/index'),
        name: 'room',
        meta: { title: '游戏房间' }
      },
      {
        path: 'game',
        component: () => import('@/views/chamber/game/index'),
        name: 'game',
        meta: { title: '游戏管理' }
      }
    ]
  },
  {
    path: '/withdraw',
    name: 'withdraw',
    component: Layout,
    redirect: '/withdraw/listUSDT',
    meta: { title: '提现列表USDT', icon: 'form' },
    children: [
    {
        path: 'withdraw/ManualTopUp',
        component: () => import('@/views/withdraw/ManualTopUp/index'),
        name: 'ManualTopUp',
        meta: { title: '人工充值' }
      },
      {
        path: 'withdraw/MemberBonus',
        component: () => import('@/views/withdraw/MemberBonus/index'),
        name: 'MemberBonus',
        meta: { title: '会员彩金' }
      },
      {
        path: 'withdraw/Manualwithdrawal',
        component: () => import('@/views/withdraw/Manualwithdrawal/index'),
        name: 'Manualwithdrawal',
        meta: { title: '人工提现' }
      },
      {
        path: 'withdraw/topUp',
        // component: () => import('@/views/wallet/topUp/index'),
        component: () => import('@/views/A_NewPage/Finance/TopUpList/index.vue'),
        name: 'withdraw/topUp',
        meta: { title: '充值列表' }
      },
      {
        path: 'treePay',
        component: () => import('@/views/treePay/list/index.vue'),
        name: 'treePay',
        meta: { title: '第三方支付' }
      },
      {
        path: 'balance',
        component: () => import('@/views/balance/log/index'),
        name: 'balance',
        meta: { title: '钱包记录' }
      },
      {
        path: 'listUSDT',
        // component: () => import('@/views/withdraw/listUSDT/index'),
        component: () => import('@/views/A_NewPage/Finance/WithdrawList/index.vue'),
        name: 'listUSDT',
        meta: { title: '提现列表USDT' }
      },
      {
        path: 'listRMB',
        component: () => import('@/views/withdraw/listRMB/index'),
        name: 'listRMB',
        meta: { title: '提现列表RMB' }
      },
        {
        path: 'yuebao',
        component: () => import('@/views/yuebao/index'),
        name: 'yuebao',
        meta: { title: '余额宝记录' }
      },
      {
        path: 'topUpChannel',
        component: () => import('@/views/wallet/topUpChannel/index'),
        name: 'topUpChannel',
        meta: { title: '充值通道' }
      },
    ]
  },
  {
    path: '/Activity',
    name: 'Activity',
    component: Layout,
    redirect: '/Activity/ActivityUser',
    meta: { title: '活动管理', icon: 'form' },
    children: [
      {
        path: 'ActivityUser',
        component: () => import('@/views/Activity/ActivityUser/index'),
        name: 'ActivityUser',
        meta: { title: '参与列表' }
      },
      {
        path: 'ActivityReward',
        component: () => import('@/views/Activity/ActivityReward/index'),
        name: 'ActivityReward',
        meta: { title: '活动列表' }
      },
      {
        path: 'Banner',
        component: () => import('@/views/Activity/Banner/index'),
        name: 'Banner',
        meta: { title: 'Banner' }
      }
    ]
  },
  {
    path: '/config',
    name: '配置管理',
    component: Layout,
    redirect: '/config/getAll',
    meta: { title: '所有配置', icon: 'form' },
    children: [
      {
        path: 'reply',
        component: () => import('@/views/reply/list/index'),
        name: 'reply',
        meta: { title: '回复管理' }
      },
      {
        path: 'configlist',
        component: () => import('@/views/config/list/index'),
        name: 'configlist',
        meta: { title: '配置列表' }
      },
      {
        path: 'playing',
        component: () => import('@/views/playing/list/index'),
        name: 'playing',
        meta: { title: '玩法管理' }
      },
      {
        path: 'getAll',
        component: () => import('@/views/config/getAll/index'),
        name: 'getAll',
        meta: { title: '所有配置' }
      },
      {
        path: 'Message',
        component: () => import('@/views/config/Message/index'),
        name: 'Message',
        meta: { title: '频道管理' }
      },
      {
        path: 'pcConfig',
        component: () => import('@/views/config/pcConfig/index'),
        name: 'pcConfig',
        meta: { title: 'PC28设置' }
      },
      {
        path: 'LotteryManagement',
        component: () => import('@/views/config/LotteryManagement/index'),
        name: 'LotteryManagement',
        meta: { title: '彩票玩法设置' }
      },

    ]
  },

  // {
  //   path: '/reply',
  //   name: 'reply',
  //   component: Layout,
  //   redirect: '/reply/reply',
  //   meta: { title: '回复管理', icon: 'form' },
  //   children: [
  //     {
  //       path: 'reply',
  //       component: () => import('@/views/reply/list/index'),
  //       name: 'reply',
  //       meta: { title: '回复管理' }
  //     }
  //   ]
  // },
  {
    path: '/certification',
    name: 'certification',
    component: Layout,
    redirect: '/certification/issuenumber',
    meta: { title: '开奖记录', icon: 'form' },
    children: [
      {
        path: 'issuenumber',
        component: () => import('@/views/certification/issuenumber/index'),
        name: 'issuenumber',
        meta: { title: 'PC28' }
      },
      {
        path: 'abnormal',
        component: () => import('@/views/certification/abnormal/index'),
        name: 'abnormal',
        meta: { title: '错误分页' }
      },
      {
        path: 'pcIssue',
        component: () => import('@/views/certification/pcIssue/index'),
        name: 'pcIssue',
        meta: { title: '极速28' }
      },
      {
        path: 'jisuGame',
        component: () => import('@/views/certification/jisuGame/index'),
        name: 'jisuGame',
        meta: { title: '彩票赔率设置' }
      },
      {
        path: 'jisuOrder',
        component: () => import('@/views/certification/jisuOrder/index'),
        name: 'jisuOrder',
        meta: { title: '极速游戏订单' }
      },
      {
        path: 'jisuOrderDetail',
        component: () => import('@/views/certification/jisuDetail/index'),
        name: 'jisuOrderDetail',
        meta: { title: '极速游戏订单详情' }
      },
      {
        path: 'jisuHistory',
        component: () => import('@/views/certification/jisuHistory/index'),
        name: 'jisuHistory',
        meta: { title: '彩票预开奖设置' }
      },

    ]
  },
  {
    path: '/order',
    name: 'order',
    component: Layout,
    redirect: '/order/index',
    meta: { title: '投注记录', icon: 'form' },
    children: [
      {
        path: 'order',
        component: () => import('@/views/order/list/index'),
        name: 'order',
        meta: { title: '投注记录' }
      }
    ]
  },
  {
    path: '/Digital',
    name: 'Digital',
    component: Layout,
    redirect: '/Digital/index',
    meta: { title: '六合彩', icon: 'form' },
    children: [
      {
        path: 'DigitalOrder',
        component: () => import('@/views/Digital/order/index'),
        name: 'DigitalOrder',
        meta: { title: '彩票订单列表' }
      },
      {
        path: 'DigitalHistory',
        component: () => import('@/views/Digital/history/index'),
        name: 'DigitalHistory',
        meta: { title: '彩票开奖历史' }
      },
      {
        path: 'DigitalNumberManage',
        component: () => import('@/views/Digital/number/index'),
        name: 'DigitalNumberManage',
        meta: { title: '号码管理' }
      },
      {
        path: 'DigitalDetail',
        component: () => import('@/views/Digital/detail/index'),
        name: 'DigitalDetail',
        meta: { title: '详情' }
      },
      {
        path: 'MacauMarkSix',
        component: () => import('@/views/Digital/MacauMarkSix/index'),
        name: 'MacauMarkSix',
        meta: { title: '澳门六合彩' }
      },

    ]
  },
  {
    path: '/rebate',
    name: 'rebate',
    component: Layout,
    redirect: '/rebate/rebate',
    meta: { title: '返拥管理', icon: 'form' },
    children: [
      {
        path: 'rebate',
        component: () => import('@/views/rebate/list/index.vue'),
        name: 'rebate',
        meta: { title: '笔笔返' }
      },
      {
        path: 'backflow',
        component: () => import('@/views/rebate/backflow/index.vue'),
        name: 'backflow',
        meta: { title: '回水返' }
      }
    ]
  },
  {
    path: '/authority',
    name: 'authority',
    component: Layout,
    redirect: '/authority/menu',
    meta: { title: '权限管理', icon: 'form' },
    children: [
      {
        path: 'menu',
        component: () => import('@/views/authority/menu/index'),
        name: 'menu',
        meta: { title: '菜单管理' }
      },
      {
        path: 'role',
        component: () => import('@/views/authority/role/index'),
        name: 'role',
        meta: { title: '角色管理' }
      },
      {
        path: 'account',
        component: () => import('@/views/authority/account/index'),
        name: 'account',
        meta: { title: '账号管理' }
      }
    ]
  },
  {
    path: '/operation',
    name: 'operation',
    component: Layout,
    redirect: '/operation/index',
    meta: { title: '运营数据', icon: 'chart' }, // icon 可以改成你项目中已有的 svg 图标名，比如 'chart' 或 'form'
    children: [
      {
        path: 'operationIndex',
        component: () => import('@/views/operationalData/index'), // 注意：你需要在 views 目录下创建对应的 vue 文件
        name: 'operationIndex',
        meta: { title: '数据概览' } // 你的二级菜单名称
      }
    ]
  },
  {
    path: '/userReports',
    name: 'userReports',
    component: Layout,
    redirect: '/userReports/index',
    meta: { title: '用户报表', icon: 'chart' }, // icon 可以改成你项目中已有的 svg 图标名，比如 'chart' 或 'form'
    children: [
      {
        path: 'userReportsIndex',
        component: () => import('@/views/userReports/index'), // 注意：你需要在 views 目录下创建对应的 vue 文件
        name: 'userReportsIndex',
        meta: { title: '用户报表' } // 你的二级菜单名称
      }
    ]
  },
    {
    path: '/promoteUsers',
    name: 'promoteUsers',
    component: Layout,
    redirect: '/promoteUsers/index',
    meta: { title: '推广用户', icon: 'chart' }, // icon 可以改成你项目中已有的 svg 图标名，比如 'chart' 或 'form'
    children: [
      {
        path: 'promoteUsersIndex',
        component: () => import('@/views/promoteUsersIndex/index'), // 注意：你需要在 views 目录下创建对应的 vue 文件
        name: 'promoteUsersIndex',
        meta: { title: '推广用户' } // 你的二级菜单名称
      }
    ]
  },

  {
    path: '/views/orderManage',
    name: '体育管理',
    component: Layout,
    redirect: '/views/orderManage',
    meta: { title: '体育管理', icon: 'form' },
    children: [
      {
        path: 'TotalSoccerAdvance',
        component: () => import('@/views/orderManage/TotalSoccerAdvance/index.vue'),
        // component: () => import('@/views/orderManage/List/index.vue'),
        name: 'TotalSoccerAdvance',
        meta: { title: '冠军足球' }
      },
      {
        path: 'TotalSoccerAdvanceOrder',
        component: () => import('@/views/orderManage/TotalSoccerAdvanceOrder/index.vue'),
        name: 'TotalSoccerAdvanceOrder',
        meta: { title: '冠军足球订单列表' }
      },
      {
        path: 'TotalSoccerAdvanceOrderDetail',
        component: () => import('@/views/orderManage/TotalSoccerAdvanceOrderDetail/index.vue'),
        name: 'TotalSoccerAdvanceOrderDetail',
        meta: { title: '冠军足球订单详情' }
      },
      {
        path: 'orderList',
        component: () => import('@/views/orderManage/List/index.vue'),
        name: 'orderList',
        meta: { title: '订单列表' }
      },
      {
        path: 'EventList',
        component: () => import('@/views/orderManage/EventList/index.vue'),
        name: 'EventList',
        meta: { title: '赛事列表' }
      },
      {
        path: 'EventErrorList',
        component: () => import('@/views/orderManage/EventErrorList/index.vue'),
        name: 'EventErrorList',
        meta: { title: '异常赛事' }
      },
      {
        path: 'EventDetail',
        component: () => import('@/views/orderManage/EventDetail/index.vue'),
        name: 'EventDetail',
        meta: { title: '赛事详情' }
      },
      {
        path: 'orderDetail',
        component: () => import('@/views/orderManage/Detail/index.vue'),
        name: 'orderDetail',
        meta: { title: '订单详情' }
      },
      {
        path: 'EventInformationIndex',
        component: () => import('@/views/EventInformation/index'), // 注意：你需要在 views 目录下创建对应的 vue 文件
        name: 'EventInformationIndex',
        meta: { title: '赛事信息' } // 你的二级菜单名称
      },
         {
        path: 'FootballGameplayList',
        component: () => import('@/views/orderManage/FootballGameplayList/index.vue'),
        name: 'FootballGameplayList',
        meta: { title: '玩法列表' }
      },
    ]
  },
  // {
  //   path: '/EventInformation',
  //   name: 'EventInformation',
  //   component: Layout,
  //   redirect: '/EventInformation/index',
  //   meta: { title: '赛事信息', icon: 'chart' }, // icon 可以改成你项目中已有的 svg 图标名，比如 'chart' 或 'form'
  //   children: [
  //     {
  //       path: 'EventInformationIndex',
  //       component: () => import('@/views/EventInformation/index'), // 注意：你需要在 views 目录下创建对应的 vue 文件
  //       name: 'EventInformationIndex',
  //       meta: { title: '赛事信息' } // 你的二级菜单名称
  //     }
  //   ]
  // },
  // 404 page must be placed at the end !!!
  { path: '*', redirect: '/404', hidden: true },
]

const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
