From 292c3ed952ff6eb9e5a44de1d41786702146c876 Mon Sep 17 00:00:00 2001
From: whycq <whycq>
Date: 星期五, 17 六月 2022 15:42:31 +0800
Subject: [PATCH] #

---
 pages/basics/matOut.vue |   99 ++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 84 insertions(+), 15 deletions(-)

diff --git a/pages/basics/matOut.vue b/pages/basics/matOut.vue
index 9bb2168..0f7ca1f 100644
--- a/pages/basics/matOut.vue
+++ b/pages/basics/matOut.vue
@@ -9,7 +9,7 @@
 				
 				<view class="title" >鍑哄簱鍙o細</view>
 				<view class="combox" >
-					<uni-combox :candidates="candidates" placeholder="璇烽�夋嫨鍑哄簱绔欑偣" v-model="city"></uni-combox>
+					<uni-combox :candidates="sites" placeholder="璇烽�夋嫨鍑哄簱绔欑偣" v-model="siteId" @click="staNoSelect()"></uni-combox>
 				</view>
 			</view>
 		</form>
@@ -31,9 +31,10 @@
 			</uni-table>
 		</view>
 		
-		<view class="cu-bar foot justify-center input" style="height: 130rpx;">
-			<view class="reset flex solid-bottom padding justify-center" >
-				<button class="cu-btn bg-yellow main-btn margin-xs" style="width: 400rpx;">鍚姩鍑哄簱</button>
+		<view class="cu-bar foot input" style="height: 130rpx;">
+			<view class="flex solid-bottom padding justify-start">
+				<button class="cu-btn bg-yellow main-btn margin-xs" style="width: 430rpx;" @click="outbound()">鍚姩鍑哄簱</button>
+				<button class="cu-btn bg-grey main-btn margin-xs" @click="reset">閲� 缃�</button>
 			</view>
 		</view>
 		
@@ -45,9 +46,9 @@
 		data() {
 			return {
 				billNo: null,
-				matData:[],
-				candidates: ['鍖椾含', '鍗椾含', '涓滀含', '姝︽眽', '澶╂触', '涓婃捣', '娴峰彛'],
-				city: ''
+				matData: [],
+				sites: [],
+				siteId: ''
 			}
 		},
 		mounted(){
@@ -55,6 +56,7 @@
 			this.baseIP = UIP;
 			const UPORT = uni.getStorageSync('UPORT');
 			this.basePORT = UPORT;
+			this.staNoSelect();
 		},
 		methods: {
 			searchBillNo() {
@@ -69,21 +71,88 @@
 						bill_no:that.billNo
 					},
 					success(result) {
-						
 						let res = result.data
 						if (res.code === 200 ) {
 							that.matData = res.data.records
-							console.log(that.matData)
-						} else if (res.code === 403) {
-							uni.navigateBack({
-							    delta: 1
-							})
+							that.staNoSelect()
+						} 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'})
 						}
-						
+					},
+				})
+			},
+			staNoSelect() {
+				let that = this;
+				uni.request({
+					url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + "/available/take/site",
+					header: {'token':uni.getStorageSync('token')},
+					success(result) {
+						let res = result.data
+						if (res.code === 200 ) {
+							that.sites = [];
+							for (var i = 0; i < res.data.length; i++) {
+								that.sites.push(res.data[i].desc)
+							}
+						} 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'})
+						}
 					}
 				})
+			},
+			outbound() {
+				let that = this
+				if (that.matData.length === 0) {
+					uni.showToast({title: "璇峰厛娣诲姞浜у搧", icon: "none",position: 'top'})
+				} else {
+					if (that.siteId == '') {
+						uni.showToast({title: "璇烽�夋嫨鍑哄簱鍙�", icon: "none",position: 'top'})
+						return;
+					}
+				};
+				var staNo = that.siteId.substring(0,3)
+				
+				var locDetls = [];
+				that.matData.forEach(function(elem) {
+					locDetls.push({billNo:elem.billNo,seqNo:elem.seqNo, matNo: elem.matNo, count: elem.qty,});
+				});
+				let param = {
+					outSite: 173,
+					locDetls: locDetls
+				}
+				uni.request({
+					url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + "/mat/out/start",
+					header: {
+						'token':uni.getStorageSync('token')},
+					data: JSON.stringify(param),
+					method:"POST",
+					success(result) {
+						if (result.data.code === 200) {
+							uni.showToast({title: result.data.msg, icon: "none",position: 'top'})
+							that.reset()
+						} else {
+							uni.showToast({title: result.data.msg, icon: "none",position: 'top'})
+						}
+					}
+				})
+			},
+			reset() {
+				this.billNo = '';
+				this.matData = [];
+				this.siteId = '';
 			}
 		}
 	}

--
Gitblit v1.9.1