diff --git a/pages/consolidation/consolidation.vue b/pages/consolidation/consolidation.vue index 42bb1b3..2f3558a 100644 --- a/pages/consolidation/consolidation.vue +++ b/pages/consolidation/consolidation.vue @@ -50,8 +50,9 @@ - + + @@ -234,6 +235,9 @@ } }, modalConfirm() { + if (!this.checkInput()) { + return; + } this.loading = true; setTimeout(() => { this.loading = false; @@ -286,6 +290,45 @@ return; } }, + // 检查输入的数值 + checkInput() { + const num = this.mainPackageActionNum * 1; + const packageList = this.newMaterialList; + const minQuantity = packageList[0]?.quantity * 1; + const maxQuantity = this.quantityTotal * 1; + if (packageList.length < 1) { + uni.showModal({ + title: '输入错误提示', + content: '需要至少两箱才能拼箱!', + showCancel: false, + confirmText: '确认' + }); + return false; + } + if (num < minQuantity) { + this.$nextTick(() => { + uni.showModal({ + title: '输入错误提示', + content: '输入值小于主箱零件数!请增加数字!', + showCancel: false, + confirmText: '确认' + }); + }) + return false; + } + if (num > maxQuantity) { + this.$nextTick(() => { + uni.showModal({ + title: '输入错误提示', + content: '输入值大于总零件数!请减小数字!', + showCancel: false, + confirmText: '确认' + }); + }) + return false; + } + return true; + }, numInput2(value) { const num = value * 1; const packageList = this.newMaterialList;