...
|
...
|
@@ -5,101 +5,101 @@ |
|
|
import _ from 'lodash';
|
|
|
|
|
|
export default function() {
|
|
|
const validateEmpty = (rule, value, callback) => {
|
|
|
if (!value) {
|
|
|
return callback(new Error());
|
|
|
} else {
|
|
|
return callback();
|
|
|
}
|
|
|
};
|
|
|
const validateEmpty = (rule, value, callback) => {
|
|
|
if (!value) {
|
|
|
return callback(new Error());
|
|
|
} else {
|
|
|
return callback();
|
|
|
}
|
|
|
};
|
|
|
|
|
|
const validateMustLessRetailPrice = (rule, value, callback) => {
|
|
|
if (!value) {
|
|
|
return callback(new Error('不能为空'));
|
|
|
}
|
|
|
const validateMustLessRetailPrice = (rule, value, callback) => {
|
|
|
if (!value) {
|
|
|
return callback(new Error('不能为空'));
|
|
|
}
|
|
|
|
|
|
if (!Number.isInteger(value)) {
|
|
|
return callback(new Error('请输入数字值'));
|
|
|
}
|
|
|
if (value > +this.product.retailPrice) {
|
|
|
return callback(new Error('必须小于等于吊牌价'));
|
|
|
}
|
|
|
return callback();
|
|
|
};
|
|
|
if (!Number.isInteger(value)) {
|
|
|
return callback(new Error('请输入数字值'));
|
|
|
}
|
|
|
if (value > +this.product.retailPrice) {
|
|
|
return callback(new Error('必须小于等于吊牌价'));
|
|
|
}
|
|
|
return callback();
|
|
|
};
|
|
|
|
|
|
const validateRetailPrice = (rule, value, callback) => {
|
|
|
if (!value) {
|
|
|
return callback(new Error('不能为空'));
|
|
|
}
|
|
|
const validateRetailPrice = (rule, value, callback) => {
|
|
|
if (!value) {
|
|
|
return callback(new Error('不能为空'));
|
|
|
}
|
|
|
|
|
|
if (!Number.isInteger(value)) {
|
|
|
return callback(new Error('请输入整数,不能有小数点'));
|
|
|
}
|
|
|
if (value > 99999) {
|
|
|
return callback(new Error('价格不能大于5位'));
|
|
|
}
|
|
|
return callback();
|
|
|
};
|
|
|
if (!Number.isInteger(value)) {
|
|
|
return callback(new Error('请输入整数,不能有小数点'));
|
|
|
}
|
|
|
if (value > 99999) {
|
|
|
return callback(new Error('价格不能大于5位'));
|
|
|
}
|
|
|
return callback();
|
|
|
};
|
|
|
|
|
|
const validateColor = (rule, value, callback) => {
|
|
|
if (_.isEmpty(value)) {
|
|
|
return callback(new Error('颜色不能为空'));
|
|
|
}
|
|
|
return callback();
|
|
|
};
|
|
|
const validateColor = (rule, value, callback) => {
|
|
|
if (_.isEmpty(value)) {
|
|
|
return callback(new Error('颜色不能为空'));
|
|
|
}
|
|
|
return callback();
|
|
|
};
|
|
|
|
|
|
const validateSize = (rule, value, callback) => {
|
|
|
if (_.isEmpty(value)) {
|
|
|
return callback(new Error('尺码不能为空'));
|
|
|
}
|
|
|
return callback();
|
|
|
};
|
|
|
const validateSize = (rule, value, callback) => {
|
|
|
if (_.isEmpty(value)) {
|
|
|
return callback(new Error('尺码不能为空'));
|
|
|
}
|
|
|
return callback();
|
|
|
};
|
|
|
|
|
|
return {
|
|
|
colors: [],
|
|
|
table: {
|
|
|
data: [],
|
|
|
selectedSizes: [],
|
|
|
selectedColors: [],
|
|
|
showValidateColor: false,
|
|
|
showValidateSize: false,
|
|
|
showValidateOtherProp: false,
|
|
|
showValidateTable: false,
|
|
|
},
|
|
|
ruleValidate: {
|
|
|
productName: [
|
|
|
{ required: true, message: '商品名不能为空', trigger: 'blur'}
|
|
|
],
|
|
|
goodsYears: [
|
|
|
{ required: true, message: '货品年不能为空', trigger: 'change', type: 'string'}
|
|
|
],
|
|
|
goodsSeason: [
|
|
|
{ required: true, message: '货品季不能为空', trigger: 'change', validator: validateEmpty}
|
|
|
],
|
|
|
expectSaleTimeStr: [
|
|
|
{ required: true, message: '请选择日期', trigger: 'change', type: 'string'}
|
|
|
],
|
|
|
gender: [
|
|
|
{ required: true, message: '请选择性别', trigger: 'change'}
|
|
|
],
|
|
|
seasons: [
|
|
|
{ required: true, message: '不能为空', trigger: 'change'}
|
|
|
],
|
|
|
ageLevel: [
|
|
|
{ required: true, message: '不能为空', trigger: 'change'}
|
|
|
],
|
|
|
retailPrice: [
|
|
|
{ required: true, trigger: 'blur', validator: validateRetailPrice},
|
|
|
],
|
|
|
salesPrice: [
|
|
|
{ required: true, trigger: 'blur', validator: validateMustLessRetailPrice},
|
|
|
],
|
|
|
selectColor: [
|
|
|
{ required: true, trigger: 'NONE', validator: validateColor},
|
|
|
],
|
|
|
selectSize: [
|
|
|
{ required: true, trigger: 'NONE', validator: validateSize},
|
|
|
],
|
|
|
},
|
|
|
};
|
|
|
return {
|
|
|
colors: [],
|
|
|
table: {
|
|
|
data: [],
|
|
|
selectedSizes: [],
|
|
|
selectedColors: [],
|
|
|
showValidateColor: false,
|
|
|
showValidateSize: false,
|
|
|
showValidateOtherProp: false,
|
|
|
showValidateTable: false,
|
|
|
},
|
|
|
ruleValidate: {
|
|
|
productName: [
|
|
|
{ required: true, message: '商品名不能为空', trigger: 'blur'}
|
|
|
],
|
|
|
goodsYears: [
|
|
|
{ required: true, message: '货品年不能为空', trigger: 'change', type: 'string'}
|
|
|
],
|
|
|
goodsSeason: [
|
|
|
{ required: true, message: '货品季不能为空', trigger: 'change', validator: validateEmpty}
|
|
|
],
|
|
|
expectSaleTimeStr: [
|
|
|
{ required: true, message: '请选择日期', trigger: 'change', type: 'string'}
|
|
|
],
|
|
|
gender: [
|
|
|
{ required: true, message: '请选择性别', trigger: 'change'}
|
|
|
],
|
|
|
seasons: [
|
|
|
{ required: true, message: '不能为空', trigger: 'change'}
|
|
|
],
|
|
|
ageLevel: [
|
|
|
{ required: true, message: '不能为空', trigger: 'change'}
|
|
|
],
|
|
|
retailPrice: [
|
|
|
{ required: true, trigger: 'blur', validator: validateRetailPrice},
|
|
|
],
|
|
|
salesPrice: [
|
|
|
{ required: true, trigger: 'blur', validator: validateMustLessRetailPrice},
|
|
|
],
|
|
|
selectColor: [
|
|
|
{ required: true, trigger: 'NONE', validator: validateColor},
|
|
|
],
|
|
|
selectSize: [
|
|
|
{ required: true, trigger: 'NONE', validator: validateSize},
|
|
|
],
|
|
|
},
|
|
|
};
|
|
|
} |
...
|
...
|
|