activityName: [
{
required: true,
message: "请输入活动名称",
trigger: ["change", "blur"],
},
{
max: 20,
message: "活动名称不能大于20个字",
trigger: "change",
},
],
activityLabel: [
{
required: true,
message: "请选择活动标签",
trigger: ["change", "blur"],
},
],
startTime: [
{
required: true,
message: "请选择活动时间",
trigger: ["change", "blur"],
},
],
num: [
{
required: true,
message: "请选择活动商品",
},
{
pattern: /^([1-9][0-9]*)$/g,
transform(value) {
return Number(value);
},
message: "请输入不为0的正整数",
trigger: ["change", "blur"],
},
],
price: [
{
required: true,
message: "请输入商品/商品组库存",
},
{
pattern: /(^[0-9]{1,2}$)|(^[0-9]{1,2}[.]{1}[0-9]{1,2}$)/g,
transform(value) {
return Number(value);
},
message: "请输入商品/商品组单价(两位小数)",
trigger: ["change", "blur"],
},
{
validator: (rule, value, callback) => {
if (this.form.linePrice == 0) {
return false;
} else if (
value < this.form.linePrice ||
value == this.form.linePrice
) {
return true;
} else {
return false;
}
},
message: "请选择活动商品或单价小于划线单价",
trigger: ["change", "blur"],
},
],
linePrice: [
{
required: true,
message: "请选择活动商品",
},
{
pattern: /^\d+(\.\d+)?$/g,
transform(value) {
return Number(value);
},
message: "请选择活动商品",
trigger: ["change", "blur"],
},
],
07-05
2467
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)