新增订单打印失败状态
This commit is contained in:
@@ -7,6 +7,7 @@ import lodopPrintWork from "@/components/lodop/lodopPrintWork.js";
|
|||||||
import invoicePrint from "@/components/lodop/invoicePrint.js";
|
import invoicePrint from "@/components/lodop/invoicePrint.js";
|
||||||
import refundPrint from "@/components/lodop/refundPrint.js";
|
import refundPrint from "@/components/lodop/refundPrint.js";
|
||||||
import { printerList } from "@/api/account.js";
|
import { printerList } from "@/api/account.js";
|
||||||
|
import { useSocket } from './socket.js';
|
||||||
|
|
||||||
export const usePrint = defineStore("print", {
|
export const usePrint = defineStore("print", {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
@@ -174,6 +175,7 @@ export const usePrint = defineStore("print", {
|
|||||||
this.isPrintService
|
this.isPrintService
|
||||||
) {
|
) {
|
||||||
const store = useUser();
|
const store = useUser();
|
||||||
|
props.deviceId = this.deviceNoteList[0].id;
|
||||||
props.deviceName = this.deviceNoteList[0].address;
|
props.deviceName = this.deviceNoteList[0].address;
|
||||||
props.shop_name = store.shopInfo.shopName;
|
props.shop_name = store.shopInfo.shopName;
|
||||||
props.loginAccount = store.userInfo.name;
|
props.loginAccount = store.userInfo.name;
|
||||||
@@ -197,17 +199,36 @@ export const usePrint = defineStore("print", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 开始打印小票
|
// 开始打印小票
|
||||||
startReceiptPrint() {
|
async startReceiptPrint() {
|
||||||
if (this.receiptTimer !== null) return;
|
try {
|
||||||
this.receiptTimer = setInterval(() => {
|
const socketStore = useSocket();
|
||||||
if (!this.receiptList.length) {
|
const userStore = useUser();
|
||||||
clearInterval(this.receiptTimer);
|
|
||||||
this.receiptTimer = null;
|
if (this.receiptTimer !== null) return;
|
||||||
} else {
|
this.receiptTimer = setInterval(() => {
|
||||||
receiptPrint(this.receiptList[0]);
|
if (!this.receiptList.length) {
|
||||||
this.receiptList.splice(0, 1);
|
clearInterval(this.receiptTimer);
|
||||||
}
|
this.receiptTimer = null;
|
||||||
}, 2000);
|
} 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) {
|
printWork(data) {
|
||||||
|
|||||||
@@ -89,6 +89,11 @@
|
|||||||
用餐模式:{{ filterLable("dineMode", scope.row.dineMode) }}
|
用餐模式:{{ filterLable("dineMode", scope.row.dineMode) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="row">订单备注:{{ scope.row.remark }}</div>
|
<div class="row">订单备注:{{ scope.row.remark }}</div>
|
||||||
|
<div class="row">打印状态:
|
||||||
|
<template v-if="scope.row.printStatus.length > 0">
|
||||||
|
打印失败({{scope.row.printStatus.map(item => item.name).join('、')}})
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -286,6 +291,7 @@ async function orderListAjax() {
|
|||||||
const res = await orderList(queryForm.value);
|
const res = await orderList(queryForm.value);
|
||||||
res.records.map(item => {
|
res.records.map(item => {
|
||||||
item.payLoading = false
|
item.payLoading = false
|
||||||
|
item.printStatus = JSON.parse(item.printStatus || '[]')
|
||||||
})
|
})
|
||||||
tableData.list = [];
|
tableData.list = [];
|
||||||
tableData.list = res.records;
|
tableData.list = res.records;
|
||||||
@@ -293,6 +299,8 @@ async function orderListAjax() {
|
|||||||
|
|
||||||
tableRef.value.setScrollTop(0);
|
tableRef.value.setScrollTop(0);
|
||||||
tableRef.value.setScrollLeft(0);
|
tableRef.value.setScrollLeft(0);
|
||||||
|
|
||||||
|
console.log("订单列表:", res);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user