From bc789245f6b3461b4cdc96d92855d75a8d596115 Mon Sep 17 00:00:00 2001
From: whycq <you@example.com>
Date: 星期日, 30 四月 2023 22:12:13 +0800
Subject: [PATCH] #
---
pages/print/print.vue | 61 ++++++++++++++++++++++++++----
1 files changed, 53 insertions(+), 8 deletions(-)
diff --git a/pages/print/print.vue b/pages/print/print.vue
index 101a7fc..3e725ea 100644
--- a/pages/print/print.vue
+++ b/pages/print/print.vue
@@ -2,10 +2,25 @@
<view>
<view class="print-model" :style="style">
<view class="display" :style="">
- <table >
- <tr><td>鏂欏彿</td><td>{{mat.matnr}}</td><td colspan="1" rowspan="2" style="width: 150px;"></td></tr>
- <tr><td>鍟嗗搧</td><td colspan="1">{{mat.matkx}}</td></tr>
- <tr><td>鏃ユ湡</td><td colspan="2">2023-04-24 15:25:32</td></tr>
+ <table>
+ <tr>
+ <td>鏂欏彿</td>
+ <td>{{mat.matnr}}</td>
+ <td colspan="1" rowspan="2" style="width: 150px;">
+ <!-- 浜岀淮鐮� -->
+ <view class="qr-box">
+ <canvas canvas-id="qrcode" v-show="qrShow" style="width: 300rpx;margin: 0 auto;" />
+ </view>
+ </td>
+ </tr>
+ <tr>
+ <td>鍟嗗搧</td>
+ <td colspan="1">{{mat.matkx}}</td>
+ </tr>
+ <tr>
+ <td>鏃ユ湡</td>
+ <td colspan="2">2023-04-24 15:25:32</td>
+ </tr>
</table>
</view>
</view>
@@ -13,11 +28,18 @@
</template>
<script>
+ import uQRCode from '@/static/js/uqrcode.js' //寮曞叆uqrcode.js
export default {
data() {
return {
- style: {height:'3px'},
- mat: {matnr: '1200128-10055',matkx: 'X5S-4-M03/333'}
+ style: {
+ height: '3px'
+ },
+ mat: {
+ matnr: '1200128-10055',
+ matkx: 'X5S-4-M03/333'
+ },
+ qrShow: false
}
},
onShow() {
@@ -28,10 +50,29 @@
console.log(getWindowInfo.windowWidth); //鍙搷浣滈〉闈㈠搴�
console.log(getWindowInfo);
console.log('鑾峰彇绐楀彛淇℃伅');
- let height = (getWindowInfo.screenWidth + 10 ) * 48 / 74
+ let height = (getWindowInfo.screenWidth + 10) * 48 / 74
console.log(height);
this.style.height = height + 'px'
-
+ this.qrFun("1200128-10055")
+
+ },
+ methods: {
+ //**鐢熸垚浜岀淮鐮�**//
+ qrFun(text) {
+ this.qrShow = true
+ uQRCode.make({
+ canvasId: 'qrcode',
+ componentInstance: this,
+ text: text,
+ size: 150,
+ margin: 0,
+ backgroundColor: '#ffffff',
+ foregroundColor: '#000000',
+ fileType: 'jpg',
+ errorCorrectLevel: uQRCode.errorCorrectLevel.H,
+ success: res => {}
+ })
+ }
}
}
</script>
@@ -44,6 +85,7 @@
align-items: center;
justify-content: center;
}
+
.display {
width: 96%;
height: 96%;
@@ -54,17 +96,20 @@
align-items: center;
justify-content: center;
}
+
.display-pak {
margin: 2%;
height: 92%;
border: 1px solid #8a8a8a;
}
+
table {
width: 92%;
height: 92%;
border: 0;
border-collapse: collapse;
}
+
td {
border: 1px solid #8a8a8a;
text-align: center;
--
Gitblit v1.9.1