From 9a9f1c994b3e79e38d908155b5ba0c03cb1ab4f3 Mon Sep 17 00:00:00 2001
From: whycq <you@example.com>
Date: 星期六, 01 四月 2023 22:24:04 +0800
Subject: [PATCH] #

---
 pages/mat/matSelected.vue |    4 
 pages/mat/matQuery.vue    |  125 +++++++++++++++++++++++++++++++++++++++--
 pages/pakin/pakin.vue     |   23 +++++++
 3 files changed, 143 insertions(+), 9 deletions(-)

diff --git a/pages/mat/matQuery.vue b/pages/mat/matQuery.vue
index d13c179..2525afc 100644
--- a/pages/mat/matQuery.vue
+++ b/pages/mat/matQuery.vue
@@ -2,16 +2,28 @@
 	<view>
 		<!-- 鎼滅储妗� -->
 		<view class="search-bar">
-			<!-- <uni-search-bar placeholder=" 鎵爜 / 杈撳叆" bgColor="#EEEEEE" @confirm="search" /> -->
+			<uni-search-bar placeholder=" 鎵爜 / 杈撳叆" bgColor="#EEEEEE" @confirm="search" />
 		</view>
 		<scroll-view>
-			<view class="tag-list" v-for="(item,i) in tagList" :key="i">
+			<view class="tag-list" v-for="(item,i) in tagList" :key="i" @click="showTag(item.id)">
 				<view class="tag">
 					<view style="display: flex;">
 						<view class="wms-tag" :style="baColor" >鍒嗙被</view>
 					</view>
 				</view>
-				<view class="tag-item">{{desc}} {{item.name}}</view>
+				<view class="tag-item">{{item.name}}</view>
+			</view>
+		</scroll-view>
+		<scroll-view>
+			<view class="tag-list" v-for="(item,i) in matList" :key="i" @click="findBySelect(item.matnr)">
+				<view class="tag">
+					<view style="display: flex;">
+						<view class="wms-tag" :style="baColor" >鍟嗗搧</view>
+					</view>
+				</view>
+				<view class="tag-item">鍟嗗搧缂栧彿锛� {{item.matnr}}</view>
+				<view class="tag-item">鍟嗗搧鍚嶇О锛� {{item.maktx}}</view>
+				<view class="tag-item">鍟嗗搧瑙勬牸锛� {{item.specs}}</view>
 			</view>
 		</scroll-view>
 	</view>
@@ -21,17 +33,118 @@
 	export default {
 		data() {
 			return {
-				tagList: [{name:"whhhsupp"},{},{}],
-				matList: [],
+				tagList: [],
+				matList: '',
 				tag: '鍒嗙被',
 				baColor: "background-color: #0081ff;",
-				desc: '缂栫爜:'
+				desc: '鍟嗗搧缂栧彿:',
+				baseUrl: '',
+				token: ''
 			}
 		},
 		onLoad() {
+			let that = this
+			// const eventChannel = this.$scope.eventChannel; // 鍏煎APP-NVUE
+			const eventChannel = this.getOpenerEventChannel();
+			
+			// 鐩戝惉acceptDataFromOpenerPage浜嬩欢锛岃幏鍙栦笂涓�椤甸潰閫氳繃eventChannel浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹�
+			eventChannel.on('commonUrl', function(data) {
+				that.commonUrl = data.commonUrl
+				that.showTag(1)
+			})
+		},
+		onShow() {
+			this.baseUrl = uni.getStorageSync('baseUrl');
+			this.token = uni.getStorageSync('token');
+			this.showTag(1)
 		},
 		methods: {
 			search() {
+			},
+			showTag(parentId) {
+				let that = this
+				uni.request({
+				    url: that.baseUrl + '/tag/list/pda/auth',
+					header: {
+						'token':uni.getStorageSync('token'),
+					},
+				    data: {
+						limit: 100000,
+						parentId: parentId
+				    },
+					header: {
+						'token':uni.getStorageSync('token'),
+					},
+					success(result) {
+						console.log(result)
+						that.tagList = null
+						that.matList = null
+						var res = result.data
+						if (res.code === 200) {
+							if (res.data != null && res.data.length > 0) {
+								that.tagList = res.data
+							} else {
+								that.showMat(parentId)
+							}
+						} else if (res.code === 403 ) {
+							uni.showToast({title: res.msg, icon: "none", position: 'top'})
+							setTimeout(() => {
+								uni.reLaunch({
+									url: '../login/login'
+								});
+							}, 1000);
+						} else {
+							uni.showToast({title: res.msg, icon: "none",position: 'top'})
+						}
+						uni.hideLoading();
+					}
+				});
+			},
+			showMat(tagId) {
+				let that = this
+				if (tagId == null || tagId == '' || tagId == undefined) {
+					return;
+				}
+				uni.request({
+				    url: that.baseUrl + '/mat/list/pda/auth',
+				    data: {
+						tagId: tagId
+				    },
+					method:"GET",
+				    header: {
+						'token':uni.getStorageSync('token'),
+				    },
+					success(result) {
+						console.log(result)
+						that.tagList = null
+						var res = result.data
+						if (res.code === 200) {
+							if (res.data != null && res.data.length > 0) {
+								that.matList = res.data
+								that.baColor = "background-color: #1cbbb4;"
+							} else {
+								// that.tagId = parentId
+							}
+						} else if (res.code === 403 ) {
+							uni.showToast({title: res.msg, icon: "none", position: 'top'})
+							setTimeout(() => {
+								uni.reLaunch({
+									url: '../login/login'
+								});
+							}, 1000);
+						} else {
+							uni.showToast({title: res.msg, icon: "none",position: 'top'})
+						}
+						
+					}
+				});
+			},
+			findBySelect(matnr) {
+				this.getOpenerEventChannel().emit('acceptDataFromOpenedPage', {data: matnr});
+				uni.navigateBack({
+					
+				})
+				
 			}
 		}
 	}
diff --git a/pages/mat/matSelected.vue b/pages/mat/matSelected.vue
index 6b3a8eb..d4fe196 100644
--- a/pages/mat/matSelected.vue
+++ b/pages/mat/matSelected.vue
@@ -24,7 +24,7 @@
 			<view class="form-item">
 				<view class="form-item-desc"><text>鏁伴噺</text></view>
 				<view class="form-item-content">
-					<uni-number-box :max="99999999" :step='1' color="#747474" />
+					<uni-number-box :value="mat.anfme" :max="99999999" :step='1' color="#747474" @change="changeValue" />
 				</view>
 			</view>
 		</view>
@@ -61,7 +61,6 @@
 			
 			// 鐩戝惉acceptDataFromOpenerPage浜嬩欢锛岃幏鍙栦笂涓�椤甸潰閫氳繃eventChannel浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹�
 			eventChannel.on('mat', function(data) {
-				console.log(data);
 				that.mat = data.data
 				that.mat.anfme = 0
 			})
@@ -79,6 +78,7 @@
 				this.mat.anfme = value
 			},
 			back() {
+				console.log(this.mat.anfme);
 				if (this.mat.anfme === 0) {
 					uni.showToast({title: '璇疯緭鍏ユ暟閲�', icon: "none", position: 'top'});
 					return;
diff --git a/pages/pakin/pakin.vue b/pages/pakin/pakin.vue
index 6a83b6d..73ce360 100644
--- a/pages/pakin/pakin.vue
+++ b/pages/pakin/pakin.vue
@@ -10,7 +10,7 @@
 				<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>
+					<text style="text-align: right;color: #409EFF;" @click="selectMat()">鎻愬彇+</text>
 					<uni-icons type="right" color="#c1c1c1"></uni-icons>
 				</view>
 			</view>
@@ -233,6 +233,27 @@
 				});
 				
 			},
+			selectMat() {
+				let that = this
+				uni.vibrateShort();
+				uni.navigateTo({
+					url: "../mat/matQuery",
+					success: function(res) {
+					    // 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�   鍚戝彟澶栦竴涓〉闈紶閫掑�肩殑
+					    res.eventChannel.emit('commonUrl', {commonUrl:that.commonUrl })
+					},
+					events: {
+					    // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹�  鍙﹀涓�涓〉闈紶杩囨潵鐨�
+					    acceptDataFromOpenedPage: function(data) {
+							that.matnr = data.data
+							that.findMat(that.matnr)
+					    },
+					},
+					
+					
+				});
+				that.matnr = ''
+			},
 			checkMat(mat) {
 				var len = this.dataList.length
 				var add = true

--
Gitblit v1.9.1