连接打印机

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_BASE_URL = 'http://192.168.1.22:8546'
VITE_BASE_URL = 'https://erp.lihaink.cn'
VITE_BASE_URL = 'http://192.168.1.22:8546'
# VITE_BASE_URL = 'https://erp.lihaink.cn'

View File

@ -5,14 +5,20 @@
<link rel="icon" type="image/svg+xml" href="/cashier.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<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">
document.addEventListener('UniAppJSBridgeReady', function() {
})
// window.receiveData = (e)=>{
// ElMessage.success("接收到消息:" + JSON.stringify(e));
// }
document.addEventListener("UniAppJSBridgeReady", function () {});
function receiveData(data) {
try {
data = JSON.parse(data);
if (data.type === "connect") {
window.postMessage(data);
}
} catch (error) {}
}
</script>
<style>

View File

@ -14,7 +14,7 @@ const list = ref([
{ name: "saleOrder", title: "收银订单", ico: "DataLine", count: 0 },
{ name: "order", title: "待提采购", ico: "DataAnalysis", 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 = () => {
let index = list.value.findIndex((item) => item.name == route.name);

View File

@ -63,10 +63,18 @@ const APPprint = (content = "") => {
onMounted(() => {
mitt.on("printReceipt", printReceipt);
// ElMessage.success(":");
window.receiveData = (e)=>{
ElMessage.success("接收到消息:");
//
window.addEventListener(
"message",
function (event) {
// alert(JSON.stringify(event.data));
if(event.data.type === "connect"){
is_connect.value = true;
ElMessage.success("已连接打印机T58");
}
},
false
);
});
onUnmounted(() => {
@ -96,7 +104,7 @@ onUnmounted(() => {
点击自动连接打印机
</el-button>
</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">
<div class="el-dropdown-link">
<el-avatar :src="merInfo.avatar" icon="user-filled" />

View File

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

View File

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

View File

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