wk
2024-06-13 9acf4430b2a93bd6db86908663fc843fce040429
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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
<template>
        <view class="appointment">
            <view class="searchview">
                <u-search @change="change" :searchIconSize="40" placeholder="请输入车牌号" height="80" clearabled v-model="carNo" @search="search" @custom="custom" @clear="clear" >
                </u-search >
            </view>
            <uni-table border
                stripe
                emptyText="暂无更多数据">
                <uni-tr>
                    <uni-th align="center">司机</uni-th>
                    <uni-th align="center">产品</uni-th>
                    <uni-th align="center">车牌号</uni-th>
                    <uni-th align="center">手机号</uni-th>
                    <uni-th align="center">预约时间段</uni-th>
                    <uni-th align="center">操作</uni-th>
                </uni-tr>
                <uni-tr v-for="(item, index) in driverBillOfLoadingData"
                    :key="item.id">
                    <uni-td align="center">{{ item.driver  }}</uni-td>
                    <uni-td align="center">{{ item.productName || '' }}</uni-td>
                    <uni-td align="center">{{ item.carNo || '' }}</uni-td>
                    <uni-td align="center">{{ item.phone || '' }}</uni-td>
                    <uni-td align="center">{{ item.startTime || '' }}-{{item.endTime || ""}}</uni-td>
                    <uni-td>
                        <view class="buttons">
                            <u-button text="查看运输证"
                                type="primary"
                                class="buttonitem"
                                v-if="item.roadTransportId"
                                @click="lookRoad(item)"></u-button>
                            <u-button text="检查"
                                type="primary"
                                class="buttonitem"
                                @click="yuYueBtnClick(item)"></u-button>
                        </view>
                    </uni-td>
                </uni-tr>
            </uni-table>
            <u-popup :show="imgshow"
                @close="closeimg"
                @open="openimg"
                mode="center"
                round="10">
                <view class="imgrPopup">
                        <u--image :showLoading="true"
                            :src="certificateImg != null ? BaseUrl + certificateImg : ''"
                            width="500rpx"
                            height="400rpx"
                            @click="imageClick(certificateImg)">
                            <view slot="error"
                                style="font-size: 24rpx;">加载失败</view>
                        </u--image>
                </view>
            </u-popup>
            <view class="previewImage-container">
                <u-popup :show="previewImageShow"
                    mode="center"
                    @close="previewImageClose"
                    @open="previewImageOpen">
                    <u--image :src="previewImageSrc != null ? BaseUrl + previewImageSrc : ''"
                        width="400px"
                        height="400px"></u--image>
                </u-popup>
            </view>
            <u-popup :show="show"
                @close="close"
                @open="open"
                mode="center"
                round="10">
                <view class="receiverPopup">
                    <uni-table border
                        stripe
                        type="selection"  
                        @selection-change="selectionChange"
                        emptyText="暂无更多数据">
                        <uni-tr>
                            <uni-th align="center">检测项</uni-th>
                        </uni-tr>
                        <uni-tr v-for="(item, index) in inspectData"
                            :key="item.id">
                            <uni-td align="center">{{ item.title  }}</uni-td>
                        </uni-tr>
                    </uni-table>
                    <view class="receiverPopup__title"><text>确定检查完毕</text></view>
                    <view class="receiverPopup__btn"><u-button text="确定"
                            type="primary"
                            @click="popClick"
                            :loading="ClickLoading"></u-button></view>
                </view>
            </u-popup>
        </view>
</template>
 
<script>
    import { BaseUrl } from '@/api/publicInterface.js';
    export default {
        components: {
        },
        data() {
            return {
                show: false, // 弹出全部领取提示
                driverBillOfLoadingData:[],
                inspectData:[],
                isAllSelected:false,
                form:{},                
                BaseUrl,
                carNo:'',
                previewImageShow:false,
                imgshow:false,
                ClickLoading:false,
                certificateImg:"",
                previewImageSrc:""
            }
        },
        onShow() {
            this.init();
        },
        methods: {
            imageClick(data) {
                this.previewImageSrc = data;
                this.$nextTick(() => {
                    this.previewImageShow = true;
                });
            },
            previewImageClose() {
                this.previewImageShow = false;
            },
            previewImageOpen() {},
            imageClick(data) {
                this.previewImageSrc = data;
                this.$nextTick(() => {
                    this.previewImageShow = true;
                });
            },
            lookRoad(item){
                this.$reqGetId('getById', item.roadTransportId).then(res => {
                    this.certificateImg=res.data.certificateImg
                    this.imgshow=true
                });
            },
            yuYueBtnClick(item){
                let char = "运输证";
                if (item.inspectedResult.includes(char)) {
                    if(item.roadTransportId){
                        if(item.inspectedResult){
                            this.inspectData=JSON.parse(item.inspectedResult)
                            this.form=item
                            this.show = true;
                        }else{
                            this.inspectData=[]
                            this.form=item
                            uni.showLoading({ title: '加载中...' });
                            this.$reqPost('addCheckLog',{
                                            carNo:this.form.carNo,
                                            taskId:this.form.id,
                                            taskcode:this.form.code,
                                        }, 'json').then(res => {
                                if (res.code === 0) {
                                    uni.$u.toast('检查成功')
                                    this.form={}
                                    this.ClickLoading = false;
                                    this.show = false;
                                    this.TaskCoalList()
                                } else {
                                    uni.$u.toast(res.msg ? res.msg : '检查失败')
                                }
                            })
                        }
                    }else{
                        uni.$u.toast('该司机未上传运输证!')
                    }
                } else {
                   if(item.inspectedResult){
                       this.inspectData=JSON.parse(item.inspectedResult)
                       this.form=item
                       this.show = true;
                   }else{
                       this.inspectData=[]
                       this.form=item
                       uni.showLoading({ title: '加载中...' });
                       this.$reqPost('addCheckLog',{
                                       carNo:this.form.carNo,
                                       taskId:this.form.id,
                                       taskcode:this.form.code,
                                   }, 'json').then(res => {
                           if (res.code === 0) {
                               uni.$u.toast('检查成功')
                               this.form={}
                               this.ClickLoading = false;
                               this.show = false;
                               this.TaskCoalList()
                           } else {
                               uni.$u.toast(res.msg ? res.msg : '检查失败')
                           }
                       })
                   }
                }
                
            },
            selectionChange(items){
              const allIds = this.inspectData.map(item => item);
              this.isAllSelected = items?.detail.index.length === allIds.length 
            },
            init() {
                this.isAllSelected=false
                this.TaskCoalList();
                this.form={}
                this.inspectData=[]
                this.certificateImg=""
            },
            popClick() {
                    if(this.isAllSelected==true){
                        this.ClickLoading = true;
                        this.inspectData=this.inspectData.map(item=>{
                            return {
                                ...item,
                                valve:"通过"
                            }
                        })
                        uni.showLoading({ title: '加载中...' });
                        this.$reqPost('addCheckLog',{
                                        carNo:this.form.carNo,
                                        taskId:this.form.id,
                                        taskcode:this.form.code,
                                        inspectedResult:JSON.stringify(this.inspectData)
                                    }, 'json').then(res => {
                            if (res.code === 0) {
                                uni.$u.toast('检查成功')
                                this.form={}
                                this.ClickLoading = false;
                                this.inspectData=[]
                                this.show = false;
                                this.TaskCoalList()
                            } else {
                                uni.$u.toast(res.msg ? res.msg : '检查失败')
                            }
                        })
                    }else{
                        uni.$u.toast('必须全部检测')
                    }
            },
            open() {},
            close() {
                this.show = false;
            },
            openimg() {},
            closeimg() {
                this.imgshow = false;
            },
            // 司机首页列表
            TaskCoalList() {
                uni.showLoading({
                    title: '加载中...'
                });
                
                if(!this.carNo){
                    this.$reqGet('getCheckTaskCoal',{flag:0}).then(res => {
                        uni.hideLoading();
                        this.driverBillOfLoadingData = res.data;
                    });
                }else{
                    this.$reqGet('getCheckTaskCoal',{flag:0,carNo:this.carNo}).then(res => {
                        uni.hideLoading();
                        this.driverBillOfLoadingData = res.data;
                    });
                }
                
                
            },
            change(res) {
                console.log(res)
            },
            search(res) {
                console.log(res)
                this.TaskCoalList()
            },
            clear(res) {
                this.carNo=""
            },
            custom(res) {
                console.log(res)
            }
        }
    };
</script>
 
<style lang="scss" scoped>
    .searchview{
        margin: 20rpx 0;
        height: 200rpx;
        u-search{
            width: 100rpx;
        }
    }
    .imgrPopup{
        width: 500rpx;
        height: 400rpx;
    }
    .receiverPopup {
        height: vww(110);
        width: 300rpx;
        
        .receiverPopup__title {
            margin: vww(10) auto 0;
            width: 80%;
            text-align: center;
        }
    
    
        &__btn {
            margin: vww(10) auto;
            width: 50%;
    
            .u-button {
                height: vww(20);
            }
        }
    }
    ::v-deep.appointment {
        .appointment-description {
            margin: vww(8) 0;
            color: #fd1446;
 
            text {
                font-weight: bold;
                display: inline-block;
                margin-left: vww(5);
                color: #252525;
            }
        }
        @mixin fourthLine {
            width: 64%;
            height: vww(68);
            display: flex;
            align-items: center;
            position: relative;
            left: vww(102);
            bottom: vww(3);
        
            .button-img {
                width: vww(122);
                height: vww(41);
                background: url('https://mx.jzeg.cn:9096/appimg/image/banner/button.png') no-repeat;
                background-size: cover;
                font-size: 28rpx;
                font-weight: 300;
                color: #ffffff;
                text-align: center;
                line-height: vww(40);
        
            }
        }
        .fourth-line {
            @include fourthLine;
        }
 
        // 表格
        .uni-table-scroll {
            width: 100%;
            overflow-x: hidden;
 
            .uni-table {
                min-width: 0 !important;
 
                .uni-table-tr {
                    padding: 0;
                    font-size: vww(10);
 
                    .uni-table-th {
                        height: vww(32);
                        line-height: vww(20);
                        padding: vww(5) vww(10);
                        color: #111111;
                        font-weight: 550;
                        background: #f5f5f5;
                    }
 
                    .uni-table-td {
                        height: vww(32);
                        line-height: vww(20);
                        padding: vww(5) vww(5);
                        color: #111111;
                        .u-button {
                            height: vww(23);
                        }
                    }
                }
            }
        }
    }
    .wait-appointment,
    .Reserved {
        position: relative;
        top: vww(-120);
    }
    .buttons{
        display: flex;
        justify-content: space-between;
        .buttonitem{
            width: 30%;
        }
    }
</style>