Commit cdbe76a1 by 姜雷

添加用车选择最小时间,和提交申请后跳转记录列表

parent d326ebf7
...@@ -50,6 +50,14 @@ class PublicCarApply extends Component { ...@@ -50,6 +50,14 @@ class PublicCarApply extends Component {
showAllCategory: !showAllCategory, showAllCategory: !showAllCategory,
})); }));
}; };
onChangeBeginDate = date => {
const { endDate } = this.state;
if (endDate && endDate.getTime() < date.getTime()) {
this.setState({ beginDate: date, endDate: date });
} else {
this.setState({ beginDate: date });
}
};
validateForm = () => { validateForm = () => {
if (!this.state.categoryId) { if (!this.state.categoryId) {
Toast.fail('请选择用车类型'); Toast.fail('请选择用车类型');
...@@ -103,8 +111,10 @@ class PublicCarApply extends Component { ...@@ -103,8 +111,10 @@ class PublicCarApply extends Component {
applyPublicCar(entity) applyPublicCar(entity)
.then(res => { .then(res => {
console.log('res: ' + res); console.log('res: ' + res);
Toast.success(res.msg); const { history } = this.props;
this.resetForm(); this.resetForm();
Toast.success(res.msg);
history.replace('/publicCar/PublicCarList');
}) })
.catch(err => { .catch(err => {
console.log('err: ' + err); console.log('err: ' + err);
...@@ -191,11 +201,12 @@ class PublicCarApply extends Component { ...@@ -191,11 +201,12 @@ class PublicCarApply extends Component {
<div className={styles.itemValue}> <div className={styles.itemValue}>
<input <input
className={styles.itemInput} className={styles.itemInput}
type="text" type="tel"
maxLength="5"
value={this.state.userCount} value={this.state.userCount}
onChange={e => onChange={e =>
this.setState({ this.setState({
userCount: e.target.value, userCount: e.target.value.replace(/\D/g, ''),
}) })
} }
/> />
...@@ -206,7 +217,8 @@ class PublicCarApply extends Component { ...@@ -206,7 +217,8 @@ class PublicCarApply extends Component {
<div className={styles.itemSelect}> <div className={styles.itemSelect}>
<DatePicker <DatePicker
value={this.state.beginDate} value={this.state.beginDate}
onChange={date => this.setState({ beginDate: date })} onChange={this.onChangeBeginDate}
minDate={new Date()}
> >
<CustomChildren className={styles.DateInnerWrap} /> <CustomChildren className={styles.DateInnerWrap} />
</DatePicker> </DatePicker>
...@@ -216,9 +228,9 @@ class PublicCarApply extends Component { ...@@ -216,9 +228,9 @@ class PublicCarApply extends Component {
<div className={styles.itemLabel}>用车结束时间</div> <div className={styles.itemLabel}>用车结束时间</div>
<div className={styles.itemSelect}> <div className={styles.itemSelect}>
<DatePicker <DatePicker
className={styles.DateWrap}
value={this.state.endDate} value={this.state.endDate}
onChange={date => this.setState({ endDate: date })} onChange={date => this.setState({ endDate: date })}
minDate={this.state.beginDate}
> >
<CustomChildren className={styles.DateInnerWrap} /> <CustomChildren className={styles.DateInnerWrap} />
</DatePicker> </DatePicker>
......
...@@ -22,6 +22,7 @@ class PublicCar extends Component { ...@@ -22,6 +22,7 @@ class PublicCar extends Component {
<NavLink <NavLink
className={styles['footer-item']} className={styles['footer-item']}
to="/publicCar/PublicCarApply" to="/publicCar/PublicCarApply"
replace
> >
约车服务 约车服务
</NavLink> </NavLink>
...@@ -29,6 +30,7 @@ class PublicCar extends Component { ...@@ -29,6 +30,7 @@ class PublicCar extends Component {
<NavLink <NavLink
className={styles['footer-item']} className={styles['footer-item']}
to="/publicCar/PublicCarList" to="/publicCar/PublicCarList"
replace
> >
约车记录 约车记录
</NavLink> </NavLink>
......
...@@ -185,10 +185,12 @@ class ReprtRepair extends Component { ...@@ -185,10 +185,12 @@ class ReprtRepair extends Component {
.then(res => { .then(res => {
console.log(res); console.log(res);
const { data } = res; const { data } = res;
const { history } = this.props;
console.log('resetForm'); console.log('resetForm');
this.resetApplyForm(); this.resetApplyForm();
Toast.hide(); Toast.hide();
Toast.success(data.msg); Toast.success(data.msg);
history.replace('/repair/RepairList');
}) })
.catch(err => { .catch(err => {
console.log(err); console.log(err);
......
...@@ -27,11 +27,19 @@ class index extends Component { ...@@ -27,11 +27,19 @@ class index extends Component {
</Switch> </Switch>
</div> </div>
<div className={styles.footer}> <div className={styles.footer}>
<NavLink className={styles['footer-item']} to="/repair/ReprtRepair"> <NavLink
className={styles['footer-item']}
to="/repair/ReprtRepair"
replace
>
报修服务 报修服务
</NavLink> </NavLink>
<span className={styles.line} /> <span className={styles.line} />
<NavLink className={styles['footer-item']} to="/repair/RepairList"> <NavLink
className={styles['footer-item']}
to="/repair/RepairList"
replace
>
报修记录 报修记录
</NavLink> </NavLink>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment