From 38aa6857c72b1ce1d6f88edd46e750231c01dbb0 Mon Sep 17 00:00:00 2001 From: ZhangYong Date: Wed, 19 Nov 2025 13:18:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E6=AC=BE=E9=87=91=E9=A2=9D=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=EF=BC=8C=E9=80=80=E6=AC=BE=E5=8F=96=E6=B6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../moneyManage/receiveDetail/receiveService.vue | 2 +- .../receiveDetail/utils/recriveFormRules.js | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/views/moneyManage/receiveDetail/receiveService.vue b/src/views/moneyManage/receiveDetail/receiveService.vue index 256cc30..7ecd4f5 100644 --- a/src/views/moneyManage/receiveDetail/receiveService.vue +++ b/src/views/moneyManage/receiveDetail/receiveService.vue @@ -382,7 +382,7 @@
ps:请在退款理由表明用户的退款需求。
- 重置 + 取消 提交
diff --git a/src/views/moneyManage/receiveDetail/utils/recriveFormRules.js b/src/views/moneyManage/receiveDetail/utils/recriveFormRules.js index 23ca657..27152fa 100644 --- a/src/views/moneyManage/receiveDetail/utils/recriveFormRules.js +++ b/src/views/moneyManage/receiveDetail/utils/recriveFormRules.js @@ -33,16 +33,22 @@ export const addFormRule = { { required: true, message: '请输入付款金额', trigger: 'blur' }, { validator: (rule, value, callback) => { - if (!/^\d+$/.test(value)) { - callback(new Error('请输入纯数字')); - } else if (value.length >= 8) { - callback(new Error('付款金额不能超过7位数字')); - } else if (Number(value) === 0) { - callback(new Error('付款金额不能为0')); + // 匹配非负数字(支持整数或最多2位小数) + const reg = /^\d+(\.\d{1,2})?$/; + if (!reg.test(value)) { + callback(new Error('请输入有效的金额(最多2位小数)')); } else { - callback(); + const num = Number(value); + if (num === 0) { + callback(new Error('付款金额不能为0')); + } else if (num > 9999999) { // 限制最大值为9999999(7位整数) + callback(new Error('付款金额不能超过9999999')); + } else { + callback(); + } } - }, trigger: 'blur' + }, + trigger: 'blur' } ], // 支付方式:必填