diff --git a/pages/outWarehouse/outWarehouse.vue b/pages/outWarehouse/outWarehouse.vue index d761068..5bcab6d 100644 --- a/pages/outWarehouse/outWarehouse.vue +++ b/pages/outWarehouse/outWarehouse.vue @@ -30,10 +30,33 @@ 选择物料号 + + - + 出库清单 - + + + + + + + + 多箱出库清单 + + + + + + + + + @@ -90,7 +113,8 @@ outOrderPlan: [], // 1-仓库扫码 2-货物扫码 3-出货单扫码 searchType: 3, - + subsectionList: ['单箱出库', '多箱出库'], + subsectionCurrent: 0, show: false, columns: [ ['无物料号'] @@ -142,10 +166,14 @@ this.outInfo.materialList.forEach((item) => { arry.push(item.partnumber); }); - this.columns.push(arry); - this.material_id = this.outInfo.materialList[0].partnumber; + if (arry.length > 0) { + this.columns.push(arry); + this.material_id = this.outInfo.materialList[0].partnumber; + } else { + this.columns.push(['无物料号']); + } } else if (type === 2) { - if (this.newMaterialList.length > 0) { + if (this.subsectionCurrent === 0 && this.newMaterialList.length > 0) { uni.showModal({ title: '提示', content: '当前货物未确认出库,请先点击下方出库按钮,出库当前货物!', @@ -154,6 +182,28 @@ }); return; } + if (this.subsectionCurrent === 1 && this.newMaterialList.length > 0) { + if(this.newMaterialList.length > 50){ + uni.showModal({ + title: '提示', + content: '批量出库数量已达到50箱,请先出库此50箱!', + showCancel: false, + confirmText: '确定' + }); + return; + } + for (let item of this.newMaterialList) { + if (item.patchCode === data.patchCode) { + uni.showModal({ + title: '提示', + content: '此货物已录入过!', + showCancel: false, + confirmText: '确定' + }); + return; + } + } + } const checkData = { production_packcode: data.originalCode, shipment_num: this.outInfo.shipmentNum, @@ -210,7 +260,8 @@ }); return; } - if (this.newMaterialList.length === 0) { + const length = this.newMaterialList.length; + if (length === 0) { uni.showModal({ title: '提示', content: '当前未扫描货物!', @@ -221,16 +272,46 @@ } uni.showModal({ title: '操作', - content: '是否确认执行出库操作?', + content: '当前已扫描:' + length + '箱货物,是否确认执行出库操作?', showCancel: true, cancelText: '取消', confirmText: '确认出库', success: (res) => { if (res.confirm) { - const data = { + let data = { shipmentNum: this.outInfo.shipmentNum, - patchCode: [this.newMaterialList[0].patchCode] + patchCode: [] }; + if (this.subsectionCurrent === 0) { + data.patchCode = [this.newMaterialList[0].patchCode]; + } else if (this.subsectionCurrent === 1) { + // 提取货物patchCode + let patchCodeList = uni.$u.deepClone(this.newMaterialList); + let newPatchCodeList = []; + for (let item of patchCodeList) { + if (item.patchCode === "" || item.patchCode === null) { + uni.showModal({ + title: '提示', + content: '箱数据有异常:' + item.originalCode, + showCancel: false, + confirmText: '确认' + }); + return; + } else { + newPatchCodeList.push(item.patchCode) + } + + } + data.patchCode = newPatchCodeList; + } + if (data.patchCode.length === 0) { + uni.showModal({ + title: '提示', + content: '无出库箱,不可出库!', + showCancel: false, + confirmText: '确认' + }); + } WarehoseApi.doMaterialOut(data).then((res) => { if (res.code !== 200) { uni.showModal({ @@ -239,7 +320,6 @@ showCancel: false, confirmText: '确认' }); - return; } else { if (res.data.item1 == 100) { @@ -261,7 +341,7 @@ } else { uni.showModal({ title: '提示', - content: '出库成功', + content: '出库成功!已成功出库' + res.data.item2 + '箱', showCancel: false, confirmText: '确认' }); @@ -319,6 +399,40 @@ this.material_id = e.value[0]; console.log(this.material_id); this.show = false; + }, + // 长按弹出删除 + handleDeleteItem(index) { + // 双击判定 + this.touchNum++; + setTimeout(() => { + if (this.touchNum >= 2) { + uni.showModal({ + title: '删除提示', + content: '是否从列表中删除此货物?', + showCancel: true, + cancelText: '取消', + confirmText: '删除', + success: (res) => { + if (res.confirm) { + this.newMaterialList.splice(index, 1); + } + } + }); + } + this.touchNum = 0; + }, 250); + }, + subsectionChange(index) { + if (this.newMaterialList.length > 0) { + uni.showModal({ + title: '提示', + content: '当前货物列表有货物!可双击删除对应货物,全删除后可切换!', + showCancel: false, + confirmText: '确认' + }); + return; + } + this.subsectionCurrent = index; } } }; @@ -376,6 +490,7 @@ .scroll-view-title { font-size: 24px; + height: 40px; display: flex; align-items: center; justify-content: center; @@ -384,9 +499,10 @@ .scroll-view-box { width: 98%; margin: 0 auto; - margin-top: 50px; - height: 200px; - padding: 10px; + margin-top: 10px; + padding-left: 10px; + padding-right: 10px; + height: 300px; background-color: rgba(179, 179, 179, 0.3); border-radius: 5px; } diff --git a/utils/request.js b/utils/request.js index 15c0f78..722cf60 100644 --- a/utils/request.js +++ b/utils/request.js @@ -50,6 +50,7 @@ const request = config => { dataType: 'json' }).then(response => { let [error, res] = response + console.log(response); // console.log('token:','Bearer ' + getToAccess-Control-Allow-Originken()); // console.log('request:',storageBaseUrl + config.url,response); if (error) { @@ -73,11 +74,11 @@ const request = config => { reject('无效的会话,或者会话已过期,请重新登录。') } else if (code === 500) { // toast(msg) - showConfirm(message) + showConfirm(msg) reject('500') } else if (code !== 200) { // toast(msg) - showConfirm(message) + showConfirm(msg) reject(code) } resolve(res.data)