From 7af9529188258a1d118609f86b19b558e80c2664 Mon Sep 17 00:00:00 2001
From: whycq <you@example.com>
Date: 星期日, 02 四月 2023 14:43:38 +0800
Subject: [PATCH] #

---
 pages/pakin/pakin.vue |   66 +++++++++++++++++++++++++++++---
 1 files changed, 59 insertions(+), 7 deletions(-)

diff --git a/pages/pakin/pakin.vue b/pages/pakin/pakin.vue
index 73ce360..61269ea 100644
--- a/pages/pakin/pakin.vue
+++ b/pages/pakin/pakin.vue
@@ -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,7 +224,6 @@
 								});
 							}, 1000);
 						} else {
-							console.log(res);
 							uni.showToast({title: res.msg, icon: "none",position: 'top'})
 						}
 						
@@ -259,6 +257,7 @@
 				var add = true
 				for (var i = 0; i < len; i++) {
 					if (mat.matnr == this.dataList[i].matnr) {
+						console.log(typeof mat.anfme);
 						this.dataList[i].anfme += mat.anfme
 						this.$forceUpdate() // 寮哄埗鍒锋柊
 						add = false
@@ -320,8 +319,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
@@ -338,7 +384,13 @@
 			// 鍙栨秷閲嶇疆
 			resetClose() {
 				
-			}
+			},
+			// 娓呯┖
+			resst() {
+				this.dataList = []
+				this.barcode = ''
+				this.barcodeFocuss()
+			},
 		}
 	}
 </script>

--
Gitblit v1.9.1