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)"
+ >
+
+
+ {{ item.unit }}
+
+
+
+ {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 @@
-
+
-
+
@@ -188,17 +188,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;
- }
- }
- }
setTimeout(() => {
model1.order[item.key] = temp;
@@ -674,18 +663,6 @@ const save = () => {
return;
}
- if (model1.order.minPrice && model1.order.maxPrice) {
- if (
- parseFloat(model1.order.price + "") < parseFloat(model1.order.minPrice) ||
- parseFloat(model1.order.price + "") > parseFloat(model1.order.maxPrice)
- ) {
- uni.showToast({
- title: `单价应在${model1.order.minPrice}-${model1.order.maxPrice}之间`,
- icon: "none",
- });
- return;
- }
- }
if (
model1.order.grossWeight?.toString() &&
model1.order.grossWeight?.toString()[
@@ -766,9 +743,7 @@ const updateOrder = () => {
});
} else {
// 0:有皮重 1:零皮重
- uni.redirectTo({
- url: "/pagesHome/index", // 要跳转到的页面路径
- });
+ uni.navigateBack()
}
}
});
diff --git a/src/pagesReceive/pricing.vue b/src/pagesReceive/pricing.vue
index d9c75ab..250c464 100644
--- a/src/pagesReceive/pricing.vue
+++ b/src/pagesReceive/pricing.vue
@@ -111,6 +111,7 @@ import PageView from "@/components/PageView/index.vue";
import { onLoad } from "@dcloudio/uni-app";
import { DeviceType, ScaleStatus } from "@/utils/enum";
import _ from "underscore";
+import { onShow } from "@dcloudio/uni-app";
const stateNew = reactive({
keywoard: "",
@@ -183,7 +184,7 @@ const pricingDetail = (id: number) => {
resetPageList();
getList();
} else {
- uni.redirectTo({
+ uni.navigateTo({
url: "/pagesReceive/form/pricingForm?id=" + id, // 要跳转到的页面路径
});
}
@@ -227,9 +228,10 @@ const handleOk = () => {
});
};
-onMounted(() => {
+onShow(() => {
+ resetPageList();
getList();
-});
+})
onLoad((option) => {
// 接收传递的标题参数
diff --git a/src/utils/validate.ts b/src/utils/validate.ts
index 2787fb9..2ace21d 100644
--- a/src/utils/validate.ts
+++ b/src/utils/validate.ts
@@ -26,6 +26,10 @@ const valid = {
pattern: /[^0-9.]/g,
message: "请输入正确的数字",
},
+ valid_decimal2: {
+ pattern: /^\d+(\.\d{1,2})?$/,
+ message: "请输入正确的数字",
+ },
valid_id_card: {
pattern:
/^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,