cashier-web/src/router/index.ts

724 lines
17 KiB
TypeScript

import type { App } from "vue";
import { createRouter, createWebHashHistory, type RouteRecordRaw } from "vue-router";
export const Layout = () => import("@/layout/index.vue");
// 静态路由
export const constantRoutes: RouteRecordRaw[] = [
{
path: "/redirect",
component: Layout,
meta: { hidden: true },
children: [
{
path: "/redirect/:path(.*)",
component: () => import("@/views/redirect/index.vue"),
},
],
},
{
path: "/login",
component: () => import("@/views/login/index.vue"),
meta: { hidden: true },
},
{
path: "/",
component: Layout,
redirect: "/index",
meta: {
title: "数据统计",
icon: "index",
alwaysShow: true,
},
children: [
{
path: "index",
component: () => import("@/views/data/index.vue"),
name: "",
meta: {
title: "数据统计",
affix: false,
keepAlive: true,
},
},
{
path: "sales",
name: "",
component: () => import("@/views/data/sales.vue"),
meta: {
title: "销售统计",
affix: false,
keepAlive: true,
},
},
{
path: "table",
name: "",
component: () => import("@/views/data/table.vue"),
meta: {
title: "桌台统计",
affix: false,
keepAlive: true,
},
},
{
path: "credit",
name: "",
component: () => import("@/views/data/credit/index.vue"),
meta: {
title: "挂账管理",
affix: false,
keepAlive: true,
},
},
{
path: "credit-detail",
name: "",
component: () => import("@/views/data/credit/detail.vue"),
meta: {
title: "挂账明细",
affix: false,
keepAlive: true,
hidden: true
},
},
{
path: "work",
name: "",
component: () => import("@/views/data/work.vue"),
meta: {
title: "交班记录",
affix: false,
keepAlive: true,
},
},
{
path: "401",
component: () => import("@/views/error/401.vue"),
meta: { hidden: true },
},
{
path: "404",
component: () => import("@/views/error/404.vue"),
meta: { hidden: true },
},
],
},
// {
// path: "/shop",
// component: Layout,
// meta: {
// title: "店铺管理",
// icon: "shopping",
// alwaysShow: true,
// },
// children: [
// {
// path: "index",
// component: () => import("@/views/shop/config/index.vue"),
// name: "shopConfig",
// meta: {
// title: "店铺配置",
// affix: false,
// keepAlive: true,
// },
// },
// {
// path: "list",
// component: () => import("@/views/shop/list/index.vue"),
// name: "shopList",
// meta: {
// title: "店铺列表",
// affix: false,
// keepAlive: true,
// },
// },
// {
// path: "role",
// component: () => import("@/views/admin/system/role/index.vue"),
// name: "shopRole",
// meta: {
// title: "角色管理",
// },
// },
// {
// path: "staff",
// component: () => import("@/views/shop/staff/index.vue"),
// name: "shopStaff",
// meta: {
// title: "员工列表",
// },
// },
// {
// path: "log",
// component: () => import("@/views/shop/log/index.vue"),
// name: "shopLog",
// meta: {
// title: "操作日志",
// },
// },
// ],
// },
// {
// path: "/system",
// component: Layout,
// meta: {
// title: "系统管理",
// icon: "system",
// alwaysShow: true,
// },
// children: [
// {
// path: "params",
// component: () => import("@/views/admin/system/params/index.vue"),
// name: "adminSysParams",
// meta: {
// title: "系统参数",
// affix: false,
// keepAlive: true,
// },
// },
// {
// path: "user",
// component: () => import("@/views/admin/system/user/index.vue"),
// name: "adminSysUser",
// meta: {
// title: "系统用户",
// affix: false,
// keepAlive: true,
// },
// },
// {
// path: "role",
// component: () => import("@/views/admin/system/role/index.vue"),
// name: "adminSysRole",
// meta: {
// title: "角色管理",
// affix: false,
// keepAlive: true,
// },
// },
// {
// path: "menu",
// component: () => import("@/views/admin/system/menu/index.vue"),
// name: "adminSysMenu",
// meta: {
// title: "菜单管理",
// affix: false,
// keepAlive: true,
// },
// },
// {
// path: "miniAppPages",
// component: () => import("@/views/admin/system/miniAppPages/index.vue"),
// name: "adminSysMiniAppPages",
// meta: {
// title: "小程序页面",
// affix: false,
// keepAlive: true,
// },
// },
// {
// path: "version",
// component: () => import("@/views/admin/system/version/index.vue"),
// name: "adminSysVersion",
// meta: {
// title: "版本管理",
// affix: false,
// keepAlive: true,
// },
// },
// ],
// },
// {
// path: "/register",
// component: Layout,
// meta: {
// title: "激活码",
// icon: "chain",
// alwaysShow: true,
// },
// children: [
// {
// path: "index",
// component: () => import("@/views/register/index.vue"),
// name: "registerIndex",
// meta: {
// title: "激活码列表",
// affix: false,
// keepAlive: true,
// },
// },
// ],
// },
// {
// path: "/online-shop",
// component: Layout,
// meta: {
// title: "线上店铺",
// icon: "system1",
// alwaysShow: true,
// },
// children: [
// {
// path: "index",
// component: () => import("@/views/online-shop/index.vue"),
// name: "shopDecoration",
// meta: {
// title: "店铺装修",
// affix: false,
// keepAlive: true,
// },
// },
// {
// path: "goods-group",
// component: () => import("@/views/online-shop/goods-group.vue"),
// name: "goodsGroup",
// meta: {
// title: "商品分组",
// },
// },
// {
// path: "pad",
// component: () => import("@/views/online-shop/pad-setting.vue"),
// name: "pad",
// meta: {
// title: "Pad点单设置",
// },
// },
// ],
// },
// {
// path: "/system-setting",
// component: Layout,
// meta: {
// title: "系统设置",
// icon: "system",
// alwaysShow: true,
// },
// children: [
// {
// path: "pay-types",
// component: () => import("@/views/system-setting/pay-types/index.vue"),
// name: "payTypes",
// meta: {
// title: "支付方式",
// affix: false,
// keepAlive: true,
// },
// },
// ],
// },
// {
// path: "/tool",
// component: Layout,
// meta: {
// title: "经营工具",
// icon: "tools",
// },
// children: [
// {
// path: "index",
// component: () => import("@/views/tool/Instead/index.vue"),
// name: "toolIndex",
// meta: {
// title: "代客下单",
// affix: false,
// keepAlive: true,
// },
// },
// {
// path: "table",
// component: () => import("@/views/tool/table/index.vue"),
// name: "table",
// meta: {
// title: "台桌管理",
// affix: false,
// keepAlive: true,
// },
// },
// ],
// },
// {
// path: "/application",
// component: Layout,
// meta: {
// title: "应用中心",
// icon: "tree",
// alwaysShow: true,
// },
// children: [
// {
// path: "marketing",
// component: () => import("@/views/application/marketing/index.vue"),
// name: "applicationMarketing",
// meta: {
// title: "营销中心",
// affix: false,
// keepAlive: true,
// },
// },
// {
// path: "index",
// component: () => import("@/views/application/list/index.vue"),
// name: "applicationIndex",
// meta: {
// title: "列表管理",
// affix: false,
// keepAlive: false,
// },
// },
// /**
// * 营销中心 start
// */
// {
// path: "coupon",
// component: () => import("@/views/application/marketing/coupon/list.vue"),
// name: "coupon",
// meta: {
// title: "优惠券",
// affix: false,
// hidden: true
// },
// },
// {
// path: "bwc",
// component: () => import("@/views/application/marketing/bwc.vue"),
// name: "bwc",
// meta: {
// title: "霸王餐",
// affix: false,
// hidden: true
// },
// },
// {
// path: "invite",
// component: () => import("@/views/application/marketing/share/index.vue"),
// name: "invite",
// meta: {
// title: "邀请裂变",
// affix: false,
// hidden: true
// },
// },
// {
// path: "points",
// component: () => import("@/views/application/marketing/points/index.vue"),
// name: "points",
// meta: {
// title: "积分",
// affix: false,
// hidden: true
// },
// },
// {
// path: "ad",
// component: () => import("@/views/application/list/ad/index.vue"),
// name: "ad",
// meta: {
// title: "广告",
// affix: false,
// hidden: true
// },
// },
// /** 营销中心end */
// /**列表start */
// {
// path: "lineUplist",
// component: () => import("@/views/application/list/lineUplist/index.vue"),
// name: "lineUplist",
// meta: {
// title: "叫号",
// affix: false,
// hidden: true
// },
// },
// {
// path: "lineUpRecord",
// component: () => import("@/views/application/list/lineUplist/record.vue"),
// name: "lineUpRecord",
// meta: {
// title: "叫号记录",
// affix: false,
// hidden: true
// },
// },
// {
// path: "advertisement",
// component: () => import("@/views/application/list/advertisement/index.vue"),
// name: "advertisement",
// meta: {
// title: "广告",
// affix: false,
// hidden: true
// },
// },
// {
// path: "storingWine",
// component: () => import("@/views/application/list/storingWine/index.vue"),
// name: "storingWine",
// meta: {
// title: "存酒",
// affix: false,
// hidden: true
// },
// },
// /**列表end */
// ],
// },
// {
// path: "/devices",
// component: Layout,
// meta: {
// title: "设备管理",
// icon: "tab",
// alwaysShow: true,
// },
// children: [
// {
// path: "printer",
// component: () => import("@/views/devices/printer.vue"),
// name: "devicesPrinter",
// meta: {
// title: "打印机",
// affix: false,
// keepAlive: true,
// },
// },
// ],
// },
// {
// path: "/product",
// component: Layout,
// meta: {
// title: "商品管理",
// icon: "money",
// alwaysShow: true,
// },
// children: [
// {
// path: "index",
// component: () => import("@/views/product/index.vue"),
// name: "productIndex",
// meta: {
// title: "商品列表",
// affix: false,
// keepAlive: true,
// },
// },
// {
// path: "addgoods",
// component: () => import("@/views/product/indexconfig/addgoods.vue"),
// name: "addgoods",
// meta: {
// title: "新增商品",
// affix: false,
// keepAlive: true,
// hidden: true
// },
// },
// {
// path: "unit",
// component: () => import("@/views/product/unit.vue"),
// name: "productUnit",
// meta: {
// title: "常用单位",
// affix: false,
// },
// },
// {
// path: "category",
// component: () => import("@/views/product/category.vue"),
// name: "productCategory",
// meta: {
// title: "商品分类",
// affix: false,
// },
// },
// {
// path: "specifications",
// component: () => import("@/views/product/specifications.vue"),
// name: "specifications",
// meta: {
// title: "商品规格",
// affix: false,
// },
// },
// ],
// },
// {
// path: "/inventory",
// component: Layout,
// meta: {
// title: "进销存",
// icon: "tab",
// alwaysShow: true,
// },
// children: [
// {
// path: "consumables",
// component: () => import("@/views/inventory/consumables/index.vue"),
// name: "consumables",
// meta: {
// title: "耗材列表",
// affix: false,
// },
// },
// {
// path: "supplier",
// component: () => import("@/views/inventory/supplier/index.vue"),
// name: "supplier",
// meta: {
// title: "供应商管理",
// affix: false,
// hidden: true
// },
// },
// {
// path: "operation_in",
// component: () => import("@/views/inventory/operation_in/index.vue"),
// name: "operation_in",
// meta: {
// title: "出入库",
// affix: false,
// hidden: true
// },
// },
// {
// path: "paymentRecord",
// component: () => import("@/views/inventory/payment-record.vue"),
// name: "paymentRecord",
// meta: {
// title: "结款记录",
// affix: false,
// hidden: true,
// },
// },
// {
// path: "classification",
// component: () => import("@/views/inventory/classification/index.vue"),
// name: "classification",
// meta: {
// title: "分类管理",
// affix: false,
// hidden: true,
// },
// },
// ],
// },
// {
// path: "/user",
// component: Layout,
// meta: {
// title: "用户管理",
// icon: "peoples",
// alwaysShow: true,
// },
// children: [
// {
// path: "index",
// component: () => import("@/views/user/list/index.vue"),
// name: "userIndex",
// meta: {
// title: "用户列表",
// affix: false,
// keepAlive: true,
// },
// },
// {
// path: "active",
// component: () => import("@/views/user/active/index.vue"),
// name: "userActive",
// meta: {
// title: "活动管理",
// affix: false,
// },
// },
// ],
// },
// {
// path: "/order",
// component: Layout,
// meta: {
// title: "订单管理",
// icon: "menu",
// alwaysShow: true,
// },
// children: [
// {
// path: "index",
// component: () => import("@/views/order/index/index.vue"),
// name: "orderIndex",
// meta: {
// title: "订单列表",
// affix: false,
// keepAlive: true,
// },
// },
// {
// path: "group-purchase",
// component: () => import("@/views/order/group-purchase.vue"),
// name: "orderRefund",
// meta: {
// title: "团购订单",
// affix: false,
// keepAlive: true,
// },
// },
// ],
// },
// {
// path: "/mytemplate",
// component: Layout,
// meta: {
// title: "我的模板",
// icon: "tab",
// alwaysShow: true,
// hidden: true
// },
// children: [
// {
// path: "index",
// component: () => import("@/views/mytemplate/index.vue"),
// name: "mytemplateIndex",
// meta: {
// title: "我的模板",
// affix: false,
// keepAlive: true,
// },
// },
// ],
// },
];
/**
* 创建路由
*/
const router = createRouter({
history: createWebHashHistory(),
routes: constantRoutes,
// 刷新时,滚动条位置还原
scrollBehavior: () => ({ left: 0, top: 0 }),
});
// 全局注册 router
export function setupRouter(app: App<Element>) {
app.use(router);
}
export default router;