From c8dc3d4f33e7548e2d02ba14e9cb770afda5df2b Mon Sep 17 00:00:00 2001
From: whycq <whycq>
Date: 星期四, 24 二月 2022 17:05:41 +0800
Subject: [PATCH] #

---
 pages/basics/combPro.vue    |    2 
 pages/basics/stockCheck.vue |  141 ++++++++++++++++++++--------------------------
 2 files changed, 62 insertions(+), 81 deletions(-)

diff --git a/pages/basics/combPro.vue b/pages/basics/combPro.vue
index 7180951..5f11f3b 100644
--- a/pages/basics/combPro.vue
+++ b/pages/basics/combPro.vue
@@ -69,7 +69,7 @@
 				maxCount:1,
 				rowNum:'',
 				value:'',
-				couChange:true,
+				couChange:true, // countChange
 				baseIP:'',
 				
 				
diff --git a/pages/basics/stockCheck.vue b/pages/basics/stockCheck.vue
index 0ebf701..aecbad3 100644
--- a/pages/basics/stockCheck.vue
+++ b/pages/basics/stockCheck.vue
@@ -1,6 +1,12 @@
 <template>
 	<view>
 		<view class="cu-form-group margin-top">
+			<view class="title">鎵樼洏鐮�</view>
+			<input v-model="billNo" placeholder="鎵爜 / 杈撳叆" name="input" @input="findCode()" focus>
+			<button v-model="matBtn" class="cu-btn bg-yellow" @click="toggle('right')"><text>+琛ュ厖</text></button>
+			
+		</view>
+		<!-- <view class="cu-form-group margin-top">
 			<view>
 				鍑哄簱鍙�
 			</view>
@@ -12,7 +18,7 @@
 			<view>
 				<button v-model="matBtn" class="cu-btn bg-yellow" @click="toggle('right')"><text>+琛ュ厖</text></button>
 			</view>
-		</view>
+		</view> -->
 		<view class="margin-top">
 			<uni-table border stripe emptyText="鏆傛棤鏇村鏁版嵁">
 				<uni-tr>
@@ -65,7 +71,7 @@
 							<text class="title">鏁伴噺</text>
 							<uni-number-box @change="countDom" v-model="count" />
 						</view>
-						<button class="cu-btn bg-yellow pda-btn2" @click="confirm">鎻愬彇</button>
+						<button class="cu-btn bg-yellow pda-btn2" @click="confirm">琛ュ厖</button>
 						
 				</view>
 			</uni-popup>
@@ -74,6 +80,16 @@
 			<!-- 鎻愮ず淇℃伅寮圭獥 -->
 			<uni-popup ref="message" type="message">
 				<uni-popup-message :type="msgType" :message="messageText" :duration="2000"></uni-popup-message>
+			</uni-popup>
+		</view>
+		<view>
+			<!-- 杈撳叆妗嗙ず渚� -->
+			<uni-popup ref="inputDialog" type="dialog">
+				<uni-popup-dialog ref="inputClose" mode="input" title="缁勬墭鏁伴噺" 
+					placeholder="璇疯緭鍏ョ粍鎵樻暟閲�" @confirm="dialogInputConfirm">
+						<uni-number-box :min="minCount" :max="maxCount" v-model="value" />
+				</uni-popup-dialog>
+					
 			</uni-popup>
 		</view>
 	</view>
@@ -85,11 +101,9 @@
 			return {
 				msgType: '',
 				messageText: '',
-				index: 0,
-				array: [],
 				matBtn:'',
-				souceData:[], // 鍒濆鍖栬〃鏍兼暟鎹褰�
-				locDetlData:[],
+				souceData:[], 
+				locDetlData:[], // 琛ㄦ牸鏁版嵁
 				matNo:'',
 				matName:'',
 				specs:'',
@@ -103,27 +117,17 @@
 				checkList:[],
 				sourceList:[],
 				minCount:0,
+				maxCount:1,
+				billNo:'',
+				matData:[],
+				rowNum:'',
+				value:'',
 			}
 		},
 		mounted(){
 			// 鑾峰彇IP绔彛
 			const UIP = uni.getStorageSync('UIP');
 			this.baseIP = UIP
-			// 鑾峰彇鍑哄簱鍙�
-			let that = this
-			uni.request({
-				url: that.baseHttp + that.baseIP + that.baseUrl + "/available/take/check/site",
-				header: {
-					'token':uni.getStorageSync('token')
-				},
-				method: 'POST',
-				async: false,
-				success(res){
-					if(res.data.code === 200){
-						that.array = res.data.data
-					}
-				}
-			})
 		},
 		methods: {
 			// 鎻愮ず绐楀彛
@@ -132,40 +136,44 @@
 				this.messageText = '鎻愬彇澶辫触'
 				this.$refs.message.open()
 			},
-			// 鍑哄簱鍙�:180绛�
-			bindPickerChange: function(e) {
+			// 鏍规嵁鎵樼洏鐮佹煡璇�
+			findCode() {
 				let that = this
-				that.index = e.detail.value
-				that.outlet = that.array[that.index]
+				if (that.billNo.length === 0 || that.billNo.length !== 8) {
+					return
+				}
+				let barCode = that.billNo
+				// 璧嬪�煎墠娓呯┖琛ㄦ牸
+				that.locDetlData = [] // 鍒濆鍖栬〃鏍兼暟鎹�
 				uni.request({
-					url: that.baseHttp + that.baseIP + that.baseUrl + "/mobile/check/queryMatFromDevNo?devNo=" + that.outlet,
+					url: that.baseHttp + that.baseIP + that.baseUrl + "/mobile/check/queryMatFromBarCode?barCode=" + barCode,
 					header: {
+						'content-type':'application/x-www-form-urlencoded',
 						'token':uni.getStorageSync('token')
 					},
+					data: {
+						barCode: barCode
+					},
 					method:'GET',
-					async:false,
-					success(res){
-						if(res.data.code === 200){
-							console.log(1)
+					success(res) {
+						console.log(res)
+						if (res.data.code === 200) {
 							that.locDetlData = res.data.data
-							if(res.data.data && res.data.data.length > 0){
+							if (res.data.data && res.data.data.length > 0) {
 								res.data.data.map(function(item){
 									that.souceData.push(item)
-									console.log(that.souceData)
 								})
 							}
-						} else if (res.data.code = 403){
+						} else if (res.data.code === 403) {
 							uni.navigateBack({
 							    delta: 1
 							})
 						} else {
-							this.messageToggle('error')
-							this.messageText = res.data.msg
+							that.messageToggle('error')
+							that.messageText = res.data.msg
 						}
 					}
-					
 				})
-				
 			},
 			// 鐐瑰嚮琛ュ厖鐨勫脊绐�
 			toggle(type) {
@@ -218,12 +226,6 @@
 					}
 				})
 			},
-			// 鍒犻櫎
-			remove(index,item){
-				this.matData.splice(index,1)
-				this.messageToggle('success')
-				this.messageText = '鍒犻櫎鎴愬姛'
-			},
 			// 寮圭獥 纭琛ュ厖
 			confirm(){
 				let that = this
@@ -237,36 +239,30 @@
 			},
 			// 淇敼鏁伴噺
 			conf(){
-				let that = this
-				let data = {
-					matNo:that.matNo,
-					matName:that.matName,
-					count:that.count
-				}
-				for (var j = 0; j < that.locDetlData.length; j++) {
-				    if (matNo === that.locDetlData[j].matNo && locNo === that.locDetlData[j].locNo) {
-				        if (that.count < that.minCount) {
-				            that.messageToggle('error')
-				            that.messageText = '鏁伴噺蹇呴』澶т簬0'
-				            return;
-				        }
-				        that.locDetlData[j].count = Number(that.count);
-				    }
-				}
-				that.messageToggle('success')
-				that.messageText = '淇敼鎴愬姛'
+				this.$refs.inputDialog.open()
+				this.maxCount = item.count
+				this.rowNum = index
+				this.value = this.maxCount
+			},
+			// 淇敼鏁伴噺寮圭獥
+			dialogInputConfirm() {
+				this.locDetlData[this.rowNum].count = this.value
+				this.messageToggle('success')
+				this.messageText = '淇敼鎴愬姛'	
 			},
 			// 绉婚櫎鐗╂枡
 			remove(index,item){
-				this.matData.splice(index,1)
+				this.locDetlData.splice(index,1)
 				this.messageToggle('success')
 				this.messageText = '鍒犻櫎鎴愬姛'
 			},
+			// 琛ュ厖鐨勬暟鎹坊鍔犲埌鎬绘暟鎹腑
 			addTableData(data){
 				let that = this
+				console.log(data.matNo.length)
 				if(data.matNo.length === 0){
 					that.messageToggle('error')
-					that.messageText = '鎻愬彇澶辫触'
+					that.messageText = '琛ュ厖澶辫触'
 					return
 				}
 				var toPush = true
@@ -287,25 +283,10 @@
 				this.$refs.popup.close()
 				
 			},
-			initTableData(data){
-				for(var i=0;i<data.length;i++){
-					var toPush =true
-					for(var j = 0; j<this.locDetlDate.length;j++){
-						if (data[i].matNo === this.locDetlData[j].matNo && data[i].locNo === this.locDetlData[j].locNo) {
-							toPush = false;
-						}
-					}
-					if(toPush){
-						this.locDetlDate.push(data[i])
-					}
-				}
-			},
 			// 閲嶇疆
 			reset(){
-				this.array = []
-				this.locDetlData = [];
-				this.checkList = []
-				this.sourceList = []
+				this.billNo = ''
+				this.addTableData()
 			},
 			check(){
 				if(this.souceData.length === 0) {

--
Gitblit v1.9.1