qingyiay
2023-09-25 f46eb243908e145da448f65bffb8ba17197d9164
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
<template>
    <view>
        <view style="position: relative;">
            <u-empty mode="data"
                icon="http://cdn.uviewui.com/uview/empty/data.png"
                textSize="30"
                iconSize="1000"
                text="暂无数据"
                v-if="detailData.length == 0"></u-empty>
        </view>
        <view class="collection-form">
            <view class="collection-form-item"
                v-for="(item, index) in detailData"
                :key="index">
                <view class="weigh-item">
                    <view class="item">
                        <view class="concrete"
                            :style="{ backgroundImage: `url(${onlineurl}/appimg/image/banner/skin.png)`, backgroundSize: 'cover', backgroundRepeat: 'no-repeat' }">
                            皮
                        </view>
                        <view class="num">{{ item.skin }}</view>
                    </view>
                    <view class="item">
                        <view class="concrete"
                            :style="{ backgroundImage: `url(${onlineurl}/appimg/image/banner/hair.png)`, backgroundSize: 'cover', backgroundRepeat: 'no-repeat' }">
                            毛
                        </view>
                        <view class="num">{{ item.hair }}</view>
                    </view>
                </view>
                <view class="info-container">
                    <view class="info-block">
                        <view class="car-num info">
                            <text class="label-text">车牌号:</text>{{item.carNo}}
                        </view>
                        <view class="order-margin info">
                            <text class="label-text">煤种名称:</text>
                            {{item.coalName}}
                        </view>
                        <view class="order-type info">
                            订单类型:{{item.orderType}}
                        </view>
                        <view class="file-name info">
                            状态:{{coalStatus[item.status]}}
                        </view>
                    </view>
                </view>
                <view class="confirm-button">
                    <u-button plain
                        type="primary"
                        text="确定装卸"
                        shape="circle"
                        @click.stop="loadOrder(item.id)"
                        :loading="loading"
                        loadingText="确认"
                        v-if='!item.ableDischar'></u-button>
                </view>
            </view>
        </view>
        <u-modal :show="loadShow"
            content='确认装卸此提煤单'
            :showCancelButton="true"
            @confirm="confirmUnload"
            @cancel="cancelUnload"></u-modal>
    </view>
</template>
 
<script>
    import { onlineurl } from '@/api/request.js'
    export default {
        data() {
            return {
                name: "",
                detailData: [],
                onlineurl,
                loadShow: false, // 确认弹窗控制
                loading: false,
                id: "",
                coalStatus: ['领取', '预约', '签到', '入场', '称皮', '称毛', '离场', '入磅房', '出磅房', '入煤仓', '出煤仓', '放空', '作废', '入场申请',
                    '进入场院', '异常审核中',
                ], // 状态
            }
        },
        onLoad(params) {
            this.name = params.coalName ? params.coalName : ''
            this.init()
        },
        methods: {
            onPullDownRefresh() {
                this.init()
                uni.stopPullDownRefresh();
            },
            init() {
                uni.showLoading({
                    title: "加载中"
                })
                this.$reqGet('getAccordingCoalNameAll', { coalName: this.name }).then(res => {
                    uni.hideLoading()
                    if (res.code === 0) {
                        const errorStatusArr = [0, 1, 2, 3, 6, 11, 12, 13];
                        this.detailData = res.data.map(v => {
                            return {
                                ...v,
                                ableDischar: v.skin === v.hair || v.hair === 0 && v.skin === 0 || v
                                    .isPretendDischar !== 0 || errorStatusArr.indexOf(v.status) !== -1
                            }
                        })
                    } else {
                        this.$u.toast('加载失败')
                    }
                })
            },
            loadOrder(id) {
                this.loadShow = true;
                this.id = id;
            },
            confirmUnload() {
                this.loadShow = false;
                this.loading = true
                this.$reqPost('confirmLoadAndUnload', { tmId: this.id }, 'params').then(res => {
                    this.loading = false;
                    if (res.code === 0) {
                        this.$u.toast('装卸成功')
                        this.init()
                    } else {
                        this.$u.toast(res.msg ? res.msg : '装卸失败')
                    }
                })
            },
            cancelUnload() {
                this.loadShow = false
            },
        }
    }
</script>
 
<style lang="scss"
    scoped>
    .collection-form {
        width: vww(345);
        margin: 0 vww(15);
        position: relative;
 
        .collection-form-item {
            width: 690rpx;
            height: 380rpx;
            background: #ffffff;
            box-shadow: 4rpx 6rpx 25rpx 0rpx rgba(73, 120, 240, 0.15);
            border-radius: 20rpx;
            overflow: hidden;
            @include flex;
            flex-direction: column;
            position: relative;
            justify-content: center;
            margin-top: vww(10);
 
            .weigh-item {
                width: 94%;
                height: vww(36);
                margin: 0 vww(10);
                @include flex;
                justify-content: space-around;
                position: relative;
                top: vww(-14);
 
                .item {
                    min-width: vww(50);
                    height: vww(45);
                    font-size: 21rpx;
                    font-weight: 400;
                    color: #ffffff;
                    text-align: center;
                    line-height: vww(30);
                    @include flex;
 
                    .concrete {
                        width: vww(36);
                        height: vww(36);
                    }
 
                    .num {
                        font-size: 40rpx;
                        font-weight: 300;
                        color: #303030;
                    }
                }
            }
 
            .info-container {
                width: 100%;
                height: vww(100);
                display: flex;
                justify-content: center;
 
                .info-block {
                    width: 600rpx;
                    height: vww(80);
                    display: flex;
                    justify-content: center;
                    flex-wrap: wrap;
 
                    .car-num,
                    .order-margin {
                        color: #FF0000;
                        font-weight: 600;
 
                        .label-text {
                            color: #409eff;
                        }
                    }
 
                }
 
                .info {
                    width: 45%;
                    height: vww(20);
                    color: #515151;
                    margin: vww(5);
                }
            }
 
 
            .confirm-button {
                width: vww(80);
                position: absolute;
                bottom: vww(6);
                right: vww(10);
            }
        }
    }
</style>