Browse Source

产品数量校验

lihuilin/feature-20251104102812-现金二期
ZhangYong 2 weeks ago
parent
commit
0fb0e7f41f
  1. 26
      src/views/moneyManage/receiveDetail/receiveService.vue
  2. 5
      src/views/moneyManage/receiveDetail/utils/recriveFormRules.js

26
src/views/moneyManage/receiveDetail/receiveService.vue

@ -200,7 +200,7 @@
<el-form-item label="产品名称" required @change="ifGold" prop="goodsName">
<ProductSelect ref="productSelectRef" v-model="addFormData.goodsName"></ProductSelect>
</el-form-item>
<el-form-item v-show="!isGold" label="产品数量" required prop="goodNum">
<el-form-item v-show="!isGold" label="产品数量" required>
<div style="display: flex;">
<el-input style="padding-right: 30px; flex: 3;" v-model="addFormData.goodNum"
placeholder="请输入产品数量" />
@ -667,6 +667,18 @@ const handleAddForm = async () => {
ElMessage.error(testGold().message);
return;
}
//
if (!isGold.value) {
if (!addFormData.value.goodNum) {
ElMessage.error('请输入产品数量');
return;
}
const positiveIntReg = /^[1-9]\d*$/;
if (!positiveIntReg.test(addFormData.value.goodNum)) {
ElMessage.error('产品数量必须为正整数');
return;
}
}
//
if (addFormData.value.payTime) {
addFormData.value.payTime = moment(addFormData.value.payTime).format('YYYY-MM-DD HH:mm:ss')
@ -704,6 +716,18 @@ const handleEditForm = async () => {
ElMessage.error(testGold().message);
return;
}
//
if (!isGold.value) {
if (!addFormData.value.goodNum) {
ElMessage.error('请输入产品数量');
return;
}
const positiveIntReg = /^[1-9]\d*$/;
if (!positiveIntReg.test(addFormData.value.goodNum)) {
ElMessage.error('产品数量必须为正整数');
return;
}
}
//
if (addFormData.value.payTime) {
addFormData.value.payTime = moment(addFormData.value.payTime).format('YYYY-MM-DD HH:mm:ss')

5
src/views/moneyManage/receiveDetail/utils/recriveFormRules.js

@ -23,11 +23,6 @@ export const addFormRule = {
// 产品数量:0-100纯数字
goodNum: [
{ required: true, message: '请输入产品数量', trigger: 'blur' },
{
pattern: /^[1-9]\d*$/,
message: '请输入正整数',
trigger: 'blur'
}
],
// 付款币种:必填
paymentCurrency: [

Loading…
Cancel
Save