优化打印 订单新增桌号和时间筛选

This commit is contained in:
gyq
2024-07-16 09:13:02 +08:00
parent 38366601d4
commit 5e7935bb53
14 changed files with 355 additions and 67 deletions

View File

@@ -58,7 +58,10 @@ export const usePrint = defineStore({
},
// 打印标签小票
labelPrint(props) {
if (this.checkLocalPrint(this.deviceLableList[0].config.deviceName)) {
if (
this.deviceLableList.length &&
this.checkLocalPrint(this.deviceLableList[0].config.deviceName)
) {
let pids = this.deviceLableList[0].config.categoryList.map(
(item) => item.id
);
@@ -94,6 +97,8 @@ export const usePrint = defineStore({
});
// 执行打印操作
this.startLabelPrint();
} else {
console.log("没有打印机");
}
},
// 开始打印标签数据

View File

@@ -14,6 +14,7 @@ export const useSocket = defineStore({
ws: null, // websocket实例
uuid: "", // 长连接唯一id
heartbeatTimer: null, // 心跳计时器
orderList: [],
}),
actions: {
// 创建uuid
@@ -92,7 +93,14 @@ export const useSocket = defineStore({
// 接收订单消息,打印小票
// printBill(data)
// 打印标签小票
printStore.labelPrint(data);
if (!this.orderList.some((el) => el == data.orderInfo.orderNo)) {
console.log("打印", data);
printStore.labelPrint(data);
this.orderList.push(data.orderInfo.orderNo);
if (this.orderList.length > 30) {
this.orderList.splice(0, 1);
}
}
} else if (data.type == "heartbeat") {
console.log("接收心跳");
}