From dcb4247056504024bdb9f685776e27e45d174b67 Mon Sep 17 00:00:00 2001
From: whycq <123456>
Date: 星期一, 09 五月 2022 23:17:04 +0800
Subject: [PATCH] ##

---
 pages/basics/outPakin.vue |   41 ++++++++++++++++++++++++++++++-----------
 1 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/pages/basics/outPakin.vue b/pages/basics/outPakin.vue
index 883b3b8..e2e0e6c 100644
--- a/pages/basics/outPakin.vue
+++ b/pages/basics/outPakin.vue
@@ -57,6 +57,12 @@
 				<button class="cu-btn lg pakin-btn bg-blue" @click="comb()">缁勬墭</button>
 			</view>
 		</view>
+		<view>
+			<!-- 鎻愮ず淇℃伅寮圭獥 -->
+			<uni-popup ref="message" type="message">
+				<uni-popup-message :type="msgType" :message="messageText" :duration="2000"></uni-popup-message>
+			</uni-popup>
+		</view>
 	</view>
 </template>
 
@@ -74,7 +80,9 @@
 				matnr:'',
 				matList:[],
 				result: '',
-				listLen:0
+				listLen:0,
+				msgType: 'success',
+				messageText: '杩欐槸涓�鏉℃垚鍔熸彁绀�',
 			}
 		},
 		mounted(){
@@ -84,7 +92,12 @@
 			this.basePORT = UPORT
 		},
 		methods: {
-			getListLength() {
+			messageToggle(type) {
+				this.msgType = type
+				this.messageText = `杩欐槸涓�鏉�${type}娑堟伅鎻愮ず`
+				this.$refs.message.open()
+			},
+			getListLength() { // 涓嬭鏍囧�掑簭
 				this.listLen = this.matList.length
 			},
 			focuss() {
@@ -106,15 +119,17 @@
 			},
 			removeMatnr() {
 				this.matnr = ''
-				uni.vibrateShort();
 				this.focus = false;
 				this.$nextTick(function() {
 					this.focus = true;
 				});
+				uni.vibrateShort();
 			},
 			remove(item,index) {
 				this.matList.splice(index,1)
 				this.listLen = this.matList.length
+				this.messageToggle('success')
+				this.messageText = '鍒犻櫎鎴愬姛'
 				uni.vibrateShort();
 			},
 			comb() {
@@ -205,22 +220,26 @@
 								mat['anfme'] = 1
 								for(let i = 0;i < that.matList.length;i++) {
 									if(that.matList[i].batch == str[2]) {
+										that.messageToggle('warn');
+										that.messageText = '閲嶅鎵弿';
 										add = false;
 										break;
 									}
 								}
 							}
 							if(add) {
+								that.messageToggle('success');
+								that.messageText = '妫�绱㈡垚鍔�';
+								that.focus = false;
+								that.$nextTick(function() {
+									that.focus = true;
+								});
+								that.listLen = that.matList.length;
+								uni.hideKeyboard();
 								that.matList.unshift(res.data)
 							}
-							that.focus = false;
-							that.$nextTick(function() {
-								that.focus = true;
-							});
-							uni.hideKeyboard();
-						that.listLen = that.matList.length
 						} else if (res.code == 403) {
-							that.messageToggle('warn')
+							that.messageToggle('error')
 							that.messageText = res.msg
 							setTimeout(() => {
 								uni.reLaunch({
@@ -228,7 +247,7 @@
 								});
 							}, 1000);
 						} else {
-							that.messageToggle('warn')
+							that.messageToggle('error')
 							that.messageText = res.msg
 							// uni.showToast({title: res.msg, icon: "none",position: 'top'})
 						}

--
Gitblit v1.9.1