fix: 修改代客下单逻辑,收到清空购物车消息和切换台桌时获取该台桌订单

This commit is contained in:
2025-03-18 09:22:55 +08:00
parent 61607fcc44
commit 259d6db77f
2 changed files with 18 additions and 12 deletions

View File

@@ -3,6 +3,7 @@ import WebSocketManager, { type ApifoxModel, msgType } from "@/utils/websocket";
import orderApi from "@/api/order/order";
import { useUserStoreHook } from "@/store/modules/user";
import { customTruncateToTwoDecimals } from '@/utils/tools'
const shopUser = useUserStoreHook();
export interface CartsState {
id: string | number;
@@ -409,6 +410,12 @@ export const useCartsStore = defineStore("carts", () => {
}
}
//获取历史订单
async function getOldOrder(table_code: string | number) {
const res = await orderApi.getHistoryList({ tableCode: table_code })
setOldOrder(res)
}
function getProductDetails(v: { product_id: string, sku_id: string }) {
const goods = goodsMap[v.product_id]
if (!goods) {
@@ -625,6 +632,7 @@ export const useCartsStore = defineStore("carts", () => {
}
if (msg.operate_type === "manage_cleanup") {
nowCartsClear()
getOldOrder(msg.data.table_code)
}
if (msg.operate_type === "batch") {
concocatSocket({ ...$initParams, table_code: table_code.value })