<template> 
 | 
    <view> 
 | 
        <!-- 搜索框 --> 
 | 
        <view class="search-bar"> 
 | 
            <uni-search-bar v-model="condition" placeholder=" 扫码 / 输入" bgColor="#EEEEEE" @input="search" /> 
 | 
        </view>     
 | 
        <view class="card" v-show="item.enableQty >0" v-for="item in menuList" @click="chose(item)"> 
 | 
            <view class="tag-item">单据号: {{item.orderNo}}</view> 
 | 
            <view class="tag-item">物料码: {{item.matnr}}</view> 
 | 
            <view class="tag-item">物料名称: {{item.maktx}}</view> 
 | 
            <view class="tag-item">规格: {{item.specs}}</view> 
 | 
            <view class="tag-item">批次: {{item.batch}}</view> 
 | 
            <view class="tag-item">数量: {{item.anfme}}</view> 
 | 
            <view class="tag-item">剩余数量: {{item.enableQty}}</view> 
 | 
        </view> 
 | 
    </view> 
 | 
</template> 
 | 
  
 | 
<script> 
 | 
    export default { 
 | 
        data() { 
 | 
            return { 
 | 
                data:'',     
 | 
                condition:'', 
 | 
                menuList: [], 
 | 
                order:'', 
 | 
                baseUrl: '', 
 | 
                token: '', 
 | 
            } 
 | 
        }, 
 | 
        onLoad() { 
 | 
            let that = this 
 | 
            const eventChannel = this.getOpenerEventChannel(); 
 | 
            eventChannel.on('data', function(data) { 
 | 
                that.order = data.data 
 | 
                that.getOrderNoList(that.order) 
 | 
            }); 
 | 
        }, 
 | 
        onShow() { 
 | 
            let that = this 
 | 
            this.baseUrl = uni.getStorageSync('baseUrl'); 
 | 
            this.token = uni.getStorageSync('token'); 
 | 
            that.getOrderNoList(that.order) 
 | 
        }, 
 | 
        methods: { 
 | 
            search(){ 
 | 
                let that = this 
 | 
                uni.request({ 
 | 
                    url: that.baseUrl + '/orderDetl/search/pda/auth', 
 | 
                    data: { 
 | 
                        condition: that.condition, 
 | 
                        order: that.order.orderNo 
 | 
                    }, 
 | 
                    // method:"GET", 
 | 
                    header: { 
 | 
                        'token':uni.getStorageSync('token'), 
 | 
                    }, 
 | 
                    success(result) { 
 | 
                        console.log(result); 
 | 
                        var res = result.data 
 | 
                        if (res.code === 200 ) { 
 | 
                            that.menuList = res.data 
 | 
                            // that.save() 
 | 
                        } 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'}) 
 | 
                        } 
 | 
                    } 
 | 
                }); 
 | 
            }, 
 | 
            getOrderNoList(order) { 
 | 
                let that = this 
 | 
                uni.request({ 
 | 
                    url: uni.getStorageSync('baseUrl') + '/orderDetl/list/pda/auth', 
 | 
                    method: 'POST', 
 | 
                    data: {                         
 | 
                        orderNo: order.orderNo 
 | 
                    }, 
 | 
                    success(res) { 
 | 
                        res = res.data 
 | 
                        that.menuList = res.data 
 | 
                    } 
 | 
                }) 
 | 
            }, 
 | 
            chose(item) { 
 | 
                let that = this 
 | 
                uni.navigateTo({ 
 | 
                    url: "../pingku/POrderPakin", 
 | 
                    success: function(res) { 
 | 
                        // 通过eventChannel向被打开页面传送数据   向另外一个页面传递值的 
 | 
                        res.eventChannel.emit('orderItem', { 
 | 
                            item: item 
 | 
                        }) 
 | 
                    }, 
 | 
                    events: { 
 | 
                        // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据  另外一个页面传过来的 
 | 
                        acceptDataFromOpenedPage: function(data) { 
 | 
                            // that.matnr = data.data 
 | 
                            // that.input(that.matnr) 
 | 
                        }, 
 | 
                    }, 
 | 
                 
 | 
                 
 | 
                }); 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
</script> 
 | 
  
 | 
<style> 
 | 
    .card { 
 | 
        margin: 20rpx; 
 | 
        padding: 30rpx; 
 | 
        background-color: #157ec1; 
 | 
        border-radius: 20rpx; 
 | 
        color: #FFF; 
 | 
    } 
 | 
    .tag-item { 
 | 
        width: 100%; 
 | 
        min-height: 60rpx; 
 | 
        line-height: 2; 
 | 
        padding-left: 50rpx; 
 | 
        color: #ffffff; 
 | 
        font-size: 14px; 
 | 
    } 
 | 
</style> 
 |