parent
44495c3ee7
commit
328b512411
|
|
@ -1 +1 @@
|
|||
"use strict";const i=require("path"),e=require("electron");let a;e.app.whenReady().then(()=>{a=new e.BrowserWindow({title:"银收客",width:1024,height:768,fullscreenable:!0,fullscreen:!process.env.VITE_DEV_SERVER_URL,simpleFullscreen:!0,frame:!!process.env.VITE_DEV_SERVER_URL,webPreferences:{nodeIntegration:!0,contextIsolation:!1}}),process.env.VITE_DEV_SERVER_URL?a.loadURL(process.env.VITE_DEV_SERVER_URL):a.loadFile(i.resolve(__dirname,"../dist/index.html")),e.app.on("activate",()=>{e.BrowserWindow.getAllWindows().length===0&&createWindow()}),e.ipcMain.on("quitHandler",(t,n)=>{e.app.quit()}),e.ipcMain.on("getPrintList",()=>{a.webContents.getPrintersAsync().then(t=>{a.webContents.send("printList",t)})});const o=new e.BrowserWindow({show:!1,width:464,height:1726,webPreferences:{nodeIntegration:!0,contextIsolation:!1}});process.env.VITE_DEV_SERVER_URL?o.loadFile(i.join(__dirname,"../public/print.html")):o.loadFile(i.resolve(__dirname,"../dist/print.html")),e.ipcMain.on("printerInfoSync",(t,n)=>{o.webContents.send("getParams",n)}),e.ipcMain.on("printStart",(t,n)=>{console.log(n);let r=JSON.parse(n).deviceName;o.webContents.print({silent:!0,deviceName:r,pageSize:{width:58e3,height:216e3},scaleFactor:80,landscape:!1,margins:{marginType:"none",top:0,bottom:0,left:0,right:0},dpi:{horizontal:203,vertical:203}})});const s=new e.BrowserWindow({show:!1,width:464,height:1726,webPreferences:{nodeIntegration:!0,contextIsolation:!1}});process.env.VITE_DEV_SERVER_URL?s.loadFile(i.join(__dirname,"../public/work_print.html")):s.loadFile(i.resolve(__dirname,"../dist/work_print.html")),e.ipcMain.on("printerWorkSync",(t,n)=>{s.webContents.send("getParams",n)}),e.ipcMain.on("printWorkStart",(t,n)=>{let r=JSON.parse(n).deviceName;s.webContents.print({silent:!0,deviceName:r,pageSize:{width:58e3,height:216e3},scaleFactor:80,landscape:!1,margins:{marginType:"none",top:0,bottom:0,left:0,right:0},dpi:{horizontal:203,vertical:203}})});const l=new e.BrowserWindow({show:!0,width:320,height:240,webPreferences:{nodeIntegration:!0,contextIsolation:!1}});process.env.VITE_DEV_SERVER_URL?l.loadFile(i.join(__dirname,"../public/tag_print.html")):l.loadFile(i.resolve(__dirname,"../dist/tag_print.html")),e.ipcMain.on("printerTagSync",(t,n)=>{console.log(n),l.webContents.send("getParams",n)}),e.ipcMain.on("printTagStart",(t,n)=>{let r=JSON.parse(n).deviceName;l.webContents.print({silent:!0,deviceName:r,pageSize:{width:4e4,height:3e4},scaleFactor:80,landscape:!1,margins:{marginType:"none",top:0,bottom:0,left:0,right:0},dpi:{horizontal:203,vertical:203}})})});e.app.on("window-all-closed",()=>{process.platform!=="darwin"&&e.app.quit()});
|
||||
"use strict";const i=require("path"),e=require("electron");let a;e.app.whenReady().then(()=>{a=new e.BrowserWindow({title:"银收客",width:1024,height:768,fullscreenable:!0,fullscreen:!process.env.VITE_DEV_SERVER_URL,simpleFullscreen:!0,frame:!!process.env.VITE_DEV_SERVER_URL,webPreferences:{nodeIntegration:!0,contextIsolation:!1}}),process.env.VITE_DEV_SERVER_URL?a.loadURL(process.env.VITE_DEV_SERVER_URL):a.loadFile(i.resolve(__dirname,"../dist/index.html")),e.app.on("activate",()=>{e.BrowserWindow.getAllWindows().length===0&&createWindow()}),e.ipcMain.on("quitHandler",(t,n)=>{e.app.quit()}),e.ipcMain.on("getPrintList",()=>{a.webContents.getPrintersAsync().then(t=>{a.webContents.send("printList",t)})});const o=new e.BrowserWindow({show:!1,width:464,height:1726,webPreferences:{nodeIntegration:!0,contextIsolation:!1}});process.env.VITE_DEV_SERVER_URL?o.loadFile(i.join(__dirname,"../public/print.html")):o.loadFile(i.resolve(__dirname,"../dist/print.html")),e.ipcMain.on("printerInfoSync",(t,n)=>{o.webContents.send("getParams",n)}),e.ipcMain.on("printStart",(t,n)=>{console.log(n);let r=JSON.parse(n).deviceName;o.webContents.print({silent:!0,deviceName:r,pageSize:{width:58e3,height:216e3},scaleFactor:80,landscape:!1,margins:{marginType:"none",top:0,bottom:0,left:0,right:0},dpi:{horizontal:203,vertical:203}})});const s=new e.BrowserWindow({show:!1,width:464,height:1726,webPreferences:{nodeIntegration:!0,contextIsolation:!1}});process.env.VITE_DEV_SERVER_URL?s.loadFile(i.join(__dirname,"../public/work_print.html")):s.loadFile(i.resolve(__dirname,"../dist/work_print.html")),e.ipcMain.on("printerWorkSync",(t,n)=>{s.webContents.send("getParams",n)}),e.ipcMain.on("printWorkStart",(t,n)=>{let r=JSON.parse(n).deviceName;s.webContents.print({silent:!0,deviceName:r,pageSize:{width:58e3,height:216e3},scaleFactor:80,landscape:!1,margins:{marginType:"none",top:0,bottom:0,left:0,right:0},dpi:{horizontal:203,vertical:203}})});const l=new e.BrowserWindow({show:!1,width:320,height:240,webPreferences:{nodeIntegration:!0,contextIsolation:!1}});process.env.VITE_DEV_SERVER_URL?l.loadFile(i.join(__dirname,"../public/tag_print.html")):l.loadFile(i.resolve(__dirname,"../dist/tag_print.html")),e.ipcMain.on("printerTagSync",(t,n)=>{console.log(n),l.webContents.send("getParams",n)}),e.ipcMain.on("printTagStart",(t,n)=>{let r=JSON.parse(n).deviceName;l.webContents.print({silent:!0,deviceName:r,pageSize:{width:4e4,height:3e4},scaleFactor:80,landscape:!1,margins:{marginType:"none",top:0,bottom:0,left:0,right:0},dpi:{horizontal:203,vertical:203}})})});e.app.on("window-all-closed",()=>{process.platform!=="darwin"&&e.app.quit()});
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ app.whenReady().then(() => {
|
|||
|
||||
// 标签小票的窗口
|
||||
const tagPrintWin = new BrowserWindow({
|
||||
show: true,
|
||||
show: false,
|
||||
width: 320,
|
||||
height: 240,
|
||||
webPreferences: {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "vite-electron",
|
||||
"private": true,
|
||||
"version": "1.3.6",
|
||||
"version": "1.3.12",
|
||||
"main": "dist-electron/main.js",
|
||||
"scripts": {
|
||||
"dev": "chcp 65001 && vite",
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
onMounted(() => {
|
||||
ipcRenderer.on("getParams", (event, arg) => {
|
||||
data.value = JSON.parse(arg);
|
||||
console.log(data.value);
|
||||
// console.log(data.value);
|
||||
|
||||
let size = 46;
|
||||
let qrcode = new QRCode(document.getElementById("ewm"), {
|
||||
|
|
@ -56,17 +56,17 @@
|
|||
correctLevel: QRCode.CorrectLevel.H,
|
||||
});
|
||||
|
||||
// ipcRenderer.send(
|
||||
// "printTagStart",
|
||||
// JSON.stringify({ deviceName: data.value.deviceName })
|
||||
// );
|
||||
ipcRenderer.send(
|
||||
"printTagStart",
|
||||
JSON.stringify({ deviceName: data.value.deviceName })
|
||||
);
|
||||
|
||||
setTimeout(() => {
|
||||
ipcRenderer.send(
|
||||
"printTagStart",
|
||||
JSON.stringify({ deviceName: data.value.deviceName })
|
||||
);
|
||||
}, 100);
|
||||
// setTimeout(() => {
|
||||
// ipcRenderer.send(
|
||||
// "printTagStart",
|
||||
// JSON.stringify({ deviceName: data.value.deviceName })
|
||||
// );
|
||||
// }, 100);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
117
src/App.vue
117
src/App.vue
|
|
@ -2,7 +2,7 @@
|
|||
<el-config-provider size="large">
|
||||
<div class="container">
|
||||
<div class="left" v-if="!hideLeftMenu">
|
||||
<left-menu />
|
||||
<left-menu ref="leftMenuRef" />
|
||||
</div>
|
||||
<div :class="{ view: !hideLeftMenu }">
|
||||
<!-- <div class="wrapper">
|
||||
|
|
@ -31,6 +31,12 @@ import { useUser } from "@/store/user.js";
|
|||
import { bySubType } from "@/api/device";
|
||||
import { dayjs, ElMessage } from "element-plus";
|
||||
import { ipcRenderer } from 'electron'
|
||||
import { scanSendMessage } from '@/api/order/index'
|
||||
import { useGlobal } from '@/store/global.js'
|
||||
|
||||
const global = useGlobal()
|
||||
|
||||
const leftMenuRef = ref(null)
|
||||
|
||||
const uuid = ref('')
|
||||
|
||||
|
|
@ -182,8 +188,10 @@ function checkLabelPrint(props) {
|
|||
let sum = 0
|
||||
|
||||
props.carts.map(item => {
|
||||
for (let i = 0; i < item.number; i++) {
|
||||
sum++
|
||||
if (pids.some(el => el == item.categoryId)) {
|
||||
for (let i = 0; i < item.number; i++) {
|
||||
sum++
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -215,9 +223,11 @@ function printLabel(list) {
|
|||
if (!checkLocalPrint(printLabelList.value[0].config.deviceName)) {
|
||||
ElMessage.error("本地打印机无法使用,请检查打印机是否正确连接");
|
||||
} else {
|
||||
list.map(item => {
|
||||
ipcRenderer.send('printerTagSync', JSON.stringify(item))
|
||||
})
|
||||
for (let i = 0; i <= list.length - 1; i++) {
|
||||
setTimeout(() => {
|
||||
ipcRenderer.send('printerTagSync', JSON.stringify(list[i]))
|
||||
}, i * 1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -319,8 +329,103 @@ function reConnect(wsUrl) {
|
|||
}, 5000)
|
||||
}
|
||||
|
||||
const nextCodeRef = ref('')
|
||||
const lastTimeRef = ref('')
|
||||
const codeRef = ref('')
|
||||
// 通过扫码枪获取条形码
|
||||
async function getBarCode(e) {
|
||||
let nextCode = ''
|
||||
let nextTime = ''
|
||||
const lastTime = lastTimeRef.value
|
||||
let code = codeRef.value
|
||||
if (window.event) {
|
||||
// IE
|
||||
nextCode = e.keyCode
|
||||
} else if (e.which) {
|
||||
// Netscape/Firefox/Opera
|
||||
nextCode = e.which
|
||||
}
|
||||
nextTime = new Date().getTime()
|
||||
// 字母上方 数字键0-9 对应键码值 48-57; 数字键盘 数字键0-9 对应键码值 96-105
|
||||
if (
|
||||
(nextCode >= 48 && nextCode <= 57) ||
|
||||
(nextCode >= 96 && nextCode <= 105)
|
||||
) {
|
||||
const codes = {
|
||||
'48': 48,
|
||||
'49': 49,
|
||||
'50': 50,
|
||||
'51': 51,
|
||||
'52': 52,
|
||||
'53': 53,
|
||||
'54': 54,
|
||||
'55': 55,
|
||||
'56': 56,
|
||||
'57': 57,
|
||||
'96': 48,
|
||||
'97': 49,
|
||||
'98': 50,
|
||||
'99': 51,
|
||||
'100': 52,
|
||||
'101': 53,
|
||||
'102': 54,
|
||||
'103': 55,
|
||||
'104': 56,
|
||||
'105': 57
|
||||
}
|
||||
nextCode = codes[nextCode]
|
||||
nextTime = new Date().getTime()
|
||||
}
|
||||
// 第二次输入延迟两秒,删除之前的数据重新计算
|
||||
if (nextTime && lastTime && nextTime - lastTime > 2000) {
|
||||
code = String.fromCharCode(nextCode)
|
||||
} else {
|
||||
code += String.fromCharCode(nextCode)
|
||||
}
|
||||
|
||||
|
||||
// 保存数据
|
||||
nextCodeRef.value = nextCode
|
||||
lastTimeRef.value = nextTime
|
||||
codeRef.value = code
|
||||
// 键入Enter
|
||||
if (e.which === 13) {
|
||||
// 判断 code 长度(这里就获取到条码值了,以下业务自由发挥)
|
||||
code = code.trim()
|
||||
if (code.length == 13) {
|
||||
console.log('A类条码:' + code);
|
||||
} else if (code.length == 23) {
|
||||
console.log('B类条码:' + code);
|
||||
} else if (code.length == 0) {
|
||||
console.log('请输入条码');
|
||||
} else {
|
||||
console.log('条码不合法:' + code);
|
||||
try {
|
||||
if (!global.isCallNumber) return
|
||||
await scanSendMessage({
|
||||
outNumber: code,
|
||||
shopId: store.userInfo.shopId,
|
||||
// shopId: 4
|
||||
})
|
||||
ElMessage.success('叫号成功')
|
||||
leftMenuRef.value.updateCallNumber()
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('code', code);
|
||||
// 键入回车务必清空code值
|
||||
codeRef.value = ''
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getPrintList()
|
||||
document.addEventListener('keydown', (e) => {
|
||||
getBarCode(e)
|
||||
})
|
||||
})
|
||||
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
<template>
|
||||
<el-dialog :title="props.title" width="600" v-model="dialogVisible" @open="opne">
|
||||
<!-- <el-input v-model="number" :placeholder="props.placeholder" readonly></el-input> -->
|
||||
<el-input ref="inputRef" v-model="number" :placeholder="props.placeholder" :readonly="loading" clearable
|
||||
@change="inputChange"></el-input>
|
||||
<div class="tips">注意:扫码请确保输入口获得焦点</div>
|
||||
<!-- <el-input ref="inputRef" v-model="number" :placeholder="props.placeholder" :readonly="loading" clearable
|
||||
@change="inputChange"></el-input> -->
|
||||
<div class="tips">注意:请扫描标签二维码</div>
|
||||
<!-- <div class="keybord_wrap">
|
||||
<div v-for="item in 9" :key="item">
|
||||
<el-button plain type="info" style="width: 100%;" @click="inputHandle(item)">{{ item }}</el-button>
|
||||
|
|
@ -46,9 +46,9 @@
|
|||
<el-pagination v-model:current-page="tableData.page" v-model:page-size="tableData.pageSize" background
|
||||
layout="total, prev, pager, next" :total="tableData.total" @current-change="handleCurrentChange" />
|
||||
</div>
|
||||
<div class="footer">
|
||||
<!-- <div class="footer">
|
||||
<el-button type="primary" style="width: 100%;" :loading="loading" @click="confirmHandle">确认</el-button>
|
||||
</div>
|
||||
</div> -->
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
|
|
@ -59,12 +59,14 @@ import { ElMessage } from 'element-plus'
|
|||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { useUser } from "@/store/user.js";
|
||||
import { scanSendMessage, getsendMessage } from '@/api/order/index'
|
||||
import { useGlobal } from '@/store/global.js'
|
||||
const global = useGlobal()
|
||||
const store = useUser();
|
||||
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
default: '叫号取餐'
|
||||
default: '叫号取餐记录'
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
|
|
@ -96,13 +98,14 @@ function filterCode(t, c = '#') {
|
|||
function show() {
|
||||
dialogVisible.value = true
|
||||
getsendMessageAjax()
|
||||
setTimeout(() => {
|
||||
inputRef.value.focus();
|
||||
}, 500);
|
||||
// setTimeout(() => {
|
||||
// inputRef.value.focus();
|
||||
// }, 500);
|
||||
}
|
||||
|
||||
function opne() {
|
||||
number.value = ''
|
||||
global.updateData(true)
|
||||
}
|
||||
|
||||
// 输入
|
||||
|
|
@ -177,7 +180,8 @@ const confirmHandle = _.throttle(async function () {
|
|||
}, 800, { leading: true, trailing: false })
|
||||
|
||||
defineExpose({
|
||||
show
|
||||
show,
|
||||
getsendMessageAjax
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -120,6 +120,10 @@ async function confirmOrder() {
|
|||
if (payLoading.value) return
|
||||
try {
|
||||
if (payList.value[payActive.value].payType == "scanCode") {
|
||||
if (money.value <= 0) {
|
||||
ElMessage.error("请输入大于0的金额");
|
||||
return;
|
||||
}
|
||||
scanModalRef.value.show();
|
||||
} else {
|
||||
if (money.value <= 0) {
|
||||
|
|
|
|||
|
|
@ -73,9 +73,18 @@ const menus = ref([
|
|||
}
|
||||
])
|
||||
|
||||
// 更新叫号记录
|
||||
function updateCallNumber() {
|
||||
callNumberRef.value.getsendMessageAjax()
|
||||
}
|
||||
|
||||
function openCall() {
|
||||
callNumberRef.value.show()
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
updateCallNumber
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
|
|
|||
|
|
@ -56,7 +56,9 @@ import { ref } from "vue";
|
|||
import icon from "@/assets/icon_scan.png";
|
||||
import { scanpay, queryOrder, quickPay, queryQuickPayStatus, accountPay, queryScanPay } from "@/api/pay";
|
||||
import { useUser } from "@/store/user.js";
|
||||
import { useGlobal } from '@/store/global.js'
|
||||
const store = useUser();
|
||||
const global = useGlobal()
|
||||
import {
|
||||
queryMembermember,
|
||||
createMembermember,
|
||||
|
|
@ -167,6 +169,8 @@ function autoCheckOrder() {
|
|||
function clearAutoCheckOrder() {
|
||||
clearInterval(timer.value)
|
||||
timer.value = null
|
||||
// 开启叫号功能
|
||||
global.updateData(true)
|
||||
}
|
||||
|
||||
// 查询用户支付状态
|
||||
|
|
@ -296,6 +300,8 @@ function close() {
|
|||
function reset() {
|
||||
loading.value = false;
|
||||
scanCode.value = "";
|
||||
// 关闭叫号功能
|
||||
global.updateData(false)
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
import { defineStore } from "pinia";
|
||||
|
||||
export const useGlobal = defineStore({
|
||||
id: "global",
|
||||
state: () => ({
|
||||
// 是否监听叫号
|
||||
isCallNumber: true,
|
||||
}),
|
||||
actions: {
|
||||
// 更新状态
|
||||
updateData(state) {
|
||||
this.isCallNumber = state;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
@ -27,9 +27,9 @@
|
|||
</div>
|
||||
<div class="search_wrap">
|
||||
<div class="input">
|
||||
<el-input placeholder="请输入商品名称查询" prefix-icon="Search" v-model="commdityName" clearable
|
||||
@input="inputChange"></el-input>
|
||||
<el-input placeholder="请输入商品名称查询" v-model="commdityName" clearable @input="inputChange"></el-input>
|
||||
</div>
|
||||
<el-button :loading="searchLoading" :icon="Search" @click="searchHandle">搜索</el-button>
|
||||
<!-- <el-button :icon="shopListType == 'text' ? 'PictureRounded' : 'PriceTag'"
|
||||
@click="changeShopListType"></el-button> -->
|
||||
</div>
|
||||
|
|
@ -41,7 +41,8 @@
|
|||
<div class="item">
|
||||
<div class="dot" v-if="item.orderCount">{{ item.orderCount }}</div>
|
||||
<div class="cover" v-if="shopListType == 'img'">
|
||||
<el-image :src="`${item.coverImg}?x-oss-process=image/resize,m_lfit,w_150,h_150`" class="el_img" fit="cover"></el-image>
|
||||
<el-image :src="`${item.coverImg}?x-oss-process=image/resize,m_lfit,w_150,h_150`"
|
||||
class="el_img" fit="cover"></el-image>
|
||||
</div>
|
||||
<div class="name"><el-text line-clamp="1">{{ item.name }}</el-text></div>
|
||||
<div class="item_empty" v-if="shopListType == 'text'"></div>
|
||||
|
|
@ -61,6 +62,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { Search } from '@element-plus/icons-vue'
|
||||
import { ref } from 'vue'
|
||||
import _ from 'lodash'
|
||||
import useStorage from "@/utils/useStorage";
|
||||
|
|
@ -106,6 +108,13 @@ const loopTimer = ref(null)
|
|||
const showPopover = ref(false)
|
||||
|
||||
const inputChange = _.debounce(function () {
|
||||
searchHandle()
|
||||
}, 500)
|
||||
|
||||
// 搜索
|
||||
const searchLoading = ref(false)
|
||||
function searchHandle() {
|
||||
searchLoading.value = true
|
||||
goodsList.value = []
|
||||
goodsPage.value = 1
|
||||
finish.value = false
|
||||
|
|
@ -114,7 +123,7 @@ const inputChange = _.debounce(function () {
|
|||
loopTimer.value = null
|
||||
|
||||
updataGoods()
|
||||
}, 500)
|
||||
}
|
||||
|
||||
// 确认选择规格回调
|
||||
function skuConfirm(params) {
|
||||
|
|
@ -279,9 +288,11 @@ async function updataGoods() {
|
|||
const res2 = await productqueryCommodityInfoAjax()
|
||||
goodsList.value.push(res2)
|
||||
}
|
||||
searchLoading.value = false
|
||||
} else {
|
||||
goodsPage.value = currentGoodsIndex.value + 1
|
||||
goodsList.value[currentGoodsIndex.value] = await productqueryCommodityInfoAjax()
|
||||
searchLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -179,8 +179,10 @@ function checkLabelPrint(props) {
|
|||
let sum = 0
|
||||
|
||||
props.carts.map(item => {
|
||||
for (let i = 0; i < item.number; i++) {
|
||||
sum++
|
||||
if (pids.some(el => el == item.categoryId)) {
|
||||
for (let i = 0; i < item.number; i++) {
|
||||
sum++
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -212,9 +214,11 @@ const printLabel = (list) => {
|
|||
if (!checkLocalPrint(printLabelList.value[0].config.deviceName)) {
|
||||
ElMessage.error("本地打印机无法使用,请检查打印机是否正确连接");
|
||||
} else {
|
||||
list.map(item => {
|
||||
ipcRenderer.send('printerTagSync', JSON.stringify(item))
|
||||
})
|
||||
for (let i = 0; i <= list.length - 1; i++) {
|
||||
setTimeout(() => {
|
||||
ipcRenderer.send('printerTagSync', JSON.stringify(list[i]))
|
||||
}, i * 1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -236,11 +240,11 @@ async function printHandle() {
|
|||
printTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
||||
};
|
||||
checkLabelPrint(data)
|
||||
if (!checkLocalPrint(printList.value[0].config.deviceName)) {
|
||||
ElMessage.error("本地打印机无法使用,请检查打印机是否正确连接3");
|
||||
} else {
|
||||
ipcRenderer.send("printerInfoSync", JSON.stringify(data));
|
||||
}
|
||||
// if (!checkLocalPrint(printList.value[0].config.deviceName)) {
|
||||
// ElMessage.error("本地小票打印机无法使用,请检查打印机是否正确连接3");
|
||||
// } else {
|
||||
// ipcRenderer.send("printerInfoSync", JSON.stringify(data));
|
||||
// }
|
||||
} else {
|
||||
// ElMessage.error("您还没有添加本地打印设备,将使用网络打印");
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -318,8 +318,10 @@ function checkLabelPrint(props) {
|
|||
let sum = 0
|
||||
|
||||
props.skuInfos.map(item => {
|
||||
for (let i = 0; i < item.num; i++) {
|
||||
sum++
|
||||
if (pids.some(el => el == item.categoryId)) {
|
||||
for (let i = 0; i < item.num; i++) {
|
||||
sum++
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -350,9 +352,11 @@ const printLabel = lodash.throttle(function (list) {
|
|||
if (!checkLocalPrint(printLabelList.value[0].config.deviceName)) {
|
||||
ElMessage.error("本地打印机无法使用,请检查打印机是否正确连接");
|
||||
} else {
|
||||
list.map(item => {
|
||||
ipcRenderer.send('printerTagSync', JSON.stringify(item))
|
||||
})
|
||||
for (let i = 0; i <= list.length - 1; i++) {
|
||||
setTimeout(() => {
|
||||
ipcRenderer.send('printerTagSync', JSON.stringify(list[i]))
|
||||
}, i * 1000)
|
||||
}
|
||||
}
|
||||
}, 1500, { leading: true, trailing: false })
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue