/*
 * @Description: In User Settings Edit
 * @Author: your name
 * @Date: 2019-09-24 12:34:06
 * @LastEditTime : 2019-12-23 18:52:56
 * @LastEditors  : Please set LastEditors
 */
import Vue from 'vue'
import Router from 'vue-router'

import Guide from '@/pages/guide/guide'
import Login from '@/pages/login'
import Regiester from '@/pages/regiester'
import Regiester2 from '@/pages/regiester2'
import PwdForgot from '@/pages/pwd-forgotten'
import FingerLogin from '@/pages/finger-login'
import Tab from '@/pages/tab'
import HomePage from '@/pages/home/home-page'
// 定位
import Location from '@/pages/home/location'

// 我的
import MyInfo from '@/pages/myInfo/my-info'
import Certification from '@/pages/myInfo/certification'
// 我的收藏
import MyProductList from '@/pages/myProductCollection/my-product-list'

// test工具类
import HlsPopup from '@/pages/hlsPopup'

// 用户绑定
import UserBind from '@/pages/userBind/userBind'
import NaturePerson from '@/pages/userBind/np/naturePerson'
import Enterprise from '@/pages/userBind/org/enterprise'

// 用户绑定new

import EnterpriseNew from '@/pages/userBindNew/org/baseInfo'
import Invoice from '@/pages/userBindNew/org/invoice'
import Enclosure from '@/pages/userBindNew/org/enclosure'
import BankInfo from '@/pages/userBindNew/org/bankInfo'
// 进件审批
import Base from '@/pages/intoApproval/intoApproval/base'
import IntoList from '@/pages/intoApproval/into-list'
import Refund from '@/pages/intoApproval/intoApproval/refund'
// 经销商签约
import ContractList from '@/pages/distributorSign/contract-list'
import ContractDetails from '@/pages/distributorSign/contract-details'
import FinancDetails from '@/pages/distributorSign/financ-details' // 还款计划
// 融资试算
import FinancingTrial from '@/pages/financingTrial/financing-trial'
import FinancingDetails from '@/pages/financingTrial/financing-details' // 融资明细
import TrialRepayPlan from '@/pages/financingTrial/trial-repay-plan'
// 合同签约
import ContractSigning from '../pages/contractSigning/contract-signing'
import ContractDetail from '@/pages/ContractSigning/contract-detail'
import ContractContent from '@/pages/ContractSigning/contract-content'
import EntryInfo from '@/pages/ContractSigning/entry-info'
import ElectronicSign from '@/pages/ContractSigning/electronic-sign'
/* import BodyCheck from '@/pages/ContractSigning/body-check' */
import ContractRepayPlan from '@/pages/ContractSigning/contract-repay-plan'

// 首付款支付
import FirstPay from '../pages/pay/firstPay/first-pay'
import PayEntry from '@/pages/pay/firstPay/pay-entry'
import ContractRecord from '@/pages/pay/firstPay/contract-record'
// 款项支付
import PaymentPayEntry from '@/pages/pay/payment/pay-entry'
import PaymentContractRecord from '@/pages/pay/payment/contract-record'
import NewList from '@/pages/pay/payment/new-list'
// 保证金支付
import MarginFirstPay from '@/pages/pay/marginPay/first-pay'
import MarginPayEntry from '@/pages/pay/marginPay/pay-entry'
// 支付页
import PayPage from '@/pages/pay/pay-page'
// 产品查询
import QueryHome from '@/pages/productQuery/query-home'
import ProDetailed from '@/pages/productQuery/product-detailed'
// 消息中心
import MessageCenter from '@/pages/messageCenter/message-list'
import ProductList from '@/pages/productQuery/product-list'
import RejectDetail from '@/pages/messageCenter/reject-detail'
// 帮助与反馈
import HelpList from '@/pages/help/help-list'
import HelpDetail from '@/pages/help/detail'
import HelpFeedback from '@/pages/help/feedback'
// 我的还款
import ReimburseMyselfList from '@/pages/reimburseMyself/reimburse-myself-list'
import ReimburseDetail from '@/pages/reimburseMyself/reimburse-detail'

// 合同还款
import ContractRepayment from '@/pages/contractRepayment/contract-repayment'
import RepayDetails from '@/pages/contractRepayment/repay-details'
import RepayPlan from '@/pages/contractRepayment/refund'

// 发车申请
import StartList from '@/pages/contractStart/start-list'
import AddCar from '@/pages/contractStart/add-car'

// 发车确认
import ConfirmDetail from '@/pages/carConfirm/confirm-detail'
import ConfirmList from '@/pages/carConfirm/confirm-list'

// 合同查询
import ContractRecords from '@/pages/contractInquire/contract-records'
import RepayDetail from '@/pages/contractInquire/repay-detail'
import RepayPlans from '@/pages/contractInquire/repay-plans'

// 业务退款
import DrawbackList from '@/pages/drawback/drawback-list'
import DrawbackDetail from '@/pages/drawback/drawback-detail'

// 视屏面签
import VideoSign from '@/pages/videoSign/video-list'
// 新版用户绑定
import NPBaseInfo from '@/pages/userBindNew/np/base-info'
import NPInvoiceInfo from '@/pages/userBindNew/np/invoice-info'
import NPBankInfo from '@/pages/userBindNew/np/bank-info'
import AccessoryInfo from '@/pages/userBindNew/np/accessory-info'

// 合同创建
import ContractCreateList from '@/pages/contractCreate/contract-create-list'
import SalesInfo from '@/pages/contractCreate/sales-info'
import PickLessee from '@/pages/contractCreate/pick-lessee'
import CreateBaseInfo from '@/pages/contractCreate/create-base-info'
import CreateRentInfo from '@/pages/contractCreate/creat-rent-info'
import CreateEnclosureInfo from '@/pages/contractCreate/create-enclosure-info'

// 我的发票
import MyInvoice from '@/pages/invoice/invoice'
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect: to => {
        return {name: 'Login'}
        /* if (!window.localStorage.needGuid || window.localStorage.needGuid === 'true') {
          return {name: 'Guide'}
        } else {
          // if none of the above states are matched, use this as the fallback
          return {name: 'Login'}
        } */
      },
    },
    {
      path: '/tab',
      component: Tab,
      name: 'Tab',
      redirect: '/tab/home-page',
      meta: {keepAlive: true},
      children: [
        {path: '/tab/home-page', component: HomePage, name: 'HomePage', meta: {keepAlive: false}},
        {path: '/tab/my-info', component: MyInfo, name: 'MyInfo', meta: {keepAlive: true}},
        {path: '/tab/message-center', component: MessageCenter, name: 'MessageCenter', meta: {keepAlive: true}},
      ],
    },

    {
      path: '/home-page',
      component: HomePage,
      name: 'HomePage',
      meta: {keepAlive: false},
    },
    {
      path: '/location',
      component: Location,
      name: 'Location',
      meta: {keepAlive: false},
    },

    {
      path: '/guide',
      component: Guide,
      name: 'Guide',
      meta: {keepAlive: true},
    },
    {
      path: '/login',
      component: Login,
      name: 'Login',
      meta: {keepAlive: true},
    },
    {
      path: '/regiester',
      component: Regiester,
      name: 'Regiester',
      meta: {keepAlive: false},
    },
    {
      path: '/regiester2',
      component: Regiester2,
      name: 'Regiester2',
      meta: {keepAlive: false},
    },
    {
      path: '/finger-login',
      component: FingerLogin,
      name: 'FingerLogin',
      meta: {keepAlive: true},
    },
    {path: '/pwd-forgot', component: PwdForgot, name: 'PwdForgot', meta: {keepAlive: true}},

    // test工具类
    {path: '/hls-popup', component: HlsPopup, name: 'HlsPopup', meta: {keepAlive: false}},
    // 用户绑定
    {path: '/user-bind', component: UserBind, name: 'UserBind', meta: {keepAlive: false}},
    {path: '/nature-person', component: NaturePerson, name: 'NaturePerson', meta: {keepAlive: false}},
    {path: '/enterprise', component: Enterprise, name: 'Enterprise', meta: {keepAlive: true}},

    // 用户绑定new
    {path: '/enterprise-new', component: EnterpriseNew, name: 'EnterpriseNew', meta: {keepAlive: true}},
    {path: '/invoice', component: Invoice, name: 'Invoice', meta: {keepAlive: true}},
    {path: '/enclosure', component: Enclosure, name: 'Enclosure', meta: {keepAlive: true}},
    {path: '/bankInfo', component: BankInfo, name: 'BankInfo', meta: {keepAlive: true}},
    // 进件审批
    {path: '/base', component: Base, name: 'Base', meta: {keepAlive: false}},
    {path: '/refund', component: Refund, name: 'Refund', meta: {keepAlive: false}},
    {path: '/into-list', component: IntoList, name: 'IntoList', meta: {keepAlive: false}},
    // 经销商签约
    {path: '/contract-list', component: ContractList, name: 'ContractList', meta: {keepAlive: true}},
    {path: '/contract-details', component: ContractDetails, name: 'ContractDetails', meta: {keepAlive: true}},
    {path: '/financ-details', component: FinancDetails, name: 'FinancDetails', meta: {keepAlive: false}},
    // 试算
    {path: '/financing-trial', component: FinancingTrial, name: 'FinancingTrial', meta: {keepAlive: true}},
    {path: '/financing-details', component: FinancingDetails, name: 'FinancingDetails', meta: {keepAlive: true}},
    {path: '/trial-repay-plan', component: TrialRepayPlan, name: 'TrialRepayPlan', meta: {keepAlive: true}},
    // 合同签约
    {path: '/contract-signing', component: ContractSigning, name: 'ContractSigning', meta: {keepAlive: true}},
    {path: '/contract-detail', component: ContractDetail, name: 'ContractDetail', meta: {keepAlive: true}},
    {path: '/contract-content', component: ContractContent, name: 'ContractContent', meta: {keepAlive: true}},
    {path: '/entry-info', component: EntryInfo, name: 'EntryInfo', meta: {keepAlive: true}},
    {path: '/contract-repay-plan', component: ContractRepayPlan, name: 'ContractRepayPlan', meta: {keepAlive: true}},
    {path: '/electronic-sign', component: ElectronicSign, name: 'ElectronicSign', meta: {keepAlive: true}},
    /* {path: '/body-check', component: BodyCheck, name: 'BodyCheck', meta: {keepAlive: true}}, */

    // 首付款支付
    {path: '/first-pay', component: FirstPay, name: 'FirstPay', meta: {keepAlive: true}},
    {path: '/pay-entry', component: PayEntry, name: 'PayEntry', meta: {keepAlive: true}},
    {path: '/contract-record', component: ContractRecord, name: 'ContractRecord', meta: {keepAlive: true}},
    // 款项支付
    {path: '/payment-pay-entry', component: PaymentPayEntry, name: 'PaymentPayEntry', meta: {keepAlive: true}},
    {path: '/new-list', component: NewList, name: 'NewList', meta: {keepAlive: true}},
    {path: '/payment-contract-record', component: PaymentContractRecord, name: 'PaymentContractRecord', meta: {keepAlive: true}},
    // 保证金支付
    {path: '/margin-first-pay', component: MarginFirstPay, name: 'MarginFirstPay', meta: {keepAlive: false}},
    {path: '/margin-pay-entry', component: MarginPayEntry, name: 'MarginPayEntry', meta: {keepAlive: false}},
    // 支付页
    {path: '/pay-page', component: PayPage, name: 'PayPage', meta: {keepAlive: false}},
    // 产品查询
    {path: '/query-home', component: QueryHome, name: 'QueryHome', meta: {keepAlive: true}},
    {path: '/product-detailed', component: ProDetailed, name: 'ProDetailed', meta: {keepAlive: true}},
    {path: '/product-list', component: ProductList, name: 'ProductList', meta: {keepAlive: true}},
    // 帮助与反馈
    {path: '/help-list', component: HelpList, name: 'HelpList', meta: {keepAlive: true}},
    {path: '/help-detail', component: HelpDetail, name: 'HelpDetail', meta: {keepAlive: true}},
    {path: '/help-feedback', component: HelpFeedback, name: 'HelpFeedback', meta: {keepAlive: false}},
    // 我的还款
    {path: '/reimburse-myself-list', component: ReimburseMyselfList, name: 'ReimburseMyselfList', meta: {keepAlive: false}},
    {path: '/reimburse-detail', component: ReimburseDetail, name: 'ReimburseDetail', meta: {keepAlive: false}},
    // 我的收藏
    {path: '/my-product-list', component: MyProductList, name: 'MyProductList', meta: {keepAlive: true}},
    // 合同还款
    {path: '/contract-repayment', component: ContractRepayment, name: 'ContractRepayment', meta: {keepAlive: true}},
    {path: '/repay-details', component: RepayDetails, name: 'RepayDetails', meta: {keepAlive: true}},
    {path: '/repay-plan', component: RepayPlan, name: 'RepayPlan', meta: {keepAlive: true}},
    // 发车申请
    {path: '/start-List', component: StartList, name: 'StartList', meta: {keepAlive: false}},
    {path: '/add-car', component: AddCar, name: 'AddCar', meta: {keepAlive: false}},
    // 发车确认
    {path: '/confirm-detail', component: ConfirmDetail, name: 'ConfirmDetail', meta: {keepAlive: true}},
    {path: '/confirm-list', component: ConfirmList, name: 'ConfirmList', meta: {keepAlive: false}},
    // 合同查询
    {path: '/contract-records', component: ContractRecords, name: 'ContractRecords', meta: {keepAlive: true}},
    {path: '/repay-detail', component: RepayDetail, name: 'RepayDetail', meta: {keepAlive: true}},
    {path: '/repay-plans', component: RepayPlans, name: 'RepayPlans', meta: {keepAlive: true}},
    {path: '/certification', component: Certification, name: 'Certification', meta: {keepAlive: false}},
    // 业务退款
    {path: '/drawback-list', component: DrawbackList, name: 'DrawbackList', meta: {keepAlive: false}},
    {path: '/drawback-detail', component: DrawbackDetail, name: 'DrawbackDetail', meta: {keepAlive: false}},
    // 视屏面签
    {path: '/video-sign', component: VideoSign, name: 'VideoSign', meta: {keepAlive: true}},
    // 消息中心
    {path: '/reject-detail', component: RejectDetail, name: 'RejectDetail', meta: {keepAlive: true}},
    // 新版用户绑定-自然人
    {path: '/np-base-info', component: NPBaseInfo, name: 'NPBaseInfo', meta: {keepAlive: true}},
    {path: '/np-invoice-info', component: NPInvoiceInfo, name: 'NPInvoiceInfo', meta: {keepAlive: true}},
    {path: '/np-bank-info', component: NPBankInfo, name: 'NPBankInfo', meta: {keepAlive: false}},
    {path: '/accessory-info', component: AccessoryInfo, name: 'AccessoryInfo', meta: {keepAlive: true}},

    // 合同创建
    {path: '/contract-create-list', component: ContractCreateList, name: 'ContractCreateList', meta: {keepAlive: true}},
    {path: '/sales-info', component: SalesInfo, name: 'SalesInfo', meta: {keepAlive: true}},
    {path: '/pick-lessee', component: PickLessee, name: 'PickLessee', meta: {keepAlive: true}},
    {path: '/create-base-info', component: CreateBaseInfo, name: 'CreateBaseInfo', meta: {keepAlive: true}},
    {path: '/create-rent-info', component: CreateRentInfo, name: 'CreateRentInfo', meta: {keepAlive: true}},
    {path: '/create-enclosure-info', component: CreateEnclosureInfo, name: 'CreateEnclosureInfo', meta: {keepAlive: true}},
    // 我的发票
    {path: '/invoice', component: MyInvoice, name: 'MyInvoice', meta: {keepAlive: false}},
  ],
  scrollBehavior (to, from, savedPosition) {
    if (to.hash) {
      return {
        selector: to.hash,
      }
    }
  },
})