ll
liukangdong
2025-02-06 68b9deaca3da75f1ea0da8943065a2016c9ead2d
h5/pages/staff/vehicle/sendACar.vue
@@ -7,8 +7,7 @@
        <u-icon class="ml12" name="arrow-down" color="#999999" />
      </view>
      <view class="item" @click="isShowCar = true">
        <text v-if="param.carCode">{{ param.carCode }}</text>
        <text v-else class="placeholder9">选择车辆</text>
        <text>{{ param.carCode || '全部车辆' }}</text>
        <u-icon class="ml12" name="arrow-down" color="#999999" />
      </view>
    </view>
@@ -18,7 +17,7 @@
        class="box_list_item"
        v-for="(item, index) in dataList"
        :key="index"
            @click="itemDetail(item)"
        @click="itemDetail(item)"
      >
        <view class="box_list_item_head">
          <text>{{ item.carCode }}</text>
@@ -47,6 +46,14 @@
          </view>
        </view>
      </view>
      <view v-if="dataList.length === 0" style="text-align: center">
        <image
          src="@/static/empty.png"
          style="width: 320rpx; margin: 120rpx auto 0"
          mode="widthFix"
        />
        <view class="placeholder9 fs24">暂无数据</view>
      </view>
    </view>
    <!-- 选择车辆 -->
    <u-picker
@@ -61,10 +68,11 @@
    <!-- 日期 -->
    <u-datetime-picker
      mode="date"
      v-model="param.queryDate"
      :show="isShowDate"
      :minDate="minDate"
      closeOnClickOverlay
      @close="isShowDate = false"
      :closeOnClickOverlay="true"
      @confirm="seletedDate"
      @cancel="isShowDate = false"
    />
@@ -81,15 +89,16 @@
      isShowDate: false,
      carsList: [],
      param: {
        memberId: uni.getStorageSync('userInfo').memberId
        queryDate: dayjs().format('YYYY-MM-DD'),
        // memberId: uni.getStorageSync('userInfo').memberId
      },
      minDate: '',
      pagination: {
        page: 0,
        capacity: 10
        capacity: 6
      },
      total: 0,
      dataList: []
      dataList: [],
    }
  },
  onLoad() {
@@ -99,48 +108,55 @@
    this.initData()
  },
  onReachBottom() {
    if (this.total > 10) {
      console.log('onReachBottom');
    if (this.total > this.dataList.length) {
      this.getList()
    }
    }else {
         this.showToast('暂无更多数据')
      }
  },
  methods: {
    getList() {
      const { param, pagination } = this
      pagination.page = pagination.page + 1
      if (param.queryDate) {
        param.queryStartTime = param.queryDate + ' 00:00:00'
        param.queryEndTime = param.queryDate + ' 23:59:59'
      }
         if(param.carCode == '全部车辆'){
            param.carCode = null
            param.carId = null
         }
      carUseBookPaiche({
        ...pagination,
        model: { ...param }
      }).then(res => {
        if (pagination.page === 1) {
          this.dataList = res.data.records
        } else {
          this.dataList = [...list, ...res.data.records]
        }
        this.dataList = [...this.dataList, ...res.data.records]
        this.total = res.data.total
      })
    },
      itemDetail(item) {
         uni.navigateTo({
            url: "/pages/staff/vehicle/sendACarDetail?id=" + item.id
         })
      },
    itemDetail(item) {
      uni.navigateTo({
        url: `/pages/staff/vehicle/sendACarDetail?id=${item.id}`
      })
    },
    seletedCar(e) {
      const item = e.value[0]
      this.pagination.page = 0
         this.dataList = []
      this.$set(this.param, 'carCode', item.code)
      this.$set(this.param, 'carId', item.id)
      this.isShowCar = false
      if (this.param.carId && this.param.queryDate) {
        this.pagination.page = 0
        this.getList()
      }
      this.getList()
    },
    seletedDate(e) {
      this.param.queryDate = dayjs(e.value).format('YYYY-MM-DD')
      this.isShowDate = false
      if (this.param.carId && this.param.queryDate) {
      setTimeout(() => {
        this.param.queryDate = dayjs(e.value).format('YYYY-MM-DD')
        this.pagination.page = 0
        this.isShowDate = false
            this.dataList = []
        this.getList()
      }
      })
    },
    endtimeClose() {
      this.param.endTime = ''
@@ -155,9 +171,9 @@
    },
    initData() {
      getCarsList({
        type: 1
        type: 0
      }).then(res => {
        this.carsList = [res.data]
        this.carsList = [[{ code: '全部车辆', id: '' }, ...res.data]]
      })
    },
  }
@@ -167,12 +183,13 @@
<style lang="scss">
.main_app {
  background: #f7f7f7;
  min-height: 100vh;
  padding: 0;
}
.app_header {
  display: flex;
  align-items: center;
  margin: 0 -15rpx;
  // margin: 0 -15rpx;
  background-color: #fff;
  .item {
    width: 360rpx;
@@ -214,13 +231,13 @@
      .error {
        color: #e0312a;
      }
         .grr{
            color: #999999;
         }
      .grr {
        color: #999999;
      }
      text {
        &:nth-child(1) {
          font-size: 32rpx;
          font-weight: 500;
          font-weight: 600;
          color: #222222;
        }
        &:nth-child(2) {