update: 去掉最大值和最小值校验
This commit is contained in:
parent
37e2c5a641
commit
58e2cb435b
|
@ -2,12 +2,12 @@
|
||||||
<up-row customStyle="flex-wrap: wrap" :gutter="8">
|
<up-row customStyle="flex-wrap: wrap" :gutter="8">
|
||||||
<up-col span="6" v-for="(item, index) in list" :key="index">
|
<up-col span="6" v-for="(item, index) in list" :key="index">
|
||||||
<view class="grid-item">
|
<view class="grid-item">
|
||||||
<up-image
|
<image
|
||||||
:src="item.url || `${url}/static/110/error.jpg`"
|
:src="item.url || `${url}/static/110/error.jpg`"
|
||||||
:mode="'widthFix'"
|
:mode="'widthFix'"
|
||||||
:width="'100%'"
|
:width="'100%'"
|
||||||
@click="showImage(index)"
|
@click="showImage(index)"
|
||||||
></up-image>
|
></image>
|
||||||
</view>
|
</view>
|
||||||
</up-col>
|
</up-col>
|
||||||
</up-row>
|
</up-row>
|
||||||
|
|
|
@ -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(() => {
|
setTimeout(() => {
|
||||||
(state as any)[item.key] = temp;
|
(state as any)[item.key] = temp;
|
||||||
}, 10);
|
}, 10);
|
||||||
|
@ -424,13 +414,6 @@ const resetState = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getFilter = () => {
|
const getFilter = () => {
|
||||||
if (state.minPrice && state.maxPrice && state.minPrice > state.maxPrice) {
|
|
||||||
uni.showToast({
|
|
||||||
title: `最大值应小于最小值`,
|
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
emit("handleOk", {
|
emit("handleOk", {
|
||||||
...state,
|
...state,
|
||||||
repairFlag: currentSpl.value,
|
repairFlag: currentSpl.value,
|
||||||
|
|
|
@ -32,7 +32,27 @@
|
||||||
:customStyle="{}"
|
:customStyle="{}"
|
||||||
border="none"
|
border="none"
|
||||||
:disabled="item.type === 'select'"
|
: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)"
|
||||||
|
>
|
||||||
|
<template #suffix>
|
||||||
|
<text>
|
||||||
|
{{ item.unit }}
|
||||||
|
</text>
|
||||||
|
</template>
|
||||||
|
</u-input>
|
||||||
|
<u-input
|
||||||
|
v-if="item.type === 'number'"
|
||||||
|
v-model="(model1.formData as any)[item.key]"
|
||||||
|
:placeholder="`请输入${
|
||||||
|
item.name
|
||||||
|
}`"
|
||||||
|
clearable
|
||||||
|
:customStyle="{}"
|
||||||
|
border="none"
|
||||||
@change="(e:any) => {handleInput(e, item)}"
|
@change="(e:any) => {handleInput(e, item)}"
|
||||||
@clear="handleClear(item)"
|
@clear="handleClear(item)"
|
||||||
>
|
>
|
||||||
|
@ -70,44 +90,26 @@ import { countDots } from "@/utils";
|
||||||
import valid from "@/utils/validate";
|
import valid from "@/utils/validate";
|
||||||
import { onLoad } from "@dcloudio/uni-app";
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
import _ from "underscore";
|
import _ from "underscore";
|
||||||
const handleClear = (item:any) => {
|
const handleClear = (item: any) => {
|
||||||
(model1.formData as any)[item.key] = '';
|
(model1.formData as any)[item.key] = "";
|
||||||
}
|
};
|
||||||
// 最低价 最高价 常用价格
|
// 最低价 最高价 常用价格
|
||||||
const handleInput = (e: any, item: any) => {
|
const handleInput = (e: any, item: any) => {
|
||||||
if (["minPrice", "maxPrice", "commonPrice"].indexOf(item.key) > -1) {
|
if (["minPrice", "maxPrice", "commonPrice"].indexOf(item.key) > -1) {
|
||||||
const temp = e?.replace(valid.valid_decimal.pattern, "");
|
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) {
|
if (countDots(temp).length > 1) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "请输入正确的" + item.name,
|
title: "请输入正确的" + item.name,
|
||||||
icon: "none",
|
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(() => {
|
setTimeout(() => {
|
||||||
model1.formData[item.key] = temp;
|
model1.formData[item.key] = temp;
|
||||||
|
@ -151,24 +153,6 @@ const rules = ref({
|
||||||
// message: "请输入所属分站",
|
// message: "请输入所属分站",
|
||||||
// trigger: ["blur", "change"],
|
// 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<any>({
|
const contrlModalParams = reactive<any>({
|
||||||
reCategory: {
|
reCategory: {
|
||||||
|
@ -198,32 +182,25 @@ const formAttrList = reactive<any>([
|
||||||
contrlModalParams.reCategory.title = "收货分类";
|
contrlModalParams.reCategory.title = "收货分类";
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// name: "所属分站",
|
|
||||||
// key: "substationName",
|
|
||||||
// type: "input",
|
|
||||||
// required: true,
|
|
||||||
// unit: "",
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
name: "最低价",
|
name: "最低价",
|
||||||
key: "minPrice",
|
key: "minPrice",
|
||||||
type: "input",
|
type: "number",
|
||||||
required: true,
|
required: false,
|
||||||
unit: "",
|
unit: "",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "最高价",
|
name: "最高价",
|
||||||
key: "maxPrice",
|
key: "maxPrice",
|
||||||
type: "input",
|
type: "number",
|
||||||
required: true,
|
required: false,
|
||||||
unit: "",
|
unit: "",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "常用价格",
|
name: "常用价格",
|
||||||
key: "commonPrice",
|
key: "commonPrice",
|
||||||
type: "input",
|
type: "number",
|
||||||
required: true,
|
required: false,
|
||||||
unit: "",
|
unit: "",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
@ -255,27 +232,7 @@ const check = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const save = () => {
|
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) => {
|
check().then((res) => {
|
||||||
if (res) {
|
if (res) {
|
||||||
startSave();
|
startSave();
|
||||||
|
@ -286,13 +243,13 @@ const startSave = () => {
|
||||||
if (model1.formData.id) {
|
if (model1.formData.id) {
|
||||||
GoodsApi.EditReceiveProduct(model1.formData).then((res) => {
|
GoodsApi.EditReceiveProduct(model1.formData).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
uni.navigateBack()
|
uni.navigateBack();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
GoodsApi.addReProducts(model1.formData).then((res) => {
|
GoodsApi.addReProducts(model1.formData).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
uni.navigateBack()
|
uni.navigateBack();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -324,7 +281,7 @@ onLoad((option) => {
|
||||||
|
|
||||||
// 设置页面标题
|
// 设置页面标题
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title: title || '新增收货产品',
|
title: title || "新增收货产品",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -350,7 +307,7 @@ onLoad((option) => {
|
||||||
border-radius: 13rpx 13rpx 0rpx 0rpx;
|
border-radius: 13rpx 13rpx 0rpx 0rpx;
|
||||||
padding: 25rpx 50rpx;
|
padding: 25rpx 50rpx;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
width: calc(100vw - 100rpx);
|
width: calc(100vw - 100rpx);
|
||||||
bottom: 0rpx;
|
bottom: 0rpx;
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
::v-deep button {
|
::v-deep button {
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
<view>
|
<view>
|
||||||
<view>
|
<view>
|
||||||
<view>{{ item.reProductsName }}</view>
|
<view>{{ item.reProductsName }}</view>
|
||||||
<view>{{ item.minPrice }} ~ {{ item.maxPrice }} 元</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="op-box">
|
<view class="op-box">
|
||||||
<view class="btn" @click="edit(item)"> 编辑 </view>
|
<view class="btn" @click="edit(item)"> 编辑 </view>
|
||||||
|
|
|
@ -183,17 +183,6 @@ const handleInput = (e: any, item: any) => {
|
||||||
icon: "none",
|
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 (item.key === "tare") {
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="c-card">
|
<view class="c-card app-container">
|
||||||
<u-form
|
<u-form
|
||||||
labelPosition="left"
|
labelPosition="left"
|
||||||
:model="model1"
|
:model="model1"
|
||||||
|
@ -111,7 +111,7 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="btn-box">
|
<view class="btn-box">
|
||||||
<u-button text="暂不定价" @click="handleBack()"></u-button>
|
<u-button text="暂不定价" @click="handleBack()"></u-button>
|
||||||
<u-button type="primary" text="保存" @click="save()"></u-button>
|
<u-button type="primary" :text="model1.order.scaleStatus === 0 ? '定价' : '保存'" @click="save()"></u-button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 收货产品弹框 -->
|
<!-- 收货产品弹框 -->
|
||||||
|
@ -188,17 +188,6 @@ const handleInput = (e: any, item: any) => {
|
||||||
icon: "none",
|
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(() => {
|
setTimeout(() => {
|
||||||
model1.order[item.key] = temp;
|
model1.order[item.key] = temp;
|
||||||
|
@ -674,18 +663,6 @@ const save = () => {
|
||||||
return;
|
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 (
|
if (
|
||||||
model1.order.grossWeight?.toString() &&
|
model1.order.grossWeight?.toString() &&
|
||||||
model1.order.grossWeight?.toString()[
|
model1.order.grossWeight?.toString()[
|
||||||
|
@ -766,9 +743,7 @@ const updateOrder = () => {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// 0:有皮重 1:零皮重
|
// 0:有皮重 1:零皮重
|
||||||
uni.redirectTo({
|
uni.navigateBack()
|
||||||
url: "/pagesHome/index", // 要跳转到的页面路径
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -111,6 +111,7 @@ import PageView from "@/components/PageView/index.vue";
|
||||||
import { onLoad } from "@dcloudio/uni-app";
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
import { DeviceType, ScaleStatus } from "@/utils/enum";
|
import { DeviceType, ScaleStatus } from "@/utils/enum";
|
||||||
import _ from "underscore";
|
import _ from "underscore";
|
||||||
|
import { onShow } from "@dcloudio/uni-app";
|
||||||
|
|
||||||
const stateNew = reactive<any>({
|
const stateNew = reactive<any>({
|
||||||
keywoard: "",
|
keywoard: "",
|
||||||
|
@ -183,7 +184,7 @@ const pricingDetail = (id: number) => {
|
||||||
resetPageList();
|
resetPageList();
|
||||||
getList();
|
getList();
|
||||||
} else {
|
} else {
|
||||||
uni.redirectTo({
|
uni.navigateTo({
|
||||||
url: "/pagesReceive/form/pricingForm?id=" + id, // 要跳转到的页面路径
|
url: "/pagesReceive/form/pricingForm?id=" + id, // 要跳转到的页面路径
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -227,9 +228,10 @@ const handleOk = () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onShow(() => {
|
||||||
|
resetPageList();
|
||||||
getList();
|
getList();
|
||||||
});
|
})
|
||||||
|
|
||||||
onLoad((option) => {
|
onLoad((option) => {
|
||||||
// 接收传递的标题参数
|
// 接收传递的标题参数
|
||||||
|
|
|
@ -26,6 +26,10 @@ const valid = {
|
||||||
pattern: /[^0-9.]/g,
|
pattern: /[^0-9.]/g,
|
||||||
message: "请输入正确的数字",
|
message: "请输入正确的数字",
|
||||||
},
|
},
|
||||||
|
valid_decimal2: {
|
||||||
|
pattern: /^\d+(\.\d{1,2})?$/,
|
||||||
|
message: "请输入正确的数字",
|
||||||
|
},
|
||||||
valid_id_card: {
|
valid_id_card: {
|
||||||
pattern:
|
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]$/,
|
/^[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]$/,
|
||||||
|
|
Loading…
Reference in New Issue