/*
 * @Descripttion: 当前组件信息
 * @version: 1.0.0
 * @Author: 无尘
 * @Date: 2018-10-10 14:44:45
 * @LastEditors: 无尘
 * @LastEditTime: 2020-12-14 16:54:50
 */
import Vue from 'vue';
import Router from 'vue-router';
import _import from './_import.js';
Vue.use(Router);

const errorPage = r => {
  import('views/errorPage/index.vue').then(module => {
    r(module);
  });
};
// 页面刷新时，重新赋值token

if (window.sessionStorage.getItem('token')) {
  /* eslint-disable */
    store.commit(types.LOGIN, window.sessionStorage.getItem('token'));
}
export const constantRouterMap = [
    // {
    //     path: '/login',
    //     name: '登录',
    //     component: _import('login', 'index')
    // },
    {
        path: '/loginMore',
        name: '登录',
        component: _import('login', 'login-more')
    },
    {
      path: '/',
      // 取到菜单数据后，会将/index的路径加到routes中
      redirect: '/index',
      component: () => import('@/components/layout/index.vue'),
      children: [
        // 通讯录
        {
                path: '/contactsList',
                name: '通讯录',
                component: _import('business', 'contacts')
            },
            /* {
                                       path: '/orgStructSet',
                                       name: '组织架构管理',
                                       component: _import('business', 'orgStructSet')
                                     },
                                     {
                                       path: '/recycle',
                                       name: '组织架构管理',
                                       component: _import('business', 'recycle')
                                     }, */
            {
                path: '/syncLog',
                name: '通讯录日志',
                component: _import('business', 'syncLog')
            },
            {
                path: '/authMerchant',
                name: '授权商户',
                component: _import('business', 'authMerchant')
            },
            {
                path: '/authMerchantForm',
                name: '新建授权商户',
                component: _import('business', 'authMerchant-form')
            },
            {
                path: '/merchantStoreList',
                name: '绑定门店列表',
                component: _import('business', 'storeList')
    },
        // 企业设置
        {
                path: '/enterpriseSet',
                name: '企业信息',
                component: _import('enterprise', 'enterpriseSet')
            },
            {
                path: '/adminList',
                name: '企业信息',
                component: _import('enterprise', 'adminList')
            },
            {
                path: '/material',
                name: '素材库',
                component: _import('enterprise', 'material')
            },
            {
                path: '/salutatory',
                name: '欢迎语',
                component: _import('enterprise', 'salutatory')
            },
            {
                path: '/salutatorySet',
                name: '新建欢迎语',
                component: _import('enterprise', 'salutatorySet')
            },
            {
                path: '/editSalutatorySet',
                name: '编辑欢迎语',
                component: _import('enterprise', 'salutatorySet')
            },
            {
                path: '/guide-setting',
                name: '导购设置',
                component: _import('enterprise', 'guide-setting')
            },
            {
                path: '/setting',
                name: '操作设置',
                component: _import('setting', 'index')
            },
                // 审核中心
                    {
                        path: '/unreview',
                        name: '未审核',
                        component: _import('reviewCenter', 'unreview')
                    },
                    {
                        path: '/reviewed',
                        name: '已审核',
                        component: _import('reviewCenter', 'reviewed')
                    },
                    {
                        path: '/reviewSet',
                        name: '审核设置',
                        component: _import('reviewCenter', 'reviewSet')
    },
    // 销售线索
    {
                path: '/taskRecord',
                name: '话务任务记录',
                component: _import('salesleads/trafficTask', 'taskRecord'),
                meta: {
                    keepAlive: true
                }
                
            },
            {
                path: '/taskView',
                name: '话务任务记录',
                component: _import('salesleads/trafficTask', 'taskView')
            },
            {
                path: '/taskDetail',
                name: '话务任务详情',
                component: _import('salesleads/trafficTask', 'taskDetail')
            },
            {
                path: '/taskViewDetail',
                name: '话务任务详情',
                component: _import('salesleads/trafficTask', 'taskViewDetail')
            },
            {
                path: '/trafficTaskSet',
                name: '话务任务设置',
                component: _import('salesleads/trafficTask', 'trafficTaskSet')
            },
            {
                path: '/grStoreList', // 群发任务-门店视图
                name: '门店视图',
                component: _import('salesleads/groupSend', 'grStoreList')
            },
            {
                path: '/grStoreDetail/:id', // 群发任务-门店视图-任务详情
                name: '门店视图',
                component: _import('salesleads/groupSend', 'grStoreDetail')
            },
            {
                path: '/grTaskList', // 群发任务-计划视图
                name: '计划视图',
                component: _import('salesleads/groupSend', 'grTaskList')
    },
        // 企业数据
        {
                path: '/enterpriseUseData',
                name: '好办使用详情',
                component: _import('enterpriseData', 'enterpriseUseData')
            },
            {
                path: '/activeDetail',
                name: '激活人员明细',
                component: _import('enterpriseData', 'activeDetail')
            },
            {
                path: '/loginDetail',
                name: '登录人员明细',
                component: _import('enterpriseData', 'loginDetail')
            },
            {
                path: '/areaLoginDetail',
                name: '区域登录人员明细',
                component: _import('enterpriseData', 'areaLoginDetail')
    },
        // 溢出门店
        {
            path: '/overStoreList',
            name: '溢出门店',
            component: _import('overstore', 'overStoreList')
    },
        // 企业应用
            /*  {
                                      path: '/appcenter',
                                      name: '企业应用中心',
                                      component: _import('enterpriseApp', 'appcenter')
                                    }, */
            /* 我的客户应用 */
            {
                        path: '/memberShowSet',
                        name: '客户展示设置',
                        component: _import('apps/customerApp', 'memberShowSet')
                    },
                    {
                        path: '/memberGroupSet',
                        name: '客户分组设置',
                        component: _import('apps/customerApp', 'memberGroupSet')
                    },
                    {
                        path: '/memberSearchSet',
                        name: '客户搜索设置',
                        component: _import('apps/customerApp', 'memberSearchSet')
                    },
                    {
                        path: '/memberDetailSet',
                        name: '客户详情设置',
                        component: _import('apps/customerApp', 'memberDetailSet')
                    },
                    {
                        path: '/memberTagSet',
                        name: '客户标签设置',
                        component: _import('apps/customerApp', 'memberTagSet')
                    },
                    {
                        path: '/syncHistory',
                        name: '同步历史',
                        component: _import('apps/customerApp', 'syncHistory')
                    },
                    {
                        path: '/myCustomerList',
                        name: '我的客户列表',
                        component: _import('apps/customerApp', 'myCustomerList')
                    },
                    {
                        path: '/addGroupTemplate',
                        name: '添加模板',
                        component: _import('apps/customerApp', 'addGroupTemplate')
                    },
                    {
                        path: '/editGroupTemplate',
                        name: '编辑模板',
                        component: _import('apps/customerApp', 'addGroupTemplate')
                    },
                    {
                        path: '/storeRangeSet',
                        name: '门店范围设置',
                        component: _import('apps/customerApp', 'storeRangeSet')
            },
                    // 云日报
            {
                        path: '/dailyRecord',
                        name: '云日报记录',
                        component: _import('apps/cloudDaily', 'dailyRecord')
                    },
                    {
                        path: '/dailyExport',
                        name: '云日报导出',
                        component: _import('apps/cloudDaily', 'dailyExport')
                    },
                    {
                        path: '/dailyDetail',
                        name: '日报详情',
                        component: _import('apps/cloudDaily', 'dailyDetail')
                    },
                    {
                        path: '/taskAssign',
                        name: '任务下发设置',
                        component: _import('apps/cloudDaily', 'taskAssign')
                    },
                    {
                        path: '/systemReport',
                        name: '系统报表',
                        component: _import('apps/cloudDaily', 'systemReport')
                    },
                    {
                        path: '/customReport',
                        name: '自定义报表',
                        component: _import('apps/cloudDaily', 'customReport')
                    },
                    {
                        path: '/customReportSet',
                        name: '新增自定义报表设置',
                        component: _import('apps/cloudDaily', 'customReportSet')
                    },
                    {
                        path: '/customReportCopy',
                        name: '复制自定义报表设置',
                        component: _import('apps/cloudDaily', 'customReportSet')
                    },
                    {
                        path: '/customReportEdit',
                        name: '编辑自定义报表设置',
                        component: _import('apps/cloudDaily', 'customReportSet')
            },
                    // 指标管理
            {
                        path: '/monthList',
                        name: '月指标列表',
                        component: _import('apps/quota', 'monthList')
                    },
                    {
                        path: '/storeMonthTask',
                        name: '门店月指标',
                        component: _import('apps/quota', 'storeMonthTask')
                    },
                    {
                        path: '/salerMonthDetail',
                        name: '导购月指标详情',
                        component: _import('apps/quota', 'salerMonthDetail')
                    },
                    {
                        path: '/companyDaySet',
                        name: '商户日权重',
                        component: _import('apps/quota', 'companyDaySet')
                    },
                    {
                        path: '/monthTask',
                        name: '月指标任务',
                        component: _import('apps/quota', 'monthTask'),
                        meta: {
                            keepAlive: true
                        }
                    },
                    {
                        path: '/monthTaskDetail',
                        name: '月指标任务详情',
                        component: _import('apps/quota', 'monthTaskDetail'),
                        meta: {
                            keepAlive: true
                        }
            },
                    // 卡券赠送
            {
                        path: '/cardList',
                        name: '卡券列表',
                        component: _import('apps/card', 'cardList')
                    },
                    {
                        path: '/cardRecord',
                        name: '卡券记录',
                        component: _import('apps/card', 'cardRecord')
                    },
                    {
                        path: '/newCard',
                        name: '新建卡券',
                        component: _import('apps/card', 'newCard')
                    },
                    {
                        path: '/editCard',
                        name: '编辑卡券',
                        component: _import('apps/card', 'newCard')
                    },
                    // 内购券
            {
                        path: '/cardTemplate',
                        name: '卡券模板',
                        component: _import('apps/protectCard', 'cardTemplate')
                    },
                    {
                        path: '/newCardTemp',
                        name: '新建模板',
                        component: _import('apps/protectCard', 'newCardTemp')
                    },
                    {
                        path: '/cardStrategy',
                        name: '卡券策略',
                        component: _import('apps/protectCard', 'cardStrategy')
                    },
                    {
                        path: '/newCardStrategy',
                        name: '新建策略',
                        component: _import('apps/protectCard', 'newCardStrategy')
                    },
                    {
                        path: '/cardPut',
                        name: '内购券投放',
                        component: _import('apps/protectCard', 'cardPut')
                    },
                    {
                        path: '/newCardPut',
                        name: '新建补发',
                        component: _import('apps/protectCard', 'newCardPut')
                    },
                    {
                        path: '/cardPutRecord',
                        name: '投放记录',
                        component: _import('apps/protectCard', 'cardPutRecord')
                    },
                    {
                        path: '/cardGetRecord',
                        name: '领取记录',
                        component: _import('apps/protectCard', 'cardGetRecord')
            },
            // 商品中心
            {
                    path: '/goodsShowSet',
                    name: '商品展示设置',
                    component: _import('apps/shoppingCenter', 'goodsShowSet')
            },
            // 订单评价
            {
                    path: '/evaluate-set',
                    name: '订单评价',
                    component: _import('apps/order-evaluate', 'evaluate-set')
                },

    {
        path: '/gic-error',
        name: 'gic跳转失败页',
        component: _import('errorPage', 'gic-error')
    },
    {
        path: '/403',
        name: '无权访问',
        component: errorPage
    },
    {
        path: '/404',
        name: 'error404',
        component: errorPage
    },
    {
        path: '/500',
        name: 'error500',
        component: errorPage
    }
    ]
  }
];
export default new Router({
    // mode:'history',
    routes: constantRouterMap,
    scrollBehavior: () => ({ y: 0 })
});
