From a1c08d1646f4c9d280a0e3462d55e9ea6aadd845 Mon Sep 17 00:00:00 2001
From: yangan <yangan0921@163.com>
Date: 星期四, 02 一月 2025 16:43:34 +0800
Subject: [PATCH] faet:拼单列表增加展示字段

---
 subPages/addDailyPlan/addDailyPlan.vue |   95 ++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 77 insertions(+), 18 deletions(-)

diff --git a/subPages/addDailyPlan/addDailyPlan.vue b/subPages/addDailyPlan/addDailyPlan.vue
index d7d1096..5139e83 100644
--- a/subPages/addDailyPlan/addDailyPlan.vue
+++ b/subPages/addDailyPlan/addDailyPlan.vue
@@ -44,6 +44,7 @@
 						   class="customer-name_block-input"
 							placeholder="璇疯緭鍏ヨ溅鏁�"
 							border="surround"
+							:disabled="isNumOk"
 							v-model="value"
 						></u--input>
 				</view>
@@ -56,13 +57,12 @@
 				</view>
 				<view class="customer-name_block">
 						  <u-input
-						  v-for="item, i in checkList2" :key="i"
 						  @clear="clearInp"
 						  clearable
 						   class="customer-name_block-input"
 							placeholder="璇烽�夋嫨璁㈠崟"
 							border="surround"
-							v-model="item.text"
+							v-model="activeName"
 							:disabled="!deptId"
 						
 						></u-input>
@@ -75,18 +75,24 @@
 			emptyText="鏆傛棤鏇村鏁版嵁">
 					<uni-tr>
 					    <uni-th align="center">浜у搧鍚嶇О</uni-th>
-						<uni-th align="center">绫诲瀷</uni-th>
-					    <uni-th align="center">浠撳簱</uni-th>
+						<uni-th align="center">瑙勬牸</uni-th>
+						<uni-th align="center" v-if="isNumOk">鏁伴噺</uni-th>
+						<uni-th align="center">璁㈠崟浣欓噺</uni-th>
 					</uni-tr>
 					<uni-tr v-for="(item, index) in subDataList" :key="index">
 						<uni-td align="center">
 							<view>{{   item.productName}}</view></uni-td>
-					<uni-td>
-						<view class="name">{{ item.orderType }}</view>
-					</uni-td>
-					
-				聽   <uni-td align="center">
-					<view>{{ item.bunkerName }}</view></uni-td>
+							<uni-td align="center">
+							<view>{{   item.productSpecs}}</view></uni-td>
+					聽   <uni-td align="center" v-if="isNumOk">
+						<view>
+							<u--input 
+							v-model="subDataList[index].nums"
+							border="surround"
+							placeholder="璇疯緭鍏ユ暟閲�" />
+								</view></uni-td>
+								<uni-td align="center">
+									<view>{{   item.surplusQuant}}</view></uni-td>
 				</uni-tr>
 				</uni-table>
 		 </view>
@@ -159,12 +165,14 @@
 			uni.$on('updateData',(data)=>{
 				console.log('鐩戝惉鍒颁簨浠舵潵鑷� updateData 锛屾惡甯﹀弬鏁颁负锛�' + JSON.parse( JSON.stringify(data)) , JSON.parse(data) .id );
 				const params = JSON.parse(data);
-				this.checkList2 = params.map(item=>{
-					item.text = item.orderCode + '/' + item.customerName;
-					return item;
-				});
-				let temp = this.checkList2;
-				this.closeOrderIds = temp.map(item=>item.id).join(',')
+				// this.checkList2 = params.map(item=>{
+				// 	item.text = item.orderCode + '/' + item.customerName;
+				// 	return item;
+				// });
+				// let temp = this.checkList2;
+				// this.closeOrderIds = temp.map(item=>item.id).join(',')
+				this.activeName = params.orderCode  +'/' + params.customerName;
+				this.closeOrderId = params.id;
 
 
 			})
@@ -175,7 +183,10 @@
 				deptId: '',
 				checkList:[],
 				deptName: '',
+				mapProductNum:'',
 				activeName:'',
+				isNumOk:false,
+				isNumData:[],
 				checkList2:[],
 				deptList: [],
 				uncoidCard:'',
@@ -195,6 +206,8 @@
 				customerNameList: [],
 				buildLoading: false,
 				subDataList:[],
+				isWeighing:'',
+				orderType:'',
 			}
 		},
 		computed: {
@@ -255,7 +268,13 @@
 				
 							if(this.deptId){
 						this.subDataList = this.customerNameList.filter(item=>item.id === e).length ? 
+						
 		  			    this.customerNameList.filter(item=>item.id === e)[0].tmOrderList  : []; 
+						this.subDataList.map(item=>{
+							item.nums = item.surplusQuant
+							return item
+						})
+						console.log(this.subDataList,'subDataList')
 						const tempArr = this.customerNameList.filter(item=>item.id === e);
 						if(tempArr.length){
 							this.unionParams = {
@@ -275,19 +294,58 @@
 							}else{
 								this.subDataList = [];
 							}
+							//鏌ョ湅鏄笉鏄噰璐殑璁℃暟
+							if(this.subDataList.find(item=>item.isWeight === 0 || item.isWeight === 2)){
+								this.isNumOk = true;
+								this.value = 1;
+							} else{
+								this.isNumOk = false;
+							}
+							if(this.isNumOk){
+								let tempArr = [];
+								this.subDataList.forEach(item=>{
+								tempArr.push(item.id + ':' + item.surplusQuant);
+								this.isWeighing = item.isWeight;
+								this.orderType = item.orderType;
+								})
+								
+								this.mapProductNum = tempArr.join(",")
+							}else{
+								this.mapProductNum = '';
+							}
 						}
 					})
 			
 				
 			},
 			confirmBuild() {
+				let tempArr = [];
+					this.subDataList.forEach(item=>{
+						this.checkList.forEach(val=>{
+							if(item.id === val){
+								tempArr.push(item.id + ':' + item.nums);
+							}
+						
+						})
+						
+						})
+					this.mapProductNum = tempArr.join(","); 
+					if(   this.subDataList.find(item=>Number(item.nums) > Number(item.surplusQuant))){
+						this.$u.toast('璇锋鏌ユ墍閫夋嫨鐨勪骇鍝佽緭鍏ョ殑鏁伴噺鏄惁灏忎簬璁㈠崟浣欓噺')
+						return;
+					}
+				;
 				let form = {
 				  orderId:this.deptId,
 				  carNum:this.value,
 				  sendDate:this.sendDate,
 				  sendSign:0,
 				  itemIds:this.checkList.join(",") + ',',
-				  closeOrderIds:this.closeOrderIds,
+				  closeOrderId:this.closeOrderId,
+				  mapProductNum:this.mapProductNum,
+				  orderType:this.orderType,
+				  isWeighing:this.isWeighing
+
 				}
 				this.buildLoading = true
 				this.$reqPost('addDeliveryPlan', form, 'json').then(res => {
@@ -326,7 +384,8 @@
 			},
 			clearInp(){
 				this.closeOrderId = '';
-			}
+				this.activeName = '';
+			},
 		},
 	}
 </script>

--
Gitblit v1.9.1