// eslint-disable-next-line
import {
  UserLayout,
  BasicLayout,
  MobileLayout,
  MobilePageLayout,
  BlankLayout,
  BigScreen,
  PageView
} from '@/layouts'
// 菜单模块
import home from './home' // 首页
import salesManageService from './salesManageService' // 销售管理
import salesReturnManage from  './salesReturnManage' // 销售退货
import purchasingManagement from './purchasingManagement' // 采购管理
import financialManagement from './financialManagement' // 财务管理
import expenseManagement from './expenseManagement' // 费用报销
import inventoryManagement from './inventoryManagement' // 库存管理
import allocationManagement from './allocationManagement' // 调拨管理
 
import salesReport from './report/salesReport' // 销售报表
import purchasingReport from './report/purchasingReport' // 采购报表
import transferReport from './report/transferReport' // 调拨报表
import spreadReport from './report/spreadReport' // 差价报表
import otherReport from './report/otherReport' // 其他报表

import dealerManagement from './dealerManagement' // 经销商管理
import productManagement from './productManagement' // 产品管理
import supplierManagement from './supplierManagement' // 供应商管理
// import promotionRulesManagement from './promotionRulesManagement' // 促销管理
import easyPassManagement from './easyPassManagement' // 易码通管理
import bigStatistics from './bigStatistics' // 大屏统计
import sysSetting from './sysSetting' // 系统设置
export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: {
      title: '首页'
    },
    redirect: '/home',
    children: [
      // 首页
      home,
      // 销售管理
      salesManageService,
      // 销售退货
      salesReturnManage,
      // 采购管理
      purchasingManagement,
      // 财务管理
      financialManagement,
      // 费用报销
      expenseManagement,
      // 库存管理
      inventoryManagement,
      // 调拨管理
      allocationManagement,
      // 报表
      salesReport,
      purchasingReport,
      spreadReport,
      transferReport,
      otherReport,
      // 产品管理
      productManagement,
      // 经销商管理
      dealerManagement,
      //  供应商管理
      supplierManagement,
      // 易码通
      easyPassManagement,
      // 大屏数据
      bigStatistics,
      // 系统设置
      sysSetting
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 移动端路由
 * @type { *[] }
 */
export const asyncMobileRouterMap = [
  {
    path: '/',
    name: 'index',
    component: MobileLayout,
    meta: {
      title: '首页'
    },
    redirect: '/home',
    children: [
       {
         path: '/home',
         name: 'home',
         component: () => import(/* webpackChunkName: "mobileRouter" */ '@/mobile/Home'),
         meta: {
           title: '首页',
           icon: 'home',
           hidden: true
         }
       }
    ]
  },
  {
    path: '/page',
    name: 'page',
    component: MobilePageLayout,
    redirect: '/inventoryQuery',
    children: [
       {
         path: '/inventoryQuery',
         name: 'inventoryQuery',
         component: () => import(/* webpackChunkName: "mobileRouter" */ '@/mobile/inventoryManagement/inventoryQuery/list.vue'),
         meta: {
           title: '库存查询',
           icon: 'monitor',
           permission: 'M_inventoryQueryList'
         }
       },
       {
         path: '/warehouseDetail/:sn/:warehouseSn',
         name: 'inventoryQueryWarehouseDetail',
         component: () => import(/* webpackChunkName: "mobileRouter" */ '@/mobile/inventoryManagement/inventoryQuery/warehouseDetail.vue'),
         meta: {
           title: '出入库明细',
           icon: 'monitor',
           permission: 'B_inventoryQuery_rkDetail'
         }
       },
       // {
       //   path: '/productPricing',
       //   name: 'productPricing',
       //   component: () => import(/* webpackChunkName: "mobileRouter" */ '@/mobile/productManagement/productPricing/list.vue'),
       //   meta: {
       //     title: '产品定价',
       //     icon: 'transaction',
       //     permission: 'M_productPricingList'
       //   }
       // },
       {
         path: '/priceInquiry',
         name: 'priceInquiry',
         component: () => import(/* webpackChunkName: "mobileRouter" */ '@/mobile/priceInquiry/list.vue'),
         meta: {
           title: '价格查询',
           icon: 'transaction',
           permission: 'M_priceInquiryList'
         }
       },
       // 产品详情
       {
         path: '/viewProduct/:sn',
         name: 'viewProduct',
         component: () => import(/* webpackChunkName: "home" */ '@/mobile/productManagement/newProduct/detail'),
         meta: {
           title: '产品详情',
           icon: 'home'
         },
         hidden: true
       }
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      },
      {
        path: 'register',
        name: 'register',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register')
      },
      {
        path: 'register-result',
        name: 'registerResult',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/RegisterResult')
      },
      {
        path: 'recover',
        name: 'recover',
        component: undefined
      }
    ]
  },
  {
    path: '/bigScreen',
    component: BigScreen,
    redirect: '/bigScreen/realTimeSalesReport',
    hidden: true,
    children: [
      {
        path: 'realTimeSalesReport',
        name: 'realTimeSalesReport',
        component: () => import(/* webpackChunkName: "bigScreen" */ '@/views/bigScreen/realTimeSalesReport/index'),
        meta: {
          title: '实时销售看板'
        }
      },
      {
        path: 'fPanalysisReport',
        name: 'fPanalysisReport',
        component: () => import(/* webpackChunkName: "bigScreen" */ '@/views/bigScreen/fPanalysisReport/index'),
        meta: {
          title: '加盟商/产品分析'
        }
      }
    ]
  },
  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }
]
