ll
liukangdong
2024-08-29 986118de12da6830ffb0c86af8e70567352c9bb9
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
<template>
    <view class="main_app">
        <view class="main_name">
            <text class="mr12">{{ platformObj.name }}</text>
            <!-- <u-icon name="arrow-down" color="#777777"></u-icon> -->
        </view>
        <!--  -->
        <view class="main_list">
            <view class="item" :class="{ active: item.driverId == driverInfo.memberId }" v-for="item in dataList" :key="item.id">
                <view class="status padding" v-if="item.status == 2">排队中</view>
                <view class="status" v-else :class="{ padding: item.status != 5 }">{{ statusMap[item.status] }}</view>
                <view v-if="item.driverId == driverInfo.memberId" class="me">我</view>
                <image v-if="item.driverId == driverInfo.memberId" class="avatar" src="@/static/driver/ic_truck_mine@2x.png" mode=""></image>
                <image v-else class="avatar" src="@/static/driver/ic_truck@2x.png" mode=""></image>
                <view class="content">
                    <view class="id_card" v-if="item.carCodeFront">{{ item.carCodeFront.slice(0, 4) }}**{{ item.carCodeFront.slice(6) }}</view>
                    <view class="line">
                        <view class="address">{{ item.platformName || '等待分配月台' }}</view>
                        <view class="time" v-if="item.status == 5">
                            <u-icon class="mr6" name="clock" color="#4d98a8"></u-icon>
                            <text>{{item.callDateTemp}}</text>
                        </view>
                    </view>
                </view>
            </view>
        </view>
    </view>
</template>
 
<script>
import { driverLineUpDetail } from '@/api';
import { statusMap } from '@/utils/config.js';
import dayjs from 'dayjs';
import duration from 'dayjs/plugin/duration'
dayjs.extend(duration)
export default {
    data() {
        return {
            statusMap,
            platformId: '',
            type: '',
            dataList: [],
            platformObj: {},
            driverInfo: uni.getStorageSync('driverInfo')
        };
    },
    onLoad(option) {
        this.type = option.type;
        this.platformId = option.platformId;
        this.getData(option.jobId || '');
    },
    methods: {
        getData(jobId) {
            const { platformId, type } = this;
            driverLineUpDetail({
                mobile: jobId ? '' : uni.getStorageSync('driverInfo').mobile,
                queryType: jobId ? 1 : 0,
                jobId: jobId
            }).then(res => {
                this.platformGroupList = res.data.platformGroupList;
                if (res.data && res.data.platformGroupList && res.data.platformGroupList.length > 0) {
                    res.data.platformGroupList.forEach(item => {
                        if (item.id == platformId) {
                            this.platformObj = { ...item };
                            if (type == 0) {
                                this.dataList = item.signJobList;
                            } else {
                                this.dataList = item.workJobList;
                            }
                            this.circulInitTaskList()
                            setInterval(() => {
                                this.circulInitTaskList()
                            }, 1000)
                        }
                    });
                }
            });
        },
        circulInitTaskList() {
                let time = new Date();
                this.dataList.forEach(item => {
                    if (item.callDate) {
                        let timeNum = time.getTime() - new Date(item.callDate).getTime();
                        if (timeNum > 3600000) {
                            item.callDateTemp = dayjs.duration(timeNum).format('HH:mm:ss');
                        } else {
                            item.callDateTemp = dayjs.duration(timeNum).format('mm:ss');
                        }
                    }
                    if (item.startDate) {
                        let timeNum = time.getTime() - new Date(item.startDate).getTime();
                        if (timeNum > 3600000) {
                            item.startDateTemp = dayjs.duration(timeNum).format('HH:mm:ss');
                        } else {
                            item.startDateTemp = dayjs.duration(timeNum).format('mm:ss');
                        }
                    }
                });
                this.$forceUpdate();
        }
    }
};
</script>
 
<style lang="scss">
page {
    background-color: #f7f7f7;
}
.main_app {
    .main_name {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 104rpx;
        font-weight: 600;
        font-size: 32rpx;
        color: #111111;
        background-color: #fff;
        margin: 0 -30rpx 20rpx;
    }
    .main_list {
        .item {
            display: flex;
            align-items: center;
            position: relative;
            padding: 30rpx;
            background-color: #fff;
            margin-bottom: 20rpx;
            border-radius: 8rpx;
            .status {
                position: absolute;
                top: 0;
                right: 0;
                height: 50rpx;
                line-height: 50rpx;
                padding: 0 20rpx;
                background: $uni-color-primary;
                color: #fff;
                font-size: 26rpx;
                border-radius: 0rpx 8rpx 0rpx 25rpx;
            }
            .me {
                position: absolute;
                top: 0;
                left: 0;
                background: #00ba67;
                border-radius: 8rpx 0rpx 8rpx 0rpx;
                height: 42rpx;
                line-height: 42rpx;
                width: 64rpx;
                text-align: center;
                color: #fff;
                font-size: 24rpx;
                z-index: 11;
            }
            .padding {
                background: #e9f5f6;
                color: $uni-color-primary;
            }
            .avatar {
                width: 84rpx;
                height: 84rpx;
                margin-right: 20rpx;
                background-color: #fff;
            }
            .content {
                flex: 1;
                .id_card {
                    font-weight: 500;
                    font-size: 30rpx;
                    color: #111111;
                }
                .line {
                    display: flex;
                    justify-content: space-between;
                    align-items: center;
                    font-size: 26rpx;
                    color: #999999;
                    margin-top: 6rpx;
                    .time {
                        display: flex;
                        align-items: center;
                        color: $uni-color-primary;
                    }
                }
            }
        }
        .active {
            background: linear-gradient(270deg, #ffffff 0%, #e1f7fe 100%);
        }
    }
}
</style>