修复 联动

This commit is contained in:
wangsongsole 2022-06-17 10:56:01 +08:00
parent 01d9f2c263
commit bba7af35b9
1 changed files with 38 additions and 12 deletions

View File

@ -30,10 +30,6 @@ import { getVoucherWarningAccount, handelResponse } from '@/assets/api'
import AddNewDialog from './Dialog'
import MobileComponent from './mobileCmponent'
import WangEditor from './wangEditor'
const getTimeList = [
{ key: '0', text: '立即生效' },
{ key: '1', text: '次日生效' }
]
const cardTypeList = [
{ key: '1', text: '借记卡' },
{ key: '2', text: '信用卡' }
@ -82,9 +78,22 @@ export default class addKnockGold extends Component {
effect_date_type: '', //
effect_date: '' //
},
TimeDiffer: '',
visible: false, //
warningInput: '', //
input_early_per: '', //
getTimeList: [
{
key: '0',
text: '立即生效',
disabled: false
},
{
key: '1',
text: '次日生效',
disabled: false
}
],
//
userSelectList: [
{
@ -150,7 +159,7 @@ export default class addKnockGold extends Component {
: '2'
model.effect_date_type =
getTimeList[
this.state.getTimeList[
Number(this.props.data.time_limit.use_time.effect_date_type)
]
model.effect_date = this.props.data.time_limit.use_time.effect_day
@ -451,16 +460,12 @@ export default class addKnockGold extends Component {
}
}
const TimeDiffer = timeDiff(
this.state.model.entry_time[0],
this.state.model.entry_time[1]
)
if (
TimeDiffer < Number(this.state.model.effect_date) ||
this.state.TimeDiffer < Number(this.state.model.effect_date) ||
1 > Number(this.state.model.effect_date)
) {
Notify.error(
`有限期不允许大于生效时间段 注:当前有效期最小时间为 1 天,最大时间为 ${TimeDiffer}`
`有限期不允许大于生效时间段 注:当前有效期最小时间为 1 天,最大时间为 ${this.state.TimeDiffer}`
)
return false
}
@ -568,6 +573,26 @@ export default class addKnockGold extends Component {
this.setState({ model: model2 })
}
getTimeDiff() {
if (this.state.model.entry_time[1]) {
const TimeDiffer = timeDiff(
this.state.model.entry_time[0],
this.state.model.entry_time[1]
)
const data = this.state.getTimeList.map((item) => {
if (item?.key === '1') {
if (TimeDiffer < 2) {
item.disabled = true
} else {
item.disabled = false
}
}
return item
})
this.setState({ TimeDiffer, getTimeList: data })
}
}
//tag
closeCallback(item) {
const newData = this.state.model.early_notifier.filter(
@ -894,6 +919,7 @@ export default class addKnockGold extends Component {
onChange={(value) => {
Bus.emit('change', 'date_time', value)
this.onHandleChange(value, 'entry_time')
this.getTimeDiff()
}}
disabledTime={this.onDisabledTime}
disabledDate={this.onDisabledRange1}
@ -956,7 +982,7 @@ export default class addKnockGold extends Component {
<div className='zent-demo-select-basic select-basic'>
<Select
clearable
options={getTimeList}
options={this.state.getTimeList}
placeholder='选择一项'
onChange={(value) => {
this.onHandleChange(value, 'effect_date_type')