From a4b95f039ae59662454df8a7541b270006c515c1 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期三, 22 三月 2023 17:02:01 +0800
Subject: [PATCH] #

---
 pages/home/home.vue       |    9 +
 pages/mat/matSelected.vue |   63 +++++++++++
 pages/login/login.vue     |   24 ++--
 manifest.json             |    2 
 pages/pakin/pakin.vue     |  155 +++++++++++++++++++++---------
 5 files changed, 183 insertions(+), 70 deletions(-)

diff --git a/manifest.json b/manifest.json
index a1d0f9a..3ff8f1c 100644
--- a/manifest.json
+++ b/manifest.json
@@ -2,7 +2,7 @@
     "name" : "涓壃WMS",
     "appid" : "__UNI__DA5854D",
     "description" : "",
-    "versionName" : "9.0.0",
+    "versionName" : "8.0.0",
     "versionCode" : "100",
     "transformPx" : false,
     /* 5+App鐗规湁鐩稿叧 */
diff --git a/pages/home/home.vue b/pages/home/home.vue
index 6ebdd2d..359a74d 100644
--- a/pages/home/home.vue
+++ b/pages/home/home.vue
@@ -2,7 +2,7 @@
 	<view>
 		<scroll-view scroll-y class="page">
 			<view class="nav-list">
-				<navigator hover-class='none' :url="'/pages/component/' + item.name" class="nav-li" navigateTo :class="'bg-'+item.color"
+				<navigator hover-class='none' :url="'/pages' + item.url" class="nav-li" navigateTo :class="'bg-'+item.color"
 				 :style="[{animation: 'show ' + ((index+1)*0.2+1) + 's 1'}]" v-for="(item,index) in elements" :key="index">
 					<view class="nav-title">{{item.title}}</view>
 					<view class="nav-name">{{item.name}}</view>
@@ -19,10 +19,11 @@
 		data() {
 			return {
 				elements: [{
-						title: '鎿嶄綔鏉�',
-						name: 'bar',
+						title: '缁勬墭鍏ュ簱',
+						name: 'pakin',
 						color: 'purple',
-						cuIcon: 'vipcard'
+						cuIcon: 'vipcard',
+						url: '/pakin/pakin'
 					},
 					{
 						title: '瀵艰埅鏍� ',
diff --git a/pages/login/login.vue b/pages/login/login.vue
index 69d3dfb..8c7adf8 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -235,7 +235,6 @@
 				let that = this;
 				uni.getSystemInfo({
 					success: (res) => {
-						console.log(res.platform);
 						if (res.platform == "android") {
 							that.AndroidCheckUpdate();
 						}
@@ -247,24 +246,20 @@
 				let that = this;
 				plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
 					that.version = wgtinfo.version //瀹㈡埛绔増鏈彿
-					console.log('褰撳墠app鐗堟湰淇℃伅锛�' + that.version);
 				})
 				setTimeout(()=>{
 					that.getUpdateVersion()
-				},1000)
+				},100)
 			},
 			// 鏍¢獙鐗堟湰
 			getUpdateVersion() {
-				console.log(this.version);
 				let that = this
 				let type = 0
 				if (that.baseUrl == 'http://undefined:undefined/undefined') {
 					return
 				}
-				console.log(2);
 				
 				let url = that.baseUrl + '/appVersion/checkUpdate/' + that.version + '/' + type
-				console.log(url);
 				uni.request({
 					url: url,
 					method: 'GET',
@@ -289,21 +284,17 @@
 			downWgt() {
 				let that = this;
 				const downloadUrl = that.baseUrl + "/appVersion/downloadApp/" + that.filename
-				console.log(downloadUrl);
 				uni.showLoading({
 					title: '鏇存柊涓�︹��'
 				})
-				console.log('*************************************');
 				const downloadTask = uni.downloadFile({ //鎵ц涓嬭浇
 					url: downloadUrl, //涓嬭浇鍦板潃
 					timeout: 1000 * 30, //30绉掕秴鏃舵椂闂�
 					success: downloadResult => { //涓嬭浇鎴愬姛
 						console.log(downloadResult);
-						// that.showdownLine = false
+						that.showdownLine = false
 						uni.hideLoading();
-						console.log('downloadResult.statusCode' + downloadResult.statusCode)
 						if (downloadResult.statusCode == 200) {
-							console.log('鏇存柊涓�')
 							uni.showModal({
 								title: '',
 								content: '鏇存柊鎴愬姛锛岀‘瀹氱幇鍦ㄩ噸鍚悧锛�',
@@ -323,15 +314,22 @@
 									}
 								}
 							});
+						} else {
+							uni.hideLoading();
+							that.showdownLine = false
+							uni.showToast({
+								title:'璇峰厛涓婁紶瀹夎鍖�',
+								icon: 'error'
+							})
 						}
 					},
 					fail: err => {
 						uni.hideLoading();
 						that.showdownLine = false
-						that.$u.toast(err.errMsg)
-						console.log(err)
+						that.$u.toast(downloadResult.errMsg)
 					},
 					complete: com => {
+						
 						console.log(com)
 					}
 				});
diff --git a/pages/mat/matSelected.vue b/pages/mat/matSelected.vue
index 89e24cf..6b3a8eb 100644
--- a/pages/mat/matSelected.vue
+++ b/pages/mat/matSelected.vue
@@ -3,15 +3,15 @@
 		<view class="form">
 			<view class="form-item">
 				<view class="form-item-desc"><text>鍟嗗搧缂栫爜</text></view>
-				<view class="form-item-content"><text>{{4561234}}</text></view>
+				<view class="form-item-content"><text>{{mat.matnr}}</text></view>
 			</view>
 			<view class="form-item">
 				<view class="form-item-desc"><text>鍟嗗搧鍚嶇О</text></view>
-				<view class="form-item-content"><text>{{"45681asda"}}</text></view>
+				<view class="form-item-content"><text>{{mat.maktx}}</text></view>
 			</view>
 			<view class="form-item">
 				<view class="form-item-desc"><text>瑙勬牸</text></view>
-				<view class="form-item-content"><text>{{"45681asda"}}</text></view>
+				<view class="form-item-content"><text>{{mat.specs}}</text></view>
 			</view>
 			<view class="form-item">
 				<view class="form-item-desc"><text>鎵瑰彿</text></view>
@@ -30,12 +30,67 @@
 		</view>
 		<!-- 搴曢儴鎿嶄綔鎸夐挳 -->
 		<view class="buttom">
-			<button size="mini" type="primary">鎻愬彇</button>
+			<button size="mini" type="primary" @click="back()">鎻愬彇</button>
 		</view>
 	</view>
 </template>
 
 <script>
+	export default {
+		data() {
+			return {
+				mat: {
+					matnr: null,
+					maktx: null,
+					specs: null,
+					batch: null,
+					anfme: null,
+				},
+				baseIP:'',
+				basePORT:'',
+			}
+		},
+		onLoad(option) {
+			let that = this
+			// #ifdef APP-NVUE
+			const eventChannel = this.$scope.eventChannel; // 鍏煎APP-NVUE
+			// #endif
+			// #ifndef APP-NVUE
+			const eventChannel = this.getOpenerEventChannel();
+			// #endif
+			
+			// 鐩戝惉acceptDataFromOpenerPage浜嬩欢锛岃幏鍙栦笂涓�椤甸潰閫氳繃eventChannel浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹�
+			eventChannel.on('mat', function(data) {
+				console.log(data);
+				that.mat = data.data
+				that.mat.anfme = 0
+			})
+			
+			
+		},
+		methods: {
+			blur() {
+				
+			},
+			focus() {
+				
+			},
+			changeValue(value) {
+				this.mat.anfme = value
+			},
+			back() {
+				if (this.mat.anfme === 0) {
+					uni.showToast({title: '璇疯緭鍏ユ暟閲�', icon: "none", position: 'top'});
+					return;
+				}
+				this.getOpenerEventChannel().emit('matList', {data: this.mat});
+				uni.vibrateShort();
+				uni.navigateBack({
+					
+				})
+			}
+		}
+	}
 </script>
 
 <style>
diff --git a/pages/pakin/pakin.vue b/pages/pakin/pakin.vue
index 56b20c2..6a83b6d 100644
--- a/pages/pakin/pakin.vue
+++ b/pages/pakin/pakin.vue
@@ -3,11 +3,11 @@
 		<view class="code">
 			<view class="item">
 				<view class="code-decs">鎵樼洏鐮�:</view>
-				<input type="text" placeholder=" 鎵爜 / 杈撳叆">
+				<input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="barcode" :focus="barcodeFocus" @confirm="barcodeInput()">
 			</view>
 			<view class="item">
 				<view class="code-decs">鐗╂枡鐮�:</view>
-				<input type="text" placeholder=" 鎵爜 / 杈撳叆">
+				<input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="matnr" :focus="matFocus" @input="findMat()">
 				<view class="item-right">
 					<button></button>
 					<text style="text-align: right;color: #409EFF;">鎻愬彇+</text>
@@ -122,52 +122,10 @@
 	export default {
 		data() {
 			return {
-				dataList: 
-				[
-				{
-					matnr: "whycq19950222222-232321111",
-					maktx: "wusuowei",
-					specs: "涓�",
-					batch: "鎵瑰彿",
-					anfme: "100"
-				}, {
-					matnr: "whycq19950520",
-					maktx: "wusuowei",
-					specs: "涓�",
-					batch: "鎵瑰彿",
-					anfme: "12"
-				},{
-					matnr: "whycq19950520",
-					maktx: "wusuowei",
-					specs: "涓�",
-					batch: "鎵瑰彿",
-					anfme: "12"
-				},{
-					matnr: "whycq19950520",
-					maktx: "wusuowei",
-					specs: "涓�",
-					batch: "鎵瑰彿",
-					anfme: "12"
-				},{
-					matnr: "whycq19950520",
-					maktx: "wusuowei",
-					specs: "涓�",
-					batch: "鎵瑰彿",
-					anfme: "12"
-				},{
-					matnr: "whycq19950520",
-					maktx: "wusuowei",
-					specs: "涓�",
-					batch: "鎵瑰彿",
-					anfme: "12"
-				},{
-					matnr: "whycq19950520",
-					maktx: "wusuowei",
-					specs: "涓�",
-					batch: "鎵瑰彿",
-					anfme: "12"
-				}
-				],
+				baseUrl: '',
+				token: '',
+				barcode: '',
+				dataList: [],
 				count: 0,
 				rowNum: '',
 				matnr: '',
@@ -177,17 +135,118 @@
 				messageText: '',
 				title: '',
 				content: '',
+				barcodeFocus: true,
+				matFocus: false,
+				matData: ''
 				
 			}
 		},
 		onLoad() {
 	
 		},
+		onShow() {
+			this.baseUrl = uni.getStorageSync('baseUrl');
+			this.token = uni.getStorageSync('token');
+		},
 		methods: {
 			messageToggle(type) {
 				this.msgType1 = type
 				this.$refs.message.open()
 			},
+			// barcode input 浜嬩欢
+			barcodeInput() {
+				// 涓嶈缃畾鏃跺櫒 浼氬嚭鐜版壂鍏ョ殑瀛楃涓蹭笉鍏�
+				setTimeout(()=>{
+					var len = this.barcode.length
+					if (len != 8) {
+						uni.showToast({title: '鎵樼洏鐮佹湁璇閲嶈瘯', icon: "none", position: 'top'});
+						this.barcodeFocuss()
+						return;
+					}
+					this.focuss()
+				},200)
+			},
+			// 鎵樼洏鐮佹湁璇噸缃�
+			barcodeFocuss() {
+				let that = this;
+				that.barcodeFocus = false;
+				setTimeout(()=>{
+					that.barcode = '';
+					that.barcodeFocus = true;
+				}, 100);
+			},
+			// 鍟嗗搧鍏夋爣娓呯┖閲嶇疆
+			focuss() {
+				// #ifdef APP
+				let that = this;
+				that.focus = false;
+				setTimeout(()=>{
+					that.matnr = '';
+					that.focus = true;
+				}, 100);
+				// #endif
+			},
+			// 鎼滅储鐗╂枡
+			findMat() {
+				let that = this
+				uni.request({
+				    url: that.baseUrl + '/mat/auth',
+				    data: {
+						matnr:that.matnr
+				    },
+				    header: {
+						'token':uni.getStorageSync('token')
+				    },
+					success(result) {
+						result = result.data
+						if (result.code === 200 && result.data) {
+							that.matData = result.data
+							that.matnr = ''
+							that.matData['batch'] = ''
+							uni.navigateTo({
+								url: "../mat/matSelected",
+								// 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
+								success: function(res) {
+									res.eventChannel.emit('mat', { data: result.data })
+								},
+								// 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹�
+								events: {
+								    dataList: function(data) {
+										that.checkMat(data.data)
+										// that.matList.push(data.data)
+									},
+								},
+							});
+						} else if (res.code == 403) {
+							uni.showToast({title: res.msg, icon: "none", position: 'top'})
+							setTimeout(() => {
+								uni.reLaunch({
+									url: '../login/login'
+								});
+							}, 1000);
+						} else {
+							console.log(res);
+							uni.showToast({title: res.msg, icon: "none",position: 'top'})
+						}
+						
+					}
+				});
+				
+			},
+			checkMat(mat) {
+				var len = this.dataList.length
+				var add = true
+				for (var i = 0; i < len; i++) {
+					if (mat.matnr == this.dataList[i].matnr) {
+						this.dataList[i].anfme += mat.anfme
+						this.$forceUpdate() // 寮哄埗鍒锋柊
+						add = false
+					}
+				}
+				if (add) {
+					this.dataList.unshift(mat)
+				}
+			},
 			// 淇敼鎵瑰彿
 			revise(item,i) {
 				this.matnr = this.dataList[i].matnr

--
Gitblit v1.9.1