You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
3.5 KiB

1 month ago
1 month ago
1 month ago
1 month ago
  1. export const addFormRule = {
  2. // 精网号:6-10位纯数字
  3. jwcode: [
  4. { required: true, message: '请输入精网号', trigger: 'blur' },
  5. { pattern: /^\d{6,10}$/, message: '请检查精网号格式', trigger: 'blur' }
  6. ],
  7. // 客户姓名:必填
  8. name: [
  9. { required: true, message: '请输入客户姓名', trigger: 'blur' }
  10. ],
  11. // 所属地区:必填
  12. market: [
  13. { required: true, message: '请选择所属地区', trigger: 'blur' }
  14. ],
  15. // 活动名称:必填 + 长度小于30
  16. activity: [
  17. { required: true, message: '请输入活动名称', trigger: 'blur' },
  18. ],
  19. // 产品名称:必填
  20. goodsName: [
  21. { required: true, message: '请选择产品名称', trigger: 'change' }
  22. ],
  23. // 产品数量:0-100纯数字
  24. goodNum: [
  25. { required: true, message: '请输入产品数量', trigger: 'blur' },
  26. ],
  27. // 永久金币:纯数字(非必填,可按需调整)
  28. permanentGold: [
  29. {
  30. validator: (rule, value, callback) => {
  31. if (value && !/^\d+$/.test(value)) {
  32. callback(new Error('请输入纯数字'));
  33. } else {
  34. callback();
  35. }
  36. }, trigger: 'blur'
  37. }
  38. ],
  39. // 免费金币:纯数字(非必填,可按需调整)
  40. freeGold: [
  41. {
  42. validator: (rule, value, callback) => {
  43. if (value && !/^\d+$/.test(value)) {
  44. callback(new Error('请输入纯数字'));
  45. } else {
  46. callback();
  47. }
  48. }, trigger: 'blur'
  49. }
  50. ],
  51. // 付款币种:必填
  52. paymentCurrency: [
  53. { required: true, message: '请选择付款币种', trigger: 'change' }
  54. ],
  55. // 付款金额:小于8位纯数字 + 不为0
  56. paymentAmount: [
  57. { required: true, message: '请输入付款金额', trigger: 'blur' },
  58. {
  59. validator: (rule, value, callback) => {
  60. if (!/^\d+$/.test(value)) {
  61. callback(new Error('请输入纯数字'));
  62. } else if (value.length >= 8) {
  63. callback(new Error('付款金额不能超过7位数字'));
  64. } else if (Number(value) === 0) {
  65. callback(new Error('付款金额不能为0'));
  66. } else {
  67. callback();
  68. }
  69. }, trigger: 'blur'
  70. }
  71. ],
  72. // 支付方式:必填
  73. payType: [
  74. { required: true, message: '请选择支付方式', trigger: 'change' }
  75. ],
  76. // 到账地区:必填
  77. receivedMarket: [
  78. { required: true, message: '请选择到账地区', trigger: 'change' }
  79. ],
  80. // 付款时间:必填
  81. payTime: [
  82. { required: true, message: '请选择付款时间', trigger: 'change' }
  83. ]
  84. };
  85. //填手续费校验规则
  86. export const editFormRule = {
  87. // 到账金额:最大6位(整数部分最多4位,小数2位),支持两位小数
  88. receivedAmount: [
  89. { required: true, message: '请输入到账金额', trigger: 'blur' },
  90. {
  91. pattern: /^\d{1,6}(\.\d{1,2})?$/,
  92. message: '请检查到账金额格式',
  93. trigger: 'blur'
  94. }
  95. ],
  96. // 手续费:同到账金额规则
  97. handlingCharge: [
  98. { required: true, message: '请输入手续费', trigger: 'blur' },
  99. {
  100. pattern: /^\d{1,6}(\.\d{1,2})?$/,
  101. message: '请检查手续费格式',
  102. trigger: 'blur'
  103. }
  104. ],
  105. };