Browse Source

收款金额校验,退款取消

lihuilin/feature-20251104102812-现金二期
ZhangYong 2 weeks ago
parent
commit
38aa6857c7
  1. 2
      src/views/moneyManage/receiveDetail/receiveService.vue
  2. 18
      src/views/moneyManage/receiveDetail/utils/recriveFormRules.js

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

@ -382,7 +382,7 @@
</div>
<div>ps:请在退款理由表明用户的退款需求</div>
<div style="display:flex;justify-content: center;margin-top: 5vh;">
<el-button type="default" @click="">重置</el-button>
<el-button type="default" @click="closeRefundForm">取消</el-button>
<el-button type="primary" @click="throttledsubmitRefund">提交</el-button>
</div>
</div>

18
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) {
// 匹配非负数字(支持整数或最多2位小数)
const reg = /^\d+(\.\d{1,2})?$/;
if (!reg.test(value)) {
callback(new Error('请输入有效的金额(最多2位小数)'));
} else {
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'
}
],
// 支付方式:必填

Loading…
Cancel
Save