From 17d991dc11f5d00a07e5f14515cc6b950c6c2df0 Mon Sep 17 00:00:00 2001
From: whycq <123456>
Date: 星期四, 12 五月 2022 12:34:12 +0800
Subject: [PATCH] #

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

diff --git a/pages/basics/checkout.vue b/pages/basics/checkout.vue
index f1114e4..30ec00b 100644
--- a/pages/basics/checkout.vue
+++ b/pages/basics/checkout.vue
@@ -9,29 +9,20 @@
 				<view class="square-content">
 					<view class="content-input">
 						<input v-model="barcode" type="text" placeholder="鎵爜 / 杈撳叆" maxlength="8" 
-						@input="findBarcode()" :focus="barcodeFocus" >
-						<!-- @focus="focuss" -->
+						@input="findBarcode()" :focus="barcodeFocus" @focus="focuss" >
 						<uni-icons type="closeempty" size="20" color="#dadada" @click="removeBarcode()"></uni-icons>
 					</view>
 				</view>
 			</view>
-			<view class="square-3">
+			<view class="square-2">
 				<view class="square-title">
 					<view class="title-sign"><view class="sign"></view></view>
 					<view class="title-text"><text>璐у搧鏉$爜</text></view>
 				</view>
 				<view class="square-content">
-					<text>绔欏彴锛�</text>
-					<view class="content-combox">
-						<uni-combox  emptyTips="鏆傛棤鏁版嵁" :candidates="siteList" v-model="desc" placeholder="绔欏彴鍙�"
-						@input="choseStaNo" disabled='true'></uni-combox>
-					</view>
-				</view>
-				<view class="square-content">
-					<text>璐у搧鏉$爜锛�</text>
-					<view class="content-input-combox">
-						<input type="text" v-model="matnr" placeholder="鎵爜 / 杈撳叆" @input="findMat()"
-						:focus="focus" >
+					<view class="content-input-combox" style="width: 94%;">
+						<input style="width: 90%;" type="text" v-model="matnr" placeholder="鎵爜 / 杈撳叆" @input="findMat()":focus="focus"
+						 @focus="focuss">
 						<!-- @focus="focuss" -->
 						<uni-icons type="closeempty" size="20" color="#dadada" @click="removeMatnr()"></uni-icons>
 					</view>
@@ -50,11 +41,11 @@
 			<checkbox-group @change="checkbox">
 				<view v-for="(item,index) in matList" :key="index" class="data-list bg-false" :class="'bg-'+item.checked" >
 					<view class="data-list-left">
-						<view class="matnr">No:{{listLen-index}}</view>
-						<view class="matnr">{{item.matnr}}-{{item.batch}}</view>
+						<view class="matnr" :style="item.color">No:{{listLen-index}}</view>
+						<view class="matnr" :style="item.color">{{item.matnr}}-{{item.batch}}</view>
 					</view>
 					<view class="data-list-right">
-						<uni-icons type="trash" size="25" color="#a5a5a5" @click="remove(item,index)"></uni-icons>
+						<uni-icons type="trash" size="20" color="#a5a5a5" @click="remove(item,index)"></uni-icons>
 					</view>
 				</view>
 			</checkbox-group>
@@ -66,6 +57,12 @@
 			<view>
 				<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>
@@ -82,13 +79,24 @@
 				searchBox: 'hide',
 				pick:'hide',
 				matnr:'',
-				matList:[{matnr:'1101842-10000',batch:'22047515999'}],
+				matList:[{matnr:'1101842-10000',batch:'22047515999',color:{color:'red'}}],
+				// matList:[],
 				result: '',
 				siteList:[],
 				desc:'',
 				staNoList:[],
 				satNo:'',
+				listLen:0,
+				msgType: 'success',
+				messageText: '杩欐槸涓�鏉℃垚鍔熸彁绀�',
+				fontColor:{color:'red'}
 			}
+		},
+		onReady() {
+			setInterval(function(){
+				// console.log(this.matList)
+				// this.getMatListLen()
+			},1000)
 		},
 		mounted(){
 			const UIP = uni.getStorageSync('UIP');
@@ -96,8 +104,14 @@
 			const UPORT = uni.getStorageSync('UPORT');
 			this.basePORT = UPORT
 			this.getOutBound();
+			
 		},
 		methods: {
+			messageToggle(type) {
+				this.msgType = type
+				this.messageText = `杩欐槸涓�鏉�${type}娑堟伅鎻愮ず`
+				this.$refs.message.open()
+			},
 			choseStaNo() {
 				for (var i = 0;i < this.staNoList.length; i++) {
 					if (this.desc == this.staNoList[i].desc) {
@@ -105,8 +119,11 @@
 					} 
 				}
 			},
+			getMatListLen() {
+				// this.listLen = this.matList.length;
+			},
 			focuss() {
-				uni.hideKeyboard()
+				// uni.hideKeyboard()
 			},
 			resst() {
 				this.matList = []
@@ -132,20 +149,15 @@
 				});
 			},
 			remove(item,index) {
-				this.matList.splice(index,1)
+				this.matList.splice(index,1);
+				this.listLen = this.matList.length
+				this.messageToggle('success')
+				this.messageText = '鍒犻櫎鎴愬姛'
 				uni.vibrateShort();
 			},
 			comb() {
 				uni.vibrateShort();
 				let that = this;
-				// if (that.barcode === '') {
-				// 	uni.showToast({title: '璇锋壂鎻忔墭鐩樻潯鐮�', icon: "none", position: 'top'});
-				// 	return;
-				// }
-				// if (that.matList.length === 0) {
-				// 	uni.showToast({title: '璇锋坊鍔犲晢鍝佸垪琛�', icon: "none", position: 'top'});
-				// 	return;
-				// }
 				uni.showLoading();
 				uni.request({
 				    url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/confirm/auth',
@@ -212,19 +224,35 @@
 						'token':uni.getStorageSync('token')
 				    },
 					success(result) {
-						
 						var res = result.data;
-						if(res.data) {
-							for(let i = 0;i<that.matList.length;i++) {
-								for (let j = 0;j < res.data.length; j++) {
-									if(JSON.stringify(that.matList[i]) === JSON.stringify(res.data[j])) {
-										res.data.splice(j,1)
+						if(res.code === 200 ) {
+							if(res.data) {
+								for(let i = 0;i<that.matList.length;i++) {
+									for (let j = 0;j < res.data.length; j++) {
+										if(JSON.stringify(that.matList[i]) === JSON.stringify(res.data[j])) {
+											res.data.splice(j,1)
+										}
 									}
 								}
+								that.matList = res.data.concat(that.matList)
+								that.listLen = that.matList.length;
+								that.focus = false;
+								that.$nextTick(function() {
+									that.focus = true;
+								});
+								that.matnr = ''
 							}
-							that.matList = res.data.concat(that.matList)
-							// that.matList = that.matList.concat(res.data)
+						} 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'})
 						}
+						
 					}
 				});
 			},
@@ -265,7 +293,6 @@
 				    },
 					success(result) {
 						var res = result.data;
-						console.log(res)
 						if(res.data) {
 							for(let i = 0;i<that.matList.length;i++) {
 								for (let j = 0;j < res.data.length; j++) {
@@ -275,9 +302,8 @@
 								}
 							}
 							that.matList = res.data.concat(that.matList)
-							// that.matList = that.matList.concat(res.data)
 						}
-						
+						that.listLen = that.matList.length;
 					}
 				});
 				
@@ -455,7 +481,7 @@
 		margin-top: 20rpx;
 	}
 	.data-list:last-child {
-		margin-bottom: 120rpx;
+		margin-bottom: 200rpx;
 	}
 	/* .data-list-left {
 		display: inline-block;
@@ -477,9 +503,9 @@
 	.matnr {
 		display: inline-block;
 		width: 100%;
-		font-size: 16px;
+		font-size: 14px;
 		font-weight: 700;
-		padding-top: 20rpx;
+		padding-top: 15rpx;
 		/* height: 130rpx;
 		line-height: 130rpx; */
 	}

--
Gitblit v1.9.1