Commit 12b26d35 by wuwx

修改选择时间bug,样式

1 parent 43edadbb
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
<br /> <br />
<el-form-item prop="effectiveTime" ref="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="datetimerange" style="width: 340px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" :picker-options="pickerOption" :default-time="defaultTime" :format="format" :disabled="editForm.effectiveType != 2 || apear != 'couponAdd'" clearable></el-date-picker> <el-date-picker v-model="editForm.effectiveTime" @change="haveChange" type="datetimerange" style="width: 340px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" :picker-options="pickerOption" :default-time="defaultTime" :format="format" :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" ref="effectiveDays"> <el-form-item prop="effectiveDays" ref="effectiveDays">
...@@ -361,7 +361,8 @@ export default { ...@@ -361,7 +361,8 @@ export default {
}, },
'editForm.effectiveTime'(newValue, oldValue) { 'editForm.effectiveTime'(newValue, oldValue) {
if (newValue && newValue.length == 2) { 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)
this.couponTime = newValue[0] + ' ~ ' + newValue[1]
} else { } else {
this.couponTime = '' this.couponTime = ''
} }
...@@ -435,6 +436,11 @@ export default { ...@@ -435,6 +436,11 @@ export default {
}, },
methods: { methods: {
haveChange() {
let oDateOne = new Date(this.editForm.effectiveTime[0]).getTime()
let timeStamp = new Date().getTime()
if(oDateOne < timeStamp) this.editForm.effectiveTime = []
},
// 编辑按钮 // 编辑按钮
editMessage() { editMessage() {
let anticipatedCostIndex = this.editFormData.findIndex(item => item.name == 'anticipatedCost') let anticipatedCostIndex = this.editFormData.findIndex(item => item.name == 'anticipatedCost')
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
<template slot="effectiveHtml"> <template slot="effectiveHtml">
<el-form-item prop="effectiveTime" ref="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="datetimerange" style="width: 340px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" :default-time="defaultTime" :format="format" :picker-options="pickerOption" :disabled="editForm.effectiveType != 2 || apear != 'couponAdd'" clearable></el-date-picker> <el-date-picker v-model="editForm.effectiveTime" @change="haveChange" type="datetimerange" style="width: 340px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" :default-time="defaultTime" :format="format" :picker-options="pickerOption" :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" ref="effectiveDays"> <el-form-item prop="effectiveDays" ref="effectiveDays">
...@@ -251,7 +251,8 @@ export default { ...@@ -251,7 +251,8 @@ export default {
}, },
'editForm.effectiveTime'(newValue, oldValue) { 'editForm.effectiveTime'(newValue, oldValue) {
if (newValue && newValue.length == 2) { 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)
this.couponTime = newValue[0] + ' ~ ' + newValue[1]
} else { } else {
this.couponTime = '' this.couponTime = ''
} }
...@@ -266,6 +267,11 @@ export default { ...@@ -266,6 +267,11 @@ export default {
}, },
methods: { methods: {
haveChange() {
let oDateOne = new Date(this.editForm.effectiveTime[0]).getTime()
let timeStamp = new Date().getTime()
if(oDateOne < timeStamp) this.editForm.effectiveTime = []
},
// 编辑按钮 // 编辑按钮
editMessage() { editMessage() {
let anticipatedCostIndex = this.editFormData.findIndex(item => item.name == 'anticipatedCost') let anticipatedCostIndex = this.editFormData.findIndex(item => item.name == 'anticipatedCost')
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<template slot="effectiveHtml"> <template slot="effectiveHtml">
<el-form-item prop="effectiveTime" ref="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="datetimerange" style="width: 340px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" :default-time="defaultTime" :format="format" :picker-options="pickerOption" :disabled="editForm.effectiveType != 2 || apear != 'couponAdd'" clearable></el-date-picker> <el-date-picker v-model="editForm.effectiveTime" @change="haveChange" type="datetimerange" style="width: 340px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" :default-time="defaultTime" :format="format" :picker-options="pickerOption" :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" ref="effectiveDays"> <el-form-item prop="effectiveDays" ref="effectiveDays">
...@@ -229,7 +229,8 @@ export default { ...@@ -229,7 +229,8 @@ export default {
}, },
'editForm.effectiveTime'(newValue, oldValue) { 'editForm.effectiveTime'(newValue, oldValue) {
if (newValue && newValue.length == 2) { 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)
this.couponTime = newValue[0] + ' ~ ' + newValue[1]
} else { } else {
this.couponTime = '' this.couponTime = ''
} }
...@@ -244,6 +245,11 @@ export default { ...@@ -244,6 +245,11 @@ export default {
}, },
methods: { methods: {
haveChange() {
let oDateOne = new Date(this.editForm.effectiveTime[0]).getTime()
let timeStamp = new Date().getTime()
if(oDateOne < timeStamp) this.editForm.effectiveTime = []
},
// 编辑按钮 // 编辑按钮
editMessage() { editMessage() {
let anticipatedCostIndex = this.editFormData.findIndex(item => item.name == 'anticipatedCost') let anticipatedCostIndex = this.editFormData.findIndex(item => item.name == 'anticipatedCost')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!