From 112c71dbe86fdffffe3dceb13fc7881e7fbe7881 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期一, 26 五月 2025 18:18:49 +0800
Subject: [PATCH] 123

---
 pages/basics/order.vue |  130 +++++++++++++++++++++++++++++++++++++------
 1 files changed, 111 insertions(+), 19 deletions(-)

diff --git a/pages/basics/order.vue b/pages/basics/order.vue
index 79649a5..0647679 100644
--- a/pages/basics/order.vue
+++ b/pages/basics/order.vue
@@ -29,20 +29,34 @@
 				</view>
 			</view>
 			
+			<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">
+					<view class="content-input">
+						<input v-model="tiaoma" type="text" placeholder="鎵爜 / 杈撳叆" @input="findTiaoMa()"
+						:focus="tmfocus" placeholder-style="line-height:  85rpx;">
+						<uni-icons type="closeempty" size="20" color="#dadada" @click="removeTm()"></uni-icons>
+					</view>
+				</view>
+			</view>
+			
 			<view class="square-1">
 				<view class="square-title">
 					<view class="title-sign"><view class="sign"></view></view>
 					<view class="title-text"><text>鍟嗗搧鍒楄〃</text></view>
 					<view v-show="matList.length != 0" class="lable">
-						<label class="label-btn" style="width: 170rpx;line-height: 95rpx;"  >
+						<!-- <label class="label-btn" style="width: 170rpx;line-height: 95rpx;"  >
 							<checkbox :checked="check" @click="allChecked()">{{checkText}}</checkbox>
-						</label>
-						<label class="label-btn"  >
+						</label> -->
+						<!-- <label class="label-btn"  >
 							<text  @click="reChecked()">鍙嶉��</text>
 						</label>
 						<label >
 							<uni-icons type="trash" size="25" color="#a5a5a5" @click="remove()"></uni-icons>
-						</label>
+						</label> -->
 					</view>
 				</view>
 				
@@ -52,17 +66,19 @@
 			</view>
 			
 			<checkbox-group @change="checkbox">
-				<view v-for="(item,index) in matList" :key="index" class="data-list bg-false" :class="'bg-'+item.checked" >
-					<label class="left-check-box">
-						<checkbox :value="item.id+''" :checked="item.checked" style="display: block;" />
+				<view v-for="(item,index) in matList" :key="index" v-if="item.anfme>0"  class="data-list bg-false" :class="'bg-'+item.checked" >
+					<label class="left-check-box" >
+						<checkbox :value="item.id+''" :checked="true" style="display: block;" />
 					</label>
-					<view class="data-list-left">
+					<view class="data-list-left" >
 						<view class="matnr"><text style="width: 700rpx;">鍝佸彿锛歿{item.matnr}}</text></view>
 						<view><text style="width: 700rpx;">鍝佸悕锛歿{item.maktx}}</text></view>
-						<view><text style="width: 700rpx;">宸ュ簭锛歿{item.sku}}</text></view>
 						<view><text style="width: 700rpx;">鎵瑰彿锛歿{item.batch}}</text></view>
 						<view>
-							<text style="width: 700rpx;">鏁伴噺锛歿{item.anfme}}</text>
+							<text style="width: 700rpx;">鎬绘暟閲忥細{{item.count}}</text>
+						</view>
+						<view>
+							<text style="width: 700rpx;">鍙粍鎵樻渶澶ф暟閲忥細{{item.anfme}}</text>
 						</view>
 					</view>
 					<view class="data-list-right">
@@ -129,12 +145,15 @@
 				commonUrl:null,
 				barcode: '',
 				barcodeFocus:true,
+				tmfocus:false,
 				focus:false,
 				type: 'center',
 				searchBox: 'hide',
 				pick:'hide',
 				order:null,
 				orderNo:null,
+				tiaoma:null,
+				tiaomas:[],
 				matList:[],
 				result: '',
 				count:'',
@@ -217,6 +236,14 @@
 					this.focus = true;
 				});
 			},
+			removeTm() {
+				this.tiaoma = ''
+				uni.vibrateShort();
+				this.tmfocus = false;
+				this.$nextTick(function() {
+					this.focus = true;
+				});
+			},
 			eject(type) {
 				this.type = type
 				// open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦� uni-popup 缁勪欢涓婄粦瀹� type灞炴��
@@ -271,7 +298,11 @@
 			comb() {
 				uni.vibrateShort();
 				let that = this;
-				if (that.barcode === '') {
+				if (!that.orderNo) {
+					uni.showToast({title: '璇锋壂鎻忓崟鎹彿', icon: "none", position: 'top'});
+					return;
+				}
+				if (!that.barcode) {
 					uni.showToast({title: '璇锋壂鎻忔墭鐩樻潯鐮�', icon: "none", position: 'top'});
 					return;
 				}
@@ -279,23 +310,24 @@
 					uni.showToast({title: '鎵樼洏鐮佸繀椤讳负8浣�', icon: "none", position: 'top'});
 					return;
 				}
-				if (that.matList.length === 0) {
+				let mats =that.matList.filter(mat =>mat.anfme>0);
+				if (mats.length === 0) {
 					uni.showToast({title: '璇锋坊鍔犲晢鍝佸垪琛�', icon: "none", position: 'top'});
 					return;
 				}
-				for (var i = 0; i < that.matList.length; i++) {
-					if (that.matList[i].anfme === 0) {
-						uni.showToast({title: '鍟嗗搧缁勬墭鏁伴噺涓�0涓嶈兘缁勬墭', icon: "none", position: 'top'});
-						return;
-					}
-				}
+				// for (var i = 0; i < mats.length; i++) {
+				// 	if (that.matList[i].anfme === 0) {
+				// 		uni.showToast({title: '鍟嗗搧缁勬墭鏁伴噺涓�0涓嶈兘缁勬墭', icon: "none", position: 'top'});
+				// 		return;
+				// 	}
+				// }
 				uni.showLoading();
 				uni.request({
 				    url: that.commonUrl + '/mobile/comb/auth',
 				    data: JSON.stringify({
 						orderNo: that.orderNo,
 						barcode: that.barcode,
-						combMats: that.matList
+						combMats: mats
 					}),
 					method: 'POST',
 				    header: {
@@ -365,6 +397,66 @@
 					}
 				});
 			},
+			findTiaoMa() {
+				let that = this
+				if (!that.orderNo) {
+					uni.showToast({title: '璇锋壂鎻忓崟鎹彿', icon: "none", position: 'top'});
+					return;
+				}
+				uni.request({
+				    url: that.commonUrl + '/mobile/mat/search/auth',
+				    data: {
+						matnr: that.tiaoma
+				    },
+				    header: {
+						'token':uni.getStorageSync('token')
+				    },
+					success(result) {
+						console.log("result锛�");
+						console.log(result)
+						let res = result.data
+						if (res.code === 200 && res.data) {
+							that.checkMat(res.data)
+							//this.tiaomas.unshift(that.tiaoma)
+						} 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'})
+						}
+					}
+				});
+			},
+			checkMat(mat) {
+				var len = this.matList.length
+				var add = true
+				for (var i = 0; i < len; i++) {
+					if (mat.matnr == this.matList[i].matnr) {
+						if ( mat.batch){
+							if( mat.batch == this.matList[i].batch){
+								this.matList[i].anfme += mat.anfme
+								this.$forceUpdate() // 寮哄埗鍒锋柊
+								add = false
+							}
+						}else{
+							this.matList[i].anfme += mat.anfme
+							this.$forceUpdate() // 寮哄埗鍒锋柊
+							add = false
+						}
+						
+					}
+				}
+				this.tiaoma = ''
+				uni.vibrateShort();
+				this.focus = false;
+				this.$nextTick(function() {
+					this.focus = true;
+				});
+			},
 			change(e) {
 				// console.log('褰撳墠妯″紡锛�' + e.type + ',鐘舵�侊細' + e.show);
 			},

--
Gitblit v1.9.1