import Vue from 'vue';
import Router from 'vue-router';
import Index from '@/components/Index';
const Login = resolve => require(['@/components/Login'], resolve);
const SignUp = resolve => require(['@/components/SignUp'], resolve);
const CheckPhone = resolve => require(['@/components/signUp/CheckPhone'], resolve);
const InputInfo = resolve => require(['@/components/signUp/InputInfo'], resolve);
const SignUpDone = resolve => require(['@/components/signUp/SignUpDone'], resolve);
const GoodsList = resolve => require(['@/components/GoodsList'], resolve);
const GoodsDetail = resolve => require(['@/components/GoodsDetail'], resolve);
const ShoppingCart = resolve => require(['@/components/ShoppingCart'], resolve);
const Order = resolve => require(['@/components/Order'], resolve);
const MemberOrder = resolve => require(['@/components/MemberOrder'], resolve);
const DepositOrder = resolve => require(['@/components/DepositOrder'], resolve);
const AddMoneyOrder = resolve => require(['@/components/AddMoneyOrder'], resolve);
const Pay = resolve => require(['@/components/Pay'], resolve);
const PayDone = resolve => require(['@/components/PayDone'], resolve);
const Freeback = resolve => require(['@/components/Freeback'], resolve);
const Home = resolve => require(['@/components/Home'], resolve);
const MyAddress = resolve => require(['@/components/home/MyAddress'], resolve);
const AddAddress = resolve => require(['@/components/home/AddAddress'], resolve);
const MyOrder = resolve => require(['@/components/home/MyOrder'], resolve);
const MyShoppingCart = resolve => require(['@/components/home/MyShoppingCart'], resolve);
const MyBidingCart = resolve => require(['@/components/home/MyBidingCart'], resolve);
const UploadShopCart = resolve => require(['@/components/home/UploadShopCart'], resolve);
const EditShoppingCart = resolve => require(['@/components/home/EditShoppingCart'], resolve);
const MyMember = resolve => require(['@/components/home/MyMember'], resolve);
const MemberUpgrade = resolve => require(['@/components/home/MemberUpgrade'], resolve);
const Merchant = resolve => require(['@/components/Merchant'], resolve);
const PayGateWay = resolve => require(['@/components/pay/payGateWay'], resolve);
const Test = resolve => require(['@/components/test/test'], resolve);
const Socket = resolve => require(['@/components/test/socket'], resolve);

Vue.use(Router);

export default new Router({
  routes: [
    {
      path: '/test',
      name: 'Test',
      component: Test
    },
    {
      path: '/socket',
      name: 'Socket',
      component: Socket
    },
    {
      path: '/payGateWay',
      name: 'PayGateWay',
      component: PayGateWay
    },
    {
      path: '/', // 首页
      name: 'Index',
      component: Index
    },
    {
      path: '/Login', // 登录
      name: 'Login',
      component: Login
    },
    {
      path: '/SignUp', // 注册
      name: 'SignUp',
      component: SignUp,
      children: [
        {
          path: '/',
          name: 'index',
          component: CheckPhone
        },
        {
          path: 'checkPhone',
          name: 'CheckPhone',
          component: CheckPhone
        },
        {
          path: 'inputInfo',
          name: 'InputInfo',
          component: InputInfo
        },
        {
          path: 'signUpDone',
          name: 'SignUpDone',
          component: SignUpDone
        }
      ]
    },
    {
      path: '/goodsList', // 商品列表
      name: 'GoodsList',
      component: GoodsList
    },
    {
      path: '/goodsDetail', // 商品详情
      name: 'GoodsDetail',
      component: GoodsDetail
    },
    {
      path: '/shoppingCart', // 商品详情
      name: 'ShoppingCart',
      component: ShoppingCart
    },
    {
      path: '/order', // 订单页面
      name: 'Order',
      component: Order
    },
    {
      path: '/memberOrder',
      name: 'MemberOrder',
      component: MemberOrder
    },
    {
      path: '/depositOrder',
      name: 'DepositOrder',
      component: DepositOrder
    },
    {
      path: '/addMoneyOrder',
      name: 'AddMoneyOrder',
      component: AddMoneyOrder
    },
    {
      path: '/pay', // 支付页面
      name: 'Pay',
      component: Pay
    },
    {
      path: '/payDone', // 支付成功页面
      name: 'PayDone',
      component: PayDone
    },
    {
      path: '/freeback', // 反馈页面
      name: 'Freeback',
      component: Freeback
    },
    {
      path: '/home', // 主页
      name: 'Home',
      component: Home,
      children: [
        {
          path: '/',
          name: 'HomeIndex',
          component: MyOrder
        },
        {
          path: 'myAddress',
          name: 'MyAddress',
          component: MyAddress
        },
        {
          path: 'addAddress',
          name: 'AddAddress',
          component: AddAddress
        },
        {
          path: 'myOrder',
          name: 'MyOrder',
          component: MyOrder
        },
        {
          path: 'myShoppingCart',
          name: 'MyShoppingCart',
          component: MyShoppingCart
        },
        {
          path: 'myBidingCart',
          name: 'MyBidingCart',
          component: MyBidingCart
        },
        {
          path: 'uploadShopCart',
          name: 'UploadShopCart',
          component: UploadShopCart
        },
        {
          path: 'editShoppingCart',
          name: 'EditShoppingCart',
          component: EditShoppingCart
        },
        {
          path: 'myMember',
          name: 'MyMember',
          component: MyMember
        },
        {
          path: 'memberUpgrade',
          name: 'MemberUpgrade',
          component: MemberUpgrade
        }
      ]
    },
    {
      path: '/merchant',
      name: 'Merchant',
      component: Merchant
    }
  ]
});
