优化订单小票打印

This commit is contained in:
gyq
2026-04-08 15:06:22 +08:00
parent 8655757dd6
commit 1985713f28
19 changed files with 782 additions and 395 deletions

View File

@@ -5,7 +5,7 @@ import axios from "axios";
import os from "os";
import fs from "fs";
import { exec } from "child_process";
import { printReceipt, printHandoverReceipt, printRefund } from "./printService";
import { printReceipt, printHandoverReceipt, printRefund,printRefundDish } from "./printService";
// ===== 核心配置:单文件缓存 =====
// 固定的缓存文件路径永远只存这1个文件
@@ -134,7 +134,7 @@ app.whenReady().then(() => {
}
});
// 打印退菜单/退款小票
// 打印退款小票
ipcMain.on('printRefund', async (event, arg) => {
try {
let _parmas = JSON.parse(arg);
@@ -147,6 +147,19 @@ app.whenReady().then(() => {
}
});
// 打印退菜单
ipcMain.on('printRefundDish', async (event, arg) => {
try {
let _parmas = JSON.parse(arg);
// console.log(_parmas);
await printRefundDish(_parmas.printerIp, _parmas.orderData);
return { ok: true }
} catch (e) {
console.log(e);
return { ok: false, msg: e.message }
}
});
app.on("activate", () => {
// 在 macOS 系统内, 如果没有已开启的应用窗口
// 点击托盘图标时通常会重新创建一个新窗口