From e4dc67055ea0c21e72815054c044b56a76ec625e Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期三, 17 四月 2024 13:08:36 +0800
Subject: [PATCH] #

---
 pages/pakin/goodsUp2.vue |  257 ++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 204 insertions(+), 53 deletions(-)

diff --git a/pages/pakin/goodsUp2.vue b/pages/pakin/goodsUp2.vue
index 6782f40..16561f3 100644
--- a/pages/pakin/goodsUp2.vue
+++ b/pages/pakin/goodsUp2.vue
@@ -3,22 +3,25 @@
 		<view class="code">
 			<view class="item">
 				<view class="code-decs">鏉$爜:</view>
-				<input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="orderNo" :focus="barcodeFocus"
-					@input="search()">
+				<input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="code" :focus="barcodeFocus" @input="findCode()">
 			</view>
 			<view class="item">
-				<view class="code-decs">鏉ユ簮鍦�:</view>
-				<uni-combox :candidates="orderNoList" placeholder="璇烽�夋嫨鏉ユ簮鍦�" :focus="barcodeFocus" v-model="orderNo" @input="findMat"></uni-combox>
+				<view class="code-decs">璐т富:</view>
+				<uni-combox :candidates="ownerList" placeholder="璇烽�夋嫨璐т富"  v-model="owner"></uni-combox>
 			</view>
 			<view class="item">
+				<view class="code-decs">搴撲綅鐮�:</view>
+				<input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="locNo" >
+			</view>
+			<!-- <view class="item">
 				<view class="code-decs">鐗╂枡鐮�:</view>
 				<input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="matnr" :focus="matFocus" @input="findMat()">
-				<view class="item-right">
-					<button></button>
-					<text style="text-align: right;color: #409EFF;" @click="selectMat()">鎻愬彇+</text>
-					<uni-icons type="right" color="#c1c1c1"></uni-icons>
-				</view>
-			</view>
+				<view class="item-right"> -->
+					<!-- <button></button> -->
+					<!-- <text style="text-align: right;color: #409EFF;" @click="selectMat()">鎻愬彇+</text> -->
+					<!-- <uni-icons type="right" color="#c1c1c1"></uni-icons> -->
+			<!-- 	</view>
+			</view> -->
 		</view>
 		<view class="mat-list-title">
 			鍟嗗搧鍒楄〃
@@ -33,38 +36,37 @@
 					<view class="list-left-item">
 						<view class="desc">缂栫爜锛�</view>
 						<view class="left-item">
-							<uni-tag :text="item.matnr" type="primary"></uni-tag>
+							{{item.matnr}}
 						</view>
 					</view>
 					<view class="list-left-item">
-						<view class="desc">鍝佸悕锛�</view>
+						<view class="desc">鍚嶇О锛�</view>
 						<view class="left-item">{{item.maktx}}</view>
+					</view>		
+					<view class="list-left-item">
+						<view class="desc">浜у湴锛�</view>
+						<view class="left-item">{{item.origin}}</view>
 					</view>
 					<view class="list-left-item">
-						<view class="desc">搴撲綅锛�</view>
-						<view class="left-item">{{item.locNo}}</view>
+						<view class="desc">鎵规锛�</view>
+						<view class="left-item">{{item.batch}}</view>
 					</view>
+					
 					<view class="list-left-item">
-						<view class="desc">鎵瑰彿锛�</view>
-						<view class="left-item">
-							<uni-tag :text="item.batch" type="warning"></uni-tag>
-						</view>
-					</view>
-					<view class="list-left-item">
-						<view class="desc">鏁伴噺锛�</view>
+						<view class="desc">鍏枻(鏁伴噺)锛�</view>
 						<view class="left-item">{{item.anfme}}</view>
 					</view>
 				</view>
 				<view class="list-right">
 					<uni-icons type="compose" color="#9add8b" size="24" @click="revise(item,i)"></uni-icons>
-					<!-- <uni-icons type="trash" color="#f58a8a" size="24" @click="remove(item,i,'warn')"></uni-icons> -->
+					<uni-icons type="trash" color="#f58a8a" size="24" @click="remove(item,i,'warn')"></uni-icons>
 				</view>
 			</view>
 		</scroll-view>
 		<!-- 搴曢儴鎿嶄綔鎸夐挳 -->
 		<view class="buttom">
 			<button size="mini" @click="reset('warn')">閲嶇疆</button>
-			<button size="mini" type="primary" @click="combConfirm('warn')">纭</button>
+			<button size="mini" type="primary" @click="combConfirm('warn')">涓婃灦</button>
 		</view>
 		<!-- 寮圭獥 -->
 		<!-- 淇敼鏁伴噺 -->
@@ -80,16 +82,16 @@
 								style="background-color: #f7f7f7;padding: 0;color: #d5d5d5;">
 						</view>
 					</view>
-					<view class="popup-item">
+					<!-- <view class="popup-item">
 						<view class="popup-item-left">搴撲綅:</view>
 						<view class="popup-item-right"><input type="text" v-model="locNo"></view>
-					</view>
-					<view class="popup-item">
+					</view> -->
+					<!-- <view class="popup-item">
 						<view class="popup-item-left">鎵瑰彿:</view>
 						<view class="popup-item-right"><input type="text" v-model="batch"></view>
-					</view>
+					</view> -->
 					<view class="popup-item">
-						<view class="popup-item-left">鏁伴噺:</view>
+						<view class="popup-item-left">鍏枻:</view>
 						<view class="popup-item-right" style="border: none;justify-content: center;">
 							<uni-number-box :value="count" :max="9999999" color="#747474" @change="changeValue" />
 						</view>
@@ -153,21 +155,114 @@
 				matFocus: false,
 				matData: '',
 				orderNo:'',
-				locNo:''
-
+				locNo:'',
+				orderNoList: [],
+				code:'',
+				origin:'',
+				ownerList: [],
+				owner: ''
 			}
 		},
 		onLoad() {
-
+			// 娌″暐鐢ㄤ簡
+			let that = this
+			// const eventChannel = this.$scope.eventChannel; // 鍏煎APP-NVUE
+			const eventChannel = this.getOpenerEventChannel();
+			
+			// 鐩戝惉acceptDataFromOpenerPage浜嬩欢锛岃幏鍙栦笂涓�椤甸潰閫氳繃eventChannel浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹�
+			eventChannel.on('item', function(data) {
+				// console.log(data.item);
+				that.origin = data.item
+			})
 		},
 		onShow() {
 			this.baseUrl = uni.getStorageSync('baseUrl');
 			this.token = uni.getStorageSync('token');
+			this.getOrderNoList()
+			this.getOwnerList()
 		},
 		methods: {
+			findCode(){
+				let that = this
+				uni.request({
+					url: that.baseUrl + '/mobile/manDetl/in/origin/origin',
+					header: { 'token':uni.getStorageSync('token') ,
+					"content-type":"application/x-www-form-urlencoded"},
+					data: {
+						code: that.code,
+						origin: that.origin,
+					},
+					method: 'GET',
+					success(res) {
+						res = res.data
+						if (res.code === 200) {
+							let item = {matnr:res.data.matnr,batch:res.data.batch,weight:res.data.anfme}
+							let matnr = {}
+							that.findMat2(res.data.matnr).then(result=>{
+								result['batch'] = res.data.batch
+								result['anfme'] = res.data.anfme
+								result.weight = res.data.weight
+								that.dataList.push(result)
+							})
+							
+							that.barcodeFocus = false
+							setTimeout(()=>{
+								that.code = ''
+								that.barcodeFocus = true
+							})
+						}
+					}
+				})
+			},
+			async findMat2(matnr) {
+				let that = this
+				let item = {}
+				let abb = await uni.request({
+					url: that.baseUrl + '/mat/auth',
+					data: {
+						matnr: matnr
+					},
+					header: {
+						'token': uni.getStorageSync('token')
+					},
+					
+				}).then((result)=> {
+					item = result.data.data
+				})
+				return item
+			},
 			messageToggle(type) {
 				this.msgType1 = type
 				this.$refs.message.open()
+			},
+			getOrderNoList() {
+				let that = this
+				uni.request({
+					url: this.baseUrl + '/originRule/list/all',
+					method: 'POST',
+					success(res) {
+						res = res.data
+						for (var i = 0; i < res.data.length; i++) {
+							that.orderNoList.push(res.data[i])
+						}
+					}
+				})
+			},
+			getOwnerList(){
+				let that = this
+				uni.request({
+					url: this.baseUrl + '/locOwnerQuery/auth',
+					header: {
+						'token':uni.getStorageSync('token')
+					},
+					method: 'POST',
+					success(res) {
+						res = res.data
+						res.data.forEach((item,index) => {
+							that.ownerList.push(item.value)
+						})
+					}
+				})
 			},
 			// 鏍规嵁鎵樼洏鐮佹悳绱�
 			search() {
@@ -206,7 +301,7 @@
 				let that = this;
 				that.barcodeFocus = false;
 				setTimeout(() => {
-					that.barcode = '';
+					that.code = '';
 					that.barcodeFocus = true;
 				}, 100);
 			},
@@ -249,13 +344,17 @@
 								// 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹�
 								events: {
 									matList: function(data) {
-										that.checkMat(data.data)
+										// that.checkMat(data.data)
+										for(let i = 0; i < data.data.count; i++) {
+											// that.checkMat(data.data)
+											that.dataList.unshift(data.data.mat)
+										}
 									},
 								},
 							});
-						} else if (res.code == 403) {
+						} else if (result.code == 403) {
 							uni.showToast({
-								title: res.msg,
+								title: result.msg,
 								icon: "none",
 								position: 'top'
 							})
@@ -266,7 +365,7 @@
 							}, 1000);
 						} else {
 							uni.showToast({
-								title: res.msg,
+								title: result.msg,
 								icon: "none",
 								position: 'top'
 							})
@@ -377,7 +476,7 @@
 			combConfirm(type) {
 				this.msgType = type
 				this.title = '璀﹀憡'
-				this.content = '鏄惁纭鐩樼偣!'
+				this.content = '鏄惁纭涓婃灦!'
 				this.$refs.combConfirm.open()
 			},
 			combClose() {
@@ -404,38 +503,70 @@
 			resst() {
 				this.dataList = []
 				this.barcode = ''
+				this.locNo = ''
+				this.owner = ''
 				this.barcodeFocuss()
 			},
 			adjust() {
-				let that = this
-				var combMats = []
-				var combParam = {}
-				combParam['orderNo'] = that.orderNo
-				combParam['wrkDetls'] = that.dataList
+				uni.vibrateShort();
+				let that = this;
+				// if (that.code === '') {
+				// 	this.messageText = "璇疯緭鍏ユ潯鐮�"
+				// 	this.messageToggle('error')
+				// 	return;
+				// }
+				// if (that.origin === '') {
+				// 	this.messageText = "璇烽�夋嫨鏉ユ簮鍦�"
+				// 	this.messageToggle('error')
+				// 	return;
+				// }
+				if (that.locNo === '') {
+					this.messageText = "璇疯緭鍏ュ簱浣嶇爜"
+					this.messageToggle('error')
+					return;
+				}
+				if (that.dataList.length === 0) {
+					this.messageText = "璇锋坊鍔犲晢鍝佸垪琛�"
+					this.messageToggle('error')
+					return;
+				}
+				for (var i = 0; i < that.dataList.length; i++) {
+					if (that.dataList[i].anfme == 0 || that.dataList[i].anfme == '') {
+						this.messageText = that.dataList[i].matnr + '缁勬墭鏁伴噺涓嶈兘涓�0'
+						this.messageToggle('error')
+						return;
+					}
+				}
 				uni.request({
-					url: that.baseUrl + '/mobile/adjustNew/auth',
+					url: that.baseUrl + '/mobile/manDetl/in/no/origin',
+					data: JSON.stringify({						
+						locNo:that.locNo,
+						combMats: that.dataList,
+						owner: that.owner
+					}),
 					method: 'POST',
-					data: JSON.stringify(combParam),
 					header: {
-						'token':uni.getStorageSync('token')
+						'token': uni.getStorageSync('token')
 					},
 					success(result) {
 						var res = result.data
 						if (res.code === 200) {
-							that.dataList = []
-							that.barcode = ''
-							uni.showToast({title: res.msg, icon: "none", position: 'top'})
+							that.resst();
+							that.messageText = "涓婃灦鎴愬姛"
+							that.messageToggle('success')
 						} else if (res.code == 403) {
-							uni.showToast({title: res.msg, icon: "none", position: 'top'})
+							that.messageText = res.msg
+							that.messageToggle('error')
 							setTimeout(() => {
 								uni.reLaunch({
 									url: '../login/login'
 								});
 							}, 1000);
 						} else {
-							uni.showToast({title: res.msg, icon: "none",position: 'top'})
+							that.messageText = res.msg
+							that.messageToggle('error')
 						}
-					},
+					}
 				});
 			},
 		}
@@ -448,7 +579,7 @@
 	.code {
 		width: 100%;
 		position: fixed;
-		min-height: 200rpx;
+		min-height: 300rpx;
 		background-color: #FFF;
 		z-index: 10;
 	}
@@ -488,10 +619,30 @@
 		width: 100%;
 		background-color: white;
 		position: fixed;
-		margin-top: 200rpx;
+		margin-top: 300rpx;
 		z-index: 9;
 		/* border-top: 1px solid #DCDFE6; */
 		text-align: center;
 		box-shadow: 0px 0px 30px 0px rgba(0, 0, 0, 0.5);
 	}
+	
+	.list {
+		display: flex;
+		min-height: 80rpx;
+		background-color: #FFF;
+		margin: 20rpx 20rpx;
+		border-radius: 20rpx;
+		box-shadow: 0px 0px 30px 0px rgba(0, 0, 0, 0.2);
+	}
+	
+	.list:first-child {
+		margin-top: 440rpx;
+	}
+	
+	.list:last-child {
+		margin-bottom: 120rpx;
+	}
+	.list-left-item{
+		margin-bottom: 2px;
+	}
 </style>

--
Gitblit v1.9.1