新增标签打印
This commit is contained in:
parent
1439f12ee5
commit
c86fff9691
|
|
@ -122,6 +122,49 @@ electron.app.whenReady().then(() => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
const tagPrintWin = new electron.BrowserWindow({
|
||||||
|
show: true,
|
||||||
|
width: 320,
|
||||||
|
height: 240,
|
||||||
|
webPreferences: {
|
||||||
|
nodeIntegration: true,
|
||||||
|
contextIsolation: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (process.env.VITE_DEV_SERVER_URL) {
|
||||||
|
tagPrintWin.loadFile(path.join(__dirname, "../public/tag_print.html"));
|
||||||
|
} else {
|
||||||
|
tagPrintWin.loadFile(path.resolve(__dirname, "../dist/tag_print.html"));
|
||||||
|
}
|
||||||
|
electron.ipcMain.on("printerTagSync", (event, arg) => {
|
||||||
|
tagPrintWin.webContents.send("getParams", arg);
|
||||||
|
});
|
||||||
|
electron.ipcMain.on("printTagStart", (event, arg) => {
|
||||||
|
console.log(arg);
|
||||||
|
const _parmas = JSON.parse(arg);
|
||||||
|
let name = _parmas.deviceName;
|
||||||
|
tagPrintWin.webContents.print({
|
||||||
|
silent: true,
|
||||||
|
deviceName: name,
|
||||||
|
pageSize: {
|
||||||
|
width: 4e4,
|
||||||
|
height: 3e4
|
||||||
|
},
|
||||||
|
scaleFactor: 80,
|
||||||
|
landscape: false,
|
||||||
|
margins: {
|
||||||
|
marginType: "none",
|
||||||
|
top: 0,
|
||||||
|
bottom: 0,
|
||||||
|
left: 0,
|
||||||
|
right: 0
|
||||||
|
},
|
||||||
|
dpi: {
|
||||||
|
horizontal: 203,
|
||||||
|
vertical: 203
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
electron.app.on("window-all-closed", () => {
|
electron.app.on("window-all-closed", () => {
|
||||||
if (process.platform !== "darwin")
|
if (process.platform !== "darwin")
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,6 @@
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { app, BrowserWindow, ipcMain } from "electron";
|
import { app, BrowserWindow, ipcMain } from "electron";
|
||||||
// import SerialPort from "serialport";
|
// const SerialPort = require("serialport");
|
||||||
|
|
||||||
// SerialPort.list().then(
|
|
||||||
// (ports) => ports.forEach(console.log),
|
|
||||||
// (err) => console.error(err)
|
|
||||||
// );
|
|
||||||
|
|
||||||
let win;
|
let win;
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
|
|
@ -52,6 +47,16 @@ app.whenReady().then(() => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ipcMain.on("getSerialPort", () => {
|
||||||
|
// SerialPort.SerialPort.list().then(
|
||||||
|
// (ports) => {
|
||||||
|
// console.log(ports);
|
||||||
|
// win.webContents.send("seriaportList", ports);
|
||||||
|
// },
|
||||||
|
// (err) => console.error(err)
|
||||||
|
// );
|
||||||
|
// });
|
||||||
|
|
||||||
// 创建打印小票子窗口
|
// 创建打印小票子窗口
|
||||||
const printWin = new BrowserWindow({
|
const printWin = new BrowserWindow({
|
||||||
show: false,
|
show: false,
|
||||||
|
|
@ -156,6 +161,58 @@ app.whenReady().then(() => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 标签小票的窗口
|
||||||
|
const tagPrintWin = new BrowserWindow({
|
||||||
|
show: true,
|
||||||
|
width: 320,
|
||||||
|
height: 240,
|
||||||
|
webPreferences: {
|
||||||
|
nodeIntegration: true,
|
||||||
|
contextIsolation: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (process.env.VITE_DEV_SERVER_URL) {
|
||||||
|
// 加载打印的html文件
|
||||||
|
tagPrintWin.loadFile(path.join(__dirname, "../public/tag_print.html"));
|
||||||
|
} else {
|
||||||
|
tagPrintWin.loadFile(path.resolve(__dirname, "../dist/tag_print.html")); // 打包后使用文件路径访问应用
|
||||||
|
}
|
||||||
|
|
||||||
|
// 接收渲染进程发送的数据
|
||||||
|
ipcMain.on("printerTagSync", (event, arg) => {
|
||||||
|
tagPrintWin.webContents.send("getParams", arg);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 执行标签小票的打印操作
|
||||||
|
ipcMain.on("printTagStart", (event, arg) => {
|
||||||
|
console.log(arg);
|
||||||
|
const _parmas = JSON.parse(arg);
|
||||||
|
// console.log(_parmas)
|
||||||
|
let name = _parmas.deviceName;
|
||||||
|
tagPrintWin.webContents.print({
|
||||||
|
silent: true,
|
||||||
|
deviceName: name,
|
||||||
|
pageSize: {
|
||||||
|
width: 40000,
|
||||||
|
height: 30000,
|
||||||
|
},
|
||||||
|
scaleFactor: 80,
|
||||||
|
landscape: false,
|
||||||
|
margins: {
|
||||||
|
marginType: "none",
|
||||||
|
top: 0,
|
||||||
|
bottom: 0,
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
},
|
||||||
|
dpi: {
|
||||||
|
horizontal: 203,
|
||||||
|
vertical: 203,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.on("window-all-closed", () => {
|
app.on("window-all-closed", () => {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "vite-electron",
|
"name": "vite-electron",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.2.16",
|
"version": "1.2.21",
|
||||||
"main": "dist-electron/main.js",
|
"main": "dist-electron/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "chcp 65001 && vite",
|
"dev": "chcp 65001 && vite",
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 6.2 KiB |
|
|
@ -0,0 +1,57 @@
|
||||||
|
* {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
padding: 2mm;
|
||||||
|
}
|
||||||
|
|
||||||
|
.print_view {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.print_view .ewm {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 99;
|
||||||
|
}
|
||||||
|
.print_view .header {
|
||||||
|
display: -webkit-box;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
-webkit-box-align: center;
|
||||||
|
-ms-flex-align: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.print_view .header .logo {
|
||||||
|
width: 90px;
|
||||||
|
}
|
||||||
|
.print_view .header .title {
|
||||||
|
margin-left: 6px;
|
||||||
|
}
|
||||||
|
.print_view .number_wrap {
|
||||||
|
display: -webkit-box;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
-webkit-box-align: end;
|
||||||
|
-ms-flex-align: end;
|
||||||
|
align-items: flex-end;
|
||||||
|
}
|
||||||
|
.print_view .number_wrap .num {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.print_view .number_wrap .info {
|
||||||
|
margin-left: 12px;
|
||||||
|
padding-bottom: 4px;
|
||||||
|
}
|
||||||
|
.print_view .time {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2023. Author Hubert Formin <2399270194@qq.com>
|
||||||
|
-->
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<title>Print preview</title>
|
||||||
|
<link rel="stylesheet" href="./tag_print.css" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="app">
|
||||||
|
<div class="print_view">
|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s+z7bfZ/p9cMMCMgQLyBAsIEOwgAzBAjIEC8gQLCBDsIAMwQIyBAvIECwgQ7CADMECMgQLyBAsIOOa3q8BeBc3LCBDsIAMwQIyBAvIECwgQ7CADMECMgQLyBAsIEOwgAzBAjIEC8gQLCBDsIAMwQIyBAvIECwgQ7CADMECMgQLyBAsIEOwgAzBAjIEC8gQLCBDsIAMwQIyBAvIECwgQ7CADMECMv4ARUAaEG+15lEAAAAASUVORK5CYII="
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
|
<div class="header">
|
||||||
|
<img class="logo" src="./logo.png" />
|
||||||
|
<!-- <span class="title">双屿Pisces</span> -->
|
||||||
|
</div>
|
||||||
|
<div class="number_wrap">
|
||||||
|
<div class="num">196</div>
|
||||||
|
<div class="info">座位号:B4</div>
|
||||||
|
</div>
|
||||||
|
<div class="shop_info">
|
||||||
|
<div class="name">[冰]美式抹茶拿铁焦糖</div>
|
||||||
|
<div class="text">【半塘 去冰 去咖啡液】</div>
|
||||||
|
</div>
|
||||||
|
<div class="time">2024-06-14 16:22:44</div>
|
||||||
|
<div class="tips">建议尽快享用,风味更佳</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script type="module">
|
||||||
|
const { ipcRenderer } = require("electron");
|
||||||
|
import {
|
||||||
|
createApp,
|
||||||
|
ref,
|
||||||
|
onMounted,
|
||||||
|
} from "../node_modules/vue/dist/vue.esm-browser.js";
|
||||||
|
|
||||||
|
createApp({
|
||||||
|
setup() {
|
||||||
|
const data = ref({});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
ipcRenderer.on("getParams", (event, arg) => {
|
||||||
|
data.value = JSON.parse(arg);
|
||||||
|
console.log(data.value);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
ipcRenderer.send(
|
||||||
|
"printTagStart",
|
||||||
|
JSON.stringify({ deviceName: data.value.deviceName })
|
||||||
|
);
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
data,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
}).mount("#app");
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
* {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
padding: 2mm;
|
||||||
|
}
|
||||||
|
.print_view {
|
||||||
|
position: relative;
|
||||||
|
.ewm {
|
||||||
|
$size: 50px;
|
||||||
|
width: $size;
|
||||||
|
height: $size;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 99;
|
||||||
|
}
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.logo {
|
||||||
|
$size: 90px;
|
||||||
|
width: $size;
|
||||||
|
}
|
||||||
|
.title {
|
||||||
|
margin-left: 6px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.number_wrap {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
.num {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
margin-left: 12px;
|
||||||
|
padding-bottom: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.time {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -75,3 +75,29 @@ export function sendMessage(params) {
|
||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扫码叫号
|
||||||
|
* @param {*} params
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function scanSendMessage(params) {
|
||||||
|
return request({
|
||||||
|
method: "get",
|
||||||
|
url: "/order/scanSendMessage",
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取叫号记录
|
||||||
|
* @param {*} params
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function getsendMessage(params) {
|
||||||
|
return request({
|
||||||
|
method: "get",
|
||||||
|
url: "/order/getsendMessage",
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,245 @@
|
||||||
|
<!-- 取餐号组件 -->
|
||||||
|
<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" 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>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<el-button plain type="info" disabled style="width: 100%;">.</el-button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<el-button plain type="info" style="width: 100%;" @click="inputHandle(0)">0</el-button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<el-button plain type="info" icon="CloseBold" style="width: 100%;" @click="delHandle"></el-button>
|
||||||
|
</div>
|
||||||
|
</div> -->
|
||||||
|
<div class="list" v-loading="tableData.loading">
|
||||||
|
<div class="item" v-for="item in tableData.list" :key="item.id">
|
||||||
|
<div class="top">
|
||||||
|
<div class="left">
|
||||||
|
{{ item.outCode }} - {{ item.productName }}
|
||||||
|
</div>
|
||||||
|
<div class="state s1" v-if="item.status == 0">
|
||||||
|
叫号成功
|
||||||
|
</div>
|
||||||
|
<div class="state s2" v-if="item.status == 1">
|
||||||
|
叫号失败
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="btm">
|
||||||
|
<div class="time">{{ dayjs(item.createTime).format('YYYY-MM-DD HH:mm:ss') }}</div>
|
||||||
|
<div class="info" v-if="item.status == 1">
|
||||||
|
{{ item.remark }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<el-empty description="暂无记录" :image-size="60" v-if="!tableData.list.length" />
|
||||||
|
</div>
|
||||||
|
<div class="page">
|
||||||
|
<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">
|
||||||
|
<el-button type="primary" style="width: 100%;" :loading="loading" @click="confirmHandle">确认</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import _ from "lodash";
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
import { onMounted, reactive, ref } from 'vue';
|
||||||
|
import { useUser } from "@/store/user.js";
|
||||||
|
import { scanSendMessage, getsendMessage } from '@/api/order/index'
|
||||||
|
const store = useUser();
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: '叫号取餐'
|
||||||
|
},
|
||||||
|
placeholder: {
|
||||||
|
type: String,
|
||||||
|
default: '请扫描取餐号'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const inputRef = ref(null)
|
||||||
|
const loading = ref(false)
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const number = ref('')
|
||||||
|
|
||||||
|
const tableData = reactive({
|
||||||
|
loading: false,
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
total: 0,
|
||||||
|
list: []
|
||||||
|
})
|
||||||
|
|
||||||
|
const emit = defineEmits(['success'])
|
||||||
|
|
||||||
|
function show() {
|
||||||
|
dialogVisible.value = true
|
||||||
|
setTimeout(() => {
|
||||||
|
inputRef.value.focus();
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
function opne() {
|
||||||
|
number.value = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
// 输入
|
||||||
|
function inputHandle(n) {
|
||||||
|
number.value += n
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
function delHandle() {
|
||||||
|
if (!number.value) return
|
||||||
|
number.value = number.value.substring(0, number.value.length - 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
const inputChange = _.debounce(function (e) {
|
||||||
|
// console.log(e);
|
||||||
|
confirmHandle();
|
||||||
|
}, 500);
|
||||||
|
|
||||||
|
// 页码改变
|
||||||
|
function handleCurrentChange() {
|
||||||
|
getsendMessageAjax()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取叫号记录
|
||||||
|
async function getsendMessageAjax() {
|
||||||
|
try {
|
||||||
|
tableData.loading = true
|
||||||
|
const res = await getsendMessage({
|
||||||
|
page: tableData.page,
|
||||||
|
pageSize: tableData.pageSize,
|
||||||
|
shopId: store.userInfo.shopId,
|
||||||
|
// shopId: 4,
|
||||||
|
})
|
||||||
|
tableData.loading = false
|
||||||
|
tableData.list = res.list
|
||||||
|
tableData.total = res.total
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确认
|
||||||
|
const confirmHandle = _.throttle(async function () {
|
||||||
|
try {
|
||||||
|
if (!number.value) return
|
||||||
|
loading.value = true
|
||||||
|
const res = await scanSendMessage({
|
||||||
|
outNumber: number.value,
|
||||||
|
shopId: store.userInfo.shopId,
|
||||||
|
// shopId: 4
|
||||||
|
})
|
||||||
|
loading.value = false
|
||||||
|
getsendMessageAjax()
|
||||||
|
setTimeout(() => {
|
||||||
|
inputRef.value.focus();
|
||||||
|
}, 500);
|
||||||
|
} catch (error) {
|
||||||
|
getsendMessageAjax()
|
||||||
|
loading.value = false
|
||||||
|
console.log(error);
|
||||||
|
setTimeout(() => {
|
||||||
|
inputRef.value.focus();
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
}, 800, { leading: true, trailing: false })
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
show
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getsendMessageAjax()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
:deep(.el-input__inner) {
|
||||||
|
height: 60px;
|
||||||
|
font-size: 36px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page {
|
||||||
|
display: flex;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tips {
|
||||||
|
padding-top: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.keybord_wrap {
|
||||||
|
padding: var(--el-font-size-base) 0;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr 1fr;
|
||||||
|
grid-template-rows: 1fr 1fr 1fr 1fr;
|
||||||
|
gap: var(--el-font-size-base);
|
||||||
|
|
||||||
|
:deep(.el-button--large) {
|
||||||
|
height: 60px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.list {
|
||||||
|
height: 200px;
|
||||||
|
margin-top: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
border-radius: 4px;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: 0 14px;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
padding: 16px 0;
|
||||||
|
|
||||||
|
&:not(:last-child) {
|
||||||
|
border-bottom: 1px solid #ececec;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.left {
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.state {
|
||||||
|
&.s1 {
|
||||||
|
color: var(--primary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.s2 {
|
||||||
|
color: var(--el-color-error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btm {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding-top: 4px;
|
||||||
|
|
||||||
|
.time {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -21,16 +21,20 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 更多 -->
|
<!-- 更多 -->
|
||||||
<more ref="moreref"></more>
|
<more ref="moreref" @openCall="openCall"></more>
|
||||||
|
<!-- 叫号 -->
|
||||||
|
<callNumber ref="callNumberRef" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import more from '@/components/more.vue'
|
import more from '@/components/more.vue'
|
||||||
|
import callNumber from './callNumber.vue'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const moreref = ref(null)
|
const moreref = ref(null)
|
||||||
|
const callNumberRef = ref(null)
|
||||||
const menus = ref([
|
const menus = ref([
|
||||||
{
|
{
|
||||||
label: '收银',
|
label: '收银',
|
||||||
|
|
@ -68,6 +72,10 @@ const menus = ref([
|
||||||
icon: 'SwitchButton'
|
icon: 'SwitchButton'
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
function openCall() {
|
||||||
|
callNumberRef.value.show()
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="drawerbox">
|
<div class="drawerbox">
|
||||||
<el-drawer size="50%" :with-header="false" direction="rtl" v-model="dialogVisible" style="padding: 0;">
|
<el-drawer size="60%" :with-header="false" direction="rtl" v-model="dialogVisible" style="padding: 0;">
|
||||||
<div class="drawerbox_box">
|
<div class="drawerbox_box">
|
||||||
<div class="drawerbox_bo_top">
|
<div class="drawerbox_bo_top">
|
||||||
<div class="drawerbox_bo_top_left">
|
<div class="drawerbox_bo_top_left">
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
<div class="drawerbox_bo_box_itemb_felx">
|
<div class="drawerbox_bo_box_itemb_felx">
|
||||||
<div class="drawerbox_bo_box_itembox">
|
<div class="drawerbox_bo_box_itembox">
|
||||||
<div class="drawerbox_bo_box_icon">
|
<div class="drawerbox_bo_box_icon">
|
||||||
<el-icon size="40" style="margin:30px;">
|
<el-icon size="40">
|
||||||
<Setting />
|
<Setting />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -40,9 +40,19 @@
|
||||||
设置
|
设置
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="drawerbox_bo_box_itembox" @click="openCallHandle">
|
||||||
|
<div class="drawerbox_bo_box_icon">
|
||||||
|
<el-icon size="40">
|
||||||
|
<Bell />
|
||||||
|
</el-icon>
|
||||||
|
</div>
|
||||||
|
<div class="drawerbox_bo_box_icontext">
|
||||||
|
叫号
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="drawerbox_bo_box_itembox" @click="router.push({ name: 'device_list' })">
|
<div class="drawerbox_bo_box_itembox" @click="router.push({ name: 'device_list' })">
|
||||||
<div class="drawerbox_bo_box_icon">
|
<div class="drawerbox_bo_box_icon">
|
||||||
<el-icon size="40" style="margin:30px;">
|
<el-icon size="40">
|
||||||
<TurnOff />
|
<TurnOff />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -52,7 +62,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="drawerbox_bo_box_itembox" @click="screenref.shows()">
|
<div class="drawerbox_bo_box_itembox" @click="screenref.shows()">
|
||||||
<div class="drawerbox_bo_box_icon">
|
<div class="drawerbox_bo_box_icon">
|
||||||
<el-icon size="40" style="margin:30px;">
|
<el-icon size="40">
|
||||||
<Switch />
|
<Switch />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -86,6 +96,8 @@ import packageData from '../../package.json'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
|
const emit = defineEmits(['openCall'])
|
||||||
|
|
||||||
const store = useUser()
|
const store = useUser()
|
||||||
const screenref = ref(null)
|
const screenref = ref(null)
|
||||||
|
|
||||||
|
|
@ -95,6 +107,12 @@ function show() {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 打开叫号弹窗
|
||||||
|
function openCallHandle() {
|
||||||
|
dialogVisible.value = false
|
||||||
|
emit('openCall')
|
||||||
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
show
|
show
|
||||||
})
|
})
|
||||||
|
|
@ -165,26 +183,25 @@ defineExpose({
|
||||||
|
|
||||||
.drawerbox_bo_box_itemb_felx {
|
.drawerbox_bo_box_itemb_felx {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
padding: 0 20px;
|
|
||||||
|
|
||||||
.drawerbox_bo_box_itembox:nth-child(1) {
|
|
||||||
margin-left: 0px;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.drawerbox_bo_box_itembox {
|
.drawerbox_bo_box_itembox {
|
||||||
width: 20%;
|
width: 20%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-left: 40px;
|
margin-right: 20px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
|
||||||
.drawerbox_bo_box_icon {
|
.drawerbox_bo_box_icon {
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
background: #2196f3;
|
background: #2196f3;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.drawerbox_bo_box_icontext {
|
.drawerbox_bo_box_icontext {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ const routes = [
|
||||||
{
|
{
|
||||||
path: "/",
|
path: "/",
|
||||||
name: "home",
|
name: "home",
|
||||||
|
// component: test,
|
||||||
component: home,
|
component: home,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,36 @@
|
||||||
<template>
|
<template>
|
||||||
<el-button @click="chooseSerial">打印</el-button>
|
<!-- <el-button @click="chooseSerial">获取串口列表</el-button> -->
|
||||||
|
<el-button @click="printTag">打印标签</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ipcRenderer } from 'electron'
|
import { ipcRenderer } from 'electron'
|
||||||
|
import { onMounted } from 'vue';
|
||||||
|
|
||||||
|
// 打印标签小票
|
||||||
|
const printTag = () => {
|
||||||
|
ipcRenderer.send('printerTagSync', JSON.stringify({
|
||||||
|
deviceName: 'Xprinter XP-365B123'
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
//选择串口设备
|
//选择串口设备
|
||||||
const chooseSerial = async () => {
|
const chooseSerial = async () => {
|
||||||
let printNum = localStorage.getItem('printNum')
|
// let printNum = localStorage.getItem('printNum')
|
||||||
if (!printNum) {
|
// if (!printNum) {
|
||||||
printNum = 1
|
// printNum = 1
|
||||||
localStorage.setItem('printNum', printNum)
|
// localStorage.setItem('printNum', printNum)
|
||||||
} else {
|
// } else {
|
||||||
printNum++
|
// printNum++
|
||||||
localStorage.setItem('printNum', printNum)
|
// localStorage.setItem('printNum', printNum)
|
||||||
}
|
// }
|
||||||
ipcRenderer.send('printStart', printNum)
|
// ipcRenderer.send('printStart', printNum)
|
||||||
|
ipcRenderer.send('getSerialPort')
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
ipcRenderer.on('seriaportList', (e, a) => {
|
||||||
|
console.log('seriaportList', a);
|
||||||
|
})
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -6,8 +6,8 @@
|
||||||
<span>{{ dayjs(item.create_time).format("YYYY-MM-DD HH:mm:ss") }}</span>
|
<span>{{ dayjs(item.create_time).format("YYYY-MM-DD HH:mm:ss") }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="dialog_footer_right">
|
<div class="dialog_footer_right">
|
||||||
<span :class="{ active: checkIn(item.biz_code) }">
|
<span :class="{ active: item.type == '+' }">
|
||||||
<template v-if="checkIn(item.biz_code)">+</template>
|
<template v-if="item.type == '+'">+</template>
|
||||||
<template v-else>-</template>
|
<template v-else>-</template>
|
||||||
¥{{ formatDecimal(item.amount) }}
|
¥{{ formatDecimal(item.amount) }}
|
||||||
</span>
|
</span>
|
||||||
|
|
@ -29,13 +29,6 @@ const props = defineProps({
|
||||||
default: {}
|
default: {}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 检测是否包含In
|
|
||||||
function checkIn(str) {
|
|
||||||
let reg = RegExp(/In/)
|
|
||||||
return str.match(reg)
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue