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
<template>
    <view>
        <view class="code">
            <view style="display: flex;align-items: center;">
                <view style="flex: 1;">
                    <uni-search-bar  v-model="searchValue"
                        maxlength="500" ancel="cancel" @confirm="getOrderNoList(locNo)" @clear="clear" placeholder="输入 / 扫描">
                    </uni-search-bar>
                </view>
                
            </view>
            <view class="code-title">
                <view></view>
                <view style="width: 100%;text-align: center;margin: 16rpx 0;">总数量:- {{menuList.length}} -</view>
            </view>
        </view>
        <view class="card" v-for="item in menuList" @click="chose(item)">            
            <view class="item">库位号:{{item.locNo}}</view>
            <view class="item">物料编码:{{item.matnr}}</view>
            <view class="item">物料名称:{{item.maktx}}</view>
            <!-- <view class="item">批&#12288;&#12288;次:{{item.batch}}</view> -->
            <view class="item">明细数量:{{item.anfme}}</view>
        </view>
        <view style="height: 50rpx;"></view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                baseUrl: '',
                token: '',
                menuList: [],
                orderNo: '',
                searchValue: ''
            }
        },
        onLoad() {
            
        },
        onShow() {
            let that = this
            that.baseUrl = uni.getStorageSync('baseUrl');
            that.token = uni.getStorageSync('token');            
            
            const eventChannel = that.getOpenerEventChannel();
            eventChannel.on('locNo', function(data) {
                // console.log(data.item);
                that.locNo = data.locNo
                that.getOrderNoList(that.locNo)
            })
            
        },
        methods: {
            clear() {
                this.searchValue = ''
                this.getOrderNoList(this.locNo)
            },
            getOrderNoList(locNo) {
                let that = this
                uni.request({
                    url: this.baseUrl + '/locDetl/forlocNo/auth/v1',
                    data: { locNo: that.locNo, matnr: that.searchValue },
                    header: { 'token': uni.getStorageSync('token') },                    
                    success(res) {
                        res = res.data
                        that.menuList = []
                        if (res.code == 200) {
                            that.menuList = res.data
                            // uni.showToast({ title: res.msg, icon: "success", position: 'top' })
                        } else if (res.code == 403) {
                            uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                            setTimeout(() => {
                                uni.reLaunch({
                                    url: '../login/login'
                                });
                            }, 1000);
                        } else {
                            uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                        }
                        
                    }
                })
            },
            chose(item) {
                let that = this
                uni.navigateTo({
                    url: "../pakin/WarehouseOutParallelBoard",
                    success: function(res) {
                        // 通过eventChannel向被打开页面传送数据   向另外一个页面传递值的
                        res.eventChannel.emit('item', {
                            item: item
                        })
                    },
                    events: {
                        // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据  另外一个页面传过来的
                        acceptDataFromOpenedPage: function(data) {
                            // that.matnr = data.data
                            that.input(that.matnr)
                        },
                    },
                
                
                });
            }
        }
    }
</script>
 
<style>
    .code {
        background-color: #d9d9d9;
        z-index: 99;
        position: sticky;
        top: 0rpx;
        left: 0;
    }
    .card {
        margin: 20rpx;
        padding: 30rpx;
        background-color: #157ec1;
        border-radius: 20rpx;
        color: #FFF;
    }
    .item {
        width: 100%;
        min-height: 60rpx;
        line-height: 2;
        padding-left: 30rpx;
        color: #FFF;
        font-size: 14px;
    }
</style>