whycq
2024-11-19 fe8fb74ce94e7bee23ed47b7175236248ac93b98
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
<template>
    <view>
        <view class="status_bar">
            <!-- 这里是状态栏 -->
        </view>
        <uni-nav-bar left-icon="left" background-color="#f8f8f8" title="订单物料" @clickLeft="back"  :fixed="true"
            :border="false" rightWidth="160rpx" leftWidth="160rpx"
            >
            <block slot="right">
                <view class="city">
                    <view>
                        <text class="uni-nav-bar-text">{{store}}</text>
                    </view>
                </view>
            </block>
         </uni-nav-bar>
         
        <view class="code">
            <view style="display: flex;align-items: center;">
                <view style="width: 70rpx;padding-left: 20rpx;" @click="changeST">{{searchType}}</view>
                <view style="flex: 1;margin-left: -8rpx;">
                    <uni-search-bar  v-model="searchValue"
                        maxlength="500" ancel="cancel" @confirm="getMatList()" @clear="clear" placeholder="输入 / 扫描">
                    </uni-search-bar>
                </view>
                
            </view>
            <view class="code-title">
                <view></view>
                <view style="width: 100%;text-align: center;margin: 16rpx 0;">{{searchValue}} 总数量:- {{total}} -</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.count}}</view>
            </view>
            <view class="order__list__right" @click="addItem(orderDetl)">
                <uni-icons type="folder-add" size="25"  color="#fff"></uni-icons>
            </view>
        </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: []
            }
        },
        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('matList', function(data) {
                _this.selectedList = data.matList
            })
            this.getMatList()
        },
        methods: {
            back() { uni.navigateBack({}) },
            set(e) {
                var ck = this.dataList[e].checked
                this.dataList[e].checked = ck ? false : true
            },
            changeST() {
                if (this.searchType == '物料') this.searchType = '订单' 
                else this.searchType = '物料'
            },
            getMatList() {
                let that = this
                let searchParam = {}
                if (this.searchType == '物料') searchParam = {matnr: that.searchValue}
                else searchParam = {orderNo: that.searchValue}
                console.log(searchParam);
                uni.request({
                    url: that.baseUrl + '/mobile/pick/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>