From 09451cd55edf531e51c6e38fc54b4dbc58712d7f Mon Sep 17 00:00:00 2001 From: yangan <yangan0921@163.com> Date: 星期二, 12 十一月 2024 12:12:22 +0800 Subject: [PATCH] feat:代码提交 --- pages/loadUnload-page/historyOrder/index.vue | 170 ++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 121 insertions(+), 49 deletions(-) diff --git a/pages/loadUnload-page/historyOrder/index.vue b/pages/loadUnload-page/historyOrder/index.vue index 50c70f8..8d562a7 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,26 +99,26 @@ <!-- <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> </view> <view class="productName"> - <text>瀹為檯閲忥細{{value.realityMeasure ? value.realityMeasure : '鏆傛棤'}}</text> + <text>瀹為檯閲忥細{{value.productQuantity ? value.productQuantity : '鏆傛棤'}}</text> </view> </view> </view> @@ -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: [], @@ -265,13 +266,18 @@ }, first: '', last: '', + dateParams:{ + startTime:'', + endTime:"", + + }, firstFilter: '', lastFilter: '', taskList: [], - tmNum:0, + // tmNum:0, filterList: [], - totalLength: 0, - totalTon: 0, + // totalLength: 0, + // totalTon: 0, // 绛涢�夊脊鍑哄眰 conditinonShow: false, // 瓒呰繃涓よ鑷姩闅愯棌 @@ -304,24 +310,38 @@ this.getTmTaskCoalData(); }, onLoad() { + this.firstDate(); + this.lastDate(); + }, + onPullDownRefresh () { + //璋冪敤鑾峰彇鏁版嵁鏂规硶 + this.getTmTaskCoalData(); + //缁撴潫涓嬫媺鍒锋柊 + this.$nextTick(()=>{ + uni.stopPullDownRefresh(); + }) + + }, methods: { firstDate() { let y = new Date().getFullYear(); //鑾峰彇骞翠唤 let m = new Date().getMonth() + 1; //鑾峰彇鏈堜唤 - let d = '01'; - m = m < 10 ? '0' + m : m; //鏈堜唤琛� 0 - this.first = [y, m, d].join('-'); - this.firstFilter = [y, m, d].join('-'); + let d = new Date().getDate(); //鑾峰彇褰撳ぉ鏃ユ湡 + m = m < 10 ? '0' + m : m; //鏈堜唤琛� 0 + this.first = [y, m, d].join('-') + ' ' + '00:00:00'; + this.dateParams.startTime = [y, m, d].join('-') ; + this.firstFilter = [y, m, d].join('-') }, lastDate() { let y = new Date().getFullYear(); //鑾峰彇骞翠唤 let m = new Date().getMonth() + 1; //鑾峰彇鏈堜唤 - let d = new Date(y, m, 0).getDate(); //鑾峰彇褰撴湀鏈�鍚庝竴鏃� + let d = new Date().getDate(); //鑾峰彇褰撴湀鏈�鍚庝竴鏃� m = m < 10 ? '0' + m : m; //鏈堜唤琛� 0 d = d < 10 ? '0' + d : d; //鏃ユ暟琛� 0 - this.last = [y, m, d].join('-'); + this.last = [y, m, d].join('-') +' ' + '23:59:59'; + this.dateParams.endTime = [y, m, d].join('-') ; this.lastFilter = [y, m, d].join('-'); }, // 绛涢�夋潯浠� @@ -391,15 +411,30 @@ uni.showLoading({ title: '鍔犺浇涓�' }); - this.$reqGet('getHistoryTaskCoalList', { startTime: this.first, endTime: this.last,bunkerIds:this.bunkerIds,userId:this.userId }).then(res => { + this.$reqGet('getHistoryTaskCoalList', { startTime: this.first , endTime:this.last ,bunkerIds:this.bunkerIds,productIds:uni.getStorageSync('productIds') }).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.map(item=>{ + if(!item.carNum){ + item.carNum = 0; + } + if(!item.weight){ + item.weight = 0; + } + if(!item.number){ + item.number = 0; + } + return item; + }); + // this.totalLength = res.data.carNum; + // this.totalTon = res.data.weight; + // this.tmNum = res.data.number; if (this.filterList.length != 0) { + console.log(this.filterList,'fis') + 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 +447,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 +460,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 +489,7 @@ } else { this.totalLength = 0; this.totalTon = 0; + } uni.hideLoading(); }); @@ -525,17 +561,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 +592,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; } }, // 纭畾绛涢�� @@ -591,8 +635,11 @@ }, confirm(e) { console.log(e, '鏃ユ湡閫夋嫨'); - this.first = e.range.before; - this.last = e.range.after; + this.first = e.range.before + ' ' + '00:00:00'; + this.dateParams.startTime = e.range.before; + this.last = e.range.after + ' ' + '23:59:59' ; + this.dateParams.endTime = e.range.after; + this.getTmTaskCoalData(); this.$nextTick(() => { this.$refs.calendar.close() }) @@ -693,8 +740,8 @@ // 鍏抽棴绛涢�夋潯浠跺脊绐� conditinonclose() { this.conditinonShow = false; - } - }, + }, + }, computed: { roleType() { return uni.getStorageSync('roleType'); @@ -703,7 +750,7 @@ return `${this.firstFilter}鑷�${this.lastFilter}`; }, dateselect() { - return `${this.first}鑷�${this.last}`; + return `${this.dateParams.startTime}鑷�${this.dateParams.endTime}`; }, coalTotal() { return this.coalList.length; @@ -731,17 +778,40 @@ }, 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) { - let tempDate = `${this.first}鑷�${this.last}`; - if (newV != old && old != '鑷�') { - this.first = newV.slice(0, 10); - this.last = newV.slice(11); - this.getTmTaskCoalData(); - } - } + // dateselect(newV, old) { + // console.log(newV,'old') + // let tempDate = `${this.first}鑷�${this.last}`; + // if (newV != old && old != '鑷�') { + // this.first = newV.slice(0, 10); + // this.last = newV.slice(11); + // // this.getTmTaskCoalData(); + // } + // }, } }; </script> @@ -1068,6 +1138,7 @@ width: 100%; height: vww(15); display: flex; + margin-bottom: 10rpx; justify-content: space-between; align-items: center; @@ -1138,6 +1209,7 @@ display: flex; justify-content: flex-start; align-items: center; + margin-top: 10rpx; color: #515151; .time-icon { -- Gitblit v1.9.1