#
whycq
2024-09-03 39c8ffa96f2046168e71501c480b1e66114c0db8
#
3个文件已添加
2个文件已修改
1021 ■■■■■ 已修改文件
pages.json 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/home/locMastManage.vue 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/phyz/checkLocDetl/checkLocDetl2.vue 342 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/phyz/checkLocDetl/locDetl2.vue 350 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/phyz/checkLocDetl/locDetlList2.vue 301 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages.json
@@ -427,6 +427,27 @@
            {
                "navigationBarTitleText" : "待包装出库单"
            }
        },
        {
            "path" : "pages/phyz/checkLocDetl/checkLocDetl2",
            "style" :
            {
                "navigationBarTitleText" : "库位盘点"
            }
        },
        {
            "path" : "pages/phyz/checkLocDetl/locDetl2",
            "style" :
            {
                "navigationBarTitleText" : "库存明细"
            }
        },
        {
            "path" : "pages/phyz/checkLocDetl/locDetlList2",
            "style" :
            {
                "navigationBarTitleText" : "库存明细"
            }
        }
    ],
    "globalStyle": {
pages/home/locMastManage.vue
@@ -33,6 +33,13 @@
                        url: `/phyz/checkLocDetl/checkLocDetl`
                    },
                    {
                        title: '库位盘点',
                        name: 'checkLocDetl',
                        color: 'blue',
                        // cuIcon: 'pullup',
                        url: `/phyz/checkLocDetl/checkLocDetl2`
                    },
                    {
                        title: '移库',
                        name: 'locMove',
                        color: 'blue',
pages/phyz/checkLocDetl/checkLocDetl2.vue
New file
@@ -0,0 +1,342 @@
<template>
    <view>
        <view class="code">
            <uni-search-bar  v-model="searchValue1"
                maxlength="500" ancel="cancel" @confirm="searchValueInput1()" @clear="clearVal" placeholder="输入 / 扫描 货架码">
            </uni-search-bar>
            <view style="display: flex;padding: 10rpx 20rpx;">
                <view class="dropdown">
                    <input type="text" style="flex: 1;" v-model="row1"  placeholder="排" placeholder-style="font-size:10px" @confirm="getLocMastList('')">
                    <uni-icons type="close" color="#c1c1c1" style="margin-left: 10rpx;" @click="clear('row1')"></uni-icons>
                </view>
                <view class="dropdown">
                    <input type="text" style="flex: 1;" v-model="bay1"   placeholder="列" placeholder-style="font-size:10px" @confirm="getLocMastList('')">
                    <uni-icons type="close" color="#c1c1c1" style="margin-left: 10rpx;" @click="clear('bay1')"></uni-icons>
                </view>
                <view class="dropdown">
                    <input type="text" style="flex: 1;" v-model="lev1"  placeholder="层" placeholder-style="font-size:10px" @confirm="getLocMastList('')">
                    <uni-icons type="close" color="#c1c1c1" style="margin-left: 10rpx;" @click="clear('lev1')"></uni-icons>
                </view>
                <view class="dropdown">
                    <input type="text" style="flex: 1;" v-model="floor"  placeholder="楼层" placeholder-style="font-size:10px" @confirm="getLocMastList('')">
                    <uni-icons type="close" color="#c1c1c1" style="margin-left: 10rpx;" @click="clear('floor')"></uni-icons>
                </view>
            </view>
        </view>
        <view class="list list-font-color" :class="locMast.color" v-for="(locMast,index) in dataList" :key="index">
            <view class="list-left">
                <view class="detl-threeCode">{{locMast.locNo}}</view>
                <view>库位状态:{{locMast.locSts$}}</view>
                <view>库位类型:{{locMast.locType1$}}</view>
                <view>货架码:{{locMast.barcode}}</view>
                <view style="display: flex;">
                    <view style="flex:1">排:<text style="font-size: 22px;font-weight: bold;">{{locMast.row1}}</text></view>
                    <view style="flex:1">列:<text style="font-size: 22px;font-weight: bold;">{{locMast.bay1}}</text></view>
                    <view style="flex:1">层:<text style="font-size: 22px;font-weight: bold;">{{locMast.lev1}}</text></view>
                </view>
            </view>
            <view class="list-right" @click="goToLocDetl(locMast)">
                <uni-icons type="right" size="25"  color="#fff"></uni-icons>
            </view>
        </view>
        <!-- 弹窗 -->
        <view>
            <uni-popup ref="check" type="dialog">
                <view class="popup">
                    <!-- 标题 -->
                    <view class="title">当前库位货架码</view>
                    <view class="popup-item">
                        <view class="popup-item-left">货架码:</view>
                        <view class="popup-item-right"><input type="text" v-model="barcode"></view>
                    </view>
                    <view class="btn">
                        <view class="btn-left" @click="checkClose">取消</view>
                        <view class="btn-right" @click="checkConfirm()">确认</view>
                    </view>
                </view>
            </uni-popup>
        </view>
    </view>
</template>
<script>
    export default {
        data() {
            return {
                searchValue1: '',
                baseUrl: '',
                token: '',
                barcode: '',
                locNo: '123123',
                row1: '',
                bay1: '',
                lev1: '',
                floor: '',
                dataList: [],
                item: ''
            }
        },
        onShow() {
            this.baseUrl = uni.getStorageSync('baseUrl');
            this.token = uni.getStorageSync('token');
            if (uni.getStorageSync('lev1')) {
                // this.lev1 = uni.getStorageSync('lev1');
            } else {
                this.lev1 = ''
            }
            this.getLocMastList()
            this.barcode = ''
        },
        methods: {
            clear(e) {
                switch (e) {
                    case 'row1':
                        setTimeout(() => {
                            this.row1 = ''
                            this.getLocMastList('')
                        }, 100);
                        break;
                    case 'bay1':
                        setTimeout(() => {
                            this.bay1 = ''
                            this.getLocMastList('')
                        }, 100);
                        break;
                    case 'lev1':
                        setTimeout(() => {
                            this.lev1 = ''
                            this.getLocMastList('')
                        }, 100);
                        break;
                    case 'floor':
                        setTimeout(() => {
                            this.floor = ''
                            this.getLocMastList('')
                        }, 100);
                        break;
                }
            },
            clearVal() {
                this.getLocMastList('')
            },
            searchValueInput1() {
                setTimeout(() => {
                    this.row1 = ''
                    this.bay1 = ''
                    this.lev1 = ''
                    this.floor = ''
                    this.getLocMastList(this.searchValue1)
                }, 100);
            },
            getLocMastList(barcode) {
                let _this = this
                // uni.setStorageSync('lev1', this.lev1);
                this.dataList = []
                uni.request({
                    url: `${_this.baseUrl}/agv/locMast/list/auth`,
                    header: {'token': uni.getStorageSync('token')},
                    data: {
                        curr: 1,
                        limit: 100,
                        row1: _this.row1,
                        bay1: _this.bay1,
                        lev1: _this.lev1,
                        floor: _this.floor,
                        barcode: barcode
                    },
                    method: 'GET',
                    success(res) {
                        res = res.data
                        if (res.code === 200) {
                            for (let k of res.data.records) {
                                if (k.locSts == 'F') {
                                    k['color'] = 'locSts-F'
                                } else if (k.locSts == 'D') {
                                    k['color'] = 'locSts-D'
                                } else if (k.locSts == 'O') {
                                    k['color'] = 'locSts-O'
                                } else if (k.locSts == 'R') {
                                    k['color'] = 'locSts-R'
                                } else if (k.locSts == 'S') {
                                    k['color'] = 'locSts-S'
                                } else if (k.locSts == 'X') {
                                    k['color'] = 'locSts-X'
                                } else if (k.locSts == 'Q') {
                                    k['color'] = 'locSts-Q'
                                } else if (k.locSts == 'P') {
                                    k['color'] = 'locSts-P'
                                } else if (k.locSts == 'X') {
                                    k['color'] = 'locSts-X'
                                }
                            }
                            _this.dataList = res.data.records
                        } 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' })
                        }
                    }
                })
            },
            goToLocDetl(e) {
                this.locNo = e.locNo
                this.item = e
                if (e.locSts == 'S' || e.locSts == 'R') {
                    uni.showToast({ title: '当前库位在作业', icon: "error", position: 'top' })
                    return
                }
                this.$refs.check.open()
            },
            checkClose() {
                this.$refs.check.close()
            },
            checkConfirm() {
                let _this = this
                let param = {
                    barcode : _this.barcode,
                    locNo : _this.locNo,
                    item: _this.item
                }
                uni.navigateTo({
                    url: "./locDetl2",
                    success: function(res) {
                        _this.$refs.check.close()
                        // 通过eventChannel向被打开页面传送数据   向另外一个页面传递值的
                        res.eventChannel.emit('item', {
                            item: param
                        })
                    },
                    events: {
                        // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据  另外一个页面传过来的
                        acceptDataFromOpenedPage: function(data) {
                            _this.$refs.check.close()
                            _this.getLocMastList()
                        }
                    },
                });
            }
        }
    }
</script>
<style>
    @import url('../../../static/css/common/order.css');
    .detl-threeCode {
        font-size: 28px;
        font-weight: bold;
    }
    .list-font-color {
        color: #fff;
        /* background-color: #2299ff; */
    }
    .dropdown {
        border: 1px solid #a7a7a7;
        border-radius: 8rpx;
        margin: 2px;
        padding: 6px;
    }
    .dropdown:first-child {
        margin-left: 2px;
    }
    .dropdown:last-child {
        margin-right: 2px;
    }
    .locSts-F {
        background-color: #d82f2f;
    }
    .locSts-D {
        background-color: #daad25;
    }
    .locSts-O {
        background-color: #55aaff;
    }
    .locSts-R {
        background-color: #aaaaff;
    }
    .locSts-S {
        background-color: #d86d66;
    }
    .locSts-P {
        background-color: #ffaa00;
    }
    .locSts-Q {
        background-color: #47a301;
    }
    .locSts-X {
        background-color: #767676;
    }
    .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 {
        position: relative;
        height: 80rpx;
        line-height: 80rpx;
        display: flex;
        align-items: center;
        font-size: 14px;
    }
    .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>
pages/phyz/checkLocDetl/locDetl2.vue
New file
@@ -0,0 +1,350 @@
<template>
    <view>
        <view style="padding: 16rpx 32rpx;font-size: 20px;font-weight: bold;">
            <view>当前库位号:{{locNo}}</view>
            <view>当前货架码:{{barcode}}</view>
        </view>
        <view class="list locSts-O">
            <view class="list-left">
                <view>实际库存</view>
                <view>库位号:{{containerDetl.locNo}}</view>
                <view>货架码:{{containerDetl.barcode}}</view>
                <view>库存品类:{{containerDetl.count}}</view>
            </view>
            <view class="list-right" @click="goToLocDetl(containerDetl)">
                <uni-icons type="right" size="25"  color="#fff"></uni-icons>
            </view>
        </view>
        <view class="list locSts-D" v-if="locDetlShow">
            <view class="list-left">
                <view>数据库存</view>
                <view>库位号:{{locDetl.locNo}}</view>
                <view>货架码:{{locDetl.barcode}}</view>
                <view>库存品类:{{locDetl.count}}</view>
            </view>
            <view class="list-right" @click="goToLocDetl(locDetl)">
                <uni-icons type="right" size="25"  color="#fff"></uni-icons>
            </view>
        </view>
        <!-- 弹窗 -->
        <view>
            <uni-popup ref="chageDetl" type="dialog">
                <view class="popup">
                    <!-- 标题 -->
                    <view class="title">修改库位状态</view>
                    <view class="popup-item">
                        <view class="dropdown" @click="toggleDropdown()">
                            <input type="text" style="width: 270rpx;" v-model="locSts" placeholder="更改为">
                            <uni-icons :type="isOpen ? 'top' : 'bottom'" color="#c1c1c1" style="margin-left: 10rpx;"></uni-icons>
                            <scroll-view scroll-y="ture" class="dropdown-content" v-if="isOpen">
                                <view class="dropdown-item" v-for="option in locStss" @click="selected(option)">{{option.title}}</view>
                            </scroll-view>
                        </view>
                    </view>
                    <view class="btn">
                        <button class="btn-left" @click="changeClose()">取消</button>
                        <button class="btn-right" @click="changeCount()" :disabled="changeDis">修改</button>
                    </view>
                </view>
            </uni-popup>
        </view>
        <!-- 底部操作按钮 -->
        <!-- <view class="buttom">
            <button size="mini" type="primary" @click="changeSts('warn')">更改库位状态</button>
            <button size="mini" type="primary" @click="changeStart('warn')" :disabled="changeStartDis">纠正库位</button>
        </view> -->
    </view>
</template>
<script>
    export default {
        data() {
            return {
                baseUrl: '',
                token: '',
                locNo: '',
                barcode: '',
                containerDetl: {
                    locNo: '',
                    barcode: '',
                    count: '',
                    data: []
                },
                locDetl: {
                    locNo: '',
                    barcode: '',
                    count: '',
                    data: []
                },
                dataList: [],
                locDetlShow: true,
                isOpen: false,
                locSts: '',
                locSts2: '',
                locStss: [
                    {title: 'F.在库',val: 'F'},
                    {title: 'D.空桶/空栈板',val: 'D'},
                    {title: 'O.空库位',val: 'O'},
                    {title: 'X.禁用',val: 'X'},
                ],
                sourceLoc: '',
                changeDis: false,
                changeStartDis: false
            }
        },
        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('item', function(data) {
                console.log(data);
                _this.locNo = data.item.locNo
                _this.barcode = data.item.barcode
                _this.sourceLoc = data.item.item
                console.log(_this.sourceLoc);
                _this.getLocDetl(data.item.locNo,data.item.barcode)
            })
        },
        methods: {
            getLocDetl(locNo,barcode) {
                let _this = this
                let param = {locNo:locNo,containerCode: barcode}
                uni.request({
                    url: `${_this.baseUrl}/agvMobile/check/detl/v1`,
                    header: {'token': uni.getStorageSync('token')},
                    data: param,
                    method: 'POST',
                    success(res) {
                        res = res.data
                        console.log(res);
                        if (res.code === 200) {
                            if (res.data.containerCode.length > 0) {
                                _this.dataList = res.data.containerCode
                                if (res.data.containerCode[0].locNo) {
                                    _this.containerDetl.locNo = res.data.containerCode[0].locNo
                                    _this.containerDetl.barcode = res.data.containerCode[0].suppCode
                                    _this.containerDetl.count = res.data.containerCode.length
                                    _this.containerDetl.data = res.data.containerCode
                                }
                            }
                            if (res.data.locNo.length > 0) {
                                _this.locDetl.locNo = res.data.locNo[0].locNo
                                _this.locDetl.barcode = res.data.locNo[0].suppCode
                                _this.locDetl.count = res.data.locNo.length
                                _this.locDetl.data = res.data.locNo
                            }
                        } 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' })
                        }
                    }
                })
            },
            goToLocDetl(item) {
                let _this = this
                if (item.data.length <= 0) {
                    uni.showToast({ title: '没有库存', icon: "error", position: 'top' })
                    return
                }
                uni.navigateTo({
                    url: "./locDetlList2",
                    success: function(res) {
                        // 通过eventChannel向被打开页面传送数据   向另外一个页面传递值的
                        res.eventChannel.emit('item', {
                            item: item
                        })
                    },
                    events: {
                        // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据  另外一个页面传过来的
                        acceptDataFromOpenedPage: function(data) {
                            _this.getLocDetl(_this.locNo,_this.barcode)
                        }
                    },
                });
            },
            toggleDropdown() {
                this.isOpen = !this.isOpen;
            },
            changeSts() {
                this.$refs.chageDetl.open()
            },
            selected(option) {
                this.locSts = option.title
                this.locSts2 = option.val
            },
            changeClose() {
                this.$refs.chageDetl.close()
            },
            changeCount() {
                let _this = this
                _this.sourceLoc.locSts = this.locSts2
                let barcode = _this.barcode
                if (this.locSts2 == 'O') {
                    barcode = ''
                }
                let param = {
                    locNo: _this.sourceLoc.locNo,
                    locSts: _this.sourceLoc.locSts,
                    barcode: _this.barcode,
                    row1: _this.sourceLoc.row1,
                    bay1: _this.sourceLoc.bay1,
                    lev1: _this.sourceLoc.lev1,
                    floor: _this.sourceLoc.floor
                }
                Object.keys(_this.sourceLoc).forEach(function(key){
                    if (_this.sourceLoc[key] == null) {
                        _this.sourceLoc[key] = ''
                    }
                })
                _this.changeDis = true
                uni.request({
                    url: `${_this.baseUrl}/agv/locMast/update/auth`,
                    header: {
                        'token': uni.getStorageSync('token'),
                        'content-type': 'application/x-www-form-urlencoded'
                    },
                    data: param,
                    method: 'POST',
                    success(res) {
                        res = res.data
                        _this.changeDis = false
                        if (res.code === 200) {
                            uni.showToast({ title: res.msg, icon: "success", position: 'top' })
                            _this.$refs.chageDetl.close()
                            setTimeout(()=> {
                                uni.navigateBack()
                            },1000)
                        } 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.changeDis = false
                    }
                })
            },
            changeStart() {
                let _this = this
                _this.changeStartDis = true
                let param = {locNo:_this.locNo,containerCode: _this.barcode}
                uni.request({
                    url: `${_this.baseUrl}/agvMobile/update/detl/v1`,
                    header: { 'token': uni.getStorageSync('token')},
                    data: param,
                    method: 'POST',
                    success(res) {
                        res = res.data
                        _this.changeStartDis = false
                        if (res.code === 200) {
                            uni.showToast({ title: res.msg, icon: "success", position: 'top' })
                            _this.$refs.chageDetl.close()
                            setTimeout(()=> {
                                uni.navigateBack()
                            },1000)
                        } 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.changeStartDis = false
                    }
                })
            }
        }
    }
</script>
<style>
    @import url('../../../static/css/common/order.css');
    .locSts-D {
        color: #FFF;
        background-color: #daad25;
    }
    .locSts-O {
        color: #FFF;
        background-color: #55aaff;
    }
    .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: #e2231a;
        border-right: 1px solid #DCDFE6;
    }
    .btn-right {
        display: flex;
        flex: 1;
        justify-content: center;
        align-items: center;
        color: #409EFF;
    }
</style>
pages/phyz/checkLocDetl/locDetlList2.vue
New file
@@ -0,0 +1,301 @@
<template>
    <view>
        <view style="padding: 16rpx 32rpx;font-size: 20px;font-weight: bold;">
            <view>当前库位号:{{locNo}}</view>
            <view>当前货架码:{{barcode}}</view>
        </view>
        <view class="list list-font-color" :class="locDetl.color" v-for="(locDetl,index) in dataList" :key="index">
            <view class="list-left">
                <view>销售订单号:{{locDetl.threeCode}}</view>
                <view>主订单号:{{locDetl.orderNo}}</view>
                <view>商品编码:{{locDetl.matnr}}</view>
                <view>商品名称:{{locDetl.maktx}}</view>
                <view>工序:{{locDetl.processSts$}}</view>
                <view>库存:{{locDetl.count}}</view>
            </view>
            <!-- <view class="list-right" @click="chageDetl(index)">
                <uni-icons type="settings" size="25"  color="#fff"></uni-icons>
            </view> -->
        </view>
        <!-- <view style="height: 100rpx;display: flex;align-items: center;justify-content: center;" @click="add()">
            <uni-icons type="folder-add" size="25"  color="#000" style="padding-right: 20rpx;"></uni-icons> 添加物料
        </view> -->
        <!-- 弹窗 -->
        <view>
            <uni-popup ref="chageDetl" type="dialog">
                <view class="popup">
                    <!-- 标题 -->
                    <view class="title">商品信息</view>
                    <view class="popup-item">
                        <view style="width: 70px;">订单号</view>
                        <view style="margin-left: 20rpx;border-bottom: 1px solid #d8d8d8;"> <input type="text" v-model="orderNo"> </view>
                    </view>
                    <view class="popup-item">
                        <view  style="width: 70px;">销售单号</view>
                        <view style="margin-left: 20rpx;border-bottom: 1px solid #d8d8d8;"> <input type="text" v-model="threeCode"> </view>
                    </view>
                    <view class="popup-item">
                        <view  style="width: 70px;">工序</view>
                            <uni-combox style="height: 20px;" :candidates="processSts$List" placeholder="请选择工序" v-model="processSts$"></uni-combox>
                        </view>
                    <view class="popup-item">
                        <uni-number-box :value="count" :step='1' :max="9999999" color="#747474" @change="changeValue" />
                    </view>
                    <view class="btn">
                        <view class="btn-left" @click="remove()">移除</view>
                        <view class="btn-right" @click="changeCount()">修改</view>
                    </view>
                </view>
            </uni-popup>
        </view>
        <!-- 底部操作按钮 -->
        <!-- <view class="buttom">
            <button size="mini" type="primary" @click="adjust('warn')">调整库存</button>
        </view> -->
    </view>
</template>
<script>
    export default {
        data() {
            return {
                baseUrl: '',
                token: '',
                dataList: [],
                count: '',
                index: 0,
                locNo: '',
                barcode: '',
                orderNo: '',
                threeCode: '',
                processSts$: '',
                processSts$List: ['待加工','已加工','无需加工']
            }
        },
        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('item', function(data) {
                console.log(data);
                _this.locNo = data.item.locNo
                _this.barcode = data.item.barcode
                for (let k of data.item.data) {
                    k['count'] = k.anfme
                }
                _this.dataList = data.item.data
            })
        },
        methods: {
            add() {
                let _this = this
                uni.navigateTo({
                    url: "../mat/mat",
                    events: {
                        // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据  另外一个页面传过来的
                        acceptDataFromOpenedPage: function(data) {
                            console.log(data.data);
                            setTimeout(()=> {
                                _this.findMat(data.data)
                            },100)
                        }
                    },
                });
            },
            findMat(mat) {
                let _this = this
                uni.navigateTo({
                    url: "../mat/matSelected",
                    success: function(res) {
                        // 通过eventChannel向被打开页面传送数据   向另外一个页面传递值的
                        res.eventChannel.emit('item', {
                            item: mat
                        })
                    },
                    events: {
                        matList: function(data) {
                            data.data.suppCode = _this.barcode
                            _this.checkMat(data.data)
                        },
                    },
                });
            },
            checkMat(mat) {
                var len = this.dataList.length
                var add = true ,sameItem = false
                for (var i = 0; i < len; i++) {
                    if (mat.matnr == this.dataList[i].matnr) {
                        for (var j = 0; j < len; j++) {
                            if (mat.threeCode == this.dataList[j].threeCode) {
                                sameItem = true
                            }
                        }
                        // 相同物料 不同批号  新加列表
                        if (mat.threeCode != this.dataList[i].threeCode) {
                            this.$forceUpdate() // 强制刷新
                            if (sameItem) {
                                add = false
                            } else {
                                add = true
                            }
                        } else {
                            // 相同物料相同批号 数量累加
                            this.dataList[i].count += mat.count
                            this.$forceUpdate() // 强制刷新
                            add = false
                        }
                    }
                }
                if (add) {
                    this.dataList.unshift(mat)
                }
            },
            chageDetl(index) {
                this.index = index
                this.count = this.dataList[index].count
                this.threeCode = this.dataList[index].threeCode
                this.orderNo = this.dataList[index].orderNo
                this.processSts$ = this.dataList[index].processSts$
                this.$refs.chageDetl.open()
            },
            // 修改数量
            changeCount() {
                this.dataList[this.index].count = this.count
                this.dataList[this.index].threeCode = this.threeCode
                this.dataList[this.index].orderNo = this.orderNo
                this.dataList[this.index].processSts$ = this.processSts$
                switch(this.processSts$) {
                    case '待加工':
                        this.dataList[this.index].processSts = 1
                        break;
                    case '已加工':
                        this.dataList[this.index].processSts = 2
                        break;
                    case '无需加工':
                        this.dataList[this.index].processSts = 3
                        break;
                }
                this.$forceUpdate() // 强制刷新
                this.$refs.chageDetl.close()
            },
            // 移除物料
            remove() {
                this.dataList.splice(this.index, 1)
                this.$refs.chageDetl.close()
            },
            adjust() {
                let _this = this
                let param = {
                    locNo: _this.locNo,
                    list: _this.dataList
                }
                uni.request({
                    url: `${_this.baseUrl}/agv/locDdetl/adjust/start`,
                    header: {'token': uni.getStorageSync('token')},
                    data: param,
                    method: 'POST',
                    success(res) {
                        res = res.data
                        if (res.code == 200) {
                            uni.showToast({ title: res.msg, icon: "success", position: 'top' })
                            _this.$refs.chageDetl.close()
                            _this.getOpenerEventChannel().emit('acceptDataFromOpenedPage', {data: this.mat});
                            setTimeout(()=> {
                                uni.navigateBack()
                            },1000)
                        } 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' })
                        }
                    }
                })
            },
            changeValue(value) {
                this.count = value
            },
        }
    }
</script>
<style>
    @import url('../../../static/css/common/order.css');
    .list-font-color {
        color: #fff;
        background-color: #2299ff;
    }
    .order-sts-start {
        background-color: #3eb689;
    }
    .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: #e2231a;
        border-right: 1px solid #DCDFE6;
    }
    .btn-right {
        display: flex;
        flex: 1;
        justify-content: center;
        align-items: center;
        color: #409EFF;
    }
</style>