修复 bug
This commit is contained in:
parent
42c335b381
commit
fa5b2de53d
|
@ -242,8 +242,47 @@ export default class addKnockGold extends Component {
|
|||
return isdisabled
|
||||
}
|
||||
|
||||
/* x时间控件禁用 */
|
||||
onDisabledRange2 = (date, type) => {
|
||||
let isdisabled = false
|
||||
let str = moment(date).format('YYYY-MM-DD HH:mm:ss')
|
||||
if (type == 'start') {
|
||||
isdisabled =
|
||||
moment(str).isBefore(this.state.model.entry_time[0]) ||
|
||||
moment(str).isAfter(this.state.model.entry_time[1])
|
||||
}
|
||||
|
||||
if (type == 'end') {
|
||||
isdisabled =
|
||||
moment(str).add(1, 'days').isBefore(this.state.model.entry_time[0]) ||
|
||||
moment(str).isAfter(this.state.model.entry_time[1])
|
||||
}
|
||||
return isdisabled
|
||||
}
|
||||
|
||||
onDisabledTime = (date, type) => {
|
||||
const min = new Date()
|
||||
let step1 = JSON.parse(sessionStorage.getItem('knockGold_effectDate'))
|
||||
const min = new Date(step1.begin_time)
|
||||
const hour = min.getHours()
|
||||
const minute = min.getMinutes()
|
||||
const second = min.getSeconds()
|
||||
const isSame = isSameDay(date, min)
|
||||
|
||||
return isSame
|
||||
? {
|
||||
disabledHours: () => initArray(hour),
|
||||
disabledMinutes: (hourValue) =>
|
||||
hourValue === hour ? initArray(minute) : [],
|
||||
disabledSeconds: (hourValue, minuteValue) =>
|
||||
hourValue === hour && minuteValue === minute
|
||||
? initArray(second)
|
||||
: []
|
||||
}
|
||||
: {}
|
||||
}
|
||||
|
||||
onDisabledTime1 = (date, type) => {
|
||||
const min = new Date(this.state.model.entry_time[0])
|
||||
const hour = min.getHours()
|
||||
const minute = min.getMinutes()
|
||||
const second = min.getSeconds()
|
||||
|
@ -422,7 +461,7 @@ export default class addKnockGold extends Component {
|
|||
this.state.model.denomination - 0 <
|
||||
this.state.model.reduce_amount - 0
|
||||
) {
|
||||
Notify.error('面额必须大于立减金额')
|
||||
Notify.error('面额必须小于满减金额')
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -439,6 +478,19 @@ export default class addKnockGold extends Component {
|
|||
return false
|
||||
}
|
||||
|
||||
if (this.state.model.all_budget - 0 < this.state.model.day_budget - 0) {
|
||||
Notify.error('单天预算发放上限必须小于总预算')
|
||||
return false
|
||||
}
|
||||
|
||||
if (
|
||||
this.state.model.all_budget / this.state.model.reduce_amount <
|
||||
this.state.model.receive_number - 0
|
||||
) {
|
||||
Notify.error('用户可领个数必须小于库存(总预算/面额)')
|
||||
return false
|
||||
}
|
||||
|
||||
/* 生效时间段 */
|
||||
if (this.setTime(this.state.model.entry_time)) {
|
||||
Notify.error('请选择结束时间或开始时间')
|
||||
|
@ -920,7 +972,8 @@ export default class addKnockGold extends Component {
|
|||
onChange={(value) => {
|
||||
this.onHandleChange(value, 'fixed_time')
|
||||
}}
|
||||
disabledDate={this.onDisabledRange}
|
||||
disabledDate={this.onDisabledRange2}
|
||||
disabledTime={this.onDisabledTime1}
|
||||
/>
|
||||
</div>
|
||||
</FormItem>
|
||||
|
|
|
@ -55,6 +55,13 @@ export default class acclist extends React.Component {
|
|||
|
||||
model.date_time = [data.begin_time, data.end_time]
|
||||
sessionStorage.setItem('datetime', JSON.stringify(model.date_time))
|
||||
sessionStorage.setItem(
|
||||
'knockGold_effectDate',
|
||||
JSON.stringify({
|
||||
begin_time: model.date_time[0],
|
||||
end_time: model.date_time[1]
|
||||
})
|
||||
)
|
||||
this.setState({ model: model, lodshow: true })
|
||||
}
|
||||
|
||||
|
@ -187,6 +194,13 @@ export default class acclist extends React.Component {
|
|||
})
|
||||
|
||||
sessionStorage.setItem('datetime', JSON.stringify(model2.date_time))
|
||||
sessionStorage.setItem(
|
||||
'knockGold_effectDate',
|
||||
JSON.stringify({
|
||||
begin_time: model2.date_time[0],
|
||||
end_time: model2.date_time[1]
|
||||
})
|
||||
)
|
||||
}
|
||||
onDisabledRange = (date, type) => {
|
||||
console.log(type)
|
||||
|
|
Loading…
Reference in New Issue