1.手机扫码下单打印标签
2.PC桌面端下单打印标签 3.无需打开叫号窗口扫码叫号取餐
This commit is contained in:
@@ -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({
|
const tagPrintWin = new BrowserWindow({
|
||||||
show: true,
|
show: false,
|
||||||
width: 320,
|
width: 320,
|
||||||
height: 240,
|
height: 240,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "vite-electron",
|
"name": "vite-electron",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.3.6",
|
"version": "1.3.12",
|
||||||
"main": "dist-electron/main.js",
|
"main": "dist-electron/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "chcp 65001 && vite",
|
"dev": "chcp 65001 && vite",
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
ipcRenderer.on("getParams", (event, arg) => {
|
ipcRenderer.on("getParams", (event, arg) => {
|
||||||
data.value = JSON.parse(arg);
|
data.value = JSON.parse(arg);
|
||||||
console.log(data.value);
|
// console.log(data.value);
|
||||||
|
|
||||||
let size = 46;
|
let size = 46;
|
||||||
let qrcode = new QRCode(document.getElementById("ewm"), {
|
let qrcode = new QRCode(document.getElementById("ewm"), {
|
||||||
@@ -56,17 +56,17 @@
|
|||||||
correctLevel: QRCode.CorrectLevel.H,
|
correctLevel: QRCode.CorrectLevel.H,
|
||||||
});
|
});
|
||||||
|
|
||||||
// ipcRenderer.send(
|
ipcRenderer.send(
|
||||||
// "printTagStart",
|
"printTagStart",
|
||||||
// JSON.stringify({ deviceName: data.value.deviceName })
|
JSON.stringify({ deviceName: data.value.deviceName })
|
||||||
// );
|
);
|
||||||
|
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
ipcRenderer.send(
|
// ipcRenderer.send(
|
||||||
"printTagStart",
|
// "printTagStart",
|
||||||
JSON.stringify({ deviceName: data.value.deviceName })
|
// JSON.stringify({ deviceName: data.value.deviceName })
|
||||||
);
|
// );
|
||||||
}, 100);
|
// }, 100);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
117
src/App.vue
117
src/App.vue
@@ -2,7 +2,7 @@
|
|||||||
<el-config-provider size="large">
|
<el-config-provider size="large">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="left" v-if="!hideLeftMenu">
|
<div class="left" v-if="!hideLeftMenu">
|
||||||
<left-menu />
|
<left-menu ref="leftMenuRef" />
|
||||||
</div>
|
</div>
|
||||||
<div :class="{ view: !hideLeftMenu }">
|
<div :class="{ view: !hideLeftMenu }">
|
||||||
<!-- <div class="wrapper">
|
<!-- <div class="wrapper">
|
||||||
@@ -31,6 +31,12 @@ import { useUser } from "@/store/user.js";
|
|||||||
import { bySubType } from "@/api/device";
|
import { bySubType } from "@/api/device";
|
||||||
import { dayjs, ElMessage } from "element-plus";
|
import { dayjs, ElMessage } from "element-plus";
|
||||||
import { ipcRenderer } from 'electron'
|
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('')
|
const uuid = ref('')
|
||||||
|
|
||||||
@@ -182,8 +188,10 @@ function checkLabelPrint(props) {
|
|||||||
let sum = 0
|
let sum = 0
|
||||||
|
|
||||||
props.carts.map(item => {
|
props.carts.map(item => {
|
||||||
for (let i = 0; i < item.number; i++) {
|
if (pids.some(el => el == item.categoryId)) {
|
||||||
sum++
|
for (let i = 0; i < item.number; i++) {
|
||||||
|
sum++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -215,9 +223,11 @@ function printLabel(list) {
|
|||||||
if (!checkLocalPrint(printLabelList.value[0].config.deviceName)) {
|
if (!checkLocalPrint(printLabelList.value[0].config.deviceName)) {
|
||||||
ElMessage.error("本地打印机无法使用,请检查打印机是否正确连接");
|
ElMessage.error("本地打印机无法使用,请检查打印机是否正确连接");
|
||||||
} else {
|
} else {
|
||||||
list.map(item => {
|
for (let i = 0; i <= list.length - 1; i++) {
|
||||||
ipcRenderer.send('printerTagSync', JSON.stringify(item))
|
setTimeout(() => {
|
||||||
})
|
ipcRenderer.send('printerTagSync', JSON.stringify(list[i]))
|
||||||
|
}, i * 1000)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,8 +329,103 @@ function reConnect(wsUrl) {
|
|||||||
}, 5000)
|
}, 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(() => {
|
onMounted(() => {
|
||||||
getPrintList()
|
getPrintList()
|
||||||
|
document.addEventListener('keydown', (e) => {
|
||||||
|
getBarCode(e)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="props.title" width="600" v-model="dialogVisible" @open="opne">
|
<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 v-model="number" :placeholder="props.placeholder" readonly></el-input> -->
|
||||||
<el-input ref="inputRef" v-model="number" :placeholder="props.placeholder" :readonly="loading" clearable
|
<!-- <el-input ref="inputRef" v-model="number" :placeholder="props.placeholder" :readonly="loading" clearable
|
||||||
@change="inputChange"></el-input>
|
@change="inputChange"></el-input> -->
|
||||||
<div class="tips">注意:扫码请确保输入口获得焦点</div>
|
<div class="tips">注意:请扫描标签二维码</div>
|
||||||
<!-- <div class="keybord_wrap">
|
<!-- <div class="keybord_wrap">
|
||||||
<div v-for="item in 9" :key="item">
|
<div v-for="item in 9" :key="item">
|
||||||
<el-button plain type="info" style="width: 100%;" @click="inputHandle(item)">{{ item }}</el-button>
|
<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
|
<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" />
|
layout="total, prev, pager, next" :total="tableData.total" @current-change="handleCurrentChange" />
|
||||||
</div>
|
</div>
|
||||||
<div class="footer">
|
<!-- <div class="footer">
|
||||||
<el-button type="primary" style="width: 100%;" :loading="loading" @click="confirmHandle">确认</el-button>
|
<el-button type="primary" style="width: 100%;" :loading="loading" @click="confirmHandle">确认</el-button>
|
||||||
</div>
|
</div> -->
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -59,12 +59,14 @@ import { ElMessage } from 'element-plus'
|
|||||||
import { onMounted, reactive, ref } from 'vue';
|
import { onMounted, reactive, ref } from 'vue';
|
||||||
import { useUser } from "@/store/user.js";
|
import { useUser } from "@/store/user.js";
|
||||||
import { scanSendMessage, getsendMessage } from '@/api/order/index'
|
import { scanSendMessage, getsendMessage } from '@/api/order/index'
|
||||||
|
import { useGlobal } from '@/store/global.js'
|
||||||
|
const global = useGlobal()
|
||||||
const store = useUser();
|
const store = useUser();
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '叫号取餐'
|
default: '叫号取餐记录'
|
||||||
},
|
},
|
||||||
placeholder: {
|
placeholder: {
|
||||||
type: String,
|
type: String,
|
||||||
@@ -96,13 +98,14 @@ function filterCode(t, c = '#') {
|
|||||||
function show() {
|
function show() {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
getsendMessageAjax()
|
getsendMessageAjax()
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
inputRef.value.focus();
|
// inputRef.value.focus();
|
||||||
}, 500);
|
// }, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
function opne() {
|
function opne() {
|
||||||
number.value = ''
|
number.value = ''
|
||||||
|
global.updateData(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 输入
|
// 输入
|
||||||
@@ -177,7 +180,8 @@ const confirmHandle = _.throttle(async function () {
|
|||||||
}, 800, { leading: true, trailing: false })
|
}, 800, { leading: true, trailing: false })
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
show
|
show,
|
||||||
|
getsendMessageAjax
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -120,6 +120,10 @@ async function confirmOrder() {
|
|||||||
if (payLoading.value) return
|
if (payLoading.value) return
|
||||||
try {
|
try {
|
||||||
if (payList.value[payActive.value].payType == "scanCode") {
|
if (payList.value[payActive.value].payType == "scanCode") {
|
||||||
|
if (money.value <= 0) {
|
||||||
|
ElMessage.error("请输入大于0的金额");
|
||||||
|
return;
|
||||||
|
}
|
||||||
scanModalRef.value.show();
|
scanModalRef.value.show();
|
||||||
} else {
|
} else {
|
||||||
if (money.value <= 0) {
|
if (money.value <= 0) {
|
||||||
|
|||||||
@@ -73,9 +73,18 @@ const menus = ref([
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
// 更新叫号记录
|
||||||
|
function updateCallNumber() {
|
||||||
|
callNumberRef.value.getsendMessageAjax()
|
||||||
|
}
|
||||||
|
|
||||||
function openCall() {
|
function openCall() {
|
||||||
callNumberRef.value.show()
|
callNumberRef.value.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
updateCallNumber
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@@ -56,7 +56,9 @@ import { ref } from "vue";
|
|||||||
import icon from "@/assets/icon_scan.png";
|
import icon from "@/assets/icon_scan.png";
|
||||||
import { scanpay, queryOrder, quickPay, queryQuickPayStatus, accountPay, queryScanPay } from "@/api/pay";
|
import { scanpay, queryOrder, quickPay, queryQuickPayStatus, accountPay, queryScanPay } from "@/api/pay";
|
||||||
import { useUser } from "@/store/user.js";
|
import { useUser } from "@/store/user.js";
|
||||||
|
import { useGlobal } from '@/store/global.js'
|
||||||
const store = useUser();
|
const store = useUser();
|
||||||
|
const global = useGlobal()
|
||||||
import {
|
import {
|
||||||
queryMembermember,
|
queryMembermember,
|
||||||
createMembermember,
|
createMembermember,
|
||||||
@@ -167,6 +169,8 @@ function autoCheckOrder() {
|
|||||||
function clearAutoCheckOrder() {
|
function clearAutoCheckOrder() {
|
||||||
clearInterval(timer.value)
|
clearInterval(timer.value)
|
||||||
timer.value = null
|
timer.value = null
|
||||||
|
// 开启叫号功能
|
||||||
|
global.updateData(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询用户支付状态
|
// 查询用户支付状态
|
||||||
@@ -296,6 +300,8 @@ function close() {
|
|||||||
function reset() {
|
function reset() {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
scanCode.value = "";
|
scanCode.value = "";
|
||||||
|
// 关闭叫号功能
|
||||||
|
global.updateData(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
|
|||||||
15
src/store/global.js
Normal file
15
src/store/global.js
Normal file
@@ -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>
|
||||||
<div class="search_wrap">
|
<div class="search_wrap">
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<el-input placeholder="请输入商品名称查询" prefix-icon="Search" v-model="commdityName" clearable
|
<el-input placeholder="请输入商品名称查询" v-model="commdityName" clearable @input="inputChange"></el-input>
|
||||||
@input="inputChange"></el-input>
|
|
||||||
</div>
|
</div>
|
||||||
|
<el-button :loading="searchLoading" :icon="Search" @click="searchHandle">搜索</el-button>
|
||||||
<!-- <el-button :icon="shopListType == 'text' ? 'PictureRounded' : 'PriceTag'"
|
<!-- <el-button :icon="shopListType == 'text' ? 'PictureRounded' : 'PriceTag'"
|
||||||
@click="changeShopListType"></el-button> -->
|
@click="changeShopListType"></el-button> -->
|
||||||
</div>
|
</div>
|
||||||
@@ -41,7 +41,8 @@
|
|||||||
<div class="item">
|
<div class="item">
|
||||||
<div class="dot" v-if="item.orderCount">{{ item.orderCount }}</div>
|
<div class="dot" v-if="item.orderCount">{{ item.orderCount }}</div>
|
||||||
<div class="cover" v-if="shopListType == 'img'">
|
<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>
|
||||||
<div class="name"><el-text line-clamp="1">{{ item.name }}</el-text></div>
|
<div class="name"><el-text line-clamp="1">{{ item.name }}</el-text></div>
|
||||||
<div class="item_empty" v-if="shopListType == 'text'"></div>
|
<div class="item_empty" v-if="shopListType == 'text'"></div>
|
||||||
@@ -52,7 +53,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</swiper-slide>
|
</swiper-slide>
|
||||||
</swiper>
|
</swiper>
|
||||||
</div>
|
</div>
|
||||||
<div class="empty">
|
<div class="empty">
|
||||||
<el-empty description="空空如也~" v-if="!goodsList.length" />
|
<el-empty description="空空如也~" v-if="!goodsList.length" />
|
||||||
</div>
|
</div>
|
||||||
@@ -61,6 +62,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { Search } from '@element-plus/icons-vue'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import useStorage from "@/utils/useStorage";
|
import useStorage from "@/utils/useStorage";
|
||||||
@@ -106,6 +108,13 @@ const loopTimer = ref(null)
|
|||||||
const showPopover = ref(false)
|
const showPopover = ref(false)
|
||||||
|
|
||||||
const inputChange = _.debounce(function () {
|
const inputChange = _.debounce(function () {
|
||||||
|
searchHandle()
|
||||||
|
}, 500)
|
||||||
|
|
||||||
|
// 搜索
|
||||||
|
const searchLoading = ref(false)
|
||||||
|
function searchHandle() {
|
||||||
|
searchLoading.value = true
|
||||||
goodsList.value = []
|
goodsList.value = []
|
||||||
goodsPage.value = 1
|
goodsPage.value = 1
|
||||||
finish.value = false
|
finish.value = false
|
||||||
@@ -114,7 +123,7 @@ const inputChange = _.debounce(function () {
|
|||||||
loopTimer.value = null
|
loopTimer.value = null
|
||||||
|
|
||||||
updataGoods()
|
updataGoods()
|
||||||
}, 500)
|
}
|
||||||
|
|
||||||
// 确认选择规格回调
|
// 确认选择规格回调
|
||||||
function skuConfirm(params) {
|
function skuConfirm(params) {
|
||||||
@@ -279,9 +288,11 @@ async function updataGoods() {
|
|||||||
const res2 = await productqueryCommodityInfoAjax()
|
const res2 = await productqueryCommodityInfoAjax()
|
||||||
goodsList.value.push(res2)
|
goodsList.value.push(res2)
|
||||||
}
|
}
|
||||||
|
searchLoading.value = false
|
||||||
} else {
|
} else {
|
||||||
goodsPage.value = currentGoodsIndex.value + 1
|
goodsPage.value = currentGoodsIndex.value + 1
|
||||||
goodsList.value[currentGoodsIndex.value] = await productqueryCommodityInfoAjax()
|
goodsList.value[currentGoodsIndex.value] = await productqueryCommodityInfoAjax()
|
||||||
|
searchLoading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -179,8 +179,10 @@ function checkLabelPrint(props) {
|
|||||||
let sum = 0
|
let sum = 0
|
||||||
|
|
||||||
props.carts.map(item => {
|
props.carts.map(item => {
|
||||||
for (let i = 0; i < item.number; i++) {
|
if (pids.some(el => el == item.categoryId)) {
|
||||||
sum++
|
for (let i = 0; i < item.number; i++) {
|
||||||
|
sum++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -212,9 +214,11 @@ const printLabel = (list) => {
|
|||||||
if (!checkLocalPrint(printLabelList.value[0].config.deviceName)) {
|
if (!checkLocalPrint(printLabelList.value[0].config.deviceName)) {
|
||||||
ElMessage.error("本地打印机无法使用,请检查打印机是否正确连接");
|
ElMessage.error("本地打印机无法使用,请检查打印机是否正确连接");
|
||||||
} else {
|
} else {
|
||||||
list.map(item => {
|
for (let i = 0; i <= list.length - 1; i++) {
|
||||||
ipcRenderer.send('printerTagSync', JSON.stringify(item))
|
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"),
|
printTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
||||||
};
|
};
|
||||||
checkLabelPrint(data)
|
checkLabelPrint(data)
|
||||||
if (!checkLocalPrint(printList.value[0].config.deviceName)) {
|
// if (!checkLocalPrint(printList.value[0].config.deviceName)) {
|
||||||
ElMessage.error("本地打印机无法使用,请检查打印机是否正确连接3");
|
// ElMessage.error("本地小票打印机无法使用,请检查打印机是否正确连接3");
|
||||||
} else {
|
// } else {
|
||||||
ipcRenderer.send("printerInfoSync", JSON.stringify(data));
|
// ipcRenderer.send("printerInfoSync", JSON.stringify(data));
|
||||||
}
|
// }
|
||||||
} else {
|
} else {
|
||||||
// ElMessage.error("您还没有添加本地打印设备,将使用网络打印");
|
// ElMessage.error("您还没有添加本地打印设备,将使用网络打印");
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -318,8 +318,10 @@ function checkLabelPrint(props) {
|
|||||||
let sum = 0
|
let sum = 0
|
||||||
|
|
||||||
props.skuInfos.map(item => {
|
props.skuInfos.map(item => {
|
||||||
for (let i = 0; i < item.num; i++) {
|
if (pids.some(el => el == item.categoryId)) {
|
||||||
sum++
|
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)) {
|
if (!checkLocalPrint(printLabelList.value[0].config.deviceName)) {
|
||||||
ElMessage.error("本地打印机无法使用,请检查打印机是否正确连接");
|
ElMessage.error("本地打印机无法使用,请检查打印机是否正确连接");
|
||||||
} else {
|
} else {
|
||||||
list.map(item => {
|
for (let i = 0; i <= list.length - 1; i++) {
|
||||||
ipcRenderer.send('printerTagSync', JSON.stringify(item))
|
setTimeout(() => {
|
||||||
})
|
ipcRenderer.send('printerTagSync', JSON.stringify(list[i]))
|
||||||
|
}, i * 1000)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, 1500, { leading: true, trailing: false })
|
}, 1500, { leading: true, trailing: false })
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user