From cac690ddd25091d1fa63c38e15d1d61110be88bd Mon Sep 17 00:00:00 2001 From: lijuncheng Date: Wed, 17 Jan 2024 14:00:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E9=87=8F=E4=B8=BA?= =?UTF-8?q?=E5=B0=8F=E6=95=B0=E7=82=B9=E5=90=8E6=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mycomponents/qty/CountQtyEdit.vue | 21 +++++++++++++++++++-- mycomponents/qty/balanceQtyEdit.vue | 19 +++++++++++++++++-- mycomponents/qty/recommendQtyEdit.vue | 26 ++++++++++++++++++++++---- 3 files changed, 58 insertions(+), 8 deletions(-) diff --git a/mycomponents/qty/CountQtyEdit.vue b/mycomponents/qty/CountQtyEdit.vue index efaf99f3..32e5e5dd 100644 --- a/mycomponents/qty/CountQtyEdit.vue +++ b/mycomponents/qty/CountQtyEdit.vue @@ -38,7 +38,9 @@ 数量 : + @mousedown="mousedown" + @input="checkNum" + :maxlength="maxlength" /> @@ -107,7 +109,8 @@ seconds: 0, timer: {}, showConfirmCountdown: false, - detaiList: [] + detaiList: [], + maxlength: 10 } }, watch: { @@ -140,6 +143,20 @@ }, }, methods: { + checkNum(e) { + let value = e.detail.value; + let dot = value.indexOf('.'); //包含小数点 + let reg = /^[0-9]+$/; //正整数 + if (dot > -1) { + this.maxlength = dot + 7; //长度是小数点后两位 + if (value.length > dot + 7) { + + } + } + if (reg.test(value)) { //如果是正整数不包含小数点 + this.maxlength = 10; + } + }, openEditPopup(item, detaiList) { this.dataContent = item this.inventoryStatus = this.dataContent.inventoryStatus; diff --git a/mycomponents/qty/balanceQtyEdit.vue b/mycomponents/qty/balanceQtyEdit.vue index 726c2d80..632b1eb0 100644 --- a/mycomponents/qty/balanceQtyEdit.vue +++ b/mycomponents/qty/balanceQtyEdit.vue @@ -36,7 +36,7 @@ 数量 : + @confirm="confirm()" @input="checkNum" :maxlength="maxlength" /> @@ -94,7 +94,8 @@ inventoryStatus: "", originalInventoryStatus: "", dataContent: {}, - handleQty: 0 + handleQty: 0, + maxlength: 10 } }, watch: { @@ -123,6 +124,20 @@ } }, methods: { + checkNum(e) { + let value = e.detail.value; + let dot = value.indexOf('.'); //包含小数点 + let reg = /^[0-9]+$/; //正整数 + if (dot > -1) { + this.maxlength = dot + 7; //长度是小数点后两位 + if (value.length > dot + 7) { + + } + } + if (reg.test(value)) { //如果是正整数不包含小数点 + this.maxlength = 10; + } + }, openEditPopup(item, handleQty) { this.dataContent = item this.inventoryStatus = this.dataContent.inventoryStatus diff --git a/mycomponents/qty/recommendQtyEdit.vue b/mycomponents/qty/recommendQtyEdit.vue index 6f021fd1..72e0ca14 100644 --- a/mycomponents/qty/recommendQtyEdit.vue +++ b/mycomponents/qty/recommendQtyEdit.vue @@ -31,12 +31,13 @@ + 总数量 : + @input="checkNum" @confirm="confirm()" :maxlength="maxlength" /> @@ -69,7 +70,8 @@ allQty: 0, stdCount: 0, labelQty: 0, - recommendQty: 0 + recommendQty: 0, + maxlength: 10 } }, watch: { @@ -104,6 +106,20 @@ }, }, methods: { + checkNum(e) { + let value = e.detail.value; + let dot = value.indexOf('.'); //包含小数点 + let reg = /^[0-9]+$/; //正整数 + if (dot > -1) { + this.maxlength = dot + 7; //长度是小数点后两位 + if (value.length > dot + 7) { + + } + } + if (reg.test(value)) { //如果是正整数不包含小数点 + this.maxlength = 10; + } + }, openEditPopup() { this.$refs.popup.open('bottom') }, @@ -148,7 +164,8 @@ } else { if (this.recommendQty != 0) { if (this.allQty > this.recommendQty) { - if (this.settingParam.allowBiggerQty != null && this.settingParam.allowBiggerQty == "TRUE") { + if (this.settingParam.allowBiggerQty != null && this.settingParam.allowBiggerQty == + "TRUE") { this.callback(); } else { this.$refs.comMessage.showErrorMessage('数量[' + this.allQty + ']不允许大于推荐数量[' + @@ -159,7 +176,8 @@ }) } } else if (this.allQty < this.recommendQty) { - if (this.settingParam.allowSmallerQty != null && this.settingParam.allowSmallerQty == "TRUE") { + if (this.settingParam.allowSmallerQty != null && this.settingParam.allowSmallerQty == + "TRUE") { this.callback(); } else { this.$refs.comMessage.showErrorMessage('数量[' + this.allQty + ']不允许小于推荐数量[' +