pang.jiabao
2025-04-11 162b3abda98bf6c33d60e0846b54febade343274
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
<template>
    <view>
        <!-- 库位号输入框 -->
        <view class="square-2">
            <view class="square-title">
                <view class="title-sign"><view class="sign"></view></view>
                <view class="title-text"><text>库位号</text></view>
            </view>
            <view class="square-content">
                <view class="content-input">
                    <input type="text" v-model="locno" placeholder="扫码 / 输入" :focus="locnoFocus">
                    <uni-icons v-show="locno" type="closeempty" size="20" color="#dadada" @click="remove('locno')"></uni-icons>
                </view>
            </view>
        </view>
        <!-- 商品码输入框 -->
        <view class="square-2">
            <view class="square-title">
                <view class="title-sign"><view class="sign"></view></view>
                <view class="title-text"><text>检索商品</text></view>
            </view>
            <view class="square-content">
                <view class="content-input-btn">
                    <input v-model="matnr" type="text" placeholder="扫码 / 输入" @input="findMat()"
                    :focus="matnrFocus" placeholder-style="line-height:  85rpx;">
                    <uni-icons v-show="matnr" type="closeempty" size="20" color="#dadada" @click="remove('matnr')"></uni-icons>
                </view>
                <view class="content-btn">
                    <button class="cu-btn bg-blue pda-btn" @click="selectMat()">+提取</button>
                </view>
            </view>
        </view>
        
        <!-- 商品列表表头 -->
        <view class="square-1">
            <view class="square-title">
                <view class="title-sign"><view class="sign"></view></view>
                <view class="title-text"><text>商品列表</text></view>
            </view>
        </view>
        
        <view class="square-none" v-show="matList.length == 0">
            <view class="v-show">Нет дополнительных данных...</view>
        </view>
        
        <checkbox-group>
            <view v-for="(item,index) in matList" :key="index" class="data-list bg-false" :class="'bg-'+item.checked" >
                <view class="data-list-left">
                    <view class="matnr"><text style="width: 400rpx;">编码:{{item.matnr}}</text></view>
                    <view><text style="width: 400rpx;">品名:{{item.maktx}}</text></view>
                    <view><text style="width: 400rpx;">批号:{{item.batch}}</text></view>
                    <view>
                        <text style="width: 400rpx;">数量:{{item.anfme}}</text>
                    </view>
                </view>
                <view class="data-list-right">
                    <label><uni-icons type="compose" size="20" color="#a5a5a5" @click="revise(item,index)"></uni-icons></label>
                    <label><uni-icons type="trash" size="25" color="#a5a5a5" @click="removeItem(item,index)"></uni-icons></label>
                </view>
            </view>
        </checkbox-group>
        
        <!-- 底部按钮 -->
        <view class="footer flex justify-around">
            <!-- <label class="label-btn" style="width: 170rpx;">
                <checkbox :checked="check" @click="allChecked()">{{checkText}}</checkbox>
            </label>
            <label class="label-btn" style="width: 100rpx;">
                <text  @click="reChecked()">反选</text>
            </label> -->
            
            <label class="label-btn" style="width: 150rpx;">
                <button class="cu-btn" @click="resst()">Сброс</button>
            </label>
            <label class="label-btn">
                <button class="cu-btn bg-blue " @click="comb()">上架</button>
            </label>
        </view>
        <view>
            <!-- 提示信息弹窗 -->
            <uni-popup ref="message" type="message">
                <uni-popup-message :type="msgType" :message="messageText" :duration="2000"></uni-popup-message>
            </uni-popup>
        </view>
    
        <!-- 弹窗 -->
        <!-- 修改数量 -->
        <uni-popup ref="revise" background-color="#fff">
            <view class="revise-box">
                <view class="revise-box-top">
                    <view class="color-block-blue"></view>
                    <text class="title">修改批号/数量</text>
                </view>
                <view class="" style="position: relative;left: 50px;margin-bottom: 20px;">
                    <text style="display: inline-block;float: left;width: 50px;">批号:</text>
                    <input type="text" style="width: 100px;border-bottom: 1px solid #9e9e9e;" v-model="batch">
                </view>
                <view class="changeBox">
                    <view class="num-box">
                        <uni-number-box :value="count" :max="9999" color="#747474"  @change="changeValue"/>
                    </view> 
                </view>
                <view class="revise-box-buttom">
                    <view>
                        <button class="cu-btn bg-blue" @click="confirm()">确认</button>
                    </view>
                </view>
            </view>
        </uni-popup>
    </view>
</template>
 
<script>
     export default {
        data() {
             return {
                locno:'', // 库位号
                matnr:'', // 商品码
                locnoFocus:true,
                matnrFocus:true,
                matList:[], // 商品列表
                listLen:0,
                listNum:1,
                msgType: 'success',
                messageText: '这是一条成功提示',
                count:'',
                rowNum:'',
                batch:''
            }
        },
        mounted(){
            const UIP = uni.getStorageSync('UIP');
            this.baseIP = UIP;
            const UPORT = uni.getStorageSync('UPORT');
            this.basePORT = UPORT
            const PROJ = uni.getStorageSync('UPROJ');
            this.baseUrl = PROJ
            this.getUrl()
        },
        methods:{
            // 获取url
            getUrl() {
                this.commonUrl = this.baseHttp + this.baseIP + ':' +this.basePORT + "/" +this.baseUrl
            },
            // 消息提示弹窗
            messageToggle(type) {
                this.msgType = type
                this.messageText = ''
                this.$refs.message.open()
            },
            // 清空input
            remove(e) {
                this[e] = ''
            },
            // 重置
            resst() {
                this.locno = ''
                this.matnr = ''
                this.matList = []
            },
            findMat() {
                let that = this
                uni.request({
                    url: that.commonUrl + '/mat/auth',
                    data: {
                        matnr:that.matnr
                    },
                    header: {
                        'token':uni.getStorageSync('token')
                    },
                    success(result) {
                        uni.vibrateShort();
                        let res = result.data
                        if (res.code === 200 && res.data) {
                            that.matData = res.data
                            that.matnr = ''
                            uni.navigateTo({
                                url: "matQuery",
                                events: {
                                    // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
                                    matList: function(data) {
                                        console.log(data)
                                        that.matList.push(data.data)
                                    },
                                },
                                success: function(res) {
                                    // 通过eventChannel向被打开页面传送数据
                                    res.eventChannel.emit('matData', { data: that.matData })
                                },
                            });
                        }
                        
                    }
                });
                
            },
            // 移除物料
            removeItem(item,index) {
                this.matList.splice(index,1)
                // this.listLen = this.matList.length
                this.messageToggle('success')
                this.messageText = '移除成功'
            },
            // 上架
            comb() {
                let that = this
                if(that.locno === '') {
                    uni.showToast({title: '请添加库位码', icon: "none", position: 'top'});
                    return;
                }
                if(that.matList.length === 0) {
                    uni.showToast({title: '请添加商品', icon: "none", position: 'top'});
                    return;
                }
                var combMats = []
                var combParam = {}
                combParam['locno'] = that.locno
                combParam['combMats'] = that.matList
                uni.request({
                    url: that.commonUrl + '/mobile/mat/onSale/auth',
                    data: JSON.stringify(combParam),
                    header: { 'token':uni.getStorageSync('token'),},
                    method:'POST',
                    success(result) {
                        var res = result.data
                        if (res.code === 200) {
                            uni.showToast({title: res.msg, icon: "none", position: 'top'});
                            that.resst()
                        } 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'})
                        }
                    }
                })
            },
            // 提取商品
            selectMat() {
                let that = this
                uni.vibrateShort();
                uni.navigateTo({
                    url: "matSelect",
                    events: {
                        // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据  另外一个页面传过来的
                        acceptDataFromOpenedPage: function(data) {
                            that.matnr = data.data
                            that.findMat(that.matnr)
                        },
                    },
                    success: function(res) {
                        // 通过eventChannel向被打开页面传送数据   向另外一个页面传递值的
                        res.eventChannel.emit('commonUrl', {commonUrl:that.commonUrl })
                    },
                    
                });
                that.matnr = ''
            },
            revise(item,index) {
                this.count = this.matList[index].anfme
                this.rowNum = index
                this.eject()
            },
            eject(type) {
                this.type = type
                // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
                this.$refs.revise.open(type)
            },
            changeValue(value) {
                this.count = value
            },
            confirm() {
                this.matList[this.rowNum].anfme = this.count
                this.matList[this.rowNum].batch = this.batch
                this.$refs.revise.close()
                this.$forceUpdate() // 强制刷新
            },
            
        }
     }
</script>
 
<style>
    @import url(@/static/css/putOnSale.css);
    .footer {
        width: 100%;
        height: 100rpx;
        line-height: 100rpx;
        background-color: #FFF;
        position: fixed;
        bottom: 0;
        border-top: 1px solid #d8d8d8;
        border-radius: 20rpx 20rpx 0 0 ;
        z-index: 1;
    }
    .revise-box {
        position: relative;
        width: 500rpx;
        height: 400rpx;
        border-radius: 25px;
    }
    .revise-box-top {
        width: 400rpx;
        height: 120rpx;
        border-radius: 25px;
    }
    .color-block-blue {
        background-color: #1E9FFF;
        display: inline-block;
        float: left;
        margin: 15rpx 15rpx 0 15rpx;
        width: 12rpx;
        height: 40rpx;
        border: 5rpx solid #1E9FFF;
        border-radius: 20rpx;
    }
    .title {
        display: inline-block;
        float: left;
        font-size: 34rpx;
        font-weight: 700;
        height: 50rpx;
        line-height: 50rpx;
        margin-top: 10rpx;
    }
</style>