From 6147ca19d6888b49f36d96f0cf345dfe13255871 Mon Sep 17 00:00:00 2001
From: yangan <yangan0921@163.com>
Date: 星期六, 14 九月 2024 17:00:46 +0800
Subject: [PATCH] feat:库管外销不需要输入折吨

---
 pages/loadUnload-page/historyOrder/index.vue |   93 ++++++++++++++++++++++++++++++++--------------
 1 files changed, 65 insertions(+), 28 deletions(-)

diff --git a/pages/loadUnload-page/historyOrder/index.vue b/pages/loadUnload-page/historyOrder/index.vue
index 50c70f8..9600088 100644
--- a/pages/loadUnload-page/historyOrder/index.vue
+++ b/pages/loadUnload-page/historyOrder/index.vue
@@ -46,7 +46,7 @@
 						v-if="filterList[index].tmTaskCoalList.length"
 						:key="index">
 						<view class="card-top">
-							<view class="left"><combined-title :title="filterList[index].sendDate"></combined-title></view>
+							<view class="left"><combined-title :title="item.sendDate"></combined-title></view>
 							<view class="card-top_num">
 								{{ item.tmTaskCoalList.length }}杞�
 								{{Number(item.tmTaskCoalList
@@ -99,20 +99,20 @@
 								<!-- <view class="black-block"><view class="black-bar"></view></view>
 								<view class="coal-type">{{ value.orderType }}</view> -->
 							</view>
-							<view class="five-line">
+							<view class="second-line">
 								<view class="coal-name">
 									<view class="productName">
 										<text>浜у搧绛夌骇锛歿{ value.productGrade  ? value.productGrade : '鏆傛棤' }}</text>
 										</view>
 										<view class="productName">
-										<text>鍖呰绫诲瀷锛歿{ proType[value.packingType]}}</text>
+										<text>{{ proType[value.packingType]}}</text>
 										</view>
 									
 								</view>
 								<!-- <view class="black-block"><view class="black-bar"></view></view>
 								<view class="coal-type">{{ value.orderType }}</view> -->
 							</view>
-							<view class="five-line">
+							<view class="second-line">
 									<view class="coal-name">
 								<view class="productName">
 										<text>璁″垝閲忥細{{ value.planMeasure  ?value.planMeasure  :'鏆傛棤'}}</text>
@@ -248,11 +248,12 @@
 			return {
 				conditionList: [],
 				coalList: [],
-				proType:['鏁h','娑叉埃鐡惰','缃愯','PVC25','PVC80','PVC1150','PVc1200'],
+				proType:['鏁h','娑叉隘鐡惰','缃愯','PVC25','PVC80','PVC1150','PVc1200'],
 				bunnkerList:[],
 				typeList: [],
 				customerList: [],
 				forwarderList: [],
+				totalLength :0,totalTon:0,tmNum:0,
 				fleetList: [],
 				filedList: [],
 				carNoList: [],
@@ -268,10 +269,10 @@
 				firstFilter: '',
 				lastFilter: '',
 				taskList: [],
-				tmNum:0,
+				// tmNum:0,
 				filterList: [],
-				totalLength: 0,
-				totalTon: 0,
+				// totalLength: 0,
+				// totalTon: 0,
 				// 绛涢�夊脊鍑哄眰
 				conditinonShow: false,
 				// 瓒呰繃涓よ鑷姩闅愯棌
@@ -393,13 +394,16 @@
 				});
 				this.$reqGet('getHistoryTaskCoalList', { startTime: this.first, endTime: this.last,bunkerIds:this.bunkerIds,userId:this.userId }).then(res => {
 					console.log(res.data,'res.data');
-					this.filterList = this.taskList = res.data.tmTaskCoalList;
-					this.totalLength = res.data.carNum;
-					this.totalTon = res.data.weight;
-					this.tmNum =  res.data.number;
+					this.filterList = this.taskList = res.data;
+					// this.totalLength = res.data.carNum;
+					// this.totalTon = res.data.weight;
+					// this.tmNum =  res.data.number;
 					if (this.filterList.length != 0) {
+						this.totalLength = 	this.filterList.reduce((x, y) => x + y.carNum,0);
+						this.totalTon = this.filterList.reduce((x, y) => new BigNumber(x).plus( y.weight),0).toFixed(2);
+						this.tmNum = this.filterList.reduce((x, y) => x + y.number,0);
 						let coalTemp,customerTemp,bunnkerTemp = [];
-						coalTemp = res.data.tmTaskCoalList.map(item=>item.tmTaskCoalList.map(val=>{
+						coalTemp = res.data.map(item=>item.tmTaskCoalList.map(val=>{
 							return {
 								name:val.productName,
 								active:false
@@ -412,7 +416,7 @@
 							return item
 						}, [])
 						}
-						customerTemp = res.data.tmTaskCoalList.map(item=>item.tmTaskCoalList.map(val=>{
+						customerTemp = res.data.map(item=>item.tmTaskCoalList.map(val=>{
 							return {
 								name:val.customerName,
 								active:false
@@ -425,7 +429,7 @@
 							return item
 						}, [])
 						}
-						bunnkerTemp=  res.data.tmTaskCoalList.map(item=>item.tmTaskCoalList.map(val=>{
+						bunnkerTemp=  res.data.map(item=>item.tmTaskCoalList.map(val=>{
 							return {
 								name:val.bunkerName,
 								active:false
@@ -454,6 +458,7 @@
 					} else {
 						this.totalLength = 0;
 						this.totalTon = 0;
+					     
 					}
 					uni.hideLoading();
 				});
@@ -525,17 +530,29 @@
 				};
 				this.filterList = this.taskList.map((val,i) => {
 					return {
-						condition: val.condition,
-						conditionId: val.conditionId,
+						carNum:val.carNum,
+						number:val.number,
+						weight:val.weight,
 						sendDate:this.taskList[i].sendDate,
-						conditionType: val.conditionType,
 						tmTaskCoalList: val.tmTaskCoalList.filter(v => Reflect.ownKeys(conditionMapping).every(key =>
 							mapping[key](v, conditionMapping[key])))
 					};
 				});
 				console.log(this.filterList,'filterList')
 				if (this.filterList.length != 0) {
-					this.totalLength = this.filterList.map(v => v.tmTaskCoalList.length).reduce((x, y) => x + y); // 杞︽暟
+					const tempArr =  this.filterList.map((item,i)=>{
+						if(!item.tmTaskCoalList.length){
+						    item.carNum = 0;
+							item.number = 0;
+							item.weight = 0;
+						}
+						return item;
+					})
+					console.log(tempArr,'temp')
+						this.totalLength = 	tempArr.reduce((x, y) => x + y.carNum,0);
+						this.totalTon = tempArr.reduce((x, y) => new BigNumber(x).plus( y.weight),0).toFixed(2);
+						this.tmNum = tempArr.reduce((x, y) => x + y.number,0);
+					
 					// this.totalTon = this.filterList.map(v => 
 					// 	v.taskCoalList.reduce((prev, cur) => {
 					// 		const cleanvalue = cur.clean || 0
@@ -544,20 +561,16 @@
 					// );
 					// this.totalTon = this.filterList.map(item=>)
 					// this.totalTon = this.filterList.map(v=>v.tmTaskCoalList.filter(item=>item.isWeight === 1).reduce((x,y)=>x.weight + y.weight));
-					const tonList = this.filterList.map(item=>item.tmTaskCoalList.filter(item=>item.isWeight === 1)).flat(1);
-				    const tmNumList = this.filterList.map(item=>item.tmTaskCoalList.filter(item=>item.isWeight !== 1)).flat(1);
-					this.totalTon = tonList.reduce((x,y)=>new BigNumber(x).plus(new BigNumber(y.clean)).toFixed(2),0)
-					this.tmNum = tmNumList.reduce((x,y)=>new BigNumber(x).plus(new BigNumber(y.productQuantity)),0)
-	console.log(tonList,this.totalTon,'tonLisy')
+					
 					// this.totalTon = this.totalTon.reduce((x, y) => { //鎬昏川閲忔暟
 					// 	let xx = new BigNumber(x)
 					// 	let yy = new BigNumber(y)
 					// 	return xx.plus(yy).toNumber().toFixed(2)
 					// }, new BigNumber(0));
 				} else {
-					this.totalLength = 0;
-					this.totalTon = 0;
-					this.tmNum = 0;
+					// this.totalLength = 0;
+					// this.totalTon = 0;
+					// this.tmNum = 0;
 				}
 			},
 			// 纭畾绛涢��
@@ -731,7 +744,29 @@
 			},
 			bunkerIds(){
 				return uni.getStorageSync('bunkerIds')
-			}
+			},
+			// totalLength(){
+			// 	console.log(this.filterList,'filterList')
+			// 	if(this.filterList.length){
+	 		// 		return	this.filterList.reduce((x, y) => x + y.carNum,0); // 杞︽暟
+			// 	}else{
+			// 		return 0
+			// 	}
+			// },
+			// totalTon(){
+			// 		if(this.filterList.length){
+	 		// 		return	this.filterList.reduce((x, y) => new BigNumber(x).plus(new BigNumber(y.weight)) ,0).toFixed(2); // 杞︽暟
+			// 	}else{
+			// 		return 0
+			// 	}
+			// },
+			// tmNum(){
+			// 		if(this.filterList.length){
+	 		// 		return	this.filterList.reduce((x, y) => new BigNumber(x).plus(new BigNumber(y.number)) ,0); // 杞︽暟
+			// 	}else{
+			// 		return 0
+			// 	}
+			// }
 		},
 		watch: {
 			dateselect(newV, old) {
@@ -1068,6 +1103,7 @@
 							width: 100%;
 							height: vww(15);
 							display: flex;
+							margin-bottom: 10rpx;
 							justify-content: space-between;
 							align-items: center;
 
@@ -1138,6 +1174,7 @@
 							display: flex;
 							justify-content: flex-start;
 							align-items: center;
+							margin-top: 10rpx;
 							color: #515151;
 
 							.time-icon {

--
Gitblit v1.9.1