连接打印机

This commit is contained in:
weipengfei 2024-05-15 10:47:09 +08:00
parent 255a82adcf
commit 9054d93b0d
7 changed files with 33 additions and 17 deletions

View File

@ -3,5 +3,5 @@ VITE_NOW_TYPE = 'dist'
VITE_PUSH_URL = 'ws://192.168.1.22:8787' VITE_PUSH_URL = 'ws://192.168.1.22:8787'
# VITE_BASE_URL = 'http://192.168.1.22:8546' VITE_BASE_URL = 'http://192.168.1.22:8546'
VITE_BASE_URL = 'https://erp.lihaink.cn' # VITE_BASE_URL = 'https://erp.lihaink.cn'

View File

@ -5,14 +5,20 @@
<link rel="icon" type="image/svg+xml" href="/cashier.svg" /> <link rel="icon" type="image/svg+xml" href="/cashier.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>里海收银系统</title> <title>里海收银系统</title>
<script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"> <script
</script> type="text/javascript"
src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"
></script>
<script type="text/javascript"> <script type="text/javascript">
document.addEventListener('UniAppJSBridgeReady', function() { document.addEventListener("UniAppJSBridgeReady", function () {});
}) function receiveData(data) {
// window.receiveData = (e)=>{ try {
// ElMessage.success("接收到消息:" + JSON.stringify(e)); data = JSON.parse(data);
// } if (data.type === "connect") {
window.postMessage(data);
}
} catch (error) {}
}
</script> </script>
<style> <style>
@ -44,7 +50,7 @@
} }
} }
/* 大屏幕 */ /* 大屏幕 */
@media screen and (min-width: 1900px){ @media screen and (min-width: 1900px) {
html { html {
font-size: 16px; font-size: 16px;
} }

View File

@ -14,7 +14,7 @@ const list = ref([
{ name: "saleOrder", title: "收银订单", ico: "DataLine", count: 0 }, { name: "saleOrder", title: "收银订单", ico: "DataLine", count: 0 },
{ name: "order", title: "待提采购", ico: "DataAnalysis", count: 0 }, { name: "order", title: "待提采购", ico: "DataAnalysis", count: 0 },
{ name: "purchaseOrder", title: "采购订单", ico: "Tickets", count: 0 }, { name: "purchaseOrder", title: "采购订单", ico: "Tickets", count: 0 },
{ name: "test", title: "打印", ico: "Tickets", count: 0 }, // { name: "test", title: "", ico: "Tickets", count: 0 },
]); ]);
const aup = () => { const aup = () => {
let index = list.value.findIndex((item) => item.name == route.name); let index = list.value.findIndex((item) => item.name == route.name);

View File

@ -63,10 +63,18 @@ const APPprint = (content = "") => {
onMounted(() => { onMounted(() => {
mitt.on("printReceipt", printReceipt); mitt.on("printReceipt", printReceipt);
// ElMessage.success(":"); //
window.receiveData = (e)=>{ window.addEventListener(
ElMessage.success("接收到消息:"); "message",
} function (event) {
// alert(JSON.stringify(event.data));
if(event.data.type === "connect"){
is_connect.value = true;
ElMessage.success("已连接打印机T58");
}
},
false
);
}); });
onUnmounted(() => { onUnmounted(() => {
@ -96,7 +104,7 @@ onUnmounted(() => {
点击自动连接打印机 点击自动连接打印机
</el-button> </el-button>
</div> </div>
<div style="margin-right: 1rem; color: #333" v-else>打印机正常运行</div> <div style="margin-right: 1rem;" v-else @click="ElMessage.success('打印机已经连接啦')">已连接打印机T58</div>
<el-dropdown trigger="hover"> <el-dropdown trigger="hover">
<div class="el-dropdown-link"> <div class="el-dropdown-link">
<el-avatar :src="merInfo.avatar" icon="user-filled" /> <el-avatar :src="merInfo.avatar" icon="user-filled" />

View File

@ -109,6 +109,7 @@ onMounted(() => {
text-align: center; text-align: center;
font-size: 1.3rem; font-size: 1.3rem;
padding-bottom: 2rem; padding-bottom: 2rem;
color: #333;
} }
} }
} }

View File

@ -138,6 +138,7 @@ onUnmounted(() => {
infinite-scroll-distance="300" infinite-scroll-distance="300"
infinite-scroll-delay="300" infinite-scroll-delay="300"
style="overflow: auto" style="overflow: auto"
v-if="formData?.id"
:infinite-scroll-immediate="false" :infinite-scroll-immediate="false"
> >
<div class="table-title">订单信息</div> <div class="table-title">订单信息</div>

View File

@ -85,7 +85,7 @@ const getOrderList = (reload = false) => {
const submitOrder = ()=>{ const submitOrder = ()=>{
createOrderApi().then(res=>{ createOrderApi().then(res=>{
console.log(res); ElMessage.success("提交成功");
}) })
} }