|
|
export const addFormRule = { // 精网号:6-10位纯数字
jwcode: [ { required: true, message: '请输入精网号', trigger: 'blur' }, { pattern: /^\d{6,10}$/, message: '请检查精网号格式', trigger: 'blur' } ], // 客户姓名:必填
name: [ { required: true, message: '请输入客户姓名', trigger: 'blur' } ], // 所属地区:必填
market: [ { required: true, message: '请选择所属地区', trigger: 'blur' } ], // 活动名称:必填 + 长度小于30
activity: [ { required: true, message: '请输入活动名称', trigger: 'blur' }, ], // 产品名称:必填
goodsName: [ { required: true, message: '请选择产品名称', trigger: 'change' } ], // 产品数量:0-100纯数字
goodNum: [ { required: true, message: '请输入产品数量', trigger: 'blur' }, ], // 永久金币:纯数字(非必填,可按需调整)
permanentGold: [ { validator: (rule, value, callback) => { if (value && !/^\d+$/.test(value)) { callback(new Error('请输入纯数字')); } else { callback(); } }, trigger: 'blur' } ], // 免费金币:纯数字(非必填,可按需调整)
freeGold: [ { validator: (rule, value, callback) => { if (value && !/^\d+$/.test(value)) { callback(new Error('请输入纯数字')); } else { callback(); } }, trigger: 'blur' } ], // 付款币种:必填
paymentCurrency: [ { required: true, message: '请选择付款币种', trigger: 'change' } ], // 付款金额:小于8位纯数字 + 不为0
paymentAmount: [ { 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')); } else { callback(); } }, trigger: 'blur' } ], // 支付方式:必填
payType: [ { required: true, message: '请选择支付方式', trigger: 'change' } ], // 到账地区:必填
receivedMarket: [ { required: true, message: '请选择到账地区', trigger: 'change' } ], // 付款时间:必填
payTime: [ { required: true, message: '请选择付款时间', trigger: 'change' } ]};
//填手续费校验规则
export const editFormRule = { // 到账金额:最大6位(整数部分最多4位,小数2位),支持两位小数
receivedAmount: [ { required: true, message: '请输入到账金额', trigger: 'blur' }, { pattern: /^\d{1,6}(\.\d{1,2})?$/, message: '请检查到账金额格式', trigger: 'blur' } ], // 手续费:同到账金额规则
handlingCharge: [ { required: true, message: '请输入手续费', trigger: 'blur' }, { pattern: /^\d{1,6}(\.\d{1,2})?$/, message: '请检查手续费格式', trigger: 'blur' } ],};
|