qingyiay
2023-04-24 bb52e0d4baffe8e0486c951e525b6614bd4aaa28
pages/customer-page/customer-my/faYunstatistics/faYunstatistics.vue
@@ -4,144 +4,128 @@
         <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">
         <u-collapse>
            <u-collapse-item :title="dateRange" value="筛选">
               <view class="filter-main">
                  <view class="filter-body">
                     <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" 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>
                  <view class="filter-body">
                     <view class="condition-name">类型:</view>
                     <view class="filter-name">
                        <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">
                     <view class="condition-name">客户:</view>
                     <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>
                  <view class="filter-body" v-if="roleType == 1">
                     <view class="condition-name">货代:</view>
                     <view class="filter-name">
                        <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">
                     <view class="condition-name">车队:</view>
                     <view class="filter-name">
                        <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">
                     <view class="condition-name">矿场:</view>
                     <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">
                     <view class="condition-name">日期:</view>
                     <view class="filter-name">
                        <u-button :text="dateselect" @click="opencalendar"></u-button>
                        <view class="filter-button">
                           <uni-calendar
                              ref="calendar"
                              class="uni-calendar--hook"
                              :clear-date="true"
                              :date="info.date"
                              :insert="info.insert"
                              :lunar="info.lunar"
                              :startDate="info.startDate"
                              :endDate="info.endDate"
                              :range="info.range"
                              @confirm="confirm"
                           />
                        </view>
         <view class="filter-show">
            <view class="filtershow-date">{{ dateRange }}</view>
            <view class="filter-icon"><u-icon name="grid" :size="40" color="#9ec16c "></u-icon></view>
            <view class="filtershow-text" @click="showPopup">筛选</view>
         </view>
         <u-popup :show="conditinonShow" mode="top" :closeable="true" :closeOnClickOverlay="true" @close="conditinonclose">
            <view class="filter-main">
               <view class="filter-body date-button">
                  <view class="condition-name">日期</view>
                  <view class="filter-name">
                     <u-button :text="dateselect" @click="opencalendar"></u-button>
                     <view class="filter-button ">
                        <uni-calendar
                           ref="calendar"
                           class="uni-calendar--hook"
                           :clear-date="true"
                           :date="info.date"
                           :insert="info.insert"
                           :lunar="info.lunar"
                           :startDate="info.startDate"
                           :endDate="info.endDate"
                           :range="info.range"
                           @confirm="confirm"
                        />
                     </view>
                  </view>
               </view>
            </u-collapse-item>
         </u-collapse>
               <view class="filter-body">
                  <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 :text="item.condition" :type="item.active ? 'success' : ''" size="small" v-if="index < coalShow"></u-button>
                     </view>
                     <view class="toggle-button">
                        <u-button :text="coalShow < coalTotal ? '查看更多' : '收起'" type="primary" size="small" @click="toggle(0)" v-if="coalTotal > 3"></u-button>
                     </view>
                  </view>
               </view>
               <view class="filter-body">
                  <view class="condition-name">类型</view>
                  <view class="filter-name">
                     <view class="filter-button" v-for="(item, index) in typeList" :key="index" @click="filterCondition(1, index, item.condition)">
                        <u-button :text="item.condition" :type="item.active ? 'success' : ''" size="small" v-if="index < typeShow"></u-button>
                     </view>
                     <view class="toggle-button">
                        <u-button :text="typeShow < typeTotal ? '查看更多' : '收起'" type="primary" size="small" @click="toggle(1)" v-if="typeTotal > 3"></u-button>
                     </view>
                  </view>
               </view>
               <view class="filter-body">
                  <view class="condition-name">客户</view>
                  <view class="filter-name">
                     <view class="filter-button" v-for="(item, index) in customerList" :key="index" @click="filterCondition(2, index, item.condition)">
                        <u-button :text="item.condition" :type="item.active ? 'success' : ''" size="small" v-if="index < customerShow"></u-button>
                     </view>
                     <view class="toggle-button">
                        <u-button
                           :text="customerShow < customerTotal ? '查看更多' : '收起'"
                           type="primary"
                           size="small"
                           @click="toggle(2)"
                           v-if="customerTotal > 3"
                        ></u-button>
                     </view>
                  </view>
               </view>
               <view class="filter-body" v-if="roleType == 1">
                  <view class="condition-name">货代</view>
                  <view class="filter-name">
                     <view class="filter-button" v-for="(item, index) in forwarderList" :key="index" @click="filterCondition(3, index, item.condition)">
                        <u-button :text="item.condition" :type="item.active ? 'success' : ''" v-if="index < forwarderShow"></u-button>
                     </view>
                     <view class="toggle-button">
                        <u-button
                           :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">
                  <view class="condition-name">车队</view>
                  <view class="filter-name">
                     <view class="filter-button" v-for="(item, index) in fleetList" :key="index" @click="filterCondition(4, index, item.condition)">
                        <u-button :text="item.condition" :type="item.active ? 'success' : ''" size="small" v-if="index < fleetShow"></u-button>
                     </view>
                     <view class="toggle-button">
                        <u-button :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">
                  <view class="condition-name">矿场</view>
                  <view class="filter-name">
                     <view class="filter-button" v-for="(item, index) in filedList" :key="index" @click="filterCondition(5, index, item.condition)">
                        <u-button :text="item.condition" :type="item.active ? 'success' : ''" size="small" v-if="index < filedShow"></u-button>
                     </view>
                     <view class="toggle-button">
                        <u-button :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 :text="item.condition" :type="item.active ? 'success' : ''" size="small" v-if="index < carNoShow"></u-button>
                     </view>
                     <view class="toggle-button">
                        <u-button :text="carNoShow < carNoTotal ? '查看更多' : '收起'" type="primary" size="small" @click="toggle(6)" v-if="carNoTotal > 3"></u-button>
                     </view>
                  </view>
               </view>
            </view>
         </u-popup>
      </view>
      <view class="date-information">
         <view class="statistics-card" v-for="(item, index) in filterList" :key="index">
@@ -155,11 +139,11 @@
                  }}吨
               </view>
            </view>
            <view class="card-main" v-for="(value, i) in item.taskCoalList" :key="i">
            <view class="card-main" v-for="(value, i) in item.taskCoalList" :key="i" @click="faYunDetail(value.id)">
               <view class="arrow-right"><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>
@@ -167,6 +151,7 @@
            </view>
         </view>
      </view>
      <tab-bar :current="1"></tab-bar>
   </view>
</template>
@@ -181,6 +166,7 @@
         forwarderList: [],
         fleetList: [],
         filedList: [],
         carNoList: [],
         isactive: false,
         info: {
            lunar: false,
@@ -194,6 +180,8 @@
         filterList: [],
         totalLength: 0,
         totalTon: 0,
         // 筛选弹出层
         conditinonShow: false,
         // 超过两行自动隐藏
         coalShow: 3,
         typeShow: 3,
@@ -201,12 +189,18 @@
         forwarderShow: 3,
         fleetShow: 3,
         filedShow: 3,
         carNoShow: 3,
         coalToggeleState: false,
         typeToggeleState: false,
         customerToggeleState: false,
         forwarderToggeleState: false,
         fleetToggeleState: false,
         filedToggeleState: false
         filedToggeleState: false,
         carNoToggeleState: false,
         // 点击右箭头详情弹窗
         faYunDetailobj: {},
         modalShow: false,
         coalStatus: ['领取', '预约', '签到', '入场', '称皮', '称毛', '离场', '入磅房', '出磅房', '入煤场', '出煤仓']
      };
   },
   onShow() {
@@ -283,6 +277,14 @@
                     active: false
                  };
               });
            this.carNoList = res.data
               .filter(v => v.conditionType == 6)
               .map(item => {
                  return {
                     ...item,
                     active: false
                  };
               });
         });
      },
      // 获取数据
@@ -328,6 +330,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) => {
@@ -343,7 +348,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 = {
@@ -352,7 +358,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 {
@@ -376,6 +383,7 @@
         }
      },
      confirm(e) {
         console.log(e, '日期选择');
         this.first = e.range.before;
         this.last = e.range.after;
      },
@@ -439,7 +447,30 @@
                  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}`
         });
      },
      // 打开筛选条件弹窗
      showPopup() {
         this.conditinonShow = true;
      },
      // 关闭筛选条件弹窗
      conditinonclose() {
         this.conditinonShow = false;
      }
   },
   computed: {
@@ -469,6 +500,9 @@
      },
      filedTotal() {
         return this.filedList.length;
      },
      carNoTotal() {
         return this.carNoList.length;
      }
   },
   watch: {
@@ -485,15 +519,14 @@
</script>
<style lang="scss" scoped>
::v-deep .u-cell__value {
   color: #9ec16c !important;
   font-size: vww(18) !important;
::v-deep .toggle-button .u-button {
   width: vww(40);
}
::v-deep .filter-name:nth-last-child(1) {
   .u-button {
      width: 66%;
   }
}
// ::v-deep .filter-name:nth-last-child(1) {
//    .u-button {
//       width: 66%;
//    }
// }
.main {
   width: 96%;
   margin: 0 auto;
@@ -513,7 +546,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;
@@ -527,11 +560,54 @@
      background-color: #fff;
      border: 1px solid #cccccc;
      border-radius: vww(5);
      .filter-show {
         width: 100%;
         height: vww(40);
         background-color: #fff;
         border-radius: vww(5);
         font-size: vww(18);
         color: #333;
         position: relative;
         display: flex;
         justify-content: space-between;
         align-items: center;
         .filtershow-date {
            font-size: vww(15);
            padding-left: vww(8);
         }
         .filter-icon {
            position: absolute;
            right: vww(45);
            top: vww(11);
         }
         .filtershow-text {
            color: #9ec16c;
            padding-right: vww(8);
            position: relative;
            &::before {
               content: '';
               position: absolute;
               width: 1px;
               height: vww(22);
               background-color: #dcdfe6;
               right: 94px;
               bottom: 0;
            }
         }
      }
      .filter-main {
         width: 100%;
         display: flex;
         flex-direction: column;
         justify-content: space-around;
         .date-button {
            width: 80%;
            height: vww(80);
            margin: vww(5) auto;
            .condition-name {
               margin-bottom: vww(10);
            }
         }
         .filter-body {
            width: 100%;
            position: relative;
@@ -539,28 +615,34 @@
            justify-content: flex-start;
            flex-wrap: wrap;
            .condition-name {
               margin-left: vww(15);
               margin-top: vww(10);
               font-size: vww(16);
               color: #686868;
            }
            .filter-name {
               width: 100%;
               width: 94%;
               margin: 0 auto;
               position: relative;
               display: flex;
               flex-wrap: wrap;
               justify-content: flex-start;
               align-items: flex-start;
               position: relative;
               top: vww(-34);
               .filter-button {
                  color: #393a3c;
                  height: vww(16);
                  padding: vww(8);
                  margin: vww(5) vww(5);
                  &:nth-child(1) {
                     margin-left: vww(48);
                  }
                  margin-bottom: vww(10);
               }
               .toggle-button {
                  margin-top: vww(12);
                  width: 30%;
                  display: flex;
                  justify-content: center;
                  position: absolute;
                  right: vww(-21);
                  top: vww(-23);
               }
            }
         }