#
whycq
2023-05-06 037fbdee1d9477db36d8bb89df2f24936c2199a9
#
1个文件已修改
137 ■■■■ 已修改文件
pages/stock/stockCheck.vue 137 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/stock/stockCheck.vue
@@ -4,7 +4,7 @@
            <view class="item">
                <view class="code-decs">托盘码:</view>
                <input type="text" placeholder=" 扫码 / 输入" v-model="barcode" :focus="barcodeFocus"
                    @confirm="barcodeInput()">
                    @input="search()">
            </view>
            <view class="item">
                <view class="code-decs">物料码:</view>
@@ -60,7 +60,7 @@
        <!-- 底部操作按钮 -->
        <view class="buttom">
            <button size="mini" @click="reset('warn')">重置</button>
            <button size="mini" type="primary" @click="combConfirm('warn')">组托</button>
            <button size="mini" type="primary" @click="combConfirm('warn')">确认</button>
        </view>
        <!-- 弹窗 -->
        <!-- 修改数量 -->
@@ -111,7 +111,7 @@
        <view>
            <uni-popup ref="combConfirm" type="dialog">
                <uni-popup-dialog :type="msgType" cancelText="取消" confirmText="确认" :title="title" :content="content"
                    @confirm="comb" @close="combClose"></uni-popup-dialog>
                    @confirm="adjust" @close="combClose"></uni-popup-dialog>
            </uni-popup>
        </view>
        <!-- 确认重置 -->
@@ -159,23 +159,38 @@
                this.msgType1 = type
                this.$refs.message.open()
            },
            // barcode input 事件
            barcodeInput() {
                // 不设置定时器 会出现扫入的字符串不全
                setTimeout(() => {
                    var len = this.barcode.length
                    if (len != 8) {
                        uni.showToast({
                            title: '托盘码有误请重试',
                            icon: "none",
                            position: 'top'
                        });
                        this.barcodeFocuss()
                        return;
            // 根据托盘码搜索
            search() {
                let that = this
                uni.request({
                    url: that.baseUrl + '/mobile/checkDetl/auth2',
                    header: {
                        'token':uni.getStorageSync('token')
                    },
                    data: {barcode: that.barcode},
                    method:'GET',
                    success(res) {
                        console.log(res);
                        res = res.data
                        if(res.code === 200){
                            for(var i = 0; i < res.data.length;i++){
                                that.dataList.push(res.data[i])
                            }
                        } 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'})
                        }
                    }
                    this.focuss()
                }, 200)
                })
            },
            // 托盘码有误重置
            barcodeFocuss() {
                let that = this;
@@ -350,62 +365,11 @@
            combConfirm(type) {
                this.msgType = type
                this.title = '警告'
                this.content = '是否现在组托!'
                this.content = '是否确认盘点!'
                this.$refs.combConfirm.open()
            },
            combClose() {
                this.$refs.combConfirm.close()
            },
            comb() {
                uni.vibrateShort();
                let that = this;
                if (that.barcode === '') {
                    this.messageText = "请扫描托盘条码"
                    this.messageToggle('error')
                    return;
                }
                if (that.dataList.length === 0) {
                    this.messageText = "请添加商品列表"
                    this.messageToggle('error')
                    return;
                }
                for (var i = 0; i < that.dataList.length; i++) {
                    if (that.dataList[i].anfme == 0 || that.dataList[i].anfme == '') {
                        this.messageText = that.dataList[i].matnr + '组托数量不能为0'
                        this.messageToggle('error')
                        return;
                    }
                }
                uni.request({
                    url: that.baseUrl + '/mobile/comb/auth',
                    data: JSON.stringify({
                        barcode: that.barcode,
                        combMats: that.dataList
                    }),
                    method: 'POST',
                    header: {
                        'token': uni.getStorageSync('token')
                    },
                    success(result) {
                        var res = result.data
                        if (res.code === 200) {
                            that.resst();
                            that.messageText = "组托成功"
                            that.messageToggle('success')
                        } else if (res.code == 403) {
                            that.messageText = res.msg
                            that.messageToggle('error')
                            setTimeout(() => {
                                uni.reLaunch({
                                    url: '../login/login'
                                });
                            }, 1000);
                        } else {
                            that.messageText = res.msg
                            that.messageToggle('error')
                        }
                    }
                });
            },
            reset(type) {
                this.msgType = type
@@ -416,6 +380,7 @@
            // 确认重置
            resetConfirm() {
                this.dataList = []
                this.barcode = ''
                this.messageText = "重置完成"
                this.messageToggle('success')
            },
@@ -429,6 +394,38 @@
                this.barcode = ''
                this.barcodeFocuss()
            },
            adjust() {
                let that = this
                var combMats = []
                var combParam = {}
                combParam['barcode'] = that.barcode
                combParam['wrkDetls'] = that.dataList
                uni.request({
                    url: that.baseUrl + '/mobile/adjustNew/auth',
                    method: 'POST',
                    data: JSON.stringify(combParam),
                    header: {
                        'token':uni.getStorageSync('token')
                    },
                    success(result) {
                        var res = result.data
                        if (res.code === 200) {
                            that.dataList = []
                            that.barcode = ''
                            uni.showToast({title: res.msg, icon: "none", position: 'top'})
                        } 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'})
                        }
                    },
                });
            },
        }
    }
</script>