/*
 * @Author: shiyao
 * @Description:
 * @Date: 2019-08-21 15:51:29
 */
import Vue from 'vue';
import Router from 'vue-router';
import _import from './_import.js';
import Layout from '@/view/layout/Layout.vue';

Vue.use(Router);

export const constantRouterMap = [
  {
    path: '/login',
    component: () => import('@/view/login/login'),
    name: 'login',
  },
  {
    path: '/404',
    component: () => import('@/view/errorPage/404'),
    name: 'error404',
  },
  {
    path: '/403',
    component: () => import('@/view/errorPage/403'),
    name: 'error403',
  },
  {
    path: '/500',
    component: () => import('@/view/errorPage/500'),
    name: 'error500',
  },
  {
    path: '/',
    name: 'Layout',
    redirect: '/allCustomers',
    component: Layout,
    children: [
      {
        path: '/allCustomers',
        component: _import('allCustomers', 'allCustomersList'),
        meta: {
          title: '全部客户',
          keepAlive: true,
        },
      },
      {
        path: '/customerDetail',
        component: _import('allCustomers', 'customerDetail'),
        meta: {
          title: '客户详情',
        },
      },
      {
        path: '/consumption',
        component: _import('allCustomers', 'consumption'),
        meta: {
          title: '会员门店消费',
        },
      },
      {
        path: '/wechattotal',
        component: _import('wechatmembers', 'wechat-total'),
        meta: {
          title: '微信总量',
          keepAlive: true,
        },
      },
      // {
      //   path: "/wechatmembers",
      //   component: _import("wechatmembers", "wechatmembers"),
      //   meta: {
      //     title: "微信会员",
      //     keepAlive: true
      //   }
      // },
      {
        path: '/talkLogPage',
        component: _import('wechatmembers', 'talkLogPage'),
        meta: {
          title: '微信会员-通话记录',
        },
      },
      {
        path: '/infoMall',
        component: _import('wechatmembers', 'infoMall'),
        meta: {
          title: '微信会员-微信商城消费',
        },
      },
      // {
      //   path: "/posmembers",
      //   component: _import("posmembers", "posmembers"),
      //   meta: {
      //     title: "pos会员",
      //     keepAlive: true
      //   }
      // },
      {
        path: '/onlinemembers',
        component: _import('onlinemembers', 'onlinemembers'),
        meta: {
          title: '电商会员',
        },
      },
      {
        path: '/buyermembers',
        component: _import('buyermembers', 'buyermembers'),
        meta: {
          title: '电商买家',
        },
      },
      {
        path: '/frozenList',
        component: _import('wechatmembers', 'frozenList'),
        meta: {
          title: '冻结会员列表',
        },
      },
      {
        path: '/frozenList/frozenMember',
        component: _import('wechatmembers', 'frozenMember'),
        meta: {
          title: '冻结会员',
        },
      },
      {
        path: '/wechatmembers/memberSetting',
        component: _import('wechatmembers', 'memberSetting'),
        meta: {
          title: '微信会员-设置',
        },
      },
      {
        path: '/labelmanager',
        component: _import('labelmanager', 'labelmanager'),
        meta: {
          title: '会员标签',
        },
      },
      {
        path: '/achievement',
        component: _import('achievement', 'achievement'),
        meta: {
          title: '会员成就',
        },
      },
      {
        path: '/achievement_interaction',
        component: _import('achievement', 'achievement'),
        meta: {
          title: '会员成就',
        },
      },
      {
        // 微信会员回收站数据页面
        path: '/memberReturn',
        component: _import('memberlist', 'memberReturn'),
        meta: {
          title: '微信会员回收站',
        },
      },
      {
        // POS会员回收站数据页面
        path: '/posRecycle',
        component: _import('memberlist', 'pos-recycle'),
        meta: {
          title: 'POS会员回收站',
        },
      },
      {
        path: '/membergroupAdd',
        component: _import('membergroup', 'membergroupAdd'),
        meta: {
          title: '会员分组-新增',
        },
      },
      {
        path: '/membergroup',
        component: _import('membergroup', 'membergroup'),
        meta: {
          title: '会员分组',
        },
      },
      {
        path: '/cardvoucher',
        component: _import('wechatmembers', 'cardvoucher'),
        meta: {
          title: '微信会员-卡券',
        },
      },
      {
        path: '/membergroupDetail',
        component: _import('membergroup', 'membergroupDetail'),
        meta: {
          title: '会员分组-详情',
        },
      },
      {
        path: '/membertask',
        component: _import('membertask', 'membertask'),
        meta: {
          title: '会员任务',
        },
      },
      {
        path: '/posmemberDetail',
        // component: _import("wechatmembers", "wechatTotalDetail"),
        redirect: '/customerDetail',
        meta: {
          title: 'pos会员-详情',
          channel: 'posMember',
        },
      },
      {
        path: '/wechatmemberDetail',
        // component: _import("wechatmembers", "wechatTotalDetail"),
        redirect: '/customerDetail',
        meta: {
          title: '微信会员-详情',
          channel: 'wxMember',
        },
      },
      {
        path: '/wechatTotalDetail',
        // component: _import("wechatmembers", "wechatTotalDetail"),
        redirect: '/customerDetail',
        meta: {
          title: '微信总量-详情',
        },
      },
      {
        path: '/integralDataPage',
        component: _import('wechatmembers', 'integralDataPage'),
        meta: {
          title: '微信会员-积分明细',
        },
      },
      {
        path: '/storedValue',
        component: _import('wechatmembers', 'storedValue'),
        meta: {
          title: '微信会员-储值明细',
        },
      },
      {
        path: '/modifyintegral',
        component: _import('wechatmembers', 'modifyintegral'),
        meta: {
          title: '微信会员-积分调整',
        },
      },
      {
        path: '/ajaxmembersinfo',
        component: _import('wechatmembers', 'ajaxmembersinfo'),
        meta: {
          title: '微信会员-会员门店消费',
        },
      },
      {
        path: '/bulkIntegral',
        name: '/bulkIntegral',
        component: _import('wechatmembers', 'bulkIntegral'),
        meta: {
          title: '批量导入',
          keepAlive: true,
        },
      },
      {
        path: '/bulkLogsDetail',
        name: '/bulkLogsDetail',
        component: _import('wechatmembers', 'bulkLogsDetail'),
        meta: {
          title: '日志详情',
        },
      },
      {
        path: '/photo-album',
        name: '/photo-album',
        component: _import('photo-album', 'album'),
        meta: {
          title: '相册',
        },
      },
      {
        path: '/img-list',
        name: '/img-list',
        component: _import('photo-album', 'img-list'),
      },
      {
        path: '/abnormal-member',
        name: '/abnormal-member',
        component: _import('wechatmembers', 'abnormal-member'),
        meta: {
          title: '异常会员列表',
        },
      },
      {
        path: '/abnormal-member-option',
        name: '/abnormal-member-option',
        component: _import('wechatmembers', 'abnormal-member-option'),
        meta: {
          title: '异常会员',
        },
      },
      {
        path: '/wmDetail',
        name: '/wmDetail',
        component: _import('wechatmembers', 'wmDetail'),
        meta: {
          title: '微盟订单',
        },
      },
      {
        path: '/otherDetail',
        name: '/otherDetail',
        component: _import('wechatmembers', 'wmDetail'),
        meta: {
          title: '其他订单',
        },
      },
      {
        path: '/block-list',
        component: _import('block-list', 'index'),
        meta: {
          title: '黑名单列表',
        },
      },
      {
        path: '/marketing-record',
        component: _import('marketingRecord', 'index'),
        meta: {
          title: '营销记录',
        },
      },
    ],
  },
];

const router = new Router({
  // mode: 'history',
  base: '/member/',
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap,
});

export default router;
