import { RouteRecordRaw } from 'vue-router'

export const staticRouter: RouteRecordRaw[] = [
  {
    path: '/',
    redirect: '/index'
  },
  {
    path: '/index',
    name: 'Index',
    component: () => import('@/views/Index.vue'),
    redirect: '/home',
    meta: {
      title: '起始页'
    },
    children: [
      {
        path: '/home',
        name: 'Home',
        component: () => import('@/views/home/Home.vue'),
        meta: {
          title: '首页'
        }
      },
      {
        path: '/saleMange',
        name: 'SaleMange',
        component: () => import('@/views/storehouse/sales/index.vue'),
        redirect: '/contract',
        meta: {
          routerView: true,
          title: '销售管理'
        },
        children: [
          {
            path: '/contractDetail/:id/:type?/:verify?',
            name: 'ContractDetail',
            component: () => import('@/views/storehouse/sales/ContractDetail.vue'),
            meta: {
              title: '合同详情'
            }
          },
          {
            path: '/percentageDetail/:id/:type?/:verify?/:titles?',
            name: 'PercentageDetail',
            component: () => import('@/views/storehouse/sales/PercentageDetail.vue'),
            meta: {
              title: '提成详情'
            }
          },{
            path: '/PercentageDetail1/:id/:type?/:verify?/:titles?',
            name: 'PercentageDetail1',
            component: () => import('@/views/storehouse/sales/PercentageDetail1.vue'),
            meta: {
              title: '提成详情'
            }
          },
          {
            path: '/verifyContractDetail/:id',
            name: 'VerifyContractDetail',
            component: () => import('@/views/storehouse/sales/VerifyContractDetail.vue'),
            meta: {
              title: '验证合同明细'
            }
          }
        ]
      },
      {
        path: '/inventoryMange',
        name: 'InventoryMange',
        component: () => import('@/views/storehouse/inventory/index.vue'),
        redirect: '/contract',
        meta: {
          routerView: true,
          title: '库存管理'
        },
        children: [
          {
            path: '/inStorageDetail/:id',
            name: 'InStorageDetail',
            component: () => import('@/views/storehouse/inventory/InStorageDetail.vue'),
            meta: {
              title: '入库详情'
            }
          },
          {
            path: '/InStorageEdit/:id',
            name: 'InStorageEdit',
            component: () => import('@/views/storehouse/inventory/InStorageEdit.vue'),
            meta: {
              title: '入库编辑'
            }
          },
          {
            path: '/receiveOutStock',
            name: 'ReceiveOutStock',
            component: () => import('@/views/storehouse/outStock/ReceiveOutStock.vue'),
            meta: {
              title: '领料出库'
            }
          },
          {
            path: '/receiveOutStockApply',
            name: 'receiveOutStockApply',
            component: () => import('@/views/storehouse/outStock/outStockApply/ReceiveOutStockApply.vue'),
            meta: {
              title: '出库申请'
            }
          },
          {
            path: '/inStockApply',
            name: 'inStockApply',
            component: () => import('@/views/storehouse/inventory/inStockApply/InStorageForm.vue'),
            meta: {
              title: '入库申请'
            }
          },
          {
            path: '/saleOutStock',
            name: 'SaleOutStock',
            component: () => import('@/views/storehouse/outStock/SaleOutStock.vue'),
            meta: {
              title: '销售出库'
            }
          },
          {
            path: '/outStockDetail/:number',
            name: 'OutStockDetail',
            component: () => import('@/views/storehouse/outStock/OutStockDetail.vue'),
            meta: {
              title: '出库详情'
            }
          },
		{
			path: '/OutStockAudit/:number/:type',
			name: 'OutStockAudit',
			component: () => import('@/views/storehouse/outStock/outStockApply/OutStockAudit.vue'),
			meta: {
				title: '出库审批'
			}
		}
        ]
      },
      {
        path: '/projectMange',
        name: 'ProjectMange',
        meta: {
          title: '项目管理'
        },
        children: []
      },
      {
        path: '/user',
        name: 'User',
        component: () => import('@/views/home/User.vue'),
        meta: {
          title: '个人中心'
        }
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/Login.vue'),
    meta: {
      title: '登录'
    }
  }
]

export const errorRouter = [
  {
    path: '/404',
    name: '404',
    component: () => import('@/components/ErrorMessage/404.vue'),
    meta: {
      title: '404页面'
    }
  }
]

/**
 * notFoundRouter(找不到路由)
 */
export const notFoundRouter = {
  path: '/:pathMatch(.*)*',
  name: 'notFound',
  redirect: { name: '404' }
}
