diff --git a/.env.development b/.env.development index 9aea75f..fc90eae 100644 --- a/.env.development +++ b/.env.development @@ -13,7 +13,7 @@ VITE_APP_API_URL=https://tapi.cashier.sxczgkj.cn/ # 正式 # VITE_APP_API_URL=http://localhost:8989 # 本地 # WebSocket 端点(不配置则关闭),线上 ws://api.youlai.tech/ws ,本地 ws://localhost:8989/ws -VITE_APP_WS_ENDPOINT= +VITE_APP_WS_ENDPOINT=wss://sockets.sxczgkj.com/wss # 启用 Mock 服务 VITE_MOCK_DEV_SERVER=false diff --git a/README.md b/README.md index a9c6529..97fb75b 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ 订单,支付相关: 商品,耗材相关: 系统相关: +购物车websocket + ## 项目特色 diff --git a/package.json b/package.json index d093947..14f1072 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "path-to-regexp": "^8.2.0", "pinia": "^2.3.1", "qs": "^6.14.0", + "sockjs-client": "^1.6.1", "sortablejs": "^1.15.6", "vue": "^3.5.13", "vue-i18n": "^11.1.0", diff --git a/src/api/account/activate.ts b/src/api/account/activate.ts new file mode 100644 index 0000000..e3d46b5 --- /dev/null +++ b/src/api/account/activate.ts @@ -0,0 +1,85 @@ +import request from "@/utils/request"; +import { Account_BaseUrl } from "@/api/config"; +const baseURL = Account_BaseUrl + "/admin/activate"; +const API = { + + getList() { + return request({ + url: `${baseURL}`, + method: "get", + }); + }, + edit(data: editRequest) { + return request({ + url: `${baseURL}`, + method: "put", + data: data, + }); + }, + add(data: addRequest) { + return request({ + url: `${baseURL}`, + method: "post", + data: data, + }); + } +} +export default API; + +export interface addRequest { + /** + * 充值金额 + */ + amount?: number; + /** + * 优惠卷id + */ + couponId?: number; + /** + * 赠送金额 + */ + giftAmount?: number; + /** + * 赠送积分 + */ + giftPoints?: number; + /** + * 是否赠送优惠卷 0否 1是 + */ + isGiftCoupon?: number; + /** + * 优惠卷数量 + */ + num?: number; + [property: string]: any; +} + +export interface editRequest { + /** + * 充值金额 + */ + amount: number; + /** + * 优惠卷id + */ + couponId?: number; + /** + * 赠送金额 + */ + giftAmount?: number; + /** + * 赠送积分 + */ + giftPoints?: number; + id: number; + /** + * 是否赠送优惠卷 0否 1是 + */ + isGiftCoupon?: number; + /** + * 优惠卷数量 + */ + num?: number; + shopId?: number; + [property: string]: any; +} \ No newline at end of file diff --git a/src/api/account/permission.ts b/src/api/account/permission.ts new file mode 100644 index 0000000..038b653 --- /dev/null +++ b/src/api/account/permission.ts @@ -0,0 +1,22 @@ +import request from "@/utils/request"; +import { Account_BaseUrl } from "@/api/config"; +const baseURL = Account_BaseUrl + "/admin"; +const ShopStaffApi = { + // 获取店铺权限列表 + getshopPermission() { + return request({ + url: `${baseURL}/shopPermission`, + method: "get", + }); + }, + // 获取员工对应的权限id + getPermission(id: number | string) { + return request({ + url: `${baseURL}/shopStaff/permission`, + method: "get", + params: { id } + }); + }, +}; + +export default ShopStaffApi; diff --git a/src/api/account/table.ts b/src/api/account/table.ts new file mode 100644 index 0000000..0991f28 --- /dev/null +++ b/src/api/account/table.ts @@ -0,0 +1,128 @@ +import request from "@/utils/request"; +import { Account_BaseUrl } from "@/api/config"; +const baseURL = Account_BaseUrl + "/admin/shopTable"; +const API = { + // 批量生成桌码 + fasetAdd(num: number) { + return request({ + url: `${baseURL}/code`, + method: "post", + data: { num }, + }); + }, + getList(data: getListRequest) { + return request({ + url: `${baseURL}`, + method: "get", + params: data + }); + }, + edit(data: editRequest) { + return request({ + url: `${baseURL}`, + method: "put", + data: data, + }); + }, + add(data: addRequest) { + return request({ + url: `${baseURL}`, + method: "post", + data: data, + }); + }, + delete(id: number | string) { + return request({ + url: `${baseURL}`, + method: "post", + data: { id }, + }); + } +} +export default API; +/** + * ShopTableAddDTO + */ +export interface addRequest { + /** + * 区域id + */ + areaId?: number | null; + /** + * 是否自动清台 + */ + autoClear?: number | null; + /** + * 客座数 + */ + capacity: number | null; + /** + * 结束数字 + */ + end: number | null; + /** + * 台桌前缀 + */ + sign: null | string; + /** + * 起始数字 + */ + start: number | null; + [property: string]: any; +} + +/** + * ShopTableDTO + */ +export interface editRequest { + /** + * 区域Id + */ + areaId?: number | null; + /** + * 自动清台 0手动 1自动 + */ + autoClear?: number | null; + /** + * 自增id + */ + id: number | null; + /** + * 是否接受网络预定 + */ + isPredate?: number | null; + /** + * 客座数,允许的客座数量 + */ + maxCapacity?: number | null; + name?: null | string; + /** + * 网络预定台桌支付金额 + */ + predateAmount?: number | null; + /** + * 二维码 + */ + qrcode?: null | string; + /** + * 台桌排序 + */ + sort?: number | null; + /** + * idle-空闲 using-使用中 subscribe预定,closed--关台, opening 开台中,cleaning 台桌清理中 + */ + status?: null | string; + [property: string]: any; +} + +export interface getListRequest { + /** + * 区域id + */ + areaId?: number; + /** + * 桌码 + */ + tableCode?: string; + [property: string]: any; +} \ No newline at end of file diff --git a/src/router/index.ts b/src/router/index.ts index 0b680b4..a13620e 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -321,7 +321,7 @@ export const constantRoutes: RouteRecordRaw[] = [ }, { path: "table", - component: () => import("@/views/tool/table.vue"), + component: () => import("@/views/tool/table/index.vue"), name: "table", meta: { title: "台桌管理", @@ -473,7 +473,7 @@ export const constantRoutes: RouteRecordRaw[] = [ }, { path: "active", - component: () => import("@/views/user/active.vue"), + component: () => import("@/views/user/active/index.vue"), name: "userActive", meta: { title: "活动管理", diff --git a/src/utils/websocket copy.ts b/src/utils/websocket copy.ts new file mode 100644 index 0000000..bd8fadb --- /dev/null +++ b/src/utils/websocket copy.ts @@ -0,0 +1,93 @@ +import { Client } from "@stomp/stompjs"; +import { getToken } from "@/utils/auth"; + +class WebSocketManager { + private client: Client | null = null; + private messageHandlers: Map void)[]> = new Map(); + private reconnectAttempts = 0; + private maxReconnectAttempts = 3; // 自定义最大重试次数 + private reconnectDelay = 5000; // 重试延迟(单位:毫秒) + + // 初始化 WebSocket 客户端 + setupWebSocket() { + const endpoint = import.meta.env.VITE_APP_WS_ENDPOINT; + + // 如果没有配置 WebSocket 端点或显式关闭,直接返回 + if (!endpoint) { + console.log("WebSocket 已被禁用,如需打开请在配置文件中配置 VITE_APP_WS_ENDPOINT"); + return; + } + + if (this.client && this.client.connected) { + console.log("客户端已存在并且连接正常"); + return this.client; + } + + this.client = new Client({ + brokerURL: endpoint, + connectHeaders: { + Authorization: getToken(), + }, + heartbeatIncoming: 30000, + heartbeatOutgoing: 30000, + reconnectDelay: 0, // 设置为 0 禁用重连 + onConnect: () => { + console.log(`连接到 WebSocket 服务器: ${endpoint}`); + this.reconnectAttempts = 0; // 重置重连计数 + this.messageHandlers.forEach((handlers, topic) => { + handlers.forEach((handler) => { + this.subscribeToTopic(topic, handler); + }); + }); + }, + onStompError: (frame) => { + console.error(`连接错误: ${frame.headers["message"]}`); + console.error(`错误详情: ${frame.body}`); + }, + onDisconnect: () => { + console.log(`WebSocket 连接已断开: ${endpoint}`); + this.reconnectAttempts++; + if (this.reconnectAttempts < this.maxReconnectAttempts) { + console.log(`正在尝试重连... 尝试次数: ${this.reconnectAttempts}`); + } else { + console.log("重连次数已达上限,停止重连"); + this.client?.deactivate(); + } + }, + }); + + this.client.activate(); + } + + // 订阅主题 + public subscribeToTopic(topic: string, onMessage: (message: string) => void) { + console.log(`正在订阅主题: ${topic}`); + if (!this.client || !this.client.connected) { + this.setupWebSocket(); + } + + if (this.messageHandlers.has(topic)) { + this.messageHandlers.get(topic)?.push(onMessage); + } else { + this.messageHandlers.set(topic, [onMessage]); + } + + if (this.client?.connected) { + this.client.subscribe(topic, (message) => { + const handlers = this.messageHandlers.get(topic); + handlers?.forEach((handler) => handler(message.body)); + }); + } + } + + // 断开 WebSocket 连接 + public disconnect() { + if (this.client) { + console.log("断开 WebSocket 连接"); + this.client.deactivate(); + this.client = null; + } + } +} + +export default new WebSocketManager(); diff --git a/src/utils/websocket.ts b/src/utils/websocket.ts index bd8fadb..e0202af 100644 --- a/src/utils/websocket.ts +++ b/src/utils/websocket.ts @@ -1,9 +1,10 @@ -import { Client } from "@stomp/stompjs"; -import { getToken } from "@/utils/auth"; class WebSocketManager { - private client: Client | null = null; + private client: WebSocket | null = null; + private connected: boolean = false; + private onMessage: (message: any) => void = function () { }; private messageHandlers: Map void)[]> = new Map(); + private type: string = 'manage'; private reconnectAttempts = 0; private maxReconnectAttempts = 3; // 自定义最大重试次数 private reconnectDelay = 5000; // 重试延迟(单位:毫秒) @@ -18,73 +19,52 @@ class WebSocketManager { return; } - if (this.client && this.client.connected) { + if (this.client && this.connected) { console.log("客户端已存在并且连接正常"); return this.client; } - - this.client = new Client({ - brokerURL: endpoint, - connectHeaders: { - Authorization: getToken(), - }, - heartbeatIncoming: 30000, - heartbeatOutgoing: 30000, - reconnectDelay: 0, // 设置为 0 禁用重连 - onConnect: () => { - console.log(`连接到 WebSocket 服务器: ${endpoint}`); - this.reconnectAttempts = 0; // 重置重连计数 - this.messageHandlers.forEach((handlers, topic) => { - handlers.forEach((handler) => { - this.subscribeToTopic(topic, handler); - }); - }); - }, - onStompError: (frame) => { - console.error(`连接错误: ${frame.headers["message"]}`); - console.error(`错误详情: ${frame.body}`); - }, - onDisconnect: () => { - console.log(`WebSocket 连接已断开: ${endpoint}`); - this.reconnectAttempts++; - if (this.reconnectAttempts < this.maxReconnectAttempts) { - console.log(`正在尝试重连... 尝试次数: ${this.reconnectAttempts}`); - } else { - console.log("重连次数已达上限,停止重连"); - this.client?.deactivate(); - } - }, - }); - - this.client.activate(); + this.client = new WebSocket(endpoint) + this.client.onopen = () => { + this.connected = true; + console.log("WebSocket 连接已建立"); + this.sendMessage('test') + }; + this.client.onclose = () => { + this.connected = false; + console.log("WebSocket 连接已断开"); + }; + this.client.onerror = (error) => { + console.error("WebSocket 发生错误:", error); + }; + this.client.onmessage = (event) => { + const message = event.data; + this.getMessage(message) + }; + } + private getMessage(message: any) { + console.log("收到消息:", message); } // 订阅主题 public subscribeToTopic(topic: string, onMessage: (message: string) => void) { console.log(`正在订阅主题: ${topic}`); - if (!this.client || !this.client.connected) { + if (!this.client || !this.connected) { this.setupWebSocket(); } - - if (this.messageHandlers.has(topic)) { - this.messageHandlers.get(topic)?.push(onMessage); - } else { - this.messageHandlers.set(topic, [onMessage]); - } - - if (this.client?.connected) { - this.client.subscribe(topic, (message) => { - const handlers = this.messageHandlers.get(topic); - handlers?.forEach((handler) => handler(message.body)); - }); + if (this.connected) { + this.onMessage = onMessage; + } + } + public sendMessage(message: any) { + if (this.client) { + this.client.send(message); } } - // 断开 WebSocket 连接 public disconnect() { if (this.client) { console.log("断开 WebSocket 连接"); - this.client.deactivate(); + this.client.close(); this.client = null; } } diff --git a/src/views/shop/staff/components/select-permission.vue b/src/views/shop/staff/components/select-permission.vue new file mode 100644 index 0000000..3a0794d --- /dev/null +++ b/src/views/shop/staff/components/select-permission.vue @@ -0,0 +1 @@ +11 \ No newline at end of file diff --git a/src/views/shop/staff/index.vue b/src/views/shop/staff/index.vue index 3a0c571..ad70a37 100644 --- a/src/views/shop/staff/index.vue +++ b/src/views/shop/staff/index.vue @@ -43,9 +43,8 @@ - - - + + @@ -55,9 +54,8 @@ :modal-config="editModalConfig" @submit-click="handleSubmitClick" > - - - + + @@ -73,7 +71,9 @@ import searchConfig from "./config/search"; import { returnOptionsLabel } from "./config/config"; import RoleApi, { type SysRole } from "@/api/account/role"; import ShopStaffApi from "@/api/account/shopStaff"; - +import permissionApi from "@/api/account/permission"; +import selectPermission from "./components/select-permission.vue"; +permissionApi.getshopPermission(); const { searchRef, contentRef, diff --git a/src/views/tool/table.vue b/src/views/tool/table.vue deleted file mode 100644 index 1e37ea7..0000000 --- a/src/views/tool/table.vue +++ /dev/null @@ -1,3 +0,0 @@ - - 11 - \ No newline at end of file diff --git a/src/views/tool/table/components/addEara.vue b/src/views/tool/table/components/addEara.vue new file mode 100644 index 0000000..58a9afc --- /dev/null +++ b/src/views/tool/table/components/addEara.vue @@ -0,0 +1,73 @@ + + + + + + + + + 取 消 + 确 定 + + + + + \ No newline at end of file diff --git a/src/views/tool/table/components/addTable.vue b/src/views/tool/table/components/addTable.vue new file mode 100644 index 0000000..feb542f --- /dev/null +++ b/src/views/tool/table/components/addTable.vue @@ -0,0 +1,235 @@ + + + + + + + + + + + + + + + + + + + + + + 起始 + + + + + + + + 结束 + + + + + + + + + + + + + + + 手动清台 + 自动清台 + + + + + + + + 低消 + 计时 + + + + + + + + + + + 取 消 + 确 定 + + + + + \ No newline at end of file diff --git a/src/views/tool/table/components/choose-diners-number.vue b/src/views/tool/table/components/choose-diners-number.vue new file mode 100644 index 0000000..7e8231a --- /dev/null +++ b/src/views/tool/table/components/choose-diners-number.vue @@ -0,0 +1,270 @@ + + + + + + 清空 + + + 位 + + + + + 取消 + 确定 + + + + + + + + + \ No newline at end of file diff --git a/src/views/tool/table/components/choose-user.vue b/src/views/tool/table/components/choose-user.vue new file mode 100644 index 0000000..f834fca --- /dev/null +++ b/src/views/tool/table/components/choose-user.vue @@ -0,0 +1,289 @@ + + + + + + + + + + + + 搜索 + + 不选择用户 + + + + + + + + + + + + + + + + + + + {{ scope.row.nickName }} + + + + + + + + 会员等级{{ scope.row.isVip }} + 否 + + + + + + + + 选择 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/views/tool/table/components/downloadTableCode.vue b/src/views/tool/table/components/downloadTableCode.vue new file mode 100644 index 0000000..92f0218 --- /dev/null +++ b/src/views/tool/table/components/downloadTableCode.vue @@ -0,0 +1,69 @@ + + + + + + + + + 取 消 + 下 载 + + + + + \ No newline at end of file diff --git a/src/views/tool/table/components/keyboard.vue b/src/views/tool/table/components/keyboard.vue new file mode 100644 index 0000000..8436f1f --- /dev/null +++ b/src/views/tool/table/components/keyboard.vue @@ -0,0 +1,319 @@ + + + + + + {{ number }} + + + + + + + + 1 + 2 + 3 + + + 4 + 5 + 6 + + + 7 + 8 + 9 + + + + + + 0 + + + + + + + + + + + + 确认 + + + + + + + \ No newline at end of file diff --git a/src/views/tool/table/components/money-keyboard.vue b/src/views/tool/table/components/money-keyboard.vue new file mode 100644 index 0000000..11e1909 --- /dev/null +++ b/src/views/tool/table/components/money-keyboard.vue @@ -0,0 +1,339 @@ + + + + + + + ¥ + + + + + + + + + + 1 + 2 + 3 + + + + + + + + 4 + 5 + 6 + 清空 + + + 7 + 8 + 9 + + + + . + 0 + 00 + + + 确认 + + + + + + + + + + + + \ No newline at end of file diff --git a/src/views/tool/table/components/order-btn.js b/src/views/tool/table/components/order-btn.js new file mode 100644 index 0000000..33c7922 --- /dev/null +++ b/src/views/tool/table/components/order-btn.js @@ -0,0 +1,62 @@ +export const orderBtns=[ + { + text: "删除", + disabled: false, + }, + { + text: "规格", + disabled: true, + }, + { + text: "菜品打折", + disabled: false, + }, + { + text: "赠菜", + disabled: false, + }, + { + text: "赠菜", + disabled: false, + }, + { + text: "打包", + disabled: false, + }, + { + text: "等叫", + disabled: false, + }, + { + text: "整单等叫", + disabled: false, + }, + { + text: "单品备注", + disabled: false, + }, + { + text: "退菜", + disabled: false, + }, + { + text: "附加费", + disabled: false, + }, + { + text: "存单", + disabled: false, + }, + { + text: "取单", + disabled: false, + }, + { + text: "修改价格", + disabled: false, + }, + { + text: "撤单", + disabled: false, + } +] \ No newline at end of file diff --git a/src/views/tool/table/components/pay-type.vue b/src/views/tool/table/components/pay-type.vue new file mode 100644 index 0000000..692dd8c --- /dev/null +++ b/src/views/tool/table/components/pay-type.vue @@ -0,0 +1,76 @@ + + + 选择支付方式 + + + + + {{ item.payName }} + + + + + + + + + + + \ No newline at end of file diff --git a/src/views/tool/table/components/subscribe.vue b/src/views/tool/table/components/subscribe.vue new file mode 100644 index 0000000..d28d178 --- /dev/null +++ b/src/views/tool/table/components/subscribe.vue @@ -0,0 +1,269 @@ + + + + + + + + + {{ item.label }} / {{ item.date.substring(8,10) }} + {{ item.day }} + + + + + + 午餐 + 晚餐 + + + + + + + + + + + + + + + + + 先生 + 女士 + + + + + + + + 取 消 + 确 定 + + + + + + diff --git a/src/views/tool/table/components/table-diancan copy.vue b/src/views/tool/table/components/table-diancan copy.vue new file mode 100644 index 0000000..283e243 --- /dev/null +++ b/src/views/tool/table/components/table-diancan copy.vue @@ -0,0 +1,3990 @@ + + + + + + + + {{ title }} + + + + {{ postPay ? "后付费" : "先付费" }} + + + + 先付费 + 后付费 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ postPay ? "后付费" : "先付费" }} + + + + 先付费 + 后付费 + + + + + + + + + + + + + + + + + + + + + + + + + + 选择用户 + + + + + + + + {{ vipUser.nickName }} + + 余额:{{ vipUser.amount }} + + + + + + + + + + + {{ item.name }} + + {{ + status[item.status] ? status[item.status].label : "" + }} + + + + {{ table ? "桌台号:" + table.name : "桌台号/取餐号" }} + + + + + + + 就餐人数:{{ perpole }}位 + + + + 清空 + + + + + + 已优惠¥{{ allGiftMoney | to2 }} + + + + + 打包 + + 共{{ allNumber }}件 + ¥{{ allPrice }} + + + + + + + 加菜/返回 + + + + 立即支付 + + + + + + + 仅下单 + + + + + + + 去结账 + + + + + + + + + + + + 以下是优惠菜品 + + + + + + + + + 已下单菜品 + + + + + + + 订单备注: {{ note.content }} + + + + + + - + + + + + + + + + + + + 规格 + + + {{ returnGiftText }} + + + {{ returnPackText }} + + + 删除 + + + + 存单 + + + 取单 + {{ + prveOrder.list.length + }} + + + + + 整单备注 + + + + + + + + + + + 展开 + + + + + {{ item.name }} + {{ + item.name + }} + + + + + 未找到相关商品 + + + + + + + + + + + + + + + + + + + + {{ item | returntypeName }} + + + {{ item.name }} + + + + + + + + + + + + + ¥{{ item.lowPrice }} + + + 售罄 + + + + + + + + + + + + + + + + + + {{ + vipUser.id ? vipUser.nickName : "服务员下单" + }} + + + 余额:{{ vipUser.amount | to2 }} + 积分:{{ vipUser.totalScore }} + + + + + + + + + 整单打折/减免 + + + + + + + + + 立即支付 + + + + + + + 账单明细 + + + + 会员优惠 + -¥0.00 + + + 门店优惠 + -¥0.00 + + + 满减优惠 + -¥0.00 + + + 优惠券 + -¥0.00 + + + 整单改价 + + -¥{{ + ((1 - createOrder.discount) * createOrder.data.amount) + | to2 + }} + + + + 打包费 + + ¥{{ createOrder.data.packFee || "0.00" }} + + + + 桌位费/附加费 + ¥0.00 + + + 总价 + + ¥{{ createOrder.data.amount | to2 }} + + + + 抹零 + -¥0.00 + + + 应付金额 + + ¥{{ + (createOrder.data.amount * createOrder.discount) | to2 + }} + + + + + + + + + + + + + + + + + + + {{ item.name }} + ({{ item.values.length }}选1) + + + + + {{ val.name }} + + + + + + + + + + ¥{{ skuGoods.data.salePrice | to2 }} + + {{ skuText }} + 库存:{{ skuGoods.data.stockNumber || 0 }} + + + + + + + + + + + + + + 已下架 + + + + 库存不足 + + + 确定 + + + + + + + + + + + + 数量 + + + {{ keyborad.number }} + + + + + + 1 + 2 + 3 + + + 4 + 5 + 6 + + + 7 + 8 + 9 + + + + 0 + + + + + + + + + + + + 确认 + + + + + + + + + + + {{ index + 1 }} + ¥{{ item.totalAmount }} + + {{ item.created_at || "" }} + ({{ item.totalNumber }}件) + + + + + + + + + + + {{ item.name }} + x{{ item.number }} + ¥{{ item.totalAmount || 0 }} + + + + {{ item.specSnap | formatSpecSnap }} + + + + + + + + + + 确认此单 + + 删除此单 + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/tool/table/components/table-diancan-back.vue b/src/views/tool/table/components/table-diancan-back.vue new file mode 100644 index 0000000..a407f04 --- /dev/null +++ b/src/views/tool/table/components/table-diancan-back.vue @@ -0,0 +1,3804 @@ + + + + + + + + {{ title }} + + + + {{ postPay ? "后付费" : "先付费" }} + + + + 先付费 + 后付费 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ postPay ? "后付费" : "先付费" }} + + + + 先付费 + 后付费 + + + + + + + + + + + + + + + + + + + + + + + + + + 选择用户 + + + + + + + + {{ vipUser.nickName }} + + 余额:{{ vipUser.amount }} + + + + + + + + + {{ table ? "桌台号:" + table.name : "桌台号/取餐号" }} + + + 清空 + + + + + + 已优惠¥{{ allGiftMoney | to2 }} + + + + + 打包 + + 共{{ allNumber }}件 + ¥{{ allPrice }} + + + + + + + 加菜/返回 + + + + 立即支付 + + + + + + + + 仅下单 + + + + + + + 去结账 + + + + + + + + + + + + 以下是优惠菜品 + + + + + + + + + 已下单菜品 + + + + + + + 订单备注: {{ note.content }} + + + + + + - + + + + + + + + + + + + 规格 + + + {{ returnGiftText }} + + + {{ returnPackText }} + + + 删除 + + + + 存单 + + + 取单 + {{ + prveOrder.list.length + }} + + + + + 整单备注 + + + + + + + + + + + 展开 + + + + + {{ item.name }} + {{ + item.name + }} + + + + + 未找到相关商品 + + + + + + + + + + + + + + + + + + + + {{ item | returntypeName }} + + + {{ item.name }} + + + + + + + + + + + + + ¥{{ item.lowPrice }} + + + 售罄 + + + + + + + + + + + + + + + + + + {{ + vipUser.id ? vipUser.nickName : "服务员下单" + }} + + + 余额:{{ vipUser.amount | to2 }} + 积分:{{ vipUser.totalScore }} + + + + + + + + + 整单打折/减免 + + + + + + + + 立即支付 + + + + + + + 账单明细 + + + + 会员优惠 + -¥0.00 + + + 门店优惠 + -¥0.00 + + + 满减优惠 + -¥0.00 + + + 优惠券 + -¥0.00 + + + 整单改价 + + -¥{{ + ((1 - createOrder.discount) * createOrder.data.amount) + | to2 + }} + + + + 打包费 + + ¥{{ createOrder.data.packFee || "0.00" }} + + + + 桌位费/附加费 + ¥0.00 + + + 总价 + + ¥{{ createOrder.data.amount | to2 }} + + + + 抹零 + -¥0.00 + + + 应付金额 + + ¥{{ + (createOrder.data.amount * createOrder.discount) | to2 + }} + + + + + + + + + + + + + + + + + + + {{ item.name }} + ({{ item.values.length }}选1) + + + + + {{ val.name }} + + + + + + + + + + ¥{{ skuGoods.data.salePrice | to2 }} + + {{ skuText }} + 库存:{{ skuGoods.data.stockNumber || "" }} + + + + + + + + + + + + + + 已下架 + + + 确定 + + + + + + + + + + + 数量 + + + {{ keyborad.number }} + + + + + + 1 + 2 + 3 + + + 4 + 5 + 6 + + + 7 + 8 + 9 + + + + 0 + + + + + + + + + + + + 确认 + + + + + + + + + + + {{ index + 1 }} + ¥{{ item.totalAmount }} + + {{ item.created_at || "" }} + ({{ item.totalNumber }}件) + + + + + + + + + + + {{ item.name }} + x{{ item.number }} + ¥{{ item.totalAmount || 0 }} + + + + {{ item.specSnap | formatSpecSnap }} + + + + + + + + + + 确认此单 + + 删除此单 + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/tool/table/components/table-diancan-oldList-back.vue b/src/views/tool/table/components/table-diancan-oldList-back.vue new file mode 100644 index 0000000..50452fd --- /dev/null +++ b/src/views/tool/table/components/table-diancan-oldList-back.vue @@ -0,0 +1,3839 @@ + + + + + + + + {{ title }} + + + + {{ postPay ? "后付费" : "先付费" }} + + + + 先付费 + 后付费 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ postPay ? "后付费" : "先付费" }} + + + + 先付费 + 后付费 + + + + + + + + + + + + + + + + + + + + + + + + + + 选择用户 + + + + + + + + {{ vipUser.nickName }} + + 余额:{{ vipUser.amount }} + + + + + + + + + {{ table ? "桌台号:" + table.name : "桌台号/取餐号" }} + + + 清空 + + + + + + 已优惠¥{{ allGiftMoney | to2 }} + + + + + 打包 + + 共{{ allNumber }}件 + ¥{{ allPrice }} + + + + + + + 加菜/返回 + + + + 立即支付 + + + + + + + + 仅下单 + + + + + + + 去结账 + + + + + + + + + + + + 以下是优惠菜品 + + + + + + + + + 已下单菜品 + + + + + + + 订单备注: {{ note.content }} + + + + + + - + + + + + + + + + + + + 规格 + + + {{ returnGiftText }} + + + {{ returnPackText }} + + + 删除 + + + + 存单 + + + 取单 + {{ + prveOrder.list.length + }} + + + + + 整单备注 + + + + + + + + + + + 展开 + + + + + {{ item.name }} + {{ + item.name + }} + + + + + 未找到相关商品 + + + + + + + + + + + + + + + + + + + + {{ item | returntypeName }} + + + {{ item.name }} + + + + + + + + + + + + + ¥{{ item.lowPrice }} + + + 售罄 + + + + + + + + + + + + + + + + + + {{ + vipUser.id ? vipUser.nickName : "服务员下单" + }} + + + 余额:{{ vipUser.amount | to2 }} + 积分:{{ vipUser.totalScore }} + + + + + + + + + 整单打折/减免 + + + + + + + + 立即支付 + + + + + + + 账单明细 + + + + 会员优惠 + -¥0.00 + + + 门店优惠 + -¥0.00 + + + 满减优惠 + -¥0.00 + + + 优惠券 + -¥0.00 + + + 整单改价 + + -¥{{ + ((1 - createOrder.discount) * createOrder.data.amount) + | to2 + }} + + + + 打包费 + + ¥{{ createOrder.data.packFee || "0.00" }} + + + + 桌位费/附加费 + ¥0.00 + + + 总价 + + ¥{{ createOrder.data.amount | to2 }} + + + + 抹零 + -¥0.00 + + + 应付金额 + + ¥{{ + (createOrder.data.amount * createOrder.discount) | to2 + }} + + + + + + + + + + + + + + + + + + + {{ item.name }} + ({{ item.values.length }}选1) + + + + + {{ val.name }} + + + + + + + + + + ¥{{ skuGoods.data.salePrice | to2 }} + + {{ skuText }} + 库存:{{ skuGoods.data.stockNumber || 0 }} + + + + + + + + + + + + + + 已下架 + + + + 库存不足 + + + 确定 + + + + + + + + + + + + + + + 数量 + + + {{ keyborad.number }} + + + + + + 1 + 2 + 3 + + + 4 + 5 + 6 + + + 7 + 8 + 9 + + + + 0 + + + + + + + + + + + + 确认 + + + + + + + + + + + {{ index + 1 }} + ¥{{ item.totalAmount }} + + {{ item.created_at || "" }} + ({{ item.totalNumber }}件) + + + + + + + + + + + {{ item.name }} + x{{ item.number }} + ¥{{ item.totalAmount || 0 }} + + + + {{ item.specSnap | formatSpecSnap }} + + + + + + + + + + 确认此单 + + 删除此单 + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/tool/table/components/table-diancan.vue b/src/views/tool/table/components/table-diancan.vue new file mode 100644 index 0000000..1b5dcae --- /dev/null +++ b/src/views/tool/table/components/table-diancan.vue @@ -0,0 +1,4302 @@ + + + + + + + + {{ title }} + + + + + {{ postPay ? "后付费" : "先付费" }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ postPay ? "后付费" : "先付费" }} + + + + 先付费 + 后付费 + + + + + + + + + + + + + + + + + + + + + + + + + + 选择用户 + + + + + + + + {{ vipUser.nickName }} + + 余额:{{ vipUser.amount }} + + + + + + + + {{ item.name }} + + + + + + + + {{ item.name }} + + {{ + status[item.status] ? status[item.status].label : "" + }} + + + + {{ table ? "桌台号:" + table.name : "桌台号/取餐号" }} + + + + + + + + 就餐人数:{{ perpole }}位 + + + + + + 就餐人数:-位 + + + + + 清空 + + + + + + + + + + + + 以下是优惠菜品 + + + + + + + + + + + + 第{{ orderItem.placeNum }}次下单 + + + + + + + 餐位费 + + + + 订单备注: {{ note.content }} + + + + + + + 已优惠¥{{ allGiftMoney | to2 }} + + + + + 打印制作单 + + + 共{{ allNumber }}件 + ¥{{ allPrice }} + + + + + + + 加菜/返回 + + + + 立即支付 + + + + + + + 仅下单 + + + + + + + 去结账 + + + + + + + + + + + - + + + + + + + + + + + + 规格 + + + {{ returnGiftText }} + + + {{ returnPackText }} + + + 删除 + + + + 存单 + + + 取单 + {{ + prveOrder.list.length + }} + + + + + 整单备注 + + 退菜 + + + + + + + + + + + + + 展开 + + + + + {{ item.name }} + {{ + item.name + }} + + + + + 未找到相关商品 + + + + + + + + + + + + + + + + + + + + {{ item | returntypeName }} + + + {{ item.name }} + + + + + + + + + + + + + ¥{{ item.lowPrice }} + + + 售罄 + + + + + + + + + + + + + + + + + + {{ + vipUser.id ? vipUser.nickName : "服务员下单" + }} + + + 余额:{{ vipUser.amount | to2 }} + 积分:{{ vipUser.totalScore }} + + + + + + + + + 整单打折/减免 + + + + + + + + + 立即支付 + + + + + + + 账单明细 + + + + 会员优惠 + -¥0.00 + + + 门店优惠 + -¥0.00 + + + 满减优惠 + -¥0.00 + + + 优惠券 + -¥0.00 + + + 整单改价 + + -¥{{ + ((1 - createOrder.discount) * createOrder.data.amount) + | to2 + }} + + + + 打包费 + + ¥{{ createOrder.data.packFee || "0.00" }} + + + + 餐位费/附加费 + + ¥{{ order.seatFee.totalAmount | to2 }} + + + + 总价 + + ¥{{ createOrder.data.amount | to2 }} + + + + 抹零 + -¥0.00 + + + 应付金额 + + ¥{{ + (createOrder.data.amount * createOrder.discount) | to2 + }} + + + + + + + + + + + + + + + + + + + {{ item.name }} + ({{ item.values.length }}选1) + + + + + {{ val.name }} + + + + + + + + + + ¥{{ skuGoods.data.salePrice | to2 }} + + {{ skuText }} + 库存:{{ skuGoods.data.stockNumber || 0 }} + + + + + + + + + + + + + + 已下架 + + + + 库存不足 + + + 确定 + + + + + + + + + + + + 数量 + + + {{ keyborad.number }} + + + + + + 1 + 2 + 3 + + + 4 + 5 + 6 + + + 7 + 8 + 9 + + + + 0 + + + + + + + + + + + + 确认 + + + + + + + + + + + {{ index + 1 }} + ¥{{ item.totalAmount }} + + {{ item.created_at || "" }} + ({{ item.totalNumber }}件) + + + + + + + + + + + {{ item.name }} + x{{ item.number }} + ¥{{ item.totalAmount || 0 }} + + + + {{ item.specSnap | formatSpecSnap }} + + + + + + + + + + 确认此单 + + 删除此单 + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/tool/table/components/table-edit.vue b/src/views/tool/table/components/table-edit.vue new file mode 100644 index 0000000..76171fc --- /dev/null +++ b/src/views/tool/table/components/table-edit.vue @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + 手动清台 + 自动清台 + + + + + + + + 低消 + 计时 + + + + + + + + + + + 取 消 + 确 定 + + + + + \ No newline at end of file diff --git a/src/views/tool/table/components/util.js b/src/views/tool/table/components/util.js new file mode 100644 index 0000000..2ec3413 --- /dev/null +++ b/src/views/tool/table/components/util.js @@ -0,0 +1,47 @@ +//判断商品是否可以下单 +export function isCanBuy(goods,isStock) { + return goods.isGrounding && goods.isPauseSale == 0 && (isStock?goods.stockNumber > 0:true) ; +} + +// 一个数组是否包含另外一个数组全部元素 +export function arrayContainsAll(arr1, arr2) { + for (let i = 0; i < arr2.length; i++) { + if (!arr1.includes(arr2[i])) { + return false; + } + } + return true; +} + +//n项 n-1项组合,生成全部结果 +export function generateCombinations(arr, k) { + let result = []; + + function helper(index, current) { + if (current.length === k) { + result.push(current.slice()); // 使用slice()来避免直接修改原始数组 + } else { + for (let i = index; i < arr.length; i++) { + current.push(arr[i]); // 将当前元素添加到组合中 + helper(i + 1, current); // 递归调用,索引增加以避免重复选择相同的元素 + current.pop(); // 回溯,移除当前元素以便尝试其他组合 + } + } + } + + helper(0, []); // 从索引0开始,初始空数组作为起点 + return result; +} + +export function returnReverseVal(val, isReturnString = true) { + const isBol = typeof val === "boolean"; + const isString = typeof val === "string"; + let reverseNewval = ""; + if (isBol) { + reverseNewval = !val; + } + if (isString) { + reverseNewval = val === "true" ? "false" : "true"; + } + return reverseNewval; +} diff --git a/src/views/user/active.vue b/src/views/tool/table/index.vue similarity index 100% rename from src/views/user/active.vue rename to src/views/tool/table/index.vue diff --git a/src/views/tool/table/status.js b/src/views/tool/table/status.js new file mode 100644 index 0000000..ecaf8c8 --- /dev/null +++ b/src/views/tool/table/status.js @@ -0,0 +1,10 @@ +export default { + pending: { label: '挂单中', type: '#E6A23C' }, + cleaning: { label: '待清台', type: '#FAAD14' }, + using: { label: '开台中', type: '#FF4D4F' }, + idle: { label: '空闲', type: '#3F9EFF' }, + paying: { label: '结算中', type: '#E6A23C' }, + closed: { label: '关台', type: '#DDDDDD' }, + subscribe: { label: '预约', type: '#52C41A ' }, + unbind: { label: '未绑定', type: 'rgb(221,221,221)' } +} diff --git a/src/views/user/active/index.vue b/src/views/user/active/index.vue new file mode 100644 index 0000000..30653d4 --- /dev/null +++ b/src/views/user/active/index.vue @@ -0,0 +1,155 @@ + + + + + + + + + + {{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }} + + + + {{ returnOptionsLabel(scope.prop, scope.row[scope.prop]) }} + + + {{ scope.row[scope.prop] ? "是" : "否" }} + + + + {{ scope.row[scope.prop] === null ? "未知" : scope.row[scope.prop] == 1 ? "男" : "女" }} + + + + + + {{ scope.row.nickName }} + + + + {{ scope.row[scope.prop] }} + + + {{ scope.row[scope.prop] }} + + + + + + + + + + + + + +