ll
liukangdong
2025-02-06 68b9deaca3da75f1ea0da8943065a2016c9ead2d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<template>
  <view class="main_app">
    <view class="app_header">
      <view class="item" @click="isShowDate = true">
        <text v-if="param.queryDate">{{ param.queryDate }}</text>
        <text v-else class="placeholder9">选择日期</text>
        <u-icon class="ml12" name="arrow-down" color="#999999" />
      </view>
      <view class="item" @click="isShowCar = true">
        <text>{{ param.carCode || '全部车辆' }}</text>
        <u-icon class="ml12" name="arrow-down" color="#999999" />
      </view>
    </view>
    <!--  -->
    <view class="box_list">
      <view
        class="box_list_item"
        v-for="(item, index) in dataList"
        :key="index"
        @click="itemDetail(item)"
      >
        <view class="box_list_item_head">
          <text>{{ item.carCode }}</text>
          <text class="loading" v-if="item.status == '0'">申请中</text>
          <text class="grr" v-if="item.status == '1'">审批中</text>
          <text class="grr" v-if="item.status == '2'">审批通过</text>
          <text class="error" v-if="item.status == '3'">审批不通过</text>
          <text class="grr" v-if="item.status == '4'">已取消</text>
        </view>
        <view class="box_list_item_nr">
          <view class="box_list_item_nr_item">
            <text>开始时间:</text>
            <text>{{ item.startTime.slice(5, 16) }}</text>
          </view>
          <view class="box_list_item_nr_item">
            <text>结束时间:</text>
            <text>{{ item.endTime.slice(5, 16) }}</text>
          </view>
          <view class="box_list_item_nr_item">
            <text>预约人:</text>
            <text>{{ item.memberName }}</text>
          </view>
          <view class="box_list_item_nr_item">
            <text>目的地:</text>
            <text>{{ item.addr }}</text>
          </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
      keyName="code"
      :show="isShowCar"
      @close="isShowCar = false"
      :closeOnClickOverlay="true"
      :columns="carsList"
      @confirm="seletedCar"
      @cancel="isShowCar = false"
    ></u-picker>
    <!-- 日期 -->
    <u-datetime-picker
      mode="date"
      v-model="param.queryDate"
      :show="isShowDate"
      :minDate="minDate"
      closeOnClickOverlay
      @close="isShowDate = false"
      @confirm="seletedDate"
      @cancel="isShowDate = false"
    />
  </view>
</template>
 
<script>
import { carUseBookPaiche, getCarsList } from '@/api'
import dayjs from 'dayjs'
export default {
  data() {
    return {
      isShowCar: false,
      isShowDate: false,
      carsList: [],
      param: {
        queryDate: dayjs().format('YYYY-MM-DD'),
        // memberId: uni.getStorageSync('userInfo').memberId
      },
      minDate: '',
      pagination: {
        page: 0,
        capacity: 6
      },
      total: 0,
      dataList: [],
    }
  },
  onLoad() {
    this.minDate = new Date(dayjs().format('YYYY') + '-01-01').getTime()
    // this.param.queryDate = dayjs().format('YYYY-MM-DD')
    this.getList()
    this.initData()
  },
  onReachBottom() {
        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 => {
        this.dataList = [...this.dataList, ...res.data.records]
        this.total = res.data.total
      })
    },
    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
      this.getList()
    },
    seletedDate(e) {
      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 = ''
      this.param.startTime = ''
      this.isShowEndDate = false
    },
    timeFilter(mode, options) {
      if (mode === 'minute') {
        return options.filter(option => option === '00' || option === '30' || option === '60')
      }
      return options
    },
    initData() {
      getCarsList({
        type: 0
      }).then(res => {
        this.carsList = [[{ code: '全部车辆', id: '' }, ...res.data]]
      })
    },
  }
};
</script>
 
<style lang="scss">
.main_app {
  background: #f7f7f7;
  min-height: 100vh;
  padding: 0;
}
.app_header {
  display: flex;
  align-items: center;
  // margin: 0 -15rpx;
  background-color: #fff;
  .item {
    width: 360rpx;
    height: 72rpx;
    margin: 15rpx;
    padding: 0 30rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    align-items: center;
  }
}
.box_list {
  width: 100%;
  padding: 30rpx;
  box-sizing: border-box;
  .box_list_item {
    width: 100%;
    margin-bottom: 20rpx;
    &:last-child {
      margin: 0 !important;
    }
    .box_list_item_head {
      width: 100%;
      height: 100rpx;
      padding: 0 30rpx;
      box-sizing: border-box;
      background: linear-gradient(270deg, #fefeff 0%, #e1f7fe 100%);
      border-radius: 8rpx 8rpx 0rpx 0rpx;
      display: flex;
      align-items: center;
      justify-content: space-between;
      .loading {
        color: #4c99a8;
      }
      .success {
        color: #03c68f;
      }
      .error {
        color: #e0312a;
      }
      .grr {
        color: #999999;
      }
      text {
        &:nth-child(1) {
          font-size: 32rpx;
          font-weight: 600;
          color: #222222;
        }
        &:nth-child(2) {
          font-size: 26rpx;
          font-weight: 400;
        }
      }
    }
    .box_list_item_nr {
      padding: 30rpx;
      width: 100%;
      box-sizing: border-box;
      background-color: #ffffff;
      .box_list_item_nr_item {
        width: 100%;
        display: flex;
        align-items: center;
        margin-bottom: 20rpx;
        text {
          &:nth-child(1) {
            font-size: 26rpx;
            font-weight: 400;
            color: #666666;
          }
          &:nth-child(2) {
            font-size: 26rpx;
            font-weight: 400;
            color: #333333;
          }
        }
      }
    }
  }
}
</style>