#
zhou zhou
2025-12-30 b13760a228deb5957f1c029689c2a28676bce94f
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
<template>
    <view class="page-container">
        <!-- 搜索表单 -->
        <view class="form-section">
            <view class="form-item">
                <view class="form-label">
                    <uni-icons type="location" size="18" color="#667eea"></uni-icons>
                    <text class="label-text">库位号</text>
                </view>
                <view class="form-input-wrap">
                    <input class="form-input" type="text" placeholder="扫码 / 输入库位号" v-model="locNo" />
                    <uni-icons v-if="locNo" type="clear" size="18" color="#c0c4cc" @click="locNo=''"></uni-icons>
                </view>
            </view>
            <view class="form-item">
                <view class="form-label">
                    <uni-icons type="list" size="18" color="#667eea"></uni-icons>
                    <text class="label-text">物料号</text>
                </view>
                <view class="form-input-wrap">
                    <input class="form-input" type="text" placeholder="扫码 / 输入物料号" v-model="matnr" @input="findMat()" />
                    <uni-icons v-if="matnr" type="clear" size="18" color="#c0c4cc" @click="matnr=''"></uni-icons>
                </view>
            </view>
        </view>
        
        <!-- 列表头部 -->
        <view class="list-header">
            <view class="header-left">
                <text class="header-title">库存列表</text>
                <view class="count-badge" v-if="dataList.length > 0">
                    <text class="count-text">{{dataList.length}}</text>
                </view>
            </view>
        </view>
        
        <!-- 库存列表 -->
        <view class="list-container">
            <view class="stock-card" v-for="(item, i) in dataList" :key="i">
                <view class="card-header">
                    <view class="card-index">{{i + 1}}</view>
                    <view class="loc-info">
                        <text class="loc-no">{{item.locNo}}</text>
                    </view>
                    <!-- <view class="qty-badge">
                        <text class="qty-text">{{item.anfme}}</text>
                    </view> -->
                </view>
                <view class="card-body">
                    <view class="info-row">
                        <view class="info-col">
                            <text class="info-label">物料编码</text>
                            <text class="info-value code">{{item.matnr}}</text>
                        </view>
                    </view>
                    <view class="info-row">
                        <view class="info-col">
                            <text class="info-label">物料名称</text>
                            <text class="info-value">{{item.maktx || '-'}}</text>
                        </view>
                    </view>
                    <view class="info-row">
                        <view class="info-col half">
                            <text class="info-label">规格</text>
                            <text class="info-value">{{item.specs || '-'}}</text>
                        </view>
                        <view class="info-col half">
                            <text class="info-label">批号</text>
                            <text class="info-value batch">{{item.batch || '-'}}</text>
                        </view>
                    </view>
                    <view class="info-row">
                        <view class="info-col half">
                            <text class="info-label">数量</text>
                            <text class="info-value qty">{{item.anfme}}</text>
                        </view>
                    </view>
                </view>
            </view>
            
            <!-- 空状态 -->
            <view class="empty-state" v-if="dataList.length === 0 && !loading">
                <uni-icons type="search" size="50" color="#CCCCCC"></uni-icons>
                <text class="empty-text">暂无库存数据</text>
                <text class="empty-hint">请输入条件后点击查询</text>
            </view>
            
            <view class="bottom-placeholder"></view>
        </view>
        
        <!-- 底部操作栏 -->
        <view class="bottom-bar">
            <view class="btn-reset" @click="reset('warn')">
                <uni-icons type="refresh" size="16" color="#909399"></uni-icons>
                <text class="btn-text">重置</text>
            </view>
            <view class="btn-submit" @click="search()">
                <uni-icons type="search" size="16" color="#ffffff"></uni-icons>
                <text class="btn-text">查询</text>
            </view>
        </view>
        
        <!-- 提示信息弹窗 -->
        <uni-popup ref="message" type="message">
            <uni-popup-message :type="msgType1" :message="messageText" :duration="2000"></uni-popup-message>
        </uni-popup>
        
        <!-- 确认重置 -->
        <uni-popup ref="resetConfirm" type="dialog">
            <uni-popup-dialog :type="msgType" cancelText="取消" confirmText="确认" :title="title" :content="content"
                @confirm="resetConfirm" @close="resetClose"></uni-popup-dialog>
        </uni-popup>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                baseUrl: '',
                token: '',
                locNo: '',
                matnr: '',
                dataList: [],
                loading: false,
                msgType: '',
                msgType1: '',
                messageText: '',
                title: '',
                content: '',
            }
        },
        onShow() {
            this.baseUrl = uni.getStorageSync('baseUrl');
            this.token = uni.getStorageSync('token');
        },
        methods: {
            // 搜索物料
            findMat() {
                let that = this;
                // let m = that.matnr.split(";");
                // let matnr1 = m[0].slice(3);
                // setTimeout(() => {
                //     that.matnr = matnr1;
                // }, 100);
            },
            search() {
                let that = this;
                that.loading = true;
                uni.request({
                    url: that.baseUrl + '/locDetl/list/auth',
                    header: { 'token': uni.getStorageSync('token') },
                    data: {
                        curr: 1,
                        limit: 100,
                        locNo: that.locNo,
                        matnr: that.matnr
                    },
                    method: "GET",
                    success(result) {
                        let res = result.data;
                        if (res.code == 200) {
                            let records = res.data.records;
                            if (records && records.length > 0) {
                                that.dataList = records;
                            } else {
                                that.dataList = [];
                                uni.showToast({
                                    title: "暂无数据",
                                    icon: "none",
                                    position: 'top',
                                    duration: 1500
                                });
                            }
                        } 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' });
                        }
                    },
                    fail() {
                        uni.showToast({ title: '网络请求失败', icon: "none", position: 'top' });
                    },
                    complete() {
                        that.loading = false;
                    }
                });
            },
            reset(type) {
                this.msgType = type;
                this.title = '确认重置';
                this.content = '是否清空查询条件?';
                this.$refs.resetConfirm.open();
            },
            resetConfirm() {
                this.dataList = [];
                this.matnr = '';
                this.locNo = '';
                this.messageText = "重置完成";
                this.messageToggle('success');
            },
            resetClose() {},
            messageToggle(type) {
                this.msgType1 = type;
                this.$refs.message.open();
            },
        }
    }
</script>
 
<style>
    /* 引入公共样式 */
    @import url('../../static/css/common.css');
 
    /* 页面特有样式 */
    .form-label {
        width: 140rpx;
    }
    
    /* 库存卡片 - 使用card-header而非card-top */
    .stock-card {
        background: #ffffff;
        border-radius: 12rpx;
        margin-top: 12rpx;
        box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
        overflow: hidden;
    }
    
    .card-header {
        display: flex;
        align-items: center;
        padding: 14rpx 16rpx;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }
    
    .card-index {
        background: rgba(255, 255, 255, 0.3);
    }
    
    .loc-info {
        flex: 1;
    }
    
    .loc-no {
        font-size: 26rpx;
        color: #ffffff;
        font-weight: 600;
    }
    
    /* 卡片内容 */
    .card-body {
        padding: 12rpx 16rpx;
    }
    
    .info-value.code {
        color: #303133;
        font-weight: 600;
    }
    
    .info-value.batch {
        color: #667eea;
    }
</style>