From 4aa1546dda1adf637a8d612c6dc0a535532294b4 Mon Sep 17 00:00:00 2001
From: whycq <913841844@qq.com>
Date: 星期一, 17 四月 2023 12:28:56 +0800
Subject: [PATCH] #

---
 pages/basics/checkout.vue |   42 ++++++++++++++++++------------------------
 1 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/pages/basics/checkout.vue b/pages/basics/checkout.vue
index 90c67b3..00f264b 100644
--- a/pages/basics/checkout.vue
+++ b/pages/basics/checkout.vue
@@ -213,6 +213,7 @@
 						'token':uni.getStorageSync('token'),
 				    },
 					success(result) {
+						console.log('findBarcode:' + result.data);
 						let res = result.data;
 						if (res.code === 200) {
 							if (res.data.ioType === 101) {
@@ -253,6 +254,10 @@
 					}, 100);
 					return;
 				}
+				if (that.matCount == that.matList.length) {
+					uni.showToast({title: '璇风‘璁ゅ嚭搴撴暟閲忥紒', icon: "none",position: 'top'})
+					return;
+				}
 				uni.request({
 				    url: that.commonUrl + '/mobile/pakout/confirm/pick/auth',
 				    data: {
@@ -265,32 +270,21 @@
 					success(result) {
 						var res = result.data;
 						if(res.code === 200 ) {
-							if(res.data) {
-								if (that.matList.length == 0) {
-									that.matList.push(res.data)
+							var add = true
+							if(res.data) { 
+								for(let i = 0;i < that.matList.length; i++) {
+									var matnr = that.matList[i].matnr + '-' +  that.matList[i].batch
+									if (matnr === that.matnr) {
+										that.messageToggle('warn');
+										that.messageText = '璇ュ晢鍝佸凡娣诲姞';
+										that.foucss();
+										add = false
+									}
+								}
+								if (add) {
+									that.matList.unshift(res.data);
 									that.listLen = that.matList.length;
 									that.foucss();
-									return;
-								}
-								for(let i = 0;i<that.matList.length;i++) {
-									if (that.matList.length < that.matCount){
-										if(JSON.stringify(that.matList[i]) === JSON.stringify(res.data)) {
-											that.messageToggle('warn');
-											that.messageText = '璇ュ晢鍝佸凡娣诲姞';
-											that.foucss();
-											return;
-										} else {
-											that.matList.unshift(res.data);
-											that.listLen = that.matList.length;
-											that.foucss();
-											return;
-										}
-									} else {
-										that.messageToggle('warn');
-										that.messageText = '宸插嚭鍏ㄩ儴鍟嗗搧锛岃纭鍑哄簱';
-										that.foucss();
-										return;
-									}
 								}
 							}
 						} else if (res.code == 403) {

--
Gitblit v1.9.1