123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- import { hasSpace, isAddr, isChinese, isEmoticon, isMobile, isnumber, isSpecialSymbol } from '@/utils/validate'
- export const addressRules = {
- receipt_quantity: [
- {
- required: true,
- trigger: 'blur',
- validator: (rule, value, callback) => {
- if (value === '') {
- callback(new Error('不能为空!'))
- } else {
- if (!isnumber(value)) {
- callback(new Error('仅支持整数!'))
- } else {
- callback()
- }
- }
- }
- }
- ],
- contactor: [
- {
- required: true,
- trigger: 'blur',
- validator: (rule, value, callback) => {
- if (value === '') {
- callback(new Error('联系人不能为空!'))
- } else {
- if (value.length < 2 || value.length > 10) {
- callback(new Error('联系人规则为2~10位汉字!'))
- } else {
- if (!isChinese(value)) {
- callback(new Error('联系人规则为2~10位汉字!'))
- } else if (isEmoticon(value)) {
- callback(new Error('联系人规则为2~10位汉字!'))
- } else {
- callback()
- }
- }
- }
- }
- }
- ],
- mobile: [
- {
- required: true,
- validator: (rule, value, callback) => {
- if (value === '') {
- callback(new Error('手机号不能为空!'))
- } else {
- if (!isMobile(value)) {
- callback(new Error('手机号格式不正确!'))
- } else {
- callback()
- }
- }
- },
- trigger: 'blur'
- }
- ],
- // addr_code: [
- // {
- // type: 'array',
- // required: false,
- // message: '收货省市区不能为空',
- // trigger: 'change'
- // }
- // ],
- addr: [
- {
- required: true,
- trigger: 'blur',
- validator: (rule, value, callback) => {
- if (value === '') {
- callback(new Error('详细地址不能为空!'))
- } else {
- if (hasSpace(value)) {
- callback(new Error('系统不允许输入转义字符,请检查后重新输入!'))
- } else if (isSpecialSymbol(value)) {
- callback(new Error('不能使用英文特殊字符!'))
- } else if (isAddr(value)) {
- callback()
- } else {
- callback(new Error('详细地址填写不规范!'))
- }
- }
- }
- }
- ]
- }
- export const createRules = {
- customerCode: {
- required: true,
- message: '业务公司不能为空',
- trigger: 'blur'
- },
- companyName: {
- required: true,
- message: '客户名称不能为空',
- trigger: 'blur'
- },
- num: {
- required: true,
- message: '销售数量不能为空',
- trigger: 'blur'
- },
- is_determine_price: {
- required: true,
- message: '销售价不能为空',
- trigger: 'blur'
- },
- price: {
- required: true,
- message: '采购价不能为空',
- trigger: 'blur'
- },
- service_proportion: {
- required: true,
- message: '服务费比例不能为空',
- trigger: 'blur'
- },
- expect_service: {
- required: true,
- message: '期望服务费不能为空',
- trigger: 'blur'
- },
- brand_id: {
- required: true,
- message: '请选择品牌',
- trigger: 'blur'
- },
- preservation_day: {
- required: true,
- message: '有效期不能为空',
- trigger: 'blur'
- },
- delivery_day: {
- required: true,
- message: '物流时间不能为空',
- trigger: 'blur'
- },
- make_day: {
- required: true,
- message: '生产工期不能为空',
- trigger: 'blur'
- },
- tax: {
- required: true,
- message: '税点不能为空',
- trigger: 'blur'
- },
- unit_id: {
- required: true,
- message: '请选择单位',
- trigger: 'blur'
- },
- cat_id: {
- required: true,
- message: '请选择分类',
- trigger: 'blur'
- },
- spec_list: {
- required: true,
- message: '请选择规格',
- trigger: 'blur'
- },
- good_name: {
- required: true,
- message: '商品名称不能为空',
- trigger: 'blur'
- },
- delivery_place: {
- required: true,
- message: '发货地不能为空',
- trigger: 'blur'
- },
- origin_place: {
- required: true,
- message: '产地不能为空',
- trigger: 'blur'
- },
- weight: {
- required: true,
- message: '总重量不能为空',
- trigger: 'blur'
- },
- supply_area: {
- required: true,
- message: '请选择供货区域',
- trigger: 'blur'
- },
- pay_way: {
- required: true,
- message: '请选择支付方式',
- trigger: 'blur'
- },
- config: {
- required: true,
- message: '配置要求不能为空',
- trigger: 'blur'
- },
- other_config: {
- required: true,
- message: '其他配置要求不能为空',
- trigger: 'blur'
- },
- remark: {
- required: true,
- message: '采购备注不能为空',
- trigger: 'blur'
- },
- cost_desc: {
- required: true,
- message: '工艺说明不能为空',
- trigger: 'blur'
- },
- good_img: {
- required: true,
- message: '请上传商品图片',
- trigger: 'blur'
- },
- supplierNo: {
- required: true,
- message: '供应商不能为空',
- trigger: 'blur'
- }
- }
|