yangan
2024-10-24 74073d164925eff4962188405355debb367aaf06
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:['散装','液氣瓶装','罐装','PVC25','PVC80','PVC1150','PVc1200'],
            proType:['散装','液氯瓶装','罐装','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,
            // 超过两行自动隐藏
@@ -391,15 +392,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 +428,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 +441,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 +470,7 @@
               } else {
                  this.totalLength = 0;
                  this.totalTon = 0;
               }
               uni.hideLoading();
            });
@@ -525,17 +542,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 +573,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 +756,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 +1115,7 @@
                     width: 100%;
                     height: vww(15);
                     display: flex;
                     margin-bottom: 10rpx;
                     justify-content: space-between;
                     align-items: center;
@@ -1138,6 +1186,7 @@
                     display: flex;
                     justify-content: flex-start;
                     align-items: center;
                     margin-top: 10rpx;
                     color: #515151;
                     .time-icon {