新增订单打印失败状态

This commit is contained in:
gyq
2025-12-29 16:09:04 +08:00
parent 3b729eabcd
commit 6ff949d97a
2 changed files with 40 additions and 11 deletions

View File

@@ -7,6 +7,7 @@ import lodopPrintWork from "@/components/lodop/lodopPrintWork.js";
import invoicePrint from "@/components/lodop/invoicePrint.js";
import refundPrint from "@/components/lodop/refundPrint.js";
import { printerList } from "@/api/account.js";
import { useSocket } from './socket.js';
export const usePrint = defineStore("print", {
state: () => ({
@@ -174,6 +175,7 @@ export const usePrint = defineStore("print", {
this.isPrintService
) {
const store = useUser();
props.deviceId = this.deviceNoteList[0].id;
props.deviceName = this.deviceNoteList[0].address;
props.shop_name = store.shopInfo.shopName;
props.loginAccount = store.userInfo.name;
@@ -197,17 +199,36 @@ export const usePrint = defineStore("print", {
}
},
// 开始打印小票
startReceiptPrint() {
if (this.receiptTimer !== null) return;
this.receiptTimer = setInterval(() => {
if (!this.receiptList.length) {
clearInterval(this.receiptTimer);
this.receiptTimer = null;
} else {
receiptPrint(this.receiptList[0]);
this.receiptList.splice(0, 1);
}
}, 2000);
async startReceiptPrint() {
try {
const socketStore = useSocket();
const userStore = useUser();
if (this.receiptTimer !== null) return;
this.receiptTimer = setInterval(() => {
if (!this.receiptList.length) {
clearInterval(this.receiptTimer);
this.receiptTimer = null;
} else {
receiptPrint(this.receiptList[0]);
// 在这里触发已打印操作标记
const data = {
type: "cashier",
operate_type: "order_print_status",
table_code: this.receiptList[0].orderInfo.tableCode,
account: userStore.shopInfo.account,
print_status: "1",
order_id: this.receiptList[0].orderInfo.id,
print_id: this.receiptList[0].deviceId,
shop_id: this.receiptList[0].orderInfo.shopId,
}
socketStore.ws.send(JSON.stringify(data));
this.receiptList.splice(0, 1);
}
}, 2000);
} catch (error) {
console.log(error);
}
},
// 打印交班小票
printWork(data) {