From 447d9ab591c3635acbaae8c8f891515e1d3b84de Mon Sep 17 00:00:00 2001 From: admin <> Date: Fri, 7 Jun 2024 10:49:08 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E6=96=B0=E5=A2=9E=E6=94=B6=E8=B4=A7?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E4=BB=B7=E6=A0=BC=E6=AF=94=E8=BE=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pagesApp/components/addReceiveProduct.vue | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/pagesApp/components/addReceiveProduct.vue b/src/pagesApp/components/addReceiveProduct.vue index 5d1dfd9..b726d62 100644 --- a/src/pagesApp/components/addReceiveProduct.vue +++ b/src/pagesApp/components/addReceiveProduct.vue @@ -83,8 +83,10 @@ const handleInput = (e: any, item: any) => { icon: "none", }); } + const minPrice = parseFloat(model1.formData.minPrice) + const maxPrice = parseFloat(model1.formData.maxPrice) if (item.key === "maxPrice") { - if (model1.formData.minPrice > model1.formData.maxPrice) { + if (minPrice > maxPrice) { uni.showToast({ title: `${item.name}应小于${model1.formData.maxPrice}`, icon: "none", @@ -93,10 +95,10 @@ const handleInput = (e: any, item: any) => { } } if (item.key === "commonPrice") { - if (model1.formData.minPrice > -1 && model1.formData.maxPrice > -1) { + if (minPrice > -1 && maxPrice > -1) { if ( - temp < model1.formData.minPrice || - temp > model1.formData.maxPrice + !(temp >= minPrice && + temp <= maxPrice) ) { uni.showToast({ title: `${item.name}应在${model1.formData.minPrice}-${model1.formData.maxPrice}之间`, @@ -253,16 +255,20 @@ const check = () => { }; const save = () => { - if (model1.formData.minPrice > model1.formData.maxPrice) { + const minPrice = parseFloat(model1.formData.minPrice) + const maxPrice = parseFloat(model1.formData.maxPrice) + if (minPrice > maxPrice) { uni.showToast({ title: `最低价应小于${model1.formData.maxPrice}`, icon: "none", }); return; } - if (model1.formData.minPrice > -1 && model1.formData.maxPrice > -1) { + + if (minPrice > -1 &&maxPrice > -1) { + const temp = model1.formData.commonPrice; - if (temp < model1.formData.minPrice || temp > model1.formData.maxPrice) { + if (!(temp >= minPrice && temp <= maxPrice)) { uni.showToast({ title: `常用价格应在${model1.formData.minPrice}-${model1.formData.maxPrice}之间`, icon: "none", @@ -270,7 +276,6 @@ const save = () => { return; } } - console.log(model1.formData); check().then((res) => { if (res) { startSave();