#
whycq
2024-11-20 cc32dc8d26f71497ce7f7e43930ec03035e6fe90
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
<template>
    <view>
        <view class="code">
            <view style="display: flex;align-items: center;">
                <view style="width: 70rpx;padding-left: 20rpx;">{{searchType}}</view>
                <view style="flex: 1;margin-left: -8rpx;background-color: white;padding: 4px;margin: 4px;border-radius: 4px;">
                    <!-- <uni-search-bar  v-model="searchValue"
                        maxlength="500" ancel="cancel" @confirm="getMatList()" @clear="clear" placeholder="输入 / 扫描">
                    </uni-search-bar> -->
                    <uni-combox :candidates="orderNoList" placeholder="请选择订单" v-model="orderNo" @input="getOrderDet"></uni-combox>
                </view>
            </view>
            <view class="code-title">
                <view style="flex: 1;"></view>
                <view style="width: 100%;text-align: center;margin: 16rpx 0;flex: 1;">{{searchValue}} 总数量:- {{dataList.length}} -</view>
                <view style="flex: 1;display: flex;align-items: center;"><button size="mini" type="primary" @click="allSelect()">{{seltitle}}</button></view>
            </view>
        </view>
        
        <view class="order__list" v-for="(orderDetl,index) in dataList" :key="index">
            <view class="order__list__left">
                <view>No:{{index + 1}}</view>
                <view>订单号:{{orderDetl.orderNo}}</view>
                <view>料号:{{orderDetl.matnr}}</view>
                <view>批号:{{orderDetl.batch}}</view>
                <view>可用数量:{{orderDetl.enableQty}}</view>
            </view>
            <view class="order__list__right">
                <!-- <uni-icons type="folder-add" size="25"  color="#fff"></uni-icons> -->
                <label @click="checkboxChange(orderDetl)">
                    <checkbox :value="orderDetl.matnr" :checked="orderDetl.checked" style="transform:scale(0.7)" /><text></text>
                </label>
            </view>
        </view>
        <!-- 底部操作按钮 -->
        <view class="buttom">
            <button size="mini" type="primary" @click="addItems()">提取</button>
        </view>
        <view style="height: 100rpx;width: 100%;text-align: center;line-height: 100rpx;">- 已经到底了 -</view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                baseUrl: '',
                token: '',
                storeId: 0,
                store: '',
                total: 0,
                searchType: '订单',
                searchValue: '',
                dataList: [],
                selectedList: [],
                matnr: '',
                orderNo: '',
                orderNoList: [],
                seltitle: '全选'
            }
        },
        onShow() {
            let _this = this
            this.baseUrl = uni.getStorageSync('baseUrl');
            this.token = uni.getStorageSync('token');
            this.storeId = uni.getStorageSync('store')
            if (this.storeId == 1) {
                this.store = '宁波仓'
            }
            if (this.storeId == 2) {
                this.store = '新昌仓'
            }
            const eventChannel = this.getOpenerEventChannel();
            eventChannel.on('item', function(data) {
                _this.matnr = data.item.matnr
                _this.getMatList()
            })
            this.getOrderNoList()
        },
        methods: {
            addItems() {
                let pickList = []
                for (let k of this.dataList) {
                    if (k.checked) {
                        pickList.push(k)
                    }
                }
                this.getOpenerEventChannel().emit('pickList', {data: pickList});
                uni.navigateBack({
                    
                })
            },
            checkboxChange(e) {
                let items = this.dataList,
                values = e.matnr;
                if (e.checked) {
                    this.$set(e,'checked',false)
                } else {
                    this.$set(e,'checked',true)
                }
                var count = 0
                for (let k of items) {
                    if (k.checked) {
                        count++
                    }
                }
                if (count == items.length && count > 0) {
                    this.seltitle = '取消全选'
                } else {
                    this.seltitle = '全选'
                }
            },
            allSelect() {
                if (this.seltitle == '全选') {
                    for (let k of this.dataList) {
                        k.checked = true
                    }
                    this.seltitle = '取消全选'
                } else {
                    for (let k of this.dataList) {
                        k.checked = false
                    }
                    this.seltitle = '全选'
                }
                
            },
            getOrderDet() {
                let that = this
                uni.request({
                    url: that.baseUrl + '/order/list/orderNo',
                    data: {orderNo: that.orderNo} ,
                    method: 'GET',
                    success(res) {
                        res = res.data;
                        if (res.code === 200) {
                            that.dataList = res.data
                            for (var i = 0; i < that.dataList.length; i++) {
                                that.$set(that.dataList[i],'checked',false)
                            }
                        }
                    }
                })
            },
            getOrderNoList() {
                let that = this
                uni.request({
                    url: this.baseUrl + '/order/comb/list/all',
                    header: {
                        'token': uni.getStorageSync('token')
                    },
                    method: 'POST',
                    success(res) {
                        res = res.data
                        for (var i = 0; i < res.data.length; i++) {
                            that.orderNoList.push(res.data[i].order_no)
                        }
                    }
                })
            },
            clear() {
                this.searchValue = ''
                this.getOrderNoList(this.locNo)
            },
            back() { uni.navigateBack({}) },
            set(e) {
                var ck = this.dataList[e].checked
                this.dataList[e].checked = ck ? false : true
            },
            getMatList() {
                let that = this
                let searchParam = {
                    orderNo: that.searchValue,
                    matnr: that.matnr,
                }
                console.log(searchParam);
                uni.request({
                    url: that.baseUrl + '/mobile/outBound/mat/list',
                    header: {
                        'token': uni.getStorageSync('token')
                    },
                    data: searchParam,
                    method: 'GET',
                    success(res) {
                        res = res.data;
                        if (res.code === 200) {
                            that.total = res.data.length
                            const result1 = res.data.filter(obj1 => 
                                !that.selectedList.some(obj2 => obj1.matnr === obj2.matnr && obj1.orderNo === obj2.orderNo)
                            );
                            that.dataList = result1
                            that.total = result1.length
                        } else if (res.code == 403) {
                            uni.showToast({ title: res.msg, icon: "error", position: 'center' })
                            setTimeout(() => { uni.reLaunch({ url: '../login/login' }); }, 1000);
                        } else {
                            uni.showToast({ title: res.msg, icon: "error", position: 'center' })
                        }
                    }
                })
                
            },
            addItem(mat) {
                this.getOpenerEventChannel().emit('sMat', {data: mat});
                uni.navigateBack({
                    
                })
            }
        }
    }
</script>
 
<style>
    @import url('../../static/css/wms.css/wms.css');
    .code {
        background-color: #d9d9d9;
        z-index: 99;
        position: sticky;
        top: 0rpx;
        left: 0;
    }
    .code-title {
        display: flex;
    }
    .order__list {
        margin: 20rpx;
        font-size: 14px;
        background-color: #fff;
        border-radius: 20rpx;
        border: 1px solid #eeeeee;
        display: flex;
        position: relative;
        background-color: #3eb689;
        color: #FFF;
    }
    .order__list__left {
        flex: 1;
        padding: 20rpx;
        position: relative;
    }
    .order__list__right {
        width: 70rpx;
        border-left: 1px solid #eeeeee;
        display: flex;
        align-items: center;
        justify-content: center;
    }
</style>