/*
 * @Descripttion: 路由
 * @version: 1.0.0
 * @Author: 无尘
 * @Date: 2020-07-16 16:37:05
 * @LastEditors: 无尘
 * @LastEditTime: 2020-10-20 16:34:49
 */
import _import from './_import.js';

const errorPage = r => {
  import('@/views/error-page/index.vue').then(module => {
    r(module);
  });
};

export const routes = [
  {
    path: '/',
    name: '/',
    redirect: 'login'
  },
  {
    path: '/login',
    name: '登录',
    component: _import('login', 'index')
  },
  {
    path: '/index',
    name: 'index',
    component: _import('index', 'index')
  },
  {
    // 通讯录
    path: '/contacts',
    name: '通讯录',
    redirect: 'contactsList',
    component: _import('business', 'index'),
    children: [
      {
        path: '/contactsList',
        name: '通讯录',
        component: _import('business', 'contacts')
      },
      {
        path: '/syncLog',
        name: '通讯录日志',
        component: _import('business', 'sync-log')
      },
      {
        path: '/authMerchant',
        name: '授权商户',
        component: _import('business', 'auth-merchant')
      },
      {
        path: '/newAuthMerchant',
        name: '新增授权',
        component: _import('business', 'new-auth-merchant')
      },
      {
        path: '/auditLog',
        name: '审核日志',
        component: _import('business', 'audit-log')
      },
    ]
  },
  {
    // 审核中心
    path: '/reviewCenter',
    name: '审核中心',
    redirect: 'unreview',
    component: _import('review-center', 'index'),
    children: [
      {
        path: '/reviewed',
        name: '已审核',
        component: _import('review-center', 'reviewed')
      },
      {
        path: '/unreview',
        name: '未审核',
        component: _import('review-center', 'unreview')
      },
      {
        path: '/audit-group-list',
        meta: { title: '审核组列表' },
        component: _import('review-center', 'audit-group-list')
      },
      {
        path: '/create-audit-group',
        meta: { title: '新建、编辑审核组' },
        component: _import('review-center', 'create-audit-group')
      },
      {
        path: '/audit-item-list',
        meta: { title: '审核事项列表' },
        component: _import('review-center', 'audit-item-list')
      },
      {
        path: '/create-audit-item',
        meta: { title: '新建、编辑审核事项' },
        component: _import('review-center', 'create-audit-item')
      },
      {
        path: '/audit-config',
        meta: { title: '审核设置' },
        component: _import('review-center', 'audit-config')
      }
    ]
  },
  {
    // 企业设置
    path: '/enterprise',
    name: '企业设置',
    redirect: 'enterpriseSet',
    component: _import('enterprise', 'index'),
    children: [
      {
        path: '/enterpriseSet',
        name: '企业信息',
        component: _import('enterprise', 'enterprise-set')
      },
      {
        path: '/admin-list',
        name: '管理员',
        component: _import('enterprise', 'admin-list')
      },
      {
        path: '/edit-role',
        name: '新建、编辑角色',
        component: _import('enterprise', 'edit-role')
      },
      {
        path: '/edit-admin',
        name: '新建编辑管理员',
        component: _import('enterprise', 'edit-admin')
      },
      {
        path: '/store-admin-list',
        name: '门店角色',
        component: _import('enterprise', 'store-admin-list')
      },
      {
        path: '/edit-store-role',
        name: '编辑门店角色',
        component: _import('enterprise', 'edit-store-role')
      },
      {
        path: '/superAdmin',
        name: '超级管理员',
        component: _import('enterprise', 'super-admin')
      }
    ]
  },
  {
    path: '/app-controls',
    meta: { title: '工作台' },
    redirect: '/app-list',
    component: _import('app-controls', 'index'),
    children: [
      {
        path: '/app-list',
        meta: { title: '服务应用' },
        component: _import('app-controls', 'app-list')
      },
      {
        path: '/app-detail',
        meta: { title: '服务应用详情' },
        component: _import('app-controls', 'app-detail')
      },
      {
        path: '/app-market',
        meta: {
          title: '服务市场'
        },
        component: _import('app-controls', 'app-market')
      },
    ]
  },
  {
    // 企业应用
    path: '/apps',
    name: '企业应用',
    // redirect: '/my-customer',
    component: _import('apps', 'index'),
    children: [
      {
        path: '/my-customer',
        name: '我的顾客',
        // redirect: '/data-dimension',
        component: _import('apps/customer-app', 'index'),
        children: [
          {
            path: '/data-dimension',
            name: '数据维度',
            component: _import('apps/customer-app', 'data-dimension')
          },
          {
            path: '/crowd-scene',
            name: '人群场景',
            component: _import('apps/customer-app', 'crowd-scene')
          },
          {
            path: '/customer-data-set',
            name: '顾客资料',
            component: _import('apps/customer-app', 'customer-data-set')
          },
          {
            path: '/clerk-tag',
            name: '导购标签',
            component: _import('apps/customer-app', 'clerk-tag')
          },
          {
            path: '/customer-assign',
            name: '顾客分配',
            component: _import('apps/customer-app', 'customer-assign')
          }
        ]
      }
    ]
  },
  {
    path: '/app-auth',
    name: '应用授权',
    component: _import('apps', 'app-auth')
  },
  {
    path: '/gic-protocol',
    meta: {
      title: '协议'
    },
    component: _import('apps', 'gic-protocol')
  },
  {
    path: '/gic-error',
    name: 'gic跳转失败页',
    component: _import('error-page', 'gic-error')
  },
  {
    path: '/403',
    name: '无权访问',
    component: errorPage
  },
  {
    path: '/404',
    name: 'error404',
    component: errorPage
  },
  {
    path: '/500',
    name: 'error500',
    component: errorPage
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
];
