From 013c394cd098850d63ae6ab24f7e752a06215363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=AD=A3=E6=98=93?= Date: Tue, 9 Jul 2024 13:49:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=BC=E7=AE=B1=E6=8F=90=E7=A4=BA=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=8C=E4=B8=8D=E5=BC=BA=E5=88=B6=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/consolidation/consolidation.vue | 47 +++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) 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;