Commit 4e6bf3fe by wangql

修改验证规则

1 parent 6b2b9b3b
...@@ -34,12 +34,12 @@ ...@@ -34,12 +34,12 @@
<template slot="effectiveHtml"> <template slot="effectiveHtml">
<el-radio v-model="editForm.effectiveType" label="3" :disabled="apear != 'couponAdd'">无有效期</el-radio> <el-radio v-model="editForm.effectiveType" label="3" :disabled="apear != 'couponAdd'">无有效期</el-radio>
<br /> <br />
<el-form-item prop="effectiveTime" style="margin-top: 12px;display: block;"> <el-form-item prop="effectiveTime" ref="effectiveTime" style="margin-top: 12px;display: block;">
<el-radio v-model="editForm.effectiveType" label="2" :disabled="apear != 'couponAdd'"> <el-radio v-model="editForm.effectiveType" label="2" :disabled="apear != 'couponAdd'">
<el-date-picker v-model="editForm.effectiveTime" type="daterange" style="width:295px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" :disabled="editForm.effectiveType != 2 || apear != 'couponAdd'" clearable></el-date-picker> <el-date-picker v-model="editForm.effectiveTime" type="daterange" style="width:295px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" :disabled="editForm.effectiveType != 2 || apear != 'couponAdd'" clearable></el-date-picker>
</el-radio> </el-radio>
</el-form-item> </el-form-item>
<el-form-item prop="effectiveDays"> <el-form-item prop="effectiveDays" ref="effectiveDays">
<el-radio v-model="editForm.effectiveType" label="1" :disabled="apear != 'couponAdd'"> <el-radio v-model="editForm.effectiveType" label="1" :disabled="apear != 'couponAdd'">
领取后 领取后
<el-input v-model="editForm.effectiveDays" style="width:100px;margin-left:5px;margin-right:5px" :disabled="apear != 'couponAdd' || editForm.effectiveType != 1" /> <el-input v-model="editForm.effectiveDays" style="width:100px;margin-left:5px;margin-right:5px" :disabled="apear != 'couponAdd' || editForm.effectiveType != 1" />
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
</template> </template>
<template slot="useBarriersHtml"> <template slot="useBarriersHtml">
<el-radio v-model="editForm.useBarriers" label="1" :disabled="apear != 'couponAdd'">无限制</el-radio> <el-radio v-model="editForm.useBarriers" label="1" :disabled="apear != 'couponAdd'">无限制</el-radio>
<el-form-item prop="full"> <el-form-item prop="full" ref="full">
<el-radio v-model="editForm.useBarriers" label="2" :disabled="apear != 'couponAdd' || editForm.useChannel == 2"> <el-radio v-model="editForm.useBarriers" label="2" :disabled="apear != 'couponAdd' || editForm.useChannel == 2">
订单满 订单满
<el-input v-model="editForm.full" placeholder="输入金额(元)" style="width: 110px;margin-left:5px;margin-right:5px" :disabled="apear != 'couponAdd' || editForm.useBarriers != 2" /> <el-input v-model="editForm.full" placeholder="输入金额(元)" style="width: 110px;margin-left:5px;margin-right:5px" :disabled="apear != 'couponAdd' || editForm.useBarriers != 2" />
...@@ -167,7 +167,7 @@ export default { ...@@ -167,7 +167,7 @@ export default {
couponName: [{ required: true, message: '请输入优惠券名称', trigger: 'change' }], couponName: [{ required: true, message: '请输入优惠券名称', trigger: 'change' }],
effectiveType: [{ required: true, message: '请选择有效期', trigger: 'change' }], effectiveType: [{ required: true, message: '请选择有效期', trigger: 'change' }],
effectiveTime: [{ required: true, message: '有效期不能为空', trigger: 'change' }], effectiveTime: [{ required: true, message: '有效期不能为空', trigger: 'change' }],
effectiveDays: [{ required: true, message: '有效天数不能为空', trigger: 'blur' }], effectiveDays: [{ required: true, message: '有效天数不能为空', trigger: 'change' }],
useBarriers: [{ required: true, message: '请选择使用限制', trigger: 'change' }], useBarriers: [{ required: true, message: '请选择使用限制', trigger: 'change' }],
full: [{ required: true, message: '门槛数值不能为空', trigger: 'blur' }], full: [{ required: true, message: '门槛数值不能为空', trigger: 'blur' }],
denomination: [{ required: true, message: '面值不能为空', trigger: 'change' }], denomination: [{ required: true, message: '面值不能为空', trigger: 'change' }],
...@@ -269,7 +269,7 @@ export default { ...@@ -269,7 +269,7 @@ export default {
this.editForm.stock = limitPrice(newValue, oldValue, 6, 0, 1) this.editForm.stock = limitPrice(newValue, oldValue, 6, 0, 1)
}, },
'editForm.effectiveTime'(newValue, oldValue) { 'editForm.effectiveTime'(newValue, oldValue) {
if (newValue && newValue.length > 0) { if (newValue && newValue.length == 2) {
this.couponTime = this.setDateString(newValue[0], true) + ' ~ ' + this.setDateString(newValue[1], true) this.couponTime = this.setDateString(newValue[0], true) + ' ~ ' + this.setDateString(newValue[1], true)
} else { } else {
this.couponTime = '' this.couponTime = ''
...@@ -318,6 +318,23 @@ export default { ...@@ -318,6 +318,23 @@ export default {
} else { } else {
this.editFormData[7].isHide = true this.editFormData[7].isHide = true
} }
},
'editForm.effectiveType'(newValue, oldValue) {
if (newValue == 3) {
this.$refs['effectiveTime'].resetField()
this.$refs['effectiveDays'].resetField()
} else if (newValue == 2) {
this.$refs['effectiveDays'].resetField()
} else if (newValue == 1) {
this.$refs['effectiveTime'].resetField()
}
},
'editForm.useBarriers'(newValue, oldValue) {
if (newValue == 1) {
this.$refs['full'].resetField()
}
} }
}, },
......
...@@ -50,12 +50,12 @@ ...@@ -50,12 +50,12 @@
<p class="edit-title">{{ title }}折扣劵</p> <p class="edit-title">{{ title }}折扣劵</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" :isEdit="true" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"> <glsx-combi-form class="edit-form-container" ref="editFormRef" :isEdit="true" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<template slot="effectiveHtml"> <template slot="effectiveHtml">
<el-form-item prop="effectiveTime" style="margin-top: 12px; display: block"> <el-form-item prop="effectiveTime" ref="effectiveTime" style="margin-top: 12px; display: block">
<el-radio v-model="editForm.effectiveType" label="2" :disabled="apear != 'couponAdd'"> <el-radio v-model="editForm.effectiveType" label="2" :disabled="apear != 'couponAdd'">
<el-date-picker v-model="editForm.effectiveTime" type="daterange" style="width: 295px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" :disabled="editForm.effectiveType != 2 || apear != 'couponAdd'" clearable></el-date-picker> <el-date-picker v-model="editForm.effectiveTime" type="daterange" style="width: 295px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" :disabled="editForm.effectiveType != 2 || apear != 'couponAdd'" clearable></el-date-picker>
</el-radio> </el-radio>
</el-form-item> </el-form-item>
<el-form-item prop="effectiveDays"> <el-form-item prop="effectiveDays" ref="effectiveDays">
<el-radio v-model="editForm.effectiveType" label="1" :disabled="apear != 'couponAdd'"> <el-radio v-model="editForm.effectiveType" label="1" :disabled="apear != 'couponAdd'">
领取后 领取后
<el-input v-model="editForm.effectiveDays" style="width: 100px; margin-left: 5px; margin-right: 5px" :disabled="apear != 'couponAdd' || editForm.effectiveType != 1" /> <el-input v-model="editForm.effectiveDays" style="width: 100px; margin-left: 5px; margin-right: 5px" :disabled="apear != 'couponAdd' || editForm.effectiveType != 1" />
...@@ -182,11 +182,18 @@ export default { ...@@ -182,11 +182,18 @@ export default {
this.editForm.stock = limitPrice(newValue, oldValue, 6, 0, 1) this.editForm.stock = limitPrice(newValue, oldValue, 6, 0, 1)
}, },
'editForm.effectiveTime'(newValue, oldValue) { 'editForm.effectiveTime'(newValue, oldValue) {
if (newValue && newValue.length > 0) { if (newValue && newValue.length == 2) {
this.couponTime = this.setDateString(newValue[0], true) + ' ~ ' + this.setDateString(newValue[1], true) this.couponTime = this.setDateString(newValue[0], true) + ' ~ ' + this.setDateString(newValue[1], true)
} else { } else {
this.couponTime = '' this.couponTime = ''
} }
},
'editForm.effectiveType'(newValue, oldValue) {
if (newValue == 2) {
this.$refs['effectiveDays'].resetField()
} else if (newValue == 1) {
this.$refs['effectiveTime'].resetField()
}
} }
}, },
......
...@@ -29,12 +29,12 @@ ...@@ -29,12 +29,12 @@
<p class="edit-title">{{ title }}兑换券</p> <p class="edit-title">{{ title }}兑换券</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" :isEdit="true" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"> <glsx-combi-form class="edit-form-container" ref="editFormRef" :isEdit="true" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<template slot="effectiveHtml"> <template slot="effectiveHtml">
<el-form-item prop="effectiveTime" style="margin-top: 12px;display: block;"> <el-form-item prop="effectiveTime" ref="effectiveTime" style="margin-top: 12px;display: block;">
<el-radio v-model="editForm.effectiveType" label="2" :disabled="apear != 'couponAdd'"> <el-radio v-model="editForm.effectiveType" label="2" :disabled="apear != 'couponAdd'">
<el-date-picker v-model="editForm.effectiveTime" type="daterange" style="width:295px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" :disabled="editForm.effectiveType != 2 || apear != 'couponAdd'" clearable></el-date-picker> <el-date-picker v-model="editForm.effectiveTime" type="daterange" style="width:295px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" :disabled="editForm.effectiveType != 2 || apear != 'couponAdd'" clearable></el-date-picker>
</el-radio> </el-radio>
</el-form-item> </el-form-item>
<el-form-item prop="effectiveDays"> <el-form-item prop="effectiveDays" ref="effectiveDays">
<el-radio v-model="editForm.effectiveType" label="1" :disabled="apear != 'couponAdd'"> <el-radio v-model="editForm.effectiveType" label="1" :disabled="apear != 'couponAdd'">
领取后 领取后
<el-input v-model="editForm.effectiveDays" style="width: 100px;margin-left:5px;margin-right:5px" :disabled="apear != 'couponAdd' || editForm.effectiveType != 1" /> <el-input v-model="editForm.effectiveDays" style="width: 100px;margin-left:5px;margin-right:5px" :disabled="apear != 'couponAdd' || editForm.effectiveType != 1" />
...@@ -161,11 +161,18 @@ export default { ...@@ -161,11 +161,18 @@ export default {
this.editForm.stock = limitPrice(newValue, oldValue, 6, 0, 1) this.editForm.stock = limitPrice(newValue, oldValue, 6, 0, 1)
}, },
'editForm.effectiveTime'(newValue, oldValue) { 'editForm.effectiveTime'(newValue, oldValue) {
if (newValue && newValue.length > 0) { if (newValue && newValue.length == 2) {
this.couponTime = this.setDateString(newValue[0], true) + ' ~ ' + this.setDateString(newValue[1], true) this.couponTime = this.setDateString(newValue[0], true) + ' ~ ' + this.setDateString(newValue[1], true)
} else { } else {
this.couponTime = '' this.couponTime = ''
} }
},
'editForm.effectiveType'(newValue, oldValue) {
if (newValue == 2) {
this.$refs['effectiveDays'].resetField()
} else if (newValue == 1) {
this.$refs['effectiveTime'].resetField()
}
} }
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!