qingyiay
2023-04-21 1fdf41cc692eb7b208fe647259d4295164280a41
pages/customer-page/customer-my/faYunstatistics/faYunstatistics.vue
@@ -4,7 +4,7 @@
         <view class="content-statistics">
            <view class="content-text">发运统计</view>
            <view class="content-text">共{{ totalLength }}车</view>
            <view class="content-text">共{{ totalTon }}吨</view>
            <view class="content-text">共{{ totalTon.toFixed(2) }}吨</view>
         </view>
      </view>
      <view class="collapse-main">
@@ -15,7 +15,17 @@
                     <view class="condition-name">煤种:</view>
                     <view class="filter-name">
                        <view class="filter-button" v-for="(item, index) in coalList" :key="index" @click="filterCondition(0, index, item.condition)">
                           <u-button shape="circle" :text="item.condition" :type="item.active ? 'success' : ''" size="small"></u-button>
                           <u-button shape="circle" :text="item.condition" :type="item.active ? 'success' : ''" size="small" v-if="index < coalShow"></u-button>
                        </view>
                        <view class="toggle-button">
                           <u-button
                              shape="circle"
                              :text="coalShow < coalTotal ? '查看更多' : '收起'"
                              type="primary"
                              size="small"
                              @click="toggle(0)"
                              v-if="coalTotal > 3"
                           ></u-button>
                        </view>
                     </view>
                  </view>
@@ -25,6 +35,16 @@
                        <view class="filter-button" v-for="(item, index) in typeList" :key="index" @click="filterCondition(1, index, item.condition)">
                           <u-button shape="circle" :text="item.condition" :type="item.active ? 'success' : ''" size="small"></u-button>
                        </view>
                        <view class="toggle-button">
                           <u-button
                              shape="circle"
                              :text="typeShow < typeTotal ? '查看更多' : '收起'"
                              type="primary"
                              size="small"
                              @click="toggle(1)"
                              v-if="typeTotal > 3"
                           ></u-button>
                        </view>
                     </view>
                  </view>
                  <view class="filter-body">
@@ -32,6 +52,16 @@
                     <view class="filter-name">
                        <view class="filter-button" v-for="(item, index) in customerList" :key="index" @click="filterCondition(2, index, item.condition)">
                           <u-button shape="circle" :text="item.condition" :type="item.active ? 'success' : ''" size="small"></u-button>
                        </view>
                        <view class="toggle-button">
                           <u-button
                              shape="circle"
                              :text="customerShow < customerTotal ? '查看更多' : '收起'"
                              type="primary"
                              size="small"
                              @click="toggle(2)"
                              v-if="customerTotal > 3"
                           ></u-button>
                        </view>
                     </view>
                  </view>
@@ -41,6 +71,16 @@
                        <view class="filter-button" v-for="(item, index) in forwarderList" :key="index" @click="filterCondition(3, index, item.condition)">
                           <u-button shape="circle" :text="item.condition" :type="item.active ? 'success' : ''" size="small"></u-button>
                        </view>
                        <view class="toggle-button">
                           <u-button
                              shape="circle"
                              :text="forwarderShow < forwarderTotal ? '查看更多' : '收起'"
                              type="primary"
                              size="small"
                              @click="toggle(3)"
                              v-if="forwarderTotal > 3"
                           ></u-button>
                        </view>
                     </view>
                  </view>
                  <view class="filter-body" v-if="roleType != 3">
@@ -49,6 +89,16 @@
                        <view class="filter-button" v-for="(item, index) in fleetList" :key="index" @click="filterCondition(4, index, item.condition)">
                           <u-button shape="circle" :text="item.condition" :type="item.active ? 'success' : ''" size="small"></u-button>
                        </view>
                        <view class="toggle-button">
                           <u-button
                              shape="circle"
                              :text="fleetShow < fleetTotal ? '查看更多' : '收起'"
                              type="primary"
                              size="small"
                              @click="toggle(4)"
                              v-if="fleetTotal > 3"
                           ></u-button>
                        </view>
                     </view>
                  </view>
                  <view class="filter-body" v-if="roleType != 1">
@@ -56,6 +106,34 @@
                     <view class="filter-name">
                        <view class="filter-button" v-for="(item, index) in filedList" :key="index" @click="filterCondition(5, index, item.condition)">
                           <u-button shape="circle" :text="item.condition" :type="item.active ? 'success' : ''" size="small"></u-button>
                        </view>
                        <view class="toggle-button">
                           <u-button
                              shape="circle"
                              :text="filedShow < filedTotal ? '查看更多' : '收起'"
                              type="primary"
                              size="small"
                              @click="toggle(5)"
                              v-if="filedTotal > 3"
                           ></u-button>
                        </view>
                     </view>
                  </view>
                  <view class="filter-body" v-if="roleType == 2">
                     <view class="condition-name">车牌号:</view>
                     <view class="filter-name">
                        <view class="filter-button" v-for="(item, index) in carNoList" :key="index" @click="filterCondition(6, index, item.condition)">
                           <u-button shape="circle" :text="item.condition" :type="item.active ? 'success' : ''" size="small"></u-button>
                        </view>
                        <view class="toggle-button">
                           <u-button
                              shape="circle"
                              :text="carNoShow < carNoTotal ? '查看更多' : '收起'"
                              type="primary"
                              size="small"
                              @click="toggle(6)"
                              v-if="carNoTotal > 3"
                           ></u-button>
                        </view>
                     </view>
                  </view>
@@ -96,10 +174,10 @@
               </view>
            </view>
            <view class="card-main" v-for="(value, i) in item.taskCoalList" :key="i">
               <view class="arrow-right"><u-icon name="arrow-right" size="50"></u-icon></view>
               <view class="arrow-right" @click="faYunDetail(value.id)"><u-icon name="arrow-right" size="50"></u-icon></view>
               <view class="main-body">
                  <view class="coal-name">煤种:{{ value.coalName || '' }}</view>
                  <view class="clean">执行量:{{ value.clean || 0 }}</view>
                  <view class="clean">执行量:{{ value.clean.toFixed(2) || 0 }}</view>
                  <view class="out-time">出场时间:{{ value.outTime || '' }}</view>
                  <view class="car-number">车牌号:{{ value.carNo || '' }}</view>
                  <view class="filedName">矿场:{{ value.filedName || '' }}</view>
@@ -121,6 +199,7 @@
         forwarderList: [],
         fleetList: [],
         filedList: [],
         carNoList: [],
         isactive: false,
         info: {
            lunar: false,
@@ -133,7 +212,26 @@
         taskList: [],
         filterList: [],
         totalLength: 0,
         totalTon: 0
         totalTon: 0,
         // 超过两行自动隐藏
         coalShow: 3,
         typeShow: 3,
         customerShow: 3,
         forwarderShow: 3,
         fleetShow: 3,
         filedShow: 3,
         carNoShow: 3,
         coalToggeleState: false,
         typeToggeleState: false,
         customerToggeleState: false,
         forwarderToggeleState: false,
         fleetToggeleState: false,
         filedToggeleState: false,
         carNoToggeleState: false,
         // 点击右箭头详情弹窗
         faYunDetailobj: {},
         modalShow: false,
         coalStatus: ['领取', '预约', '签到', '入场', '称皮', '称毛', '离场', '入磅房', '出磅房', '入煤场', '出煤仓']
      };
   },
   onShow() {
@@ -210,6 +308,14 @@
                     active: false
                  };
               });
            this.carNoList = res.data
               .filter(v => v.conditionType == 6)
               .map(item => {
                  return {
                     ...item,
                     active: false
                  };
               });
         });
      },
      // 获取数据
@@ -255,6 +361,9 @@
            case 5:
               this.filedList[i].active = !this.filedList[i].active;
               break;
            case 6:
               this.carNoList[i].active = !this.carNoList[i].active;
               break;
         }
         const validateFn = key => (v, arr) => {
@@ -270,7 +379,8 @@
            customerName: this.customerList.filter(v => v.active == true).map(item => item.condition),
            xsUser2Name: this.forwarderList.filter(v => v.active == true).map(item => item.condition),
            fleetName: this.fleetList.filter(v => v.active == true).map(item => item.condition),
            filedName: this.filedList.filter(v => v.active == true).map(item => item.condition)
            filedName: this.filedList.filter(v => v.active == true).map(item => item.condition),
            carNo: this.carNoList.filter(v => v.active == true).map(item => item.condition)
         };
         const mapping = {
@@ -279,7 +389,8 @@
            customerName: validateFn('customerName'),
            xsUser2Name: validateFn('xsUser2Name'),
            fleetName: validateFn('fleetName'),
            filedName: validateFn('filedName')
            filedName: validateFn('filedName'),
            carNo: validateFn('carNo')
         };
         this.filterList = this.taskList.map(val => {
            return {
@@ -308,6 +419,83 @@
      },
      opencalendar() {
         this.$refs.calendar.open();
      },
      // 点击查看更多
      toggle(value) {
         switch (value) {
            case 0:
               if (!this.coalToggeleState) {
                  this.coalShow = this.coalTotal;
                  this.coalToggeleState = true;
               } else {
                  this.coalShow = 3;
                  this.coalToggeleState = false;
               }
               break;
            case 1:
               if (!this.typeToggeleState) {
                  this.typeShow = this.typeTotal;
                  this.typeToggeleState = true;
               } else {
                  this.typeShow = 3;
                  this.typeToggeleState = false;
               }
               break;
            case 2:
               if (!this.customerToggeleState) {
                  this.customerShow = this.customerTotal;
                  this.customerToggeleState = true;
               } else {
                  this.customerShow = 3;
                  this.customerToggeleState = false;
               }
               break;
            case 3:
               if (!this.forwarderToggeleState) {
                  this.forwarderShow = this.forwarderTotal;
                  this.forwarderToggeleState = true;
               } else {
                  this.forwarderShow = 3;
                  this.forwarderToggeleState = false;
               }
               break;
            case 4:
               if (!this.fleetToggeleState) {
                  this.fleetShow = this.fleetTotal;
                  this.fleetToggeleState = true;
               } else {
                  this.fleetShow = 3;
                  this.fleetToggeleState = false;
               }
               break;
            case 5:
               if (!this.filedToggeleState) {
                  this.filedShow = this.filedTotal;
                  this.filedToggeleState = true;
               } else {
                  this.filedShow = 3;
                  this.filedToggeleState = false;
               }
               break;
            case 6:
               if (!this.carNoToggeleState) {
                  this.carNoShow = this.carNoTotal;
                  this.carNoToggeleState = true;
               } else {
                  this.carNoShow = 3;
                  this.carNoToggeleState = false;
               }
               break;
         }
      },
      // 跳转发运详情
      faYunDetail(takeCoalId) {
         uni.navigateTo({
            url: `/pages/public-page/faYunstatisticsDetails/faYunstatisticsDetails?id=${takeCoalId}`
         });
      },
      confirm() {
         this.modalShow = false;
      }
   },
   computed: {
@@ -319,12 +507,32 @@
      },
      dateselect() {
         return `${this.first}-${this.last}`;
      },
      coalTotal() {
         return this.coalList.length;
      },
      typeTotal() {
         return this.typeList.length;
      },
      customerTotal() {
         return this.customerList.length;
      },
      forwarderTotal() {
         return this.forwarderList.length;
      },
      fleetTotal() {
         return this.fleetList.length;
      },
      filedTotal() {
         return this.filedList.length;
      },
      carNoTotal() {
         return this.carNoList.length;
      }
   },
   watch: {
      dateselect(newV, old) {
         let tempDate = `${this.first}-${this.last}`;
         console.log(newV, '新', old, '旧', tempDate, '一开始');
         if (newV != old && old != '-') {
            this.first = newV.slice(0, 10);
            this.last = newV.slice(11);
@@ -364,7 +572,7 @@
         justify-content: space-between;
         align-items: center;
         .content-text {
            width: vww(80);
            width: 33.3%;
            height: vww(30);
            font-size: vww(20);
            color: #393a3c;
@@ -410,6 +618,12 @@
                     margin-left: vww(48);
                  }
               }
               .toggle-button {
                  margin: vww(12) auto;
                  position: relative;
                  left: -10%;
                  transform: translateX(-50%);
               }
            }
         }
      }