diff --git a/src/components/Photo/index.vue b/src/components/Photo/index.vue index 2d536e3..582a65e 100644 --- a/src/components/Photo/index.vue +++ b/src/components/Photo/index.vue @@ -2,12 +2,12 @@ - + > diff --git a/src/pagesApp/components/FilterDialog.vue b/src/pagesApp/components/FilterDialog.vue index d5299dc..ba2ba13 100644 --- a/src/pagesApp/components/FilterDialog.vue +++ b/src/pagesApp/components/FilterDialog.vue @@ -210,16 +210,6 @@ const handleInput = (e: any, item: any) => { }); } - if (item.key === "maxPrice" || item.key === "minPrice") { - if (state.minPrice && state.maxPrice && state.minPrice > state.maxPrice) { - uni.showToast({ - title: `最大值应小于最小值`, - icon: "none", - }); - return; - } - } - setTimeout(() => { (state as any)[item.key] = temp; }, 10); @@ -424,13 +414,6 @@ const resetState = () => { }; const getFilter = () => { - if (state.minPrice && state.maxPrice && state.minPrice > state.maxPrice) { - uni.showToast({ - title: `最大值应小于最小值`, - icon: "none", - }); - return; - } emit("handleOk", { ...state, repairFlag: currentSpl.value, diff --git a/src/pagesApp/components/addReceiveProduct.vue b/src/pagesApp/components/addReceiveProduct.vue index b31244a..f1a0495 100644 --- a/src/pagesApp/components/addReceiveProduct.vue +++ b/src/pagesApp/components/addReceiveProduct.vue @@ -32,7 +32,27 @@ :customStyle="{}" border="none" :disabled="item.type === 'select'" - :disabledColor="['收货分类'].indexOf(item.name) > -1?'#ffffff':'#f5f7fa'" + :disabledColor=" + ['收货分类'].indexOf(item.name) > -1 ? '#ffffff' : '#f5f7fa' + " + @change="(e:any) => {handleInput(e, item)}" + @clear="handleClear(item)" + > + + + @@ -70,44 +90,26 @@ import { countDots } from "@/utils"; import valid from "@/utils/validate"; import { onLoad } from "@dcloudio/uni-app"; import _ from "underscore"; -const handleClear = (item:any) => { - (model1.formData as any)[item.key] = ''; -} +const handleClear = (item: any) => { + (model1.formData as any)[item.key] = ""; +}; // 最低价 最高价 常用价格 const handleInput = (e: any, item: any) => { if (["minPrice", "maxPrice", "commonPrice"].indexOf(item.key) > -1) { const temp = e?.replace(valid.valid_decimal.pattern, ""); + if (!valid.valid_decimal2.pattern.test(temp)) { + uni.showToast({ + title: "请输入正确的" + item.name + ", 且最多保留2位小数", + icon: "none", + }); + return; + } if (countDots(temp).length > 1) { uni.showToast({ title: "请输入正确的" + item.name, icon: "none", }); } - const minPrice = parseFloat(model1.formData.minPrice) - const maxPrice = parseFloat(model1.formData.maxPrice) - if (item.key === "maxPrice") { - if (minPrice > maxPrice) { - uni.showToast({ - title: `${item.name}应小于${model1.formData.maxPrice}`, - icon: "none", - }); - return; - } - } - if (item.key === "commonPrice") { - if (minPrice > -1 && maxPrice > -1) { - if ( - !(temp >= minPrice && - temp <= maxPrice) - ) { - uni.showToast({ - title: `${item.name}应在${model1.formData.minPrice}-${model1.formData.maxPrice}之间`, - icon: "none", - }); - return; - } - } - } setTimeout(() => { model1.formData[item.key] = temp; @@ -151,24 +153,6 @@ const rules = ref({ // message: "请输入所属分站", // trigger: ["blur", "change"], // }, - "formData.minPrice": { - type: "number", - required: true, - message: "最低价为空或输入错误", - trigger: ["blur", "change"], - }, - "formData.maxPrice": { - type: "number", - required: true, - message: "最高价为空或输入错误", - trigger: ["blur", "change"], - }, - "formData.commonPrice": { - type: "number", - required: true, - message: "常用价格为空或输入错误", - trigger: ["blur", "change"], - }, }); const contrlModalParams = reactive({ reCategory: { @@ -198,32 +182,25 @@ const formAttrList = reactive([ contrlModalParams.reCategory.title = "收货分类"; }, }, - // { - // name: "所属分站", - // key: "substationName", - // type: "input", - // required: true, - // unit: "", - // }, { name: "最低价", key: "minPrice", - type: "input", - required: true, + type: "number", + required: false, unit: "", }, { name: "最高价", key: "maxPrice", - type: "input", - required: true, + type: "number", + required: false, unit: "", }, { name: "常用价格", key: "commonPrice", - type: "input", - required: true, + type: "number", + required: false, unit: "", }, ]); @@ -255,27 +232,7 @@ const check = () => { }; const save = () => { - 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 (minPrice > -1 &&maxPrice > -1) { - - const temp = model1.formData.commonPrice; - if (!(temp >= minPrice && temp <= maxPrice)) { - uni.showToast({ - title: `常用价格应在${model1.formData.minPrice}-${model1.formData.maxPrice}之间`, - icon: "none", - }); - return; - } - } + check().then((res) => { if (res) { startSave(); @@ -286,13 +243,13 @@ const startSave = () => { if (model1.formData.id) { GoodsApi.EditReceiveProduct(model1.formData).then((res) => { if (res.code === 200) { - uni.navigateBack() + uni.navigateBack(); } }); } else { GoodsApi.addReProducts(model1.formData).then((res) => { if (res.code === 200) { - uni.navigateBack() + uni.navigateBack(); } }); } @@ -324,7 +281,7 @@ onLoad((option) => { // 设置页面标题 uni.setNavigationBarTitle({ - title: title || '新增收货产品', + title: title || "新增收货产品", }); }); @@ -350,7 +307,7 @@ onLoad((option) => { border-radius: 13rpx 13rpx 0rpx 0rpx; padding: 25rpx 50rpx; position: fixed; -width: calc(100vw - 100rpx); + width: calc(100vw - 100rpx); bottom: 0rpx; z-index: 999; ::v-deep button { diff --git a/src/pagesApp/receiveProduct.vue b/src/pagesApp/receiveProduct.vue index 2cab7fb..f642631 100644 --- a/src/pagesApp/receiveProduct.vue +++ b/src/pagesApp/receiveProduct.vue @@ -28,7 +28,6 @@ {{ item.reProductsName }} - {{ item.minPrice }} ~ {{ item.maxPrice }} 元 编辑 diff --git a/src/pagesApp/receiveSpl.vue b/src/pagesApp/receiveSpl.vue index 7826cde..cd9ec5a 100644 --- a/src/pagesApp/receiveSpl.vue +++ b/src/pagesApp/receiveSpl.vue @@ -183,17 +183,6 @@ const handleInput = (e: any, item: any) => { icon: "none", }); } - if (item.key === "price") { - if (model1.order.minPrice && model1.order.maxPrice) { - if (temp < model1.order.minPrice || temp > model1.order.maxPrice) { - uni.showToast({ - title: `${item.name}应在${model1.order.minPrice}-${model1.order.maxPrice}之间`, - icon: "none", - }); - return; - } - } - } if (item.key === "tare") { if ( diff --git a/src/pagesReceive/form/pricingForm.vue b/src/pagesReceive/form/pricingForm.vue index 3d25171..3797b30 100644 --- a/src/pagesReceive/form/pricingForm.vue +++ b/src/pagesReceive/form/pricingForm.vue @@ -1,5 +1,5 @@