#
zhou zhou
16 小时以前 8d3ebc610d048289f8ca4d8bc86ac11208a60fef
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
<template>
    <view class="page-container">
        <!-- 搜索框 -->
        <view class="search-bar">
            <uni-search-bar v-model="condition" placeholder=" 扫码 / 输入" bgColor="#F5F5F5" @confirm="search" @cancel="onCancelSearch" />
        </view>
        
        <!-- 订单列表 -->
        <view class="order-list">
            <view class="order-card" v-for="(item,i) in matList" :key="i" @click="toPrint(item)">
                <!-- 卡片头部 -->
                <view class="card-header">
                    <view class="order-badge" :class="getSettleClass(item.exceStatus)">
                        <text class="badge-text">{{item.exceStatus$ || '未知'}}</text>
                    </view>
                    <view class="order-no">
                        <text class="order-no-label">单据号</text>
                        <text class="order-no-value">{{item.code}}</text>
                    </view>
                </view>
                
                <!-- 卡片内容 -->
                <view class="card-body">
                    <view class="info-row">
                        <view class="info-item">
                            <text class="info-label">单据类型</text>
                            <text class="info-value">{{item.wkType$ || '-'}}</text>
                        </view>
                        <!-- <view class="info-item">
                            <text class="info-label">应出数量</text>
                            <text class="info-value">{{item.anfme || '-'}}</text>
                        </view> -->
                    </view>
                    <view class="info-row">
                        <view class="info-item">
                            <text class="info-label">应出数量</text>
                            <text class="info-value">{{item.anfme || '-'}}</text>
                        </view>
                        <view class="info-item">
                            <text class="info-label">完成数量</text>
                            <text class="info-value">{{item.qty || '-'}}</text>
                        </view>
                    </view>
                </view>
                
                
                <!-- 卡片底部 -->
                <view class="card-footer">
                    <text class="view-detail">查看详情</text>
                    <uni-icons type="right" size="14" color="#999"></uni-icons>
                </view>
            </view>
        </view>
        
        <!-- 空状态 -->
        <view class="empty-state" v-if="matList.length === 0 && !loading">
            <uni-icons type="search" size="60" color="#CCCCCC"></uni-icons>
            <text class="empty-text">暂无订单数据</text>
            <text class="empty-hint">下拉刷新试试</text>
        </view>
        
        <!-- 加载更多 -->
        <uni-load-more v-show="matList.length !== 0" :status="status" :icon-size="16" :content-text="contentText" />
    </view>
</template>
 
<script>
    import { request } from '@/common/request.js'
    export default {
        data() {
            return {
                tagList: [],
                matList: [],
                condition: '',
                loading: false,
                curr: 1,
                limit:5,
                status: 'more',
                contentText: {
                    contentdown: '上拉加载更多',
                    contentrefresh: '加载中',
                    contentnomore: '没有更多'
                },
                // 当前tagId
                tagIdNow: 1,
                orderTypeId:''
            }
        },
        // 下拉刷新
        onPullDownRefresh() {
            this.refreshData();
        },
        // 上拉加载更多
        onReachBottom() {
            if (this.status !== 'noMore') {
                this.status = 'loading';
                this.loadMoreData();
            }
        },
        onLoad() {
            let that = this
            const eventChannel = this.getOpenerEventChannel();
            if (eventChannel) {
                eventChannel.on('orderTypeId', function(data) {
                    that.orderTypeId = data.orderTypeId
                    console.log(data)
                })
            }
        },
        onShow() {
            // 每次进入页面重新加载
            this.refreshData();
        },
        methods: {
            // 刷新数据
            refreshData() {
                this.curr = 1;
                this.matList = [];
                this.status = 'more';
                this.loading = true;
                this.fetchOrderList(true);
            },
            // 加载更多数据
            loadMoreData() {
                this.fetchOrderList(false);
            },
            // 获取订单列表
            async fetchOrderList(isRefresh) {
                try {
                    const res = await request('/other/transferPage', {
                        curr: this.curr,
                        limit: this.limit,
                        orderNo: this.condition,
                        orderType: this.orderTypeId
                    }, 'GET', true);
                    
                    if (res.code === 200) {
                        let records = res.data.records || [];
                        if (records.length > 0) {
                            if (isRefresh) {
                                this.matList = records;
                            } else {
                                this.matList = this.matList.concat(records);
                            }
                            this.curr = this.curr + 1;
                            this.status = 'more';
                        } else {
                            this.status = 'noMore';
                        }
                    } else if (res.code === 403) {
                        uni.showToast({ title: res.msg, icon: "none", position: 'top' });
                        setTimeout(() => {
                            uni.reLaunch({ url: '../login/login' });
                        }, 1000);
                    } else {
                        uni.showToast({ title: res.msg, icon: "none", position: 'top' });
                    }
                } catch (err) {
                    // request.js 已经处理了错误提示
                } finally {
                    this.loading = false;
                    uni.stopPullDownRefresh();
                }
            },
            // 搜索
            async search() {
                if (!this.condition.trim()) {
                    this.refreshData();
                    return;
                }
                this.loading = true;
                try {
                    const res = await request('/other/transferPage', {
                        curr: this.curr,
                        limit: this.limit,
                        orderNo: this.condition
                    }, 'GET', true);
                    
                    if (res.code === 200) {
                        this.matList = res.data || [];
                        this.status = 'noMore';
                    } else if (res.code === 403) {
                        uni.showToast({ title: res.msg, icon: "none", position: 'top' });
                        setTimeout(() => {
                            uni.reLaunch({ url: '../login/login' });
                        }, 1000);
                    } else {
                        uni.showToast({ title: res.msg, icon: "none", position: 'top' });
                    }
                } catch (err) {
                    // request.js 已经处理了错误提示
                } finally {
                    this.loading = false;
                }
            },
            // 取消搜索
            onCancelSearch() {
                this.condition = '';
                this.refreshData();
            },
            // 根据状态返回样式类名
            getSettleClass(settle) {
                // settle: 1-待处理, 2-处理中, 3-已完成, 4-已取消 (根据实际情况调整)
                const classMap = {
                    1: 'badge-pending',
                    2: 'badge-processing',
                    3: 'badge-completed',
                    4: 'badge-cancelled'
                };
                return classMap[settle] || 'badge-default';
            },
            // 跳转到订单详情
            toPrint(item) {
                let that = this;
                uni.navigateTo({
                    url: "./orderDetlList",
                    success: function(res) {
                        res.eventChannel.emit('data', {
                            data: item
                        });
                    },
                    events: {
                        acceptDataFromOpenedPage: function(data) {
                            that.matnr = data.data;
                            that.findMat(that.matnr);
                        },
                    },
                });
            }
        }
    }
</script>
 
<style>
    @import url('@/static/css/wms.css/wms.css');
    
    .page-container {
        min-height: 100vh;
        background: #f5f7fa;
        padding-bottom: 20rpx;
    }
    
    .search-bar {
        padding: 0rpx 8rpx;
        background: #ffffff;
        box-shadow: 0 2rpx 12rpx rgba(0, 129, 255, 0.08);
    }
    
    .order-list {
        padding: 0 24rpx;
    }
    
    .order-card {
        background: #ffffff;
        border-radius: 16rpx;
        margin-top: 20rpx;
        box-shadow: 0 4rpx 20rpx rgba(0, 129, 255, 0.1);
        overflow: hidden;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
        border: 1rpx solid #e4e7ed;
    }
    
    .order-card:active {
        transform: scale(0.98);
        box-shadow: 0 2rpx 10rpx rgba(0, 129, 255, 0.15);
    }
    
    .card-header {
        display: flex;
        align-items: center;
        padding: 24rpx 28rpx;
        background: linear-gradient(135deg, #0081ff 0%, #1890ff 100%);
    }
    
    .order-badge {
        padding: 6rpx 16rpx;
        border-radius: 20rpx;
        margin-right: 20rpx;
    }
    
    .badge-text {
        font-size: 22rpx;
        font-weight: 500;
        color: #ffffff;
    }
    
    /* 状态徽章颜色 */
    .badge-pending {
        background: rgba(255, 255, 255, 0.3);
    }
    
    .badge-processing {
        background: #ffc107;
    }
    
    .badge-completed {
        background: #28a745;
    }
    
    .badge-cancelled {
        background: #dc3545;
    }
    
    .badge-default {
        background: rgba(255, 255, 255, 0.25);
    }
    
    .order-no {
        flex: 1;
    }
    
    .order-no-label {
        font-size: 22rpx;
        color: rgba(255, 255, 255, 0.7);
        display: block;
    }
    
    .order-no-value {
        font-size: 28rpx;
        color: #ffffff;
        font-weight: 600;
        display: block;
        margin-top: 4rpx;
    }
    
    .card-body {
        padding: 24rpx 28rpx;
    }
    
    .info-row {
        display: flex;
        flex-wrap: wrap;
    }
    
    .info-item {
        width: 50%;
        margin-bottom: 16rpx;
    }
    
    .info-label {
        font-size: 24rpx;
        color: #909399;
        display: block;
    }
    
    .info-value {
        font-size: 28rpx;
        color: #303133;
        font-weight: 500;
        display: block;
        margin-top: 6rpx;
    }
    
    .card-footer {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        padding: 20rpx 28rpx;
        border-top: 1rpx solid #f0f0f0;
    }
    
    .view-detail {
        font-size: 26rpx;
        color: #909399;
        margin-right: 8rpx;
    }
    
    /* 空状态 */
    .empty-state {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 120rpx 0;
    }
    
    .empty-text {
        font-size: 30rpx;
        color: #909399;
        margin-top: 30rpx;
    }
    
    .empty-hint {
        font-size: 24rpx;
        color: #c0c4cc;
        margin-top: 12rpx;
    }
</style>