拼团活动相关校验
parent
9e365c27b5
commit
7763abd591
|
@ -3,7 +3,7 @@
|
||||||
<Card>
|
<Card>
|
||||||
<Form ref="form" :model="form" :label-width="130" :rules="formValidate">
|
<Form ref="form" :model="form" :label-width="130" :rules="formValidate">
|
||||||
<FormItem label="活动名称" prop="promotionName" :label-width="130">
|
<FormItem label="活动名称" prop="promotionName" :label-width="130">
|
||||||
<Input v-model="form.promotionName" clearable style="width: 260px" />
|
<Input v-model="form.promotionName" clearable style="width: 260px" maxlength="25" />
|
||||||
<div style="color: #cccccc">
|
<div style="color: #cccccc">
|
||||||
活动名称将显示在对人拼团活动列表中,方便商家管理使用,最多输入25个字符
|
活动名称将显示在对人拼团活动列表中,方便商家管理使用,最多输入25个字符
|
||||||
</div>
|
</div>
|
||||||
|
@ -21,11 +21,11 @@
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem label="参团人数" prop="requiredNum" :label-width="130">
|
<FormItem label="参团人数" prop="requiredNum" :label-width="130">
|
||||||
<Input v-model="form.requiredNum" style="width: 260px">
|
<Input v-model="form.requiredNum" style="width: 260px" max="8">
|
||||||
<span slot="append">人</span>
|
<span slot="append">人</span>
|
||||||
</Input>
|
</Input>
|
||||||
<span style="color: #cccccc"
|
<span style="color: #cccccc"
|
||||||
>建议参团人数不少于2人,不超过20人。</span
|
>参团人数不少于2人,不得超过10人。</span
|
||||||
>
|
>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="限购数量" prop="limitNum" :label-width="130">
|
<FormItem label="限购数量" prop="limitNum" :label-width="130">
|
||||||
|
@ -54,6 +54,7 @@
|
||||||
type="textarea"
|
type="textarea"
|
||||||
:rows="4"
|
:rows="4"
|
||||||
clearable
|
clearable
|
||||||
|
maxlength="255"
|
||||||
style="width: 260px"
|
style="width: 260px"
|
||||||
/>
|
/>
|
||||||
<br />
|
<br />
|
||||||
|
@ -94,7 +95,7 @@ export default {
|
||||||
requiredNum: [
|
requiredNum: [
|
||||||
{ required: true, message: "参团人数不能为空" },
|
{ required: true, message: "参团人数不能为空" },
|
||||||
{
|
{
|
||||||
pattern: /^(1|[1-9]\d?|100)$/,
|
pattern: /^([2-9]|10)?$/,
|
||||||
message: "参团人数不合法",
|
message: "参团人数不合法",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -135,13 +136,25 @@ export default {
|
||||||
this.$refs.form.validate((valid) => {
|
this.$refs.form.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.submitLoading = true;
|
this.submitLoading = true;
|
||||||
let params = JSON.parse(JSON.stringify(this.form));
|
let params = JSON.parse(JSON.stringify(this.form))
|
||||||
params.startTime = this.$options.filters.unixToDate(
|
params.startTime = this.$options.filters.unixToDate(
|
||||||
this.form.rangeTime[0] / 1000
|
this.form.rangeTime[0] / 1000
|
||||||
);
|
);
|
||||||
|
|
||||||
params.endTime = this.$options.filters.unixToDate(
|
params.endTime = this.$options.filters.unixToDate(
|
||||||
this.form.rangeTime[1] / 1000
|
this.form.rangeTime[1] / 1000
|
||||||
);
|
);
|
||||||
|
if(params.startTime === '' || params.endTime ===''){
|
||||||
|
this.$Message.error("活动时间不能为空");
|
||||||
|
this.submitLoading = false;
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(params.startTime < new Date()){
|
||||||
|
this.$Message.error("拼团活动开始时间不能小于当前时间");
|
||||||
|
this.submitLoading = false;
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
delete params.rangeTime
|
delete params.rangeTime
|
||||||
if (!this.id) {
|
if (!this.id) {
|
||||||
// 添加 避免编辑后传入id等数据 记得删除
|
// 添加 避免编辑后传入id等数据 记得删除
|
||||||
|
|
Loading…
Reference in New Issue