<template> 
 | 
    <view> 
 | 
        <view class="list shop-car" v-for="(item,index) in dataList" :key="index"> 
 | 
            <view class="list-left"> 
 | 
                <view class="detl-threeCode" style="padding: 16rpx 0;">{{item.csocode}}</view> 
 | 
                <view>库位:{{item.locNo}}</view> 
 | 
                <view>编号:{{item.matnr}}</view> 
 | 
                <view>名称:{{item.maktx}}</view> 
 | 
                <view>自由项:{{item.containerCode}}</view> 
 | 
                <view>规格:{{item.specs}}</view> 
 | 
                <view>批号:{{item.batch}}</view> 
 | 
                <view>库存数量:{{item.count}}</view> 
 | 
                <view class="detl-threeCode" style="display: flex;padding: 32rpx 0;align-items: center;font-size: 24px;"> 
 | 
                    <view>出库数量:{{item.anfme}}</view> 
 | 
                    <view style="margin-left: 50rpx;" @click="revise(item)"> 
 | 
                        <uni-icons type="compose" size="30" color="#fff"></uni-icons> 
 | 
                    </view> 
 | 
                </view> 
 | 
                 
 | 
                <view class="detl-threeCode" style="display: flex;padding: 0 0 32rpx 0;font-size: 20px;">出库站: 
 | 
                        <!-- @click="toggleDropdown(item)" --> 
 | 
                    <view class="dropdown" > 
 | 
                        <!-- <view style="height: 100%;width: 100%; position: fixed;background-color: rgba(0,0,0,.4);left:0;top:0" v-if = "item.isOpen"></view> --> 
 | 
                        <input @input="staInput(item.agvStaNo,item.agvStaNos,index)" type="text" style="width: 270rpx;font-size: 16px;" v-model="item.agvStaNo" placeholder="请选择出库站" placeholder-style="color: #fff"> 
 | 
                        <!-- <uni-icons :type="item.isOpen ? 'top' : 'bottom'" color="#fff" style="margin-left: 10rpx;"></uni-icons> --> 
 | 
                         
 | 
                        <view style="font-size: 10px;">只支持扫码</view> 
 | 
                        <!-- <scroll-view scroll-y="ture" class="dropdown-content" v-if="item.isOpen"> 
 | 
                            <view class="dropdown-item" v-for="option in options" @click="selected(option,item)">{{option}}</view> 
 | 
                        </scroll-view> --> 
 | 
                    </view> 
 | 
                </view> 
 | 
                <button @click="combConfirm(item)" :disabled="combDis">立即出库</button> 
 | 
            </view> 
 | 
        </view> 
 | 
        <!-- 弹窗 --> 
 | 
        <view> 
 | 
            <uni-popup ref="addItem" type="dialog"> 
 | 
                <view class="popup"> 
 | 
                    <!-- 标题 --> 
 | 
                    <view class="title">出库数量</view> 
 | 
                    <view class="popup-item"> 
 | 
                        <view> 
 | 
                            <uni-number-box :value="data.anfme" :step='0.01' :min="0" :max="maxCount" color="#747474" @change="changeValue" /> 
 | 
                        </view> 
 | 
                         
 | 
                    </view> 
 | 
                    <view class="popup-item"> 
 | 
                        <view> 
 | 
                            <view @click="max()" style="padding: 0rpx 16rpx;background-color: #d9d9d9;font-size: 10px;">MAX</view> 
 | 
                        </view> 
 | 
                         
 | 
                    </view> 
 | 
                    <view class="btn"> 
 | 
                        <view class="btn-left" @click="addClose">取消</view> 
 | 
                        <view class="btn-right" @click="addConfirm()">确认</view> 
 | 
                    </view> 
 | 
                </view> 
 | 
            </uni-popup> 
 | 
        </view> 
 | 
        <view style="height: 100rpx;"></view> 
 | 
        <!-- 底部操作按钮 --> 
 | 
        <!-- <view class="buttom"> 
 | 
            <button size="mini" @click="reset('warn')">稍后处理</button> 
 | 
            <button size="mini" type="primary" @click="combConfirm('warn')" :disabled="combDis">立即出库</button> 
 | 
        </view> --> 
 | 
    </view> 
 | 
</template> 
 | 
  
 | 
<script> 
 | 
    export default { 
 | 
        data() { 
 | 
            return { 
 | 
                baseUrl: '', 
 | 
                token: '', 
 | 
                data: {}, 
 | 
                dataList: [], 
 | 
                option: '', 
 | 
                options: [], 
 | 
                combDis: false, 
 | 
                maxCount: 0, 
 | 
                orderType: '' 
 | 
            } 
 | 
        }, 
 | 
        onShow() { 
 | 
            let _this = this 
 | 
            this.baseUrl = uni.getStorageSync('baseUrl'); 
 | 
            this.token = uni.getStorageSync('token'); 
 | 
            // const eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE 
 | 
            const eventChannel = this.getOpenerEventChannel(); 
 | 
            // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据 
 | 
            // eventChannel.on('mat', function(data) { 
 | 
            //     let ids = [data.mat.id] 
 | 
            //     _this.getPakoutList(ids,data.mat.locNo) 
 | 
            // }) 
 | 
            eventChannel.on('item', function(data) { 
 | 
                let ids = [data.item.id] 
 | 
                if (data.item.orderType == 'bcp') { 
 | 
                    _this.getPakoutList(ids,'bcp') 
 | 
                } else { 
 | 
                    _this.getPakoutList(ids,null) 
 | 
                } 
 | 
                 
 | 
            }) 
 | 
            eventChannel.on('type', function(data) { 
 | 
                console.log(data); 
 | 
                if (data) { 
 | 
                    _this.orderType = data.type 
 | 
                } 
 | 
            }) 
 | 
        }, 
 | 
        methods: { 
 | 
            max() { 
 | 
                this.data.anfme = this.data.count 
 | 
            }, 
 | 
            toggleDropdown(item) { 
 | 
                this.options = [] 
 | 
                item.isOpen = !item.isOpen; 
 | 
                for    (let k of item.agvStaNos) { 
 | 
                    this.options.push(k) 
 | 
                } 
 | 
            }, 
 | 
            selected(option,item) { 
 | 
                item.agvStaNo = option 
 | 
            }, 
 | 
            staInput(item,items,index) { 
 | 
                var flag = false 
 | 
                for (let k of items) { 
 | 
                    if (k == item) flag = true  
 | 
                } 
 | 
                if(!flag) { 
 | 
                    uni.showToast({ title: '当前站点无法使用,已复位', icon: "error", position: 'top' }) 
 | 
                    setTimeout(() => { 
 | 
                        this.dataList[index].agvStaNo = '' 
 | 
                    }, 100); 
 | 
                } 
 | 
            }, 
 | 
            // 订单明细 
 | 
            getPakoutList(ids,bcp) { 
 | 
                let _this = this 
 | 
                uni.request({ 
 | 
                    url: `${_this.baseUrl}/bcp/out/pakout/preview/auth/v2`, 
 | 
                    header: {'token': uni.getStorageSync('token')}, 
 | 
                    data: ids, 
 | 
                    method: 'POST', 
 | 
                    success(res) { 
 | 
                        res = res.data 
 | 
                        if (res.code === 200) { 
 | 
                            for (let k of res.data) { 
 | 
                                if (k.locNo != null) { 
 | 
                                    k['isOpen'] = false 
 | 
                                    k['count'] = k.anfme 
 | 
                                    k.agvStaNo = '' 
 | 
                                    k.anfme = 0 
 | 
                                    // if (_this.orderType == 'bcp') { 
 | 
                                    //     if (k.locNo.substring(k.locNo.length - 1, k.locNo.length) == 1) { 
 | 
                                    //         continue 
 | 
                                    //     } 
 | 
                                    // } 
 | 
                                    _this.dataList.push(k) 
 | 
                                } 
 | 
                            } 
 | 
                            console.log(_this.dataList); 
 | 
                        } 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' }) 
 | 
                        } 
 | 
                    } 
 | 
                }) 
 | 
            }, 
 | 
            revise(item) { 
 | 
                this.data = item 
 | 
                this.maxCount = item.count  
 | 
                this.$refs.addItem.open() 
 | 
            }, 
 | 
            addClose() { 
 | 
                this.$refs.addItem.close() 
 | 
                this.data.anfme = 0 
 | 
            }, 
 | 
            addConfirm() { 
 | 
                this.$refs.addItem.close() 
 | 
            }, 
 | 
            changeValue(value) { 
 | 
                this.data.anfme = value 
 | 
            }, 
 | 
            combConfirm(item) { 
 | 
                let _this = this 
 | 
                _this.combDis = true 
 | 
                if (_this.data.anfme == 0) { 
 | 
                    uni.showToast({ title: '出库数量不能为0!', icon: "error", position: 'top'}) 
 | 
                    return 
 | 
                } 
 | 
                uni.showLoading({}) 
 | 
                let combList = [] 
 | 
                combList.push(item) 
 | 
                uni.request({ 
 | 
                    url: `${_this.baseUrl}/out/pakout/auth`, 
 | 
                    header: {'token': uni.getStorageSync('token')}, 
 | 
                    data: combList, 
 | 
                    method: 'POST', 
 | 
                    success(res) { 
 | 
                        _this.combDis = false 
 | 
                        res = res.data 
 | 
                        if (res.code === 200) { 
 | 
                            uni.hideLoading({}) 
 | 
                            uni.showToast({ title: '出库成功', icon: "success", position: 'top'}) 
 | 
                            setTimeout(()=> { 
 | 
                                uni.navigateBack({ 
 | 
                                    delta: 2 
 | 
                                }); 
 | 
                            },700) 
 | 
                        } 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' }) 
 | 
                        } 
 | 
                    }, 
 | 
                    fail(res) { 
 | 
                        _this.combDis = false 
 | 
                    } 
 | 
                }) 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
</script> 
 | 
  
 | 
<style scoped> 
 | 
    @import url('../../../static/css/common/order.css'); 
 | 
    .shop-car { 
 | 
        background-color: #2299ff; 
 | 
        color: #fff; 
 | 
    } 
 | 
    .detl-threeCode { 
 | 
        font-size: 34px; 
 | 
        font-weight: bold; 
 | 
    } 
 | 
    .dropdown-item { 
 | 
        font-size: 20px; 
 | 
        font-weight: bold; 
 | 
    } 
 | 
     
 | 
    .popup { 
 | 
        width: 80vw; 
 | 
        min-height: 100rpx; 
 | 
        background-color: #FFF; 
 | 
        border-radius: 25rpx; 
 | 
        position: relative; 
 | 
    } 
 | 
    .title { 
 | 
        height: 100rpx; 
 | 
        line-height: 100rpx; 
 | 
        width: 100%; 
 | 
        color: #606266; 
 | 
        text-align: center; 
 | 
        font-size: 16px; 
 | 
    } 
 | 
    .popup-item { 
 | 
        height: 80rpx; 
 | 
        line-height: 80rpx; 
 | 
        display: flex; 
 | 
        align-items: center; 
 | 
        justify-content: center; 
 | 
    } 
 | 
    .popup-item-left { 
 | 
        width: 16vw; 
 | 
        padding-right: 20rpx; 
 | 
        text-align: right; 
 | 
        color: #606266; 
 | 
    } 
 | 
    .popup-item-right { 
 | 
        display: flex; 
 | 
        align-items: center; 
 | 
        width: 50vw; 
 | 
        height: 50rpx; 
 | 
        padding: 2px 5px; 
 | 
        border: 1px solid #E4E7ED; 
 | 
        border-radius: 5rpx; 
 | 
    } 
 | 
    .popup-item-right input{ 
 | 
        color: #606266; 
 | 
    } 
 | 
    .btn { 
 | 
        display: flex; 
 | 
        height: 90rpx; 
 | 
        margin-top: 20rpx; 
 | 
        border-top: 1px solid #DCDFE6; 
 | 
        justify-content: center; 
 | 
        align-items: center; 
 | 
    } 
 | 
    .btn-left { 
 | 
        display: flex; 
 | 
        flex: 1; 
 | 
        height: 100%; 
 | 
        justify-content: center; 
 | 
        align-items: center; 
 | 
        color: #606266; 
 | 
        border-right: 1px solid #DCDFE6; 
 | 
    } 
 | 
    .btn-right { 
 | 
        display: flex; 
 | 
        flex: 1; 
 | 
        justify-content: center; 
 | 
        align-items: center; 
 | 
        color: #409EFF; 
 | 
    } 
 | 
</style> 
 |