修改注释 封装方法
This commit is contained in:
parent
13a6a94859
commit
ad0cc4829b
|
@ -182,6 +182,27 @@ export default class addKnockGold extends Component {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
/* 校验表单 */
|
||||||
|
if (!this.limitFunction()) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
//缓存
|
||||||
|
let temp = []
|
||||||
|
if (sessionStorage.getItem('knockGoldData')) {
|
||||||
|
temp = JSON.parse(sessionStorage.getItem('knockGoldData'))
|
||||||
|
}
|
||||||
|
let data = temp ? temp : []
|
||||||
|
const models = this.state.model
|
||||||
|
models.uuid = uuid(6, 16)
|
||||||
|
data.push(models)
|
||||||
|
sessionStorage.setItem('knockGoldData', JSON.stringify(data))
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 校验表单function */
|
||||||
|
limitFunction() {
|
||||||
if (!this.state.model.card_type) {
|
if (!this.state.model.card_type) {
|
||||||
Notify.error('请选择卡种')
|
Notify.error('请选择卡种')
|
||||||
return false
|
return false
|
||||||
|
@ -199,10 +220,7 @@ export default class addKnockGold extends Component {
|
||||||
|
|
||||||
/* 可用时间段 */
|
/* 可用时间段 */
|
||||||
if (this.state.model.usable_time === '1') {
|
if (this.state.model.usable_time === '1') {
|
||||||
if (
|
if (!this.state.model.effect_date_type || !this.state.model.effect_date) {
|
||||||
!this.state.model.effect_date_type ||
|
|
||||||
!this.state.model.effect_date
|
|
||||||
) {
|
|
||||||
Notify.error('请完整的填写或选择可用时间段')
|
Notify.error('请完整的填写或选择可用时间段')
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -229,10 +247,7 @@ export default class addKnockGold extends Component {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (this.state.model.denomination - 0 > this.state.model.all_budget - 0) {
|
||||||
this.state.model.denomination - 0 >
|
|
||||||
this.state.model.all_budget - 0
|
|
||||||
) {
|
|
||||||
Notify.error('面额必须小于总预算')
|
Notify.error('面额必须小于总预算')
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -251,20 +266,6 @@ export default class addKnockGold extends Component {
|
||||||
Notify.error('请选择结束时间或开始时间')
|
Notify.error('请选择结束时间或开始时间')
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
//缓存
|
|
||||||
let temp = []
|
|
||||||
if (sessionStorage.getItem('knockGoldData')) {
|
|
||||||
temp = JSON.parse(sessionStorage.getItem('knockGoldData'))
|
|
||||||
}
|
|
||||||
let data = temp ? temp : []
|
|
||||||
const models = this.state.model
|
|
||||||
models.uuid = uuid(6, 16)
|
|
||||||
data.push(models)
|
|
||||||
sessionStorage.setItem('knockGoldData', JSON.stringify(data))
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//限制时间
|
//限制时间
|
||||||
|
@ -278,6 +279,7 @@ export default class addKnockGold extends Component {
|
||||||
debugger
|
debugger
|
||||||
return blr
|
return blr
|
||||||
}
|
}
|
||||||
|
|
||||||
// onProductChange(e) {
|
// onProductChange(e) {
|
||||||
// console.log('e ===>', e)
|
// console.log('e ===>', e)
|
||||||
// this.setState({ cur_product: e })
|
// this.setState({ cur_product: e })
|
||||||
|
@ -308,7 +310,7 @@ export default class addKnockGold extends Component {
|
||||||
// })
|
// })
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//输入框或选择器change事件
|
/* 输入事件和选择事件统一处理 */
|
||||||
onHandleChange(value, key) {
|
onHandleChange(value, key) {
|
||||||
let model2 = this.state.model
|
let model2 = this.state.model
|
||||||
model2[key] = value
|
model2[key] = value
|
||||||
|
|
Loading…
Reference in New Issue