From 0d2024eabd0f07bc4ab3341dddc10464d31938f8 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期六, 21 十二月 2024 18:47:12 +0800
Subject: [PATCH] #新增订单筛选物料界面

---
 pages/print/print.vue |  232 +++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 174 insertions(+), 58 deletions(-)

diff --git a/pages/print/print.vue b/pages/print/print.vue
index ec0a463..f983025 100644
--- a/pages/print/print.vue
+++ b/pages/print/print.vue
@@ -1,58 +1,174 @@
-<template>
-	<view>
-		<button @click="connectBluetooth">connect</button>
-	</view>
-</template>
-
-<script>
-	export default {
-		data() {
-			return {
-
-			}
-		},
-		methods: {
-			connectBluetooth() {
-				let that = this
-				uni.openBluetoothAdapter({
-					success(res) {
-						console.log(res)
-						uni.getBluetoothAdapterState({
-							success(res) {
-								console.log(res);
-								if (!res.discovering) {
-									uni.startBluetoothDevicesDiscovery({
-										success(res) {
-											console.log(res);
-											uni.onBluetoothDeviceFound(devices => {
-												console.log('寮�濮嬬洃鍚鎵惧埌鏂拌澶囩殑浜嬩欢');
-												// this.$set(this.disabled, 3, false);
-												uni.getBluetoothDevices({
-													success: res => {
-														this.newDeviceLoad = false;
-														console.log('鑾峰彇钃濈墮璁惧鎴愬姛:' + res.errMsg);
-														// console.log(JSON.stringify(res))
-													},
-												});
-											});
-										},
-										fail(err) {
-											console.log();
-										}
-									})
-								}
-							}
-						})
-					},
-				})
-				// 鐩戝惉钃濈墮璁惧鍒楄〃
-				
-			},
-
-		}
-	}
-</script>
-
-<style>
-
-</style>
+<template>
+	<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;">
+							<!-- 浜岀淮鐮� -->
+							<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.maktx}}</td>
+					</tr>
+					<tr>
+						<td>鏃ユ湡</td>
+						<td colspan="2">{{time}}</td>
+					</tr>
+				</table>
+			</view>
+		</view>
+		<view>
+			<button @click="toPrint">鎵撳嵃</button>
+		</view>
+	</view>
+</template>
+
+<script>
+	import uQRCode from '@/static/js/uqrcode.js' //寮曞叆uqrcode.js
+	export default {
+		data() {
+			return {
+				style: {
+					height: '3px'
+				},
+				mat: {
+					matnr: '1200128-10055',
+					maktx: 'X5S-4-M03/333'
+				},
+				qrShow: false,
+				time: ''
+			}
+		},
+		onShow() {
+			let getWindowInfo = uni.getWindowInfo()
+			// console.log(getWindowInfo.screenHeight); //灞忓箷楂樺害
+			// console.log(getWindowInfo.screenWidth); //灞忓箷瀹藉害
+			// console.log(getWindowInfo.windowHeight); //鍙搷浣滈〉闈㈤珮搴�
+			// console.log(getWindowInfo.windowWidth); //鍙搷浣滈〉闈㈠搴�
+			// console.log(getWindowInfo);
+			// console.log('鑾峰彇绐楀彛淇℃伅');
+			let height = (getWindowInfo.screenWidth + 10) * 48 / 74
+			// console.log(height);
+			this.style.height = height + 'px'
+			this.getDate()
+
+		},
+		onLoad(opt) {
+			let that = this
+			const eventChannel = this.getOpenerEventChannel();
+			eventChannel.on('data', function(data) {
+				that.mat = data.data 
+				that.qrFun(that.mat.matnr)
+			})
+			
+		},
+		methods: {
+			// 鎵撳嵃
+			toPrint() {
+				let that = this
+				uni.navigateTo({
+					url: "../print/printUNI",
+					success: function(res) {
+						// 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�   鍚戝彟澶栦竴涓〉闈紶閫掑�肩殑
+						res.eventChannel.emit('data1', {
+							data: that.mat,
+							time: that.time
+						})
+					},
+					events: {
+						// 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹�  鍙﹀涓�涓〉闈紶杩囨潵鐨�
+						acceptDataFromOpenedPage: function(data) {
+							that.matnr = data.data
+						},
+					},
+				
+				
+				});
+			},
+			//**鐢熸垚浜岀淮鐮�**//
+			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 => {}
+				})
+			},
+			// 鏃ュ巻
+			getDate() {
+				var dt = new Date();
+				var year,month,day,hours,minutes,seconds,weeks
+				year = dt.getFullYear();
+				month = (dt.getMonth()+1) < 10 ? '0'+ (dt.getMonth()+1) : (dt.getMonth()+1);
+				day = dt.getDate() < 10 ? '0'+dt.getDate() : dt.getDate();
+				hours = dt.getHours() < 10 ? '0' + dt.getHours() : dt.getHours();
+				minutes = dt.getMinutes() < 10 ? '0' + dt.getMinutes() : dt.getMinutes();
+				seconds = dt.getSeconds() < 10 ? '0' + dt.getSeconds() : dt.getSeconds(); 
+				weeks = dt.getDay(); 
+				switch (weeks) {
+					case 0: weeks = "鏄熸湡鏃�"; break;
+					case 1: weeks = "鏄熸湡涓�"; break;
+					case 2: weeks = "鏄熸湡浜�"; break;
+					case 3: weeks = "鏄熸湡涓�"; break;
+					case 4: weeks = "鏄熸湡鍥�"; break;
+					case 5: weeks = "鏄熸湡浜�"; break;
+					default : weeks = "鏄熸湡鍏�";
+				}
+				this.time = year + "骞�" + month + "鏈�" + day + "鏃� " + hours + ":" + minutes + ":" + seconds + " "
+			},
+		}
+	}
+</script>
+
+<style>
+	.print-model {
+		width: 100%;
+		/* background-color: #555555; */
+		display: flex;
+		align-items: center;
+		justify-content: center;
+	}
+
+	.display {
+		width: 96%;
+		height: 96%;
+		border-radius: 5px;
+		background-color: #FFF;
+		box-shadow: #bdbdbd;
+		display: flex;
+		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;
+	}
+</style>
\ No newline at end of file

--
Gitblit v1.9.1