更新没有usb打印机时调用云打印机

This commit is contained in:
gyq
2024-08-02 17:54:52 +08:00
parent f8c5c9bf59
commit ac469cbc32
7 changed files with 323 additions and 178 deletions

View File

@@ -122,6 +122,7 @@ const isPrint = ref(true);
const printHandle = _.throttle(async function () {
try {
if (!isPrint.value) return;
printLoading.value = true;
const data = {
shop_name: store.userInfo.shopName,
loginAccount: store.userInfo.loginAccount,
@@ -134,20 +135,20 @@ const printHandle = _.throttle(async function () {
printTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
};
printStore.labelPrint(data)
printStore.pushReceiptData(data)
// try {
// printLoading.value = true;
// await print({
// type: "normal",
// ispre: true,
// orderId: props.orderInfo.id,
// });
// printLoading.value = false;
// // ElMessage.success("打印成功");
// } catch (error) {
// printLoading.value = false;
// console.log(error);
// }
setTimeout(() => {
printLoading.value = false;
}, 1500)
if (printStore.deviceNoteList.length) {
printStore.pushReceiptData(data)
} else {
await print({
type: "normal",
ispre: true,
orderId: props.orderInfo.id,
});
printLoading.value = false;
ElMessage.success("打印成功");
}
} catch (error) {
console.log(error);
}
@@ -194,8 +195,19 @@ async function printOrderLable() {
})
// 打印标签
printStore.labelPrint(data)
// 打印小票
printStore.pushReceiptData(data)
if (printStore.deviceNoteList.length) {
// 打印小票
printStore.pushReceiptData(data)
} else {
await print({
type: "normal",
ispre: true,
orderId: props.orderInfo.id,
});
printLoading.value = false;
ElMessage.success("打印成功");
}
} catch (error) {
console.log(error);
}