优化usb打印

This commit is contained in:
gyq
2026-04-24 09:30:02 +08:00
parent cb8c9139fe
commit 6aec434015
3 changed files with 9 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
{
"name": "vite-electron",
"private": true,
"version": "2.0.25",
"version": "2.0.27",
"main": "dist-electron/main.js",
"scripts": {
"dev": "chcp 65001 && vite",

View File

@@ -130,6 +130,7 @@ export const usePrint = defineStore("print", {
// 结算单
async ORDER(data) {
try {
console.log('结算单===', data);
// 筛选条件:状态启用 + 小票类型 + handoverSwitch=1 + 打印机可用 + 打印服务正常
const validPrinters = this.deviceNoteList.filter(p => {
return p.status

View File

@@ -13,7 +13,7 @@
<el-input v-model="form.name" placeholder="请输入设备名称"></el-input>
</el-form-item>
<el-form-item label="设备类型">
<el-radio-group v-model="form.connectionType">
<el-radio-group v-model="form.connectionType" @change="form.address = ''">
<el-radio-button label="USB" value="USB"></el-radio-button>
<el-radio-button label="局域网" value="局域网"></el-radio-button>
</el-radio-group>
@@ -37,10 +37,9 @@
</el-form-item>
<el-form-item label="商品分类">
<div class="column">
<el-radio-group v-model="form.classifyPrint" @change="form.categoryList = [];form.categoryIds = ''">
<el-radio-group v-model="form.classifyPrint" @change="form.categoryList = []; form.categoryIds = ''">
<el-radio-button label="全部" value="0"></el-radio-button>
<el-radio-button label="部分" value="1"
v-show="printTypeList[1].values.length > 0"></el-radio-button>
<el-radio-button label="部分" value="1" v-show="printTypeList[1].values.length > 0"></el-radio-button>
</el-radio-group>
<div style="cursor: pointer" @click="classifyRef.show()" v-if="form.classifyPrint == '1'">
<span style="color: #409eff" v-if="form.categoryList.length">
@@ -175,6 +174,7 @@ import { usePrint } from "@/store/print.js";
import { printerAdd, printerDetail } from "@/api/account.js";
import classify from "@/components/classify/index.vue";
import { useGoods } from '@/store/goods.js'
import receiptPrint from "@/components/lodop/receiptPrint.js";
const goodsStore = useGoods()
const classifyRef = ref(null);
@@ -240,7 +240,7 @@ const form = ref({
categoryList: [], // 分类
sort: '',
receiptSize: '58mm', // 小票尺寸 58mm 80mm
classifyPrint: '1', // 分类打印 0-所有 1-部分分类 2-部分商品
classifyPrint: '0', // 分类打印 0-所有 1-部分分类 2-部分商品
printNum: '', // 打印数量 c1m1^2 = 顾客+商家[2张] m1^1 = 商家[1张] c1^1顾客[1张] c2m1^3顾客2+商家1[3张]
kitchenPrintMode: 'all', // 打印方式 all-全部打印 normal-仅打印结账单「前台」one-仅打印制作单「厨房」queue-仅打印排队取号
printContentType: [],
@@ -308,7 +308,7 @@ function printHandle() {
printData.printTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
if (form.value.connectionType === 'USB') {
printStore.pushReceiptData(printData, false);
receiptPrint(printData,)
} else if (form.value.connectionType === '局域网') {
ipcRenderer.send('ORDER', JSON.stringify({
printerIp: form.value.address,
@@ -402,7 +402,7 @@ async function tbPrintMachineDetailAjax(id) {
})
console.log(form.value);
// if (printTypeList.value[1].values.length > 0 && form.value.classifyPrint == 1) {
// form.value.classifyPrint = 1