import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

/* Layout */
import Layout from '@/layout'

/* Router Modules */

/**
 * 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
    noCache: true                if set true, the page will no be cached(default is false)
    affix: true                  if set true, the tag will affix in the tags-view
    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: '/redirect',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path(.*)',
        component: () => import('@/views/redirect/index')
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },
  {
    path: '/login2',
    component: () => import('@/views/login/login2'),
    hidden: true
  },
  {
    path: '/auth-redirect',
    component: () => import('@/views/login/auth-redirect'),
    hidden: true
  },
  {
    path: '/404',
    component: () => import('@/views/error-page/404'),
    hidden: true
  },
  {
    path: '/401',
    component: () => import('@/views/error-page/401'),
    hidden: true
  },
  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [
      {
        path: 'dashboard',
        component: () => import('@/views/dashboard/index'),
        name: 'Dashboard',
        meta: { title: 'Dashboard', icon: 'dashboard', affix: true }
      }
    ]
  }
]

/**
 * asyncRoutes
 * the routes that need to be dynamically loaded based on user roles
 */
export const asyncRoutes = [
  {
    path: '/finance',
    component: Layout,
    alwaysShow: true, // will always show the root menu
    name: 'finance',
    meta: {
      title: '财务',
      icon: 'el-icon-suitcase',
      roles: ['系统管理员', '头程管理', '财务', '客服', '销售', '渠道运营'] // you can set roles in root nav
    },
    children: [
      {
        path: 'insideLadingBill',
        component: () => import('@/views/finance/ladingBill'),
        name: 'LadingBill',
        meta: {
          title: '自飞头程帐单',
          roles: ['系统管理员', '头程管理', '财务'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'userLadingBill',
        component: () => import('@/views/finance/ladingBill'),
        name: 'LadingBill',
        meta: {
          title: '客户头程帐单',
          roles: ['系统管理员', '头程管理', '财务', '客服'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'delivery',
        component: () => import('@/views/finance/delivery'),
        name: 'Delivery',
        meta: {
          title: '派送帐单',
          roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'customer',
        component: () => import('@/views/finance/customer'),
        name: 'Customer',
        meta: {
          title: '客户帐单',
          roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'bill',
        component: () => import('@/views/finance/estimated'),
        name: 'Estimated',
        meta: {
          title: '预计盈亏报表',
          roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'estimated2',
        component: () => import('@/views/finance/estimated2'),
        name: 'Estimated2',
        meta: {
          title: '盈亏报表',
          roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'financeReport',
        component: () => import('@/views/finance/financeReport'),
        name: 'FinanceReport',
        meta: {
          title: '财务报表',
          roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'difference',
        component: () => import('@/views/finance/difference'),
        name: 'Difference',
        meta: {
          title: '预估毛利模板完成',
          roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'chargeLog',
        component: () => import('@/views/finance/charging/chargeLog'),
        name: 'ChargeLog',
        meta: {
          title: '分公司扣费记录',
          roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'CustomerIncome',
        component: () => import('@/views/finance/charging/customerIncome'),
        name: 'CustomerIncome',
        meta: {
          title: '小包收入',
          roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'QuotaApply',
        hidden: true,
        component: () => import('@/views/finance/QuotaApply'),
        name: 'QuotaApply',
        meta: {
          title: '授信申请',
          roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'customerAccount',
        component: () => import('@/views/finance/index'),
        alwaysShow: true,
        name: 'CusetomerAccount',
        meta: {
          cache: true,
          icon: 'el-icon-s-tools',
          title: '收款',
          roles: ['系统管理员', '财务']
        },
        children: [
          {
            path: 'CusetomerAccountList',
            component: () => import('@/views/finance/cusetomerAccount'),
            name: 'CusetomerAccount',
            meta: {
              title: '客户帐户',
              roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'CollectionAccount',
            component: () => import('@/views/finance/CollectionAccount'),
            name: 'CollectionAccount',
            meta: {
              title: '收款帐户',
              roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'RemittanceMange',
            component: () => import('@/views/finance/RemittanceMange'),
            name: 'RemittanceMange',
            meta: {
              title: '应收',
              roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'customerRemittance',
            component: () => import('@/views/finance/customerRemittance'),
            name: 'CustomerRemittance',
            meta: {
              title: '客户付款单',
              roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'TransactionList',
            component: () => import('@/views/finance/Transaction/list'),
            name: 'TransactionList',
            meta: {
              title: '交易流水',
              roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
            }
          }]
      },
      {
        path: 'baseInfos',
        component: () => import('@/views/finance/index'),
        alwaysShow: true,
        name: 'BaseInfos',
        meta: {
          cache: true,
          icon: 'el-icon-s-tools',
          title: '基础设置',
          roles: ['系统管理员', '财务', '销售', '渠道运营']
        },
        children: [
          {
            path: 'QuotaInput',
            component: () => import('@/views/finance/QuotaInput'),
            name: 'QuotaInput',
            meta: {
              title: '批量导入',
              roles: ['系统管理员', '财务', '客服'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'QuotationManagement',
            component: () => import('@/views/finance/QuotationManagement'),
            name: 'QuotationManagement',
            meta: {
              title: '报价查看',
              roles: ['系统管理员', '财务', '销售', '渠道运营'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'quotationApproveRecord',
            component: () => import('@/views/finance/quotationApproveRecord'),
            name: 'QuotationApproveRecord',
            meta: {
              title: '报价审批记录',
              roles: ['系统管理员', '财务', '销售'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'Rate',
            component: () => import('@/views/finance/rate'),
            name: 'Rate',
            meta: {
              title: '末端汇率',
              roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'FinanceCustomerRate',
            component: () => import('@/views/finance/financeCustomerRate'),
            name: 'FinanceCustomerRate',
            meta: {
              title: '客户汇率',
              roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'EsRate',
            component: () => import('@/views/finance/euExchangeRate'),
            name: 'EsRate',
            meta: {
              title: '欧盟税率',
              roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'financeIncidentalType',
            component: () => import('@/views/finance/financeIncidentalType'),
            name: 'FinanceIncidentalType',
            meta: {
              title: '杂费类型',
              roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
            }
          }, {
            path: 'estimateFee',
            component: () => import('@/views/finance/estimateFee'),
            name: 'EstimateFee',

            meta: {
              title: '预估费用',
              roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'feeTemplate',
            component: () => import('@/views/finance/feeTemplate'),
            name: 'FeeTemplate',
            meta: {
              title: '头程模板管理',
              roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'firstPort',
            component: () => import('@/views/finance/firstPort'),
            name: 'FirstPort',
            meta: {
              title: '口岸管理',
              roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'firstService',
            component: () => import('@/views/finance/firstService'),
            name: 'FirstService',
            meta: {
              title: '头程服务/客户管理',
              roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'FinanceTool',
            component: () => import('@/views/finance/tool'),
            name: 'FinanceTool',
            meta: {
              title: '工具',
              roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
            }
          }
          // {
          //   path: 'firstCustomer',
          //   component: () => import('@/views/finance/firstCustomer'),
          //   name: 'firstCustomer',
          //   meta: {
          //     title: '头程客户管理',
          //     roles: ['系统管理员', '财务'] /3/ or you can only set roles in sub nav
          //   }
          // }
        ]
      }
    ]
  },
  {
    path: '/smp',
    component: Layout,
    alwaysShow: true, // will always show the root menu
    name: 'smp',
    meta: {
      title: '结算系统',
      icon: 'el-icon-suitcase',
      roles: ['系统管理员'] // you can set roles in root nav
    },
    children: [
      {
        path: '/smp/formula',
        component: () => import('@/views/finance/index'),
        name: 'supplement',
        meta: {
          cache: true,
          title: '公式编辑',
          icon: 'el-icon-notebook-2',
          roles: ['系统管理员', '客服'] // you can set roles in root nav
        },
        children: [{
          path: '/smp/formula/edit',
          component: () => import('@/views/smp/formula/edit'),
          name: 'FormulaEdit',
          meta: {
            title: '公式编辑',
            roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
          }
        }
        ]
      }
    ]
  },
  {
    path: '/weight',
    component: Layout,
    alwaysShow: true, // will always show the root menu
    name: 'weight',
    meta: {
      title: '订单',
      icon: 'el-icon-shopping-cart-2',
      roles: ['系统管理员', '仓库管理员', '物流管理员', '行运易', '客服', '财务', '渠道运营', '销售'] // you can set roles in root nav
    },
    children: [
      {
        path: '/orderManagement',
        component: () => import('@/views/finance/index'),
        alwaysShow: true, // will always show the root menu
        hidden: false,
        name: 'oper',
        meta: {
          cache: true,
          title: '订单管理',
          icon: 'el-icon-shopping-cart-2',
          roles: ['系统管理员', '客服', '行运易', '渠道运营', '销售', '财务'] // you can set roles in root nav
        },
        children: [{
          path: '/fba/otherFee',
          hidden: false,
          component: () => import('@/views/fba/otherFee'),
          name: 'FbaOtherFee',
          meta: {
            title: 'FBA附加费管理',
            roles: ['系统管理员', '行运易', '渠道运营', '销售', '财务'] // or you can only set roles in sub nav
          }
        }, {
          path: '/orderManagement/list',
          hidden: false,
          component: () => import('@/views/orders/management/list'),
          name: 'OrderManagementList',
          meta: {
            title: '订单管理',
            roles: ['系统管理员', '行运易', '渠道运营', '销售', '财务'] // or you can only set roles in sub nav
          }
        },

        {
          path: '/kongpai',
          component: () => import('@/views/finance/index'),
          alwaysShow: true, // will always show the root menu
          name: 'kongpai',
          meta: {
            cache: true,
            title: '空派',
            icon: 'el-icon-s-promotion',
            roles: ['系统管理员', '客服', '行运易','销售', '仓库管理员', '物流管理员', '财务'] // you can set roles in root nav
          },
          children: [
            {
              path: 'addressee',
              component: () => import('@/views/kongPai/addressee'),
              name: 'KongPaiAddressee',
              meta: {
                title: '空派收件',
                roles: ['系统管理员', '行运易', '客服', '财务', '仓库管理员', '物流管理员'] // or you can only set roles in sub nav
              }
            },
            {
              path: 'order',
              component: () => import('@/views/kongPai/order'),
              name: 'KongPaiOrder',
              meta: {
                title: '空派打单',
                roles: ['系统管理员', '行运易', '客服', '财务', '仓库管理员', '物流管理员'] // or you can only set roles in sub nav
              }
            },
            {
              path: 'income',
              component: () => import('@/views/kongPai/income'),
              name: 'Income',
              meta: {
                title: '空派收入',
                roles: ['系统管理员', '行运易', '客服', '财务','销售'] // or you can only set roles in sub nav
              }
            },
            {
              path: 'settlement',
              component: () => import('@/views/kongPai/settlement'),
              name: 'Settlement',
              meta: {
                title: '空派结算',
                roles: ['系统管理员', '行运易', '客服', '财务'] // or you can only set roles in sub nav
              }
            },
            {
              path: 'grossSales',
              component: () => import('@/views/finance/grossSales'),
              name: 'GrossSales',
              meta: {
                title: '销售毛利报表',
                roles: ['系统管理员', '行运易', '客服', '财务','销售'] // or you can only set roles in sub nav
              }
            }
          ]
        },

        {
          path: '/orderManagement/receipt',
          hidden: false,
          component: () => import('@/views/orders/management/customerOrderReceipt'),
          name: 'CustomerOrderReceipt',
          meta: {
            title: '多票收货',
            roles: ['系统管理员', '行运易'] // or you can only set roles in sub nav
          }
        }
        ]
      },
      {
        path: '/oper',
        component: () => import('@/views/finance/index'),
        alwaysShow: true, // will always show the root menu
        name: 'oper',
        meta: {
          cache: true,
          title: '操作',
          icon: 'el-icon-thumb',
          roles: ['系统管理员', '客服', '行运易'] // you can set roles in root nav
        },
        children: [{
          path: 'intercept',
          component: () => import('@/views/weight/intercept'),
          name: 'Intercept',
          meta: {
            title: '核重',
            roles: ['系统管理员', '行运易'] // or you can only set roles in sub nav
          }
        },
        {
          path: 'question',
          component: () => import('@/views/weight/question'),
          name: 'Question',
          meta: {
            title: '问题件登记',
            roles: ['系统管理员', '行运易'] // or you can only set roles in sub nav
          }
        },
        {
          path: 'claimRecord',
          component: () => import('@/views/orders/claimRecord'),
          name: 'ClaimRecord',
          meta: {
            title: '索赔管理',
            roles: ['系统管理员', '行运易', '客服', '财务'] // or you can only set roles in sub nav
          }
        },
        {
          path: 'financeCustomerSupplements',
          component: () => import('@/views/finance/financeCustomerSupplements'),
          name: 'FinanceCustomerSupplements',
          meta: {
            title: '补款管理',
            roles: ['系统管理员', '行运易', '客服', '财务'] // or you can only set roles in sub nav
          }
        },
        {
          path: '/orders/batch',
          component: () => import('@/views/orders/batch'),
          name: 'InputESBOrder',
          meta: {
            title: '郑州E速宝下单',
            roles: ['系统管理员', '客服'] // or you can only set roles in sub nav
          }
        },{
          path: 'paymentIoss',
          component: () => import('@/views/orders/temporaryPaymentIOSS'),
          name: 'TemporaryPaymentIOSS',
          meta: {
            title: 'IOSS临时代缴',
            roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
          }
        },
        {
          path: 'BatchChangeEndService',
          component: () => import('@/views/orders/batchChangeEndService'),
          name: 'BatchChangeEndService',
          meta: {
            title: '末端面单更换',
            roles: ['系统管理员', '客服'] // or you can only set roles in sub nav
          }
        },
        {
          path: 'ChannelChangeEndService',
          component: () => import('@/views/orders/channelChangeEndService'),
          name: 'ChannelChangeEndService',
          meta: {
            title: '计费渠道更换',
            roles: ['系统管理员', '客服'] // or you can only set roles in sub nav
          }
        },
        {
          path: 'importIbFba',
          component: () => import('@/views/orders/importIbFba'),
          name: 'ImportIbFba',
          meta: {
            title: 'IB-FBA批量下单',
            roles: ['系统管理员', '客服', '行运易'] // or you can only set roles in sub nav
          }
        }, {
          path: 'AURemote',
          component: () => import('@/views/orders/auRemote'),
          name: 'AURemote',
          meta: {
            title: '澳洲偏远临时放行',
            roles: ['系统管理员', '客服', '行运易'] // or you can only set roles in sub nav
          }
        }, {
          path: 'BatchImportCounting',
          component: () => import('@/views/orders/batchImportCounting'),
          name: 'BatchImportCounting',
          meta: {
            title: '批量导入计抛',
            roles: ['系统管理员', '客服', '行运易'] // or you can only set roles in sub nav
          }
        }, {
          path: 'BatchImportWeight',
          component: () => import('@/views/orders/batchImportWeight'),
          name: 'BatchImportWeight',
          meta: {
            title: '批量导入实重',
            roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
          }
        }, {
          path: 'orderBatchReturn',
          component: () => import('@/views/orders/orderBatchReturn'),
          name: 'OrderBatchReturn',
          meta: {
            title: '订单批量回退',
            roles: ['系统管理员', '行运易'] // or you can only set roles in sub nav
          }
        },
        {
          path: 'orderBatchRecharging',
          component: () => import('@/views/orders/orderBatchRecharging'),
          name: 'OrderBatchRecharging',
          meta: {
            title: '订单批量重计费',
            roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
          }
        },
        {
          path: 'orderManualEntry',
          component: () => import('@/views/orders/OrderManualEntry'),
          name: 'OrderManualEntry',
          meta: {
            title: '订单人工入帐',
            roles: ['系统管理员', '财务', '客服'] // or you can only set roles in sub nav
          }
        },
        {
          path: 'reapplyESBTracking',
          component: () => import('@/views/orders/ReapplyESBTracking'),
          name: 'ReapplyESBTracking',
          meta: {
            title: '重新申请ESB单号',
            roles: ['系统管理员', '客服'] // or you can only set roles in sub nav
          }
        },
        {
          path: 'postalTrackingOnline',
          component: () => import('@/views/orders/PostalTrackingOnline'),
          name: 'PostalTrackingOnline',
          meta: {
            title: '邮政单号提前上网',
            roles: ['系统管理员', '客服'] // or you can only set roles in sub nav
          }
        },
        {
          path: 'confirmationGoods',
          component: () => import('@/views/orders/ConfirmationGoods'),
          name: 'ConfirmationGoods',
          meta: {
            title: '收货确认',
            roles: ['系统管理员', '客服'] // or you can only set roles in sub nav
          }
        },
        {
          path: 'pickupForecast',
          component: () => import('@/views/orders/PickupForecast'),
          name: 'PickupForecast',
          meta: {
            title: '上门取件预报',
            roles: ['系统管理员', '客服'] // or you can only set roles in sub nav
          }
        },
        ]
      },
      {
        path: '/batchTransfer',
        alwaysShow: true,
        component: () => import('@/views/finance/index'),
        meta: {
          cache: true,
          title: '批次转运',
          icon: 'el-icon-truck',
          roles: ['系统管理员', '客服', '行运易']
        },
        children: [{
          path: 'index',
          component: () => import('@/views/batchTransfer/index'),
          name: 'BatchTransfer',
          meta: {
            title: '批次转运',
            icon: 'el-icon-truck',
            roles: ['系统管理员', '客服', '行运易']
          }
        }, {
          path: 'create',
          component: () => import('@/views/batchTransfer/create'),
          name: 'CreateBatchTransfer',
          meta: {
            title: '创建批次转运',
            icon: 'el-icon-truck',
            roles: ['系统管理员', '客服', '行运易']
          }
        }
        ]
      },
      {
        path: '/ExcelInput',
        component: () => import('@/views/finance/index'),
        alwaysShow: true, // will always show the root menu
        name: 'excelInput',
        meta: {
          cache: true,
          title: '文件上传',
          icon: 'el-icon-upload',
          roles: ['系统管理员', '客服'] // you can set roles in root nav
        },
        children: [
          {
            path: '/ExcelInput/input',
            component: () => import('@/views/ExcelInput/input'),
            name: 'ExcelInput',
            meta: {
              title: '文件上传',
              roles: ['系统管理员', '客服'] // or you can only set roles in sub nav
            }
          }
        ]
      },
      {
        path: '/logs',
        component: () => import('@/views/finance/index'),
        alwaysShow: true, // will always show the root menu
        name: 'logs',
        meta: {
          cache: true,
          title: '日志',
          icon: 'el-icon-notebook-2',
          roles: ['系统管理员', '客服', '行运易', '仓库管理员','销售'] // you can set roles in root nav
        },
        children: [
          {
            path: 'interceptOrder',
            component: () => import('@/views/orders/interceptOrder'),
            name: 'InterceptOrder',
            meta: {
              title: '拦截记录',
              roles: ['系统管理员', '行运易', '客服', '财务'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'transferLog',
            component: () => import('@/views/logs/transferLog.vue'),
            name: 'TransferLog',
            meta: {
              title: '转单日志',
              roles: ['系统管理员', '客服', '行运易']
            }
          },
          {
            path: 'CreateOrder',
            component: () => import('@/views/logs/CreateOrder'),
            name: 'CreateOrder',
            meta: {
              title: '下单日志',
              roles: ['系统管理员'] // or you can only set roles in sub nav
            }
          },

          {
            path: 'Warehouse',
            component: () => import('@/views/logs/Warehouse'),
            name: 'Warehouse',
            meta: {
              title: '仓库操作日志',
              roles: ['系统管理员', '行运易'] // or you can only set roles in sub nav
            }
          }, {
            path: 'WeightingLog',
            component: () => import('@/views/logs/WeightingLog.vue'),
            name: 'WeightingLog',
            meta: {
              title: '称重台日志',
              roles: ['系统管理员', '客服', '行运易']
            }
          },
          {
            path: 'erroJobLog',
            component: () => import('@/views/logs/ErroJobLog'),
            name: 'ErroJobLog',
            meta: {
              title: '推送失败日志',
              roles: ['系统管理员'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'arrearsReminder',
            component: () => import('@/views/report/arrearsReminder'),
            name: 'ArrearsReminder',
            meta: {
              title: '欠费提醒记录',
              roles: ['系统管理员', '仓库管理员', '行运易', '销售'] // or you can only set roles in sub nav
            }
          },
        ]
      },
      {
        path: '/report',
        component: () => import('@/views/finance/index'),
        alwaysShow: true, // will always show the root menu
        name: 'report',
        meta: {
          cache: true,
          title: '报表',
          icon: 'el-icon-s-marketing',
          roles: ['系统管理员', '仓库管理员', '物流管理员'] // you can set roles in root nav
        },
        children: [
          {
            path: 'userWrok',
            component: () => import('@/views/report/userWrok'),
            name: 'UserWrok',
            meta: {
              title: '工作统计',
              roles: ['系统管理员', '仓库管理员', '物流管理员'] // or you can only set roles in sub nav
            }
          }, {
            path: 'orderCountStatistics',
            component: () => import('@/views/report/orderCountStatistics'),
            name: 'OrderCountStatistics',
            meta: {
              title: '单量统计报表',
              roles: ['系统管理员', '仓库管理员', '物流管理员'] // or you can only set roles in sub nav
            }
          }, {
            path: 'delayOrder',
            component: () => import('@/views/report/delayOrder'),
            name: 'DelayOrder',
            meta: {
              title: '延期操作监控',
              roles: ['系统管理员', '仓库管理员', '物流管理员'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'TransferLogAnalysis',
            component: () => import('@/views/logs/TransferLogAnalysis.vue'),
            name: 'TransferLogAnalysis',
            meta: {
              title: '转单统计',
              roles: ['系统管理员', '客服', '行运易']
            }
          }
        ]
      },
      {
        path: '/other',
        component: () => import('@/views/finance/index'),
        alwaysShow: true, // will always show the root menu
        name: 'other',
        meta: {
          cache: true,
          title: '其他',
          icon: 'el-icon-house',
          roles: ['系统管理员', '客服', '行运易'] // you can set roles in root nav
        },
        children: [{
          path: 'outTemplate',
          component: () => import('@/views/orders/outTemplate'),
          name: 'OutTemplate',
          meta: {
            title: '数据导出模板',
            roles: ['系统管理员', '行运易', '客服', '财务'] // or you can only set roles in sub nav
          }
        },
        {
          path: 'downLuxPackLabel',
          component: () => import('@/views/orders/downLuxPackLabel'),
          name: 'DownLuxPackLabel',
          meta: {
            title: '下载卢邮大包标签',
            roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
          }
        },
        {
          path: 'deAddressLookup',
          component: () => import('@/views/orders/deAddressLookup'),
          name: 'DeAddressLookup',
          meta: {
            title: '德国地址查询',
            roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
          }
        }, {
          path: 'imageGenerate',
          component: () => import('@/views/imageGenerate/emailGenerate'),
          name: 'ImageGenerate',
          meta: {
            title: '图片生成',
            roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
          }
        }, {
          path: 'problemOrderEmail',
          component: () => import('@/views/orders/SendProblemOrderEmail'),
          name: 'ProblemOrderEmail',
          meta: {
            title: '发送问题件邮件',
            roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
          }
        }, {
          path: 'fixIoss',
          component: () => import('@/views/orders/fixIoss'),
          name: 'FixIoss',
          meta: {
            title: '设置IOSS',
            roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
          }
        }, {
          path: 'cancelChannelOrder',
          component: () => import('@/views/orders/cancelChannelOrder'),
          name: 'CancelChannelOrder',
          meta: {
            title: '取消渠道订单',
            roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
          }
        }, {
          path: 'fltIoss',
          component: () => import('@/views/orders/generateFtlIOSS'),
          name: 'FltIoss',
          meta: {
            title: '法翔加密IOSS',
            roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
          }
        },
        {
          path: 'calculator',
          component: () => import('@/views/orders/Calculator'),
          name: 'Calculator',
          meta: {
            title: '运费试算',
            roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
          }
        },
          // , {
          //   path: 'previewTemp',
          //   component: () => import('@/views/imageGenerate/previewTemp'),
          //   name: 'previewTemp',
          //   meta: {
          //     title: '模板预览',
          //     roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
          //   }
          // }
        ]
      }

    ]
  },
  {
    path: '/transfer',
    component: Layout,
    alwaysShow: true,
    meta: {
      title: '转运',
      icon: 'el-icon-box',
      roles: ['系统管理员', '客服', '行运易']
    },
    children: [
      {
        path: 'createboxes',
        component: () => import('@/views/transfer/createBoxes'),
        name: 'CreateBoxes',
        meta: {
          title: '批量创建箱子',
          roles: ['系统管理员', '客服', '行运易']
        }
      },
      {
        path: 'italyCustomsBox',
        component: () => import('@/views/transfer/ItalyCustomsBox'),
        name: 'ItalyCustomsBox',
        meta: {
          title: '意大利清关箱号',
          roles: ['系统管理员', '客服', '行运易']
        }
      },
    ]
  },
  {
    path: '/tracking',
    component: Layout,
    alwaysShow: true, // will always show the root menu
    name: 'tracking',
    meta: {
      title: '跟踪',
      icon: 'el-icon-location-outline',
      roles: ['系统管理员', '财务', '客服', '行运易', '渠道运营'] // you can set roles in root nav
    },
    children: [
      {
        path: 'config',
        component: () => import('@/views/tracking/config'),
        name: 'ConfigTracking',
        meta: {
          title: '末端跟踪转换',
          icon: 'el-icon-notebook-2',
          roles: ['系统管理员', '客服', '行运易'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'serviceProvider',
        component: () => import('@/views/tracking/serviceProvider'),
        name: 'ServiceProvider',
        meta: {
          title: '异常轨迹服务商',
          icon: 'el-icon-notebook-2',
          roles: ['系统管理员', '客服', '行运易'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'seventeenServiceProvider',
        component: () => import('@/views/tracking/seventeenServiceProvider'),
        name: 'SeventeenServiceProvider',
        meta: {
          title: '变更17服务商',
          icon: 'el-icon-notebook-2',
          roles: ['系统管理员', '客服', '行运易'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'metabase',
        component: () => import('@/views/tracking/metabase'),
        name: 'metabase',
        meta: {
          title: '签收率监控表',
          icon: 'el-icon-notebook-2',
          roles: ['系统管理员', '客服', '行运易'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'trackingsum',
        component: () => import('@/views/tracking/trackingsum'),
        name: 'trackingsum',
        meta: {
          title: '线路监控表-总表',
          icon: 'el-icon-notebook-2',
          roles: ['系统管理员', '客服', '行运易'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'bulkDelivery',
        component: () => import('@/views/tracking/bulkDelivery'),
        name: 'bulkDelivery',
        meta: {
          title: '空派物流监控表',
          icon: 'el-icon-notebook-2',
          roles: ['系统管理员', '客服', '行运易'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'timeEfficiencyAnalysis',
        component: () => import('@/views/tracking/timeEfficiencyAnalysis'),
        name: 'timeEfficiencyAnalysis',
        meta: {
          title: '时效(派送渠道)分析',
          icon: 'el-icon-notebook-2',
          roles: ['系统管理员', '客服', '行运易'] // or you can only set roles in sub nav
        }
      },

      {
        path: 'tracking',
        component: () => import('@/views/tracking/list'),
        name: 'TrackingList',
        meta: {
          title: '物流跟踪',
          icon: 'el-icon-notebook-2',
          roles: ['系统管理员', '财务', '客服', '行运易', '渠道运营'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'trackingindex',
        component: () => import('@/views/tracking/index'),
        name: 'Trackingindex',
        meta: {
          title: '面板',
          roles: ['系统管理员', '财务', '客服', '行运易'] // or you can only set roles in sub nav
        },
        hidden: true
      }, {
        path: 'notice',
        component: () => import('@/views/finance/index'),
        name: 'notice',
        meta: {
          cache: true,
          title: '通知',
          icon: 'el-icon-notebook-2',
          roles: ['系统管理员', '客服'] // you can set roles in root nav
        },
        children: [{
          path: 'trackingStopWarning',
          component: () => import('@/views/notice/TrackingStopWarning'),
          name: 'TrackingStopWarning',
          meta: {
            icon: 'el-icon-notebook-1',
            title: '跟踪停止预警',
            roles: ['系统管理员', '客服'] // or you can only set roles in sub nav
          }
        },
        {
          path: 'channelPhone',
          component: () => import('@/views/channel/channelPhone'),
          name: 'ChannelPhone',
          meta: {
            icon: 'el-icon-notebook-1',
            title: '邮局电话管理',
            roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
          }
        },
        {
          path: 'trackingQuestions',
          component: () => import('@/views/notice/TrackingQuestions'),
          name: 'TrackingQuestions',
          meta: {
            icon: 'el-icon-notebook-1',
            title: '物流问题通知',
            roles: ['系统管理员', '客服'] // or you can only set roles in sub nav
          }
        },
        {
          path: 'weight',
          component: () => import('@/views/notice/CustomerConfig'),
          name: 'CustomerConfig',
          meta: {
            icon: 'el-icon-notebook-1',
            title: '客户邮箱设置',
            roles: ['系统管理员', '客服'] // or you can only set roles in sub nav
          }
        },
        {
          path: 'SendJobConifg',
          component: () => import('@/views/notice/SendJobConifg'),
          name: 'SendJobConifg',
          meta: {
            icon: 'el-icon-notebook-1',
            title: '发件设置',
            roles: ['系统管理员', '客服'] // or you can only set roles in sub nav
          }
        }
        ]
      }, {
        path: '/OperateNodeTime',
        component: () => import('@/views/finance/index'),
        name: 'other',
        alwaysShow: true,
        meta: {
          cache: true,
          title: '全流程环节监控',
          icon: 'el-icon-notebook-2',
          roles: ['系统管理员', '客服', '行运易'] // you can set roles in root nav
        },
        children: [
          {
            path: 'orderTime',
            component: () => import('@/views/orders/OrderOperateNodeTime.vue'),
            name: 'OrderOperateNodeTime',
            meta: {
              title: '全流程环节监控',
              roles: ['系统管理员', '客服', '行运易']
            }
          },
          {
            path: 'settings',
            component: () => import('@/views/orders/OperateNodeTimeOutSetting.vue'),
            name: 'OperateNodeTimeOutSetting',
            meta: {
              title: '环节超时时间设置',
              roles: ['系统管理员', '客服', '行运易']
            }
          }
        ]
      },
      {
        path: 'supplementConfig',
        component: () => import('@/views/finance/index'),
        name: 'supplement',
        meta: {
          cache: true,
          title: '轨迹补充',
          icon: 'el-icon-notebook-2',
          roles: ['系统管理员', '客服'] // you can set roles in root nav
        },
        children: [{
          path: 'TrackSupplement',
          component: () => import('@/views/orders/trackSupplement'),
          name: 'TrackSupplement',
          meta: {
            title: '手动补充轨迹',
            roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
          }
        },
        {
          path: '/supplementLog/list',
          component: () => import('@/views/tracking/supplementLog/list'),
          name: 'SupplementLogList',
          meta: {
            title: '补充记录',
            roles: ['系统管理员', '财务', '客服', '行运易'] // or you can only set roles in sub nav
          }
        }, {
          path: 'supplementConfig/configs',
          component: () => import('@/views/tracking/supplementConfig/configs'),
          name: 'SupplementConfig',
          meta: {
            title: '自动补充配置',
            roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
          }
        },
        {
          path: 'supplementLog/ExpressLine',
          component: () => import('@/views/tracking/supplementLog/ExpressLine'),
          name: 'ExpressLineLogs',
          meta: {
            title: '快线轨迹日志',
            roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
          }
        }
        ]
      },
      {
        path: 'onlinetrack',
        component: () => import('@/views/tracking/trackobtain/onlinetrack'),
        name: 'Onlinetrack',
        meta: {
          title: '系统轨迹',
          roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'esuibaotrack',
        component: () => import('@/views/tracking/ESuibao/list'),
        name: 'ESuibaoTrack',
        meta: {
          title: 'E速宝轨迹处理',
          roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'esbMonitor',
        component: () => import('@/views/tracking/ESuibao/monitor'),
        name: 'EsbMonitor',
        meta: {
          title: 'E速宝轨迹预警',
          roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
        }
      },{
        path: 'trackMonitor',
        component: () => import('@/views/tracking/ESuibao/trackMonitor'),
        name: 'TrackMonitor',
        meta: {
          title: 'E速宝监控表',
          roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'waitRestartTrace',
        component: () => import('@/views/tracking/ESuibao/waitRestartTrace'),
        name: 'WaitRestartTrace',
        meta: {
          title: '重启轨迹跟踪',
          roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'dwEsb',
        component: () => import('@/views/tracking/ESuibao/dwEsb'),
        name: 'ManualPush',
        meta: {
          title: '手动推送东莞E速宝',
          roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
        }
      },
      {
        path: '51TrackLogic',
        component: () => import('@/views/finance/index'),
        name: '51TrackLogic',
        meta: {
          cache: true,
          title: '51轨迹',
          icon: 'el-icon-notebook-2',
          roles: ['系统管理员', '客服'] // you can set roles in root nav
        },
        children: [
        //   {
        //   path: '51TrackConfig',
        //   component: () => import('@/views/tracking/51TrackLogic/51TrackConfig'),
        //   name: '51TrackConfig',
        //   meta: {
        //     title: '提单轨迹匹配逻辑',
        //     roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
        //   }
        // },
          {
            path: 'TrackSupplement',
            component: () => import('@/views/tracking/51TrackLogic/nodeTime'),
            name: 'NodeTime',
            meta: {
              title: '查看捕获时间',
              roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
            }
          }
        ]
      },
      {
        path: 'ordermail',
        component: () => import('@/views/finance/index'),
        name: 'orderMail',
        meta: {
          cache: true,
          title: '订单邮件',
          icon: 'el-icon-notebook-2',
          roles: ['系统管理员', '客服'] // you can set roles in root nav
        },
        children: [
          {
            path: 'mailTemplate',
            component: () => import('@/views/orders/mailTemplate'),
            name: 'Mailtemplate',
            meta: {
              title: '邮件模版',
              roles: ['系统管理员', '行运易', '客服'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'sendRecord',
            component: () => import('@/views/orders/sendRecord'),
            name: 'SendRecord',
            meta: {
              title: '发送记录',
              roles: ['系统管理员', '财务', '客服', '行运易'] // or you can only set roles in sub nav
            }
          }
        ]
      }
    ]
  },
  // {
  //   path: '/packing/medios',
  //   component: Layout,
  //   alwaysShow: true, // will always show the root menu
  //   name: 'packing',
  //   meta: {
  //     title: '仓库',
  //     icon: 'el-icon-box',
  //     roles: ['系统管理员', '行运易'] // you can set roles in root nav
  //   },
  //   children: [
  //     {
  //       path: 'medios',
  //       component: () => import('@/views/packing/medios'),
  //       name: 'medios',
  //       meta: {
  //         title: '语音配置',
  //         roles: ['系统管理员', '行运易'] // or you can only set roles in sub nav
  //       }
  //     },
  //     {
  //       path: 'bag',
  //       component: () => import('@/views/packing/bag'),
  //       name: 'bag',
  //       meta: {
  //         title: '入库批次',
  //         roles: ['系统管理员', '行运易'] // or you can only set roles in sub nav
  //       }
  //     },
  //     {
  //       path: 'customerHandover',
  //       component: () => import('@/views/orders/customerHandover'),
  //       name: 'customerHandover',
  //       meta: {
  //         title: '订单交接',
  //         roles: ['系统管理员', '行运易'] // or you can only set roles in sub nav
  //       }
  //     }
  //   ]
  // },
  {
    path: '/channel',
    component: Layout,
    name: 'channel',
    alwaysShow: true,
    meta: {
      title: '渠道管理',
      icon: 'el-icon-truck',
      roles: ['系统管理员', '行运易', '客服', '渠道运营'] // you can set roles in root nav
    },
    children: [
      {
        path: '/channels',
        component: () => import('@/views/finance/index'),
        name: 'channels',
        meta: {
          cache: true,
          title: '渠道',
          icon: 'el-icon-s-grid',
          roles: ['系统管理员', '客服', '渠道运营'] // you can set roles in root nav
        },
        children: [
          {
            path: 'PublicCategory',
            component: () => import('@/views/channel/publicCategory'),
            name: 'PublicCategory',
            meta: {
              title: '公开渠道匹配',
              roles: ['系统管理员', '渠道运营'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'channelMatchRules',
            component: () => import('@/views/channel/channelMatchRules'),
            name: 'ChannelMatchRules',
            meta: {
              title: '内部渠道跳转',
              roles: ['系统管理员', '渠道运营'] // or you can only set roles in sub nav
            }
          },
          {

            path: 'channel',
            component: () => import('@/views/channel/list'),
            name: 'ChannelList',
            meta: {
              title: '内部渠道管理',
              roles: ['系统管理员', '客服', '渠道运营'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'channelEdit',
            hidden: true,
            component: () => import('@/views/channel/edit'),
            name: 'ChannelEdit',
            meta: {
              noCache: true,
              title: '新增内部渠道',
              roles: ['系统管理员', '客服', '渠道运营'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'channelCopy',
            hidden: true,
            component: () => import('@/views/channel/edit'),
            name: 'ChannelCopy',
            meta: {
              noCache: true,
              title: '复制内部渠道',
              roles: ['系统管理员', '客服', '渠道运营'] // or you can only set roles in sub nav
            }
          }, {
            path: 'channelTest',
            component: () => import('@/views/channel/channelTest'),
            name: 'ChannelTest',
            meta: {
              noCache: true,
              title: '渠道测试下单',
              roles: ['系统管理员', '客服', '渠道运营'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'publicChannel',
            component: () => import('@/views/public-channel/list'),
            name: 'PublicChannel',
            meta: {
              title: '公开渠道管理',
              roles: ['系统管理员', '客服', '财务', '渠道运营'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'publicChannelEdit',
            component: () => import('@/views/public-channel/edit'),
            name: 'PublicChannelEdit',
            hidden: true,
            meta: {
              noCache: true,
              title: '新增公开渠道',
              roles: ['系统管理员', '客服', '渠道运营'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'autoTransferSetting',
            component: () => import('@/views/setting/autoTransferSetting'),
            name: 'AutoTransferSetting',
            meta: {
              title: '自动中转面单设置',
              roles: ['系统管理员', '渠道运营'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'Express',
            component: () => import('@/views/channel/express'),
            name: 'Express',
            meta: {
              title: '渠道匹配规则',
              roles: ['系统管理员', '渠道运营'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'PostalArea',
            component: () => import('@/views/channel/channelPostalArea'),
            name: 'PostalArea',
            meta: {
              title: '渠道通邮地区',
              roles: ['系统管理员', '客服', '渠道运营'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'BarCodeList',
            component: () => import('@/views/barcode/list'),
            name: 'BarCodeList',
            meta: {
              title: '运单匹配截取',
              roles: ['系统管理员', '行运易', '客服', '渠道运营'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'medios',
            component: () => import('@/views/packing/medios'),
            name: 'Medios',
            meta: {
              title: '渠道语音',
              roles: ['系统管理员', '行运易', '客服', '渠道运营'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'ChannelOrderCancel',
            hidden: false, // 先取消显示
            component: () => import('@/views/channel/ChannelOrderCancel'),
            name: 'ChannelOrderCancel',
            meta: {
              title: '渠道面单取消',
              roles: ['系统管理员', '行运易', '客服', '渠道运营'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'WeightCoefficientManagement',
            hidden: false, // 先取消显示
            component: () => import('@/views/channel/WeightCoefficientManagement'),
            name: 'WeightCoefficientManagement',
            meta: {
              title: '抛重系数管理',
              roles: ['系统管理员', '行运易', '客服', '渠道运营'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'ChannelAddressVerif',
            hidden: false, // 先取消显示
            component: () => import('@/views/channel/channelAddressVerif'),
            name: 'ChannelAddressVerif',
            meta: {
              title: '偏远地址检测',
              roles: ['系统管理员', '行运易', '客服', '渠道运营'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'RemoteRule',
            component: () => import('@/views/channel/remoteRule'),
            name: 'RemoteRule',
            meta: {
              title: '偏远规则',
              roles: ['系统管理员', '渠道运营'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'ChannelCNTrunkLine',
            hidden: false, // 先取消显示
            component: () => import('@/views/channel/channelCNTrunkLine'),
            name: 'ChannelCNTrunkLine',
            meta: {
              title: '菜鸟干线推送',
              roles: ['系统管理员', '行运易', '客服', '渠道运营'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'ChannelCNTrunkLineEdit',
            hidden: true,
            component: () => import('@/views/channel/channelCNTrunkLineEdit'),
            name: 'ChannelCNTrunkLineEdit',
            meta: {
              noCache: true,
              title: '编辑提单干线信息',
              roles: ['系统管理员', '行运易', '客服', '渠道运营']// or you can only set roles in sub nav
            }
          }
        ]
      },
      {
        path: 'notice',
        component: () => import('@/views/finance/index'),
        name: 'notice',
        meta: {
          cache: true,
          title: '申报',
          icon: 'el-icon-money',
          roles: ['系统管理员','行运易', '客服', '渠道运营'] // you can set roles in root nav
        },

        children: [
          {
            path: 'BagDeclare',
            component: () => import('@/views/channel/bagDeclare'),
            name: 'BagDeclare',
            meta: {
              title: '大包申报日志',
              roles: ['系统管理员', '行运易', '客服', '渠道运营'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'channelDeclareRule',
            component: () => import('@/views/channel/channelDeclareRule'),
            name: 'ChannelDeclareRule',
            meta: {
              title: '渠道申报价值规则设置',
              roles: ['系统管理员', '行运易', '客服', '渠道运营'] // or you can only set roles in sub nav
            }
          }, {
            path: 'usDeclarationLimit',
            component: () => import('@/views/channel/usDeclarationLimit'),
            name: 'UsDeclarationLimit',
            meta: {
              title: '美国渠道品名限制',
              roles: ['系统管理员', '行运易', '客服', '渠道运营'] // or you can only set roles in sub nav
            }
          }, {
            path: 'channelDeclareRuleDetail',
            component: () => import('@/views/channel/channelDeclareRuleDetail'),
            name: 'ChannelDeclareRuleDetail',
            hidden: true,
            meta: {
              noCache: true,
              title: '渠道申报规则明细',
              roles: ['系统管理员', '行运易', '客服', '渠道运营'] // or you can only set roles in sub nav
            }
          }, {
            path: 'specialGoodsName',
            component: () => import('@/views/setting/specialGoodsNameSetting'),
            name: 'SpecialGoodsName',
            meta: {
              title: '品名拦截设置',
              roles: ['系统管理员', '行运易', '客服', '渠道运营'] // or you can only set roles in sub nav
            }
          }, {
            path: 'declarationFix',
            component: () => import('@/views/setting/declarationFix'),
            name: 'DeclarationFix',
            meta: {
              title: '品名自动匹配',
              roles: ['系统管理员', '行运易', '客服', '渠道运营'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'hsCodeMatch',
            component: () => import('@/views/declare/hsCodeMatch'),
            name: 'HsCodeMatch',
            meta: {
              title: '海关编码自动匹配',
              roles: ['系统管理员', '行运易', '客服', '渠道运营'] // or you can only set roles in sub nav
            }
          },
          {
            path: 'ServiceDeclaredUnitPrice',
            component: () => import('@/views/channel/serviceDeclaredUnitPrice'),
            name: 'ServiceDeclaredUnitPrice',
            meta: {
              title: '欧盟申报价值',
              roles: ['系统管理员', '渠道运营'] // or you can only set roles in sub nav
            }
          },
          {
            path: '/WeightAdj',
            component: () => import('@/views/channel/weightAdj'),
            name: 'WeightAdj',
            meta: {
              title: '重量调整',
              roles: ['系统管理员', '渠道运营'] // or you can only set roles in sub nav
            }
          },
          {
            path: '/providerWeightAdj',
            component: () => import('@/views/channel/providerWeightAdj'),
            name: 'ProviderWeightAdj',
            meta: {
              title: '服务商重量随机调整',
              roles: ['系统管理员', '渠道运营'] // or you can only set roles in sub nav
            }
          },
        ]
      }
    ]
  },
  {
    path: '/setting',
    component: Layout,
    name: 'setting',
    alwaysShow: true,
    meta: {
      title: '客户管理',
      icon: 'el-icon-s-custom',
      roles: ['系统管理员', '行运易', '客服', '财务'] // you can set roles in root nav
    },
    children: [
      {
        path: 'customer',
        component: () => import('@/views/customer/list'),
        name: 'CustomerSetting',
        meta: {
          title: '客户管理',
          roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'customerMaintenance',
        component: () => import('@/views/customer/customerMaintenance'),
        name: 'CustomerMaintenance',
        meta: {
          title: '客户维护',
          roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'BDManage',
        component: () => import('@/views/businessDivision/manage'),
        name: 'BDManage',
        meta: {
          title: '事业部/业务员管理',
          roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'toleranceConfig',
        component: () => import('@/views/weight/toleranceConfig'),
        name: 'ToleranceConfig',
        meta: {
          title: '容差配置',
          roles: ['系统管理员', '客服'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'CustomerBillCard',
        component: () => import('@/views/customer/customerBillCard'),
        name: 'CustomerBillCard',
        meta: {
          title: '额度管理',
          roles: ['系统管理员'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'customerBillCardDetail',
        hidden: true,
        component: () => import('@/views/customer/customerBillCardDetail'),
        name: 'CustomerBillCardDetail',
        meta: {
          noCache: true,
          title: '流水管理',
          roles: ['系统管理员'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'adjustmentQuotaLogs',
        hidden: true,
        component: () => import('@/views/customer/adjustmentQuotaLogs'),
        name: 'AdjustmentQuotaLogs',
        meta: {
          noCache: true,
          title: '调整记录',
          roles: ['系统管理员'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'NoticeList',
        component: () => import('@/views/notice/list'),
        name: 'NoticeList',
        meta: {
          title: '公告管理',
          roles: ['系统管理员', '客服'] // or you can only set roles in sub nav
        }
      },
      {
        path: 'customerEdit',
        hidden: true,
        component: () => import('@/views/customer/edit'),
        name: 'CustomerEdit',
        meta: {
          title: '新增客户',
          noCache: true,
          roles: ['系统管理员', '财务'] // or you can only set roles in sub nav
        }
      }

    ]
  },
  {
    path: '/',
    component: Layout,
    alwaysShow: true, // will always show the root menu
    name: 'gps',
    meta: {
      title: '车辆跟踪',
      icon: 'el-icon-picture',
      roles: ['系统管理员'] // you can set roles in root nav
    },
    children: [
      {
        path: '/gps/gps',
        component: () => import('@/views/modelDrawing/modelDrawing'),
        name: 'ModelDrawing',
        meta: {
          title: '制衣样图',
          roles: ['系统管理员'] // or you can only set roles in sub nav
        }
      }
    ]
  }, {
    path: '/knowledgeSevice/dict',
    component: Layout,
    alwaysShow: true,
    name: 'Dicts',
    meta: {
      title: '培训资料',
      icon: 'el-icon-service',
      roles: ['系统管理员', '行运易', '客服', '销售', '财务']
    },
    children: [
      {
        path: '/knowledgeSevice/dict',
        component: () => import('@/views/knowledgeSevice/dicts'),
        name: 'Dicts',
        meta: {
          title: '培训资料'
        }
      },
      {
        path: '/knowledgeSevice/files/:id',
        hidden: true,
        component: () => import('@/views/knowledgeSevice/files'),
        name: 'Files',
        meta: {
          title: '培训明细'
        }
      }
    ]
  },
  {
    path: '/ds',
    component: Layout,
    alwaysShow: true,
    name: 'ds',
    meta: {
      title: '一键代发',
      icon: 'el-icon-umbrella',
      roles: ['系统管理员', '行运易'] // you can set roles in root nav
    },
    children: [
      {
        path: '/ds/pickOrder',
        component: () => import('@/views/orderPick/list'),
        name: 'PickOrder',
        meta: {
          title: '拣货单',
          roles: ['系统管理员', '行运易'] // or you can only set roles in sub nav
        }
      },
      {
        path: '/ds/pickCheck',
        component: () => import('@/views/orderPick/pickCheck'),
        name: 'PickCheck',
        meta: {
          title: '拣货检验',
          roles: ['系统管理员', '行运易'] // or you can only set roles in sub nav
        }
      },
      {
        path: '/ds/barCode',
        component: () => import('@/views/orderPick/barCode'),
        name: 'BarCode',
        meta: {
          title: '条码打印',
          roles: ['系统管理员', '行运易'] // or you can only set roles in sub nav
        }
      },
      {
        path: '/ds/dsStock',
        component: () => import('@/views/dsStock/index'),
        name: 'DsStock',
        meta: {
          title: '库存查询',
          roles: ['系统管理员', '行运易'] // or you can only set roles in sub nav
        }
      },
      {
        path: '/ds/dsStockIn',
        component: () => import('@/views/dsStock/inStockLog'),
        name: 'DsStockIn',
        meta: {
          title: '入库日志',
          roles: ['系统管理员', '行运易'] // or you can only set roles in sub nav
        }
      },
      {
        path: '/ds/dsStockOut',
        component: () => import('@/views/dsStock/outStockLog'),
        name: 'DsStockOut',
        meta: {
          title: '出库日志',
          roles: ['系统管理员', '行运易'] // or you can only set roles in sub nav
        }
      },
      {
        path: '/ds/purchase',
        component: () => import('@/views/dsStock/purchase'),
        name: 'PurchaseList',
        meta: {
          title: '采购查询',
          roles: ['系统管理员', '行运易'] // or you can only set roles in sub nav
        }
      },
      {
        path: '/ds/Stock',
        component: () => import('@/views/finance/index'),
        // alwaysShow: true, // will always show the root menu
        name: 'Stock',
        meta: {
          cache: true,
          title: '仓库管理',
          roles: ['系统管理员', '客服', '行运易'] // you can set roles in root nav
        },
        children: [
          {
            path: '/ds/stock/room/list',
            name: 'StockRoomList',
            component: () => import('@/views/stock/room/list'),
            meta: {
              title: '库房管理',
              roles: ['系统管理员', '行运易'] // you can set roles in root nav
            }
          },
          {
            path: '/ds/stock/area/list',
            name: 'StockAreaList',
            component: () => import('@/views/stock/area/list'),
            meta: {
              title: '库区管理',
              roles: ['系统管理员', '行运易'] // you can set roles in root nav
            }
          },
          {
            path: '/ds/stock/path/list',
            name: 'StockPathList',
            component: () => import('@/views/stock/path/list'),
            meta: {
              title: '通道管理',
              roles: ['系统管理员', '行运易'] // you can set roles in root nav
            }
          },
          {
            path: '/ds/stock/shelf/list',
            name: 'StockShelfList',
            component: () => import('@/views/stock/shelf/list'),
            meta: {
              title: '货架管理',
              roles: ['系统管理员', '行运易'] // you can set roles in root nav
            }
          },
          {
            path: '/ds/stock/shelf/shelf',
            name: 'StockShelf',
            component: () => import('@/views/stock/shelf/shelf'),
            meta: {
              title: '货架管理',
              roles: ['系统管理员', '行运易'] // you can set roles in root nav
            },
            hidden: true
          }
        ]
      },
      {
        path: '/dsoperation',
        component: () => import('@/views/finance/index'),
        // alwaysShow: true, // will always show the root menu
        name: 'dsoperation',
        meta: {
          cache: true,
          title: '仓库作业',
          roles: ['系统管理员', '客服', '行运易'] // you can set roles in root nav
        },
        children: [{
          path: '/ds/operation/receive',
          name: 'OperationReceive',
          component: () => import('@/views/dsOperation/receive/receive'),
          meta: {
            title: '收货',
            roles: ['系统管理员', '行运易'] // you can set roles in root nav
          }
        },
        {
          path: '/ds/ReceiveLog',
          component: () => import('@/views/dsOperation/receive/log'),
          name: 'ReceiveLog',
          meta: {
            title: '收货日志',
            roles: ['系统管理员', '行运易'] // or you can only set roles in sub nav
          }
        },
        // {
        //   path: '/ds/operation/weighting/weight',
        //   name: 'weight',
        //   component: () => import('@/views/dsOperation/weighting/weight'),
        //   meta: {
        //     title: '称重',
        //     roles: ['系统管理员'] // you can set roles in root nav
        //   }
        // },
        {
          path: '/ds/operation/onShelf',
          name: 'onShelf',
          component: () => import('@/views/dsOperation/onShelf/onshelf'),
          meta: {
            title: '上架',
            roles: ['系统管理员', '行运易'] // you can set roles in root nav
          }
        },
        {
          path: '/ds/operation/inventoryTask',
          hidden: false,
          name: 'InventoryTaskList',
          component: () => import('@/views/dsOperation/inventory/list'),
          meta: {
            title: '库存盘点',
            roles: ['系统管理员', '行运易'] // you can set roles in root nav
          }
        },
        {
          path: '/ds/operation/inventoryTaskEdit',
          hidden: true,
          name: 'InventoryTaskEdit',
          component: () => import('@/views/dsOperation/inventory/Edit'),
          meta: {
            noCache: true,
            title: '编辑任务',
            roles: ['系统管理员', '行运易'] // you can set roles in root nav
          }
        },
        {
          path: '/ds/operation/inventoryTaskDetail',
          hidden: true,
          name: 'InventoryTaskDetail',
          component: () => import('@/views/dsOperation/inventory/Detail'),
          meta: {
            title: '盘点详情',
            roles: ['系统管理员', '行运易'] // you can set roles in root nav
          }
        }

        ]
      },
      {
        path: '/dsOperation/printerSetting',
        name: 'PrinterSetting',
        component: () => import('@/views/dsOperation/printerSetting'),
        meta: {
          title: '打印机设置',
          roles: ['系统管理员', '行运易'] // you can set roles in root nav
        }
      }
    ]
  },
  // 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
