From 9e52dcf4615e6b50cef57a56c37fd13b777d1051 Mon Sep 17 00:00:00 2001
From: whycq <you@example.com>
Date: 星期日, 02 四月 2023 18:25:45 +0800
Subject: [PATCH] #
---
 pages/pakin/pakin.vue |   87 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 79 insertions(+), 8 deletions(-)
diff --git a/pages/pakin/pakin.vue b/pages/pakin/pakin.vue
index 6a83b6d..b1d1a83 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>
@@ -43,7 +43,7 @@
 					</view>
 					<view class="list-left-item">
 						<view class="desc">鏁伴噺锛�</view>
-						<view class="left-item"><uni-tag :text="item.anfme"></uni-tag></view>
+						<view class="left-item">{{item.anfme}}</view>
 					</view>
 				</view>
 				<view class="list-right">
@@ -211,9 +211,8 @@
 								},
 								// 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹�
 								events: {
-								    dataList: function(data) {
+								    matList: function(data) {
 										that.checkMat(data.data)
-										// that.matList.push(data.data)
 									},
 								},
 							});
@@ -225,13 +224,32 @@
 								});
 							}, 1000);
 						} else {
-							console.log(res);
 							uni.showToast({title: res.msg, icon: "none",position: 'top'})
 						}
 						
 					}
 				});
 				
+			},
+			selectMat() {
+				let that = this
+				uni.navigateTo({
+					url: "../mat/matQuery",
+					success: function(res) {
+					    // 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�   鍚戝彟澶栦竴涓〉闈紶閫掑�肩殑
+					    res.eventChannel.emit('commonUrl', {commonUrl: '' })
+					},
+					events: {
+					    // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹�  鍙﹀涓�涓〉闈紶杩囨潵鐨�
+					    acceptDataFromOpenedPage: function(data) {
+							that.matnr = data.data
+							that.findMat(that.matnr)
+					    },
+					},
+					
+					
+				});
+				that.matnr = ''
 			},
 			checkMat(mat) {
 				var len = this.dataList.length
@@ -299,8 +317,55 @@
 				this.$refs.combConfirm.close()
 			},
 			comb() {
-				this.messageText = "缁勬墭鎴愬姛"
-				this.messageToggle('success')
+				uni.vibrateShort();
+				let that = this;
+				if (that.barcode === '') {
+					this.messageText = "璇锋壂鎻忔墭鐩樻潯鐮�"
+					this.messageToggle('error')
+					return;
+				}
+				if (that.dataList.length === 0) {
+					this.messageText = "璇锋坊鍔犲晢鍝佸垪琛�"
+					this.messageToggle('error')
+					return;
+				}
+				for (var i = 0; i < that.dataList.length; i++) {
+					if (that.dataList[i].anfme == 0 || that.dataList[i].anfme == '') {
+						this.messageText = that.dataList[i].matnr + '缁勬墭鏁伴噺涓嶈兘涓�0'
+						this.messageToggle('error')
+						return;
+					}
+				}
+				uni.request({
+				    url: that.baseUrl + '/mobile/comb/auth',
+				    data: JSON.stringify({
+						barcode: that.barcode,
+						combMats: that.dataList
+					}),
+					method: 'POST',
+				    header: {
+						'token':uni.getStorageSync('token')
+				    },
+					success(result) {
+						var res = result.data
+						if (res.code === 200) {
+							that.resst();
+							that.messageText = "缁勬墭鎴愬姛"
+							that.messageToggle('success')
+						} else if (res.code == 403) {
+							that.messageText = res.msg
+							that.messageToggle('error')
+							setTimeout(() => {
+								uni.reLaunch({
+									url: '../login/login'
+								});
+							}, 1000);
+						} else {
+							that.messageText = res.msg
+							that.messageToggle('error')
+						}
+					}
+				});
 			},
 			reset(type) {
 				this.msgType = type
@@ -317,7 +382,13 @@
 			// 鍙栨秷閲嶇疆
 			resetClose() {
 				
-			}
+			},
+			// 娓呯┖
+			resst() {
+				this.dataList = []
+				this.barcode = ''
+				this.barcodeFocuss()
+			},
 		}
 	}
 </script>
--
Gitblit v1.9.1