index.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. import Vue from "vue";
  2. import Router from "vue-router";
  3. Vue.use(Router);
  4. /* Layout */
  5. import Layout from "@/layout";
  6. /**
  7. * Note: sub-menu only appear when route children.length >= 1
  8. * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
  9. *
  10. * hidden: true if set true, item will not show in the sidebar(default is false)
  11. * alwaysShow: true if set true, will always show the root menu
  12. * if not set alwaysShow, when item has more than one children route,
  13. * it will becomes nested mode, otherwise not show the root menu
  14. * redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
  15. * name:'router-name' the name is used by <keep-alive> (must set!!!)
  16. * meta : {
  17. roles: ['admin','editor'] control the page roles (you can set multiple roles)
  18. title: 'title' the name show in sidebar and breadcrumb (recommend set)
  19. icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
  20. breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
  21. activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
  22. }
  23. */
  24. /**
  25. * constantRoutes
  26. * a base page that does not have permission requirements
  27. * all roles can be accessed
  28. */
  29. export const constantRoutes = [
  30. {
  31. path: "/login",
  32. component: () => import("@/views/login/index"),
  33. hidden: true
  34. },
  35. {
  36. path: "/404",
  37. component: () => import("@/views/404"),
  38. hidden: true
  39. },
  40. // {
  41. // path: '/',
  42. // component: Layout,
  43. // redirect: '/dashboard',
  44. // children: [{
  45. // path: 'dashboard',
  46. // name: 'Dashboard',
  47. // component: () => import('@/views/dashboard/index'),
  48. // meta: { title: 'Dashboard', icon: 'dashboard' }
  49. // }]
  50. // },
  51. {
  52. path: "/",
  53. component: Layout,
  54. redirect: "/shop/message"
  55. // children: [{
  56. // path: 'message',
  57. // name: 'Message',
  58. // component: () => import('@/views/shop/message/index'),
  59. // meta: { title: '门店管理' }
  60. // }]
  61. },
  62. //门店
  63. {
  64. path: "/shop",
  65. component: Layout,
  66. redirect: "/shop/message",
  67. name: "Shop",
  68. meta: { title: "门店", icon: "el-icon-s-shop" },
  69. children: [
  70. {
  71. path: "message",
  72. name: "Message",
  73. component: () => import("@/views/shop/message/index"),
  74. meta: { title: "门店管理" }
  75. },
  76. {
  77. path: "manageimg",
  78. name: "manageimg",
  79. component: () => import("@/views/shop/manageimg/index"),
  80. meta: { title: "图片管理" }
  81. },
  82. {
  83. hidden: true,
  84. path: "trim",
  85. name: "Trim",
  86. component: () => import("@/views/shop/trim/index"),
  87. meta: { title: "门店设置" }
  88. },
  89. {
  90. hidden: true,
  91. path: "setStore",
  92. name: "SetStore",
  93. component: () => import("@/views/shop/setStore/index"),
  94. meta: { title: "新建门店" }
  95. },
  96. {
  97. hidden: true,
  98. path: "renovation",
  99. name: "renovation",
  100. component: () => import("@/views/shop/renovation/index"),
  101. meta: { title: "门店装修" }
  102. }
  103. ]
  104. },
  105. //商品
  106. {
  107. path: "/goods",
  108. component: Layout,
  109. children: [
  110. {
  111. path: "index",
  112. name: "Goods",
  113. component: () => import("@/views/goods/index"),
  114. meta: { title: "商品", icon: "el-icon-s-goods" }
  115. }
  116. ]
  117. },
  118. //商户统计
  119. {
  120. hidden: true,
  121. path: "/merchant",
  122. component: Layout,
  123. children: [
  124. {
  125. path: "index",
  126. name: "Merchant",
  127. component: () => import("@/views/merchant/index"),
  128. meta: { title: "商户统计", icon: "el-icon-data-board" }
  129. }
  130. ]
  131. },
  132. //下单
  133. {
  134. path: "/shopping",
  135. component: Layout,
  136. children: [
  137. {
  138. path: "index",
  139. name: "Shopping",
  140. component: () => import("@/views/shopping/index"),
  141. meta: { title: "下单", icon: "el-icon-shopping-cart-2" }
  142. }
  143. ]
  144. },
  145. //订单
  146. {
  147. path: "/orders",
  148. component: Layout,
  149. redirect: "/orders/list",
  150. name: "Order",
  151. meta: { title: "订单", icon: "el-icon-notebook-2" },
  152. children: [
  153. {
  154. path: "list",
  155. name: "List",
  156. component: () => import("@/views/orders/list"),
  157. meta: { title: "列表" }
  158. },
  159. {
  160. path: "query",
  161. name: "Query",
  162. component: () => import("@/views/orders/query"),
  163. meta: { title: "查询", noCache: false }
  164. }
  165. ]
  166. },
  167. //统计
  168. {
  169. hidden: true,
  170. path: "/statistics",
  171. component: Layout,
  172. children: [
  173. {
  174. path: "index",
  175. name: "Census",
  176. component: () => import("@/views/statistics/census"),
  177. meta: { title: "统计", icon: "el-icon-s-grid" }
  178. }
  179. ]
  180. },
  181. //优惠券
  182. {
  183. path: "/coupon",
  184. component: Layout,
  185. redirect: "/coupon/list",
  186. meta: { title: "优惠券", icon: "el-icon-s-ticket" },
  187. children: [
  188. {
  189. path: "list",
  190. name: "List",
  191. component: () => import("@/views/coupon/list"),
  192. meta: { title: "列表" }
  193. },
  194. {
  195. path: "query",
  196. name: "Query",
  197. component: () => import("@/views/coupon/query"),
  198. meta: { title: "查询" }
  199. }
  200. ]
  201. },
  202. //营销
  203. // {
  204. // path: "/market",
  205. // component: Layout,
  206. // children: [
  207. // {
  208. // path: "index",
  209. // name: "Market",
  210. // component: () => import("@/views/market/index"),
  211. // meta: { title: "营销", icon: "el-icon-s-marketing" }
  212. // }
  213. // ]
  214. // },
  215. //拼团
  216. // {
  217. // path: "/group",
  218. // component: Layout,
  219. // children: [
  220. // {
  221. // path: "index",
  222. // name: "Group",
  223. // component: () => import("@/views/group/index"),
  224. // meta: { title: "拼团", icon: "el-icon-s-cooperation" }
  225. // }
  226. // ]
  227. // },
  228. //门店地图
  229. {
  230. path: "/shapmap",
  231. component: Layout,
  232. redirect: "/shapmap/map",
  233. name: "Shop",
  234. meta: { title: "门店地图", icon: "el-icon-place" },
  235. children: [
  236. {
  237. path: "map",
  238. name: "Map",
  239. component: () => import("@/views/shapmap/map/index"),
  240. meta: { title: "门店位置" }
  241. },
  242. {
  243. path: "marker",
  244. name: "Marker",
  245. component: () => import("@/views/shapmap/marker/index"),
  246. meta: { title: "门店覆盖区域" }
  247. },
  248. {
  249. path: "mtmap",
  250. name: "Mtmap",
  251. component: () => import("@/views/shapmap/mtmap/index"),
  252. meta: { title: "美团门店位置" }
  253. },
  254. {
  255. path: "mtmarker",
  256. name: "Mtmarker",
  257. component: () => import("@/views/shapmap/mtmarker/index"),
  258. meta: { title: "美团门店覆盖区域" }
  259. }
  260. ]
  261. },
  262. //other
  263. // {
  264. // path: '/example',
  265. // component: Layout,
  266. // redirect: '/example/table',
  267. // name: 'Example',
  268. // meta: { title: 'Example', icon: 'el-icon-s-help' },
  269. // children: [
  270. // {
  271. // path: 'table',
  272. // name: 'Table',
  273. // component: () => import('@/views/table/index'),
  274. // meta: { title: 'Table', icon: 'table' }
  275. // },
  276. // {
  277. // path: 'tree',
  278. // name: 'Tree',
  279. // component: () => import('@/views/tree/index'),
  280. // meta: { title: 'Tree', icon: 'tree' }
  281. // }
  282. // ]
  283. // },
  284. // {
  285. // path: '/form',
  286. // component: Layout,
  287. // children: [
  288. // {
  289. // path: 'index',
  290. // name: 'Form',
  291. // component: () => import('@/views/form/index'),
  292. // meta: { title: 'Form', icon: 'form' }
  293. // }
  294. // ]
  295. // },
  296. // {
  297. // path: '/nested',
  298. // component: Layout,
  299. // redirect: '/nested/menu1',
  300. // name: 'Nested',
  301. // meta: {
  302. // title: 'Nested',
  303. // icon: 'nested'
  304. // },
  305. // children: [
  306. // {
  307. // path: 'menu1',
  308. // component: () => import('@/views/nested/menu1/index'), // Parent router-view
  309. // name: 'Menu1',
  310. // meta: { title: 'Menu1' },
  311. // children: [
  312. // {
  313. // path: 'menu1-1',
  314. // component: () => import('@/views/nested/menu1/menu1-1'),
  315. // name: 'Menu1-1',
  316. // meta: { title: 'Menu1-1' }
  317. // },
  318. // {
  319. // path: 'menu1-2',
  320. // component: () => import('@/views/nested/menu1/menu1-2'),
  321. // name: 'Menu1-2',
  322. // meta: { title: 'Menu1-2' },
  323. // children: [
  324. // {
  325. // path: 'menu1-2-1',
  326. // component: () => import('@/views/nested/menu1/menu1-2/menu1-2-1'),
  327. // name: 'Menu1-2-1',
  328. // meta: { title: 'Menu1-2-1' }
  329. // },
  330. // {
  331. // path: 'menu1-2-2',
  332. // component: () => import('@/views/nested/menu1/menu1-2/menu1-2-2'),
  333. // name: 'Menu1-2-2',
  334. // meta: { title: 'Menu1-2-2' }
  335. // }
  336. // ]
  337. // },
  338. // {
  339. // path: 'menu1-3',
  340. // component: () => import('@/views/nested/menu1/menu1-3'),
  341. // name: 'Menu1-3',
  342. // meta: { title: 'Menu1-3' }
  343. // }
  344. // ]
  345. // },
  346. // {
  347. // path: 'menu2',
  348. // component: () => import('@/views/nested/menu2/index'),
  349. // name: 'Menu2',
  350. // meta: { title: 'menu2' }
  351. // }
  352. // ]
  353. // },
  354. // {
  355. // path: 'external-link',
  356. // component: Layout,
  357. // children: [
  358. // {
  359. // path: 'https://panjiachen.github.io/vue-element-admin-site/#/',
  360. // meta: { title: 'External Link', icon: 'link' }
  361. // }
  362. // ]
  363. // },
  364. // 404 page must be placed at the end !!!
  365. { path: "*", redirect: "/404", hidden: true }
  366. ];
  367. export const asyncRouterMap = [
  368. ////优惠券
  369. // {
  370. // path: "/coupon",
  371. // component: Layout,
  372. // meta: {
  373. // role: ["用户"]
  374. // },
  375. // children: [
  376. // {
  377. // path: "index",
  378. // name: "Coupon",
  379. // component: () => import("@/views/coupon/index"),
  380. // meta: { title: "优惠券", icon: "el-icon-s-ticket" }
  381. // }
  382. // ]
  383. // }
  384. ];
  385. const createRouter = () =>
  386. new Router({
  387. // mode: 'history', // require service support
  388. scrollBehavior: () => ({ y: 0 }),
  389. routes: constantRoutes
  390. });
  391. const router = createRouter();
  392. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  393. export function resetRouter() {
  394. const newRouter = createRouter();
  395. router.matcher = newRouter.matcher; // reset router
  396. }
  397. export default router;