Commit 96a7b808 authored by baixian's avatar baixian

学员消课购课优化

parent 756466c6
......@@ -4,15 +4,15 @@ const basepath = `${location.protocol}//${pathify(window.location.host)}/`;
let api = '';
let dakaapi = '';
if (ENVIRONMENT == 'pro') {
// api = 'https://test.wp53.cn/v2/api/';
// dakaapi = 'https:clock.wp53.cn/v3/';
api = 'https://wx.m.shangjiadao.cn/v2/api/';
dakaapi = 'https://qxapi.qingxiao.online/daka/v3/';
api = 'https://test.wp53.cn/v2/api/';
dakaapi = 'https:clock.wp53.cn/v3/';
// api = 'https://wx.m.shangjiadao.cn/v2/api/';
// dakaapi = 'https://qxapi.qingxiao.online/daka/v3/';
} else if (ENVIRONMENT == 'dev') {
api = 'https://wx.m.shangjiadao.cn/v2/api/';
dakaapi = 'https://qxapi.qingxiao.online/daka/v3/';
// api = 'https://test.wp53.cn/v2/api/';
// dakaapi = 'https:clock.wp53.cn/v3/';
// api = 'https://wx.m.shangjiadao.cn/v2/api/';
// dakaapi = 'https://qxapi.qingxiao.online/daka/v3/';
api = 'https://test.wp53.cn/v2/api/';
dakaapi = 'https:clock.wp53.cn/v3/';
} else if (ENVIRONMENT == 'testenv') {
api = 'https://test.wp53.cn/v2/api/';
dakaapi = 'https:clock.wp53.cn/v3/';
......
......@@ -133,7 +133,6 @@ export default {
let new_rest_dates = [];
new_rest_dates = [...new Set(new_rest_dates.concat(...rest_dates))];
const loadmessage = message.loading('保存中...', 0);
console.log(new_rest_dates, 'rest_datesd提交的数据');
for (let i = 0; i < new_rest_dates.length; i++) {
new_rest_dates[i] = moment(new_rest_dates[i]).format('YYYY-M-DD');
}
......@@ -240,7 +239,6 @@ export default {
}
}
}
console.log(newWeekDay, '删除后的数据');
yield put({
type: 'updateState',
payload: {
......@@ -484,7 +482,6 @@ export default {
type: 'img',
value: imageUrl,
});
console.log(jobParams, 'jobParams');
yield put({
type: 'updateState',
payload: {
......
......@@ -884,6 +884,15 @@ class ClassDetailForm extends React.Component {
},
});
}
toDetail = (id) => {
const { dispatch } = this.props;
dispatch({
type: 'classdetail/toDetail',
payload: {
id,
},
});
}
render() {
const { getFieldDecorator } = this.props.form;
const {
......
......@@ -236,7 +236,7 @@ class RenewEdit extends React.Component {
<div className={pageStyle.buytimebox}>
<Col className={pageStyle.course}>
<Form.Item
label="购买课时"
label="购买天数"
labelCol={{
xs: { span: 24 },
sm: { span: 4 },
......@@ -250,18 +250,18 @@ class RenewEdit extends React.Component {
rules: [
{
required: false,
message: '请输入购买课时',
message: '请输入购买天数',
},
],
})(
<InputNumber placeholder="请输入购买课时" style={{ width: 200 }} />,
<InputNumber placeholder="请输入购买天数" style={{ width: 200 }} />,
)}
&nbsp;&nbsp;
</Form.Item>
</Col>
<Col className={pageStyle.course}>
<Form.Item
label="赠送课时"
label="赠送天数"
labelCol={{
xs: { span: 24 },
sm: { span: 4 },
......@@ -275,11 +275,11 @@ class RenewEdit extends React.Component {
rules: [
{
required: false,
message: '请输入赠送课时',
message: '请输入赠送天数',
},
],
})(
<InputNumber placeholder="请输入赠送课时" style={{ width: 200 }} />,
<InputNumber placeholder="请输入赠送天数" style={{ width: 200 }} />,
)}
&nbsp;&nbsp;
</Form.Item>
......
......@@ -7,8 +7,14 @@ const { Option } = Select;
const { TextArea } = Input;
class eliminateEdit extends React.Component {
state = {
currentCourse: {},
constructor(props) {
super(props);
this.state = {
currentCourse: {
course_mode: 1,
},
expendValue: 0,
};
}
componentDidMount() { // 挂载
}
......@@ -32,6 +38,12 @@ class eliminateEdit extends React.Component {
...values,
course_mode: this.state.currentCourse.course_mode,
});
this.setState({
currentCourse: {
surplus: 0,
},
expendValue: 0,
});
}
});
}
......@@ -43,13 +55,25 @@ class eliminateEdit extends React.Component {
});
}
close = () => {
const { close, form } = this.props;
const { close, form, dispatch } = this.props;
form.resetFields();
this.setState({
currentCourse: {},
currentCourse: {
surplus: 0,
},
});
close();
}
expendChange = (e) => {
const { currentCourse } = this.state;
this.props.form.validateFields((err, values) => {
if (!err) {
this.setState({
expendValue: Number(currentCourse.surplus - Number(e.target.value)),
});
}
});
}
render() {
const {
visible,
......@@ -60,9 +84,9 @@ class eliminateEdit extends React.Component {
operator,
toChangeOperator,
} = this.props;
const { getFieldDecorator } = this.props.form;
const { getFieldDecorator, getFieldValue } = this.props.form;
const courseExcludeClassTypeList = (studentinfo.student_courses && studentinfo.student_courses.filter(ele => ele.course_mode != 3)) || [];
const { currentCourse } = this.state;
const { currentCourse, expendValue } = this.state;
return (
<Modal
visible={visible}
......@@ -81,11 +105,11 @@ class eliminateEdit extends React.Component {
label="已购课程"
labelCol={{
xs: { span: 24 },
sm: { span: 4 },
sm: { span: 5 },
}}
wrapperCol={{
xs: { span: 24 },
sm: { span: 20 },
sm: { span: 19 },
}}
>
{getFieldDecorator('student_course_id', {
......@@ -95,33 +119,37 @@ class eliminateEdit extends React.Component {
{courseExcludeClassTypeList.map(ele => <Option value={ele.id}>{ele.course.title}</Option>)}
</Select>)}
</Form.Item>
<Form.Item
label="剩余课时"
labelCol={{
xs: { span: 24 },
sm: { span: 4 },
}}
wrapperCol={{
xs: { span: 24 },
sm: { span: 20 },
}}
>
{currentCourse.course_mode == 1 &&
{getFieldValue('student_course_id') != undefined ? (
<Form.Item
label="当前剩余"
labelCol={{
xs: { span: 24 },
sm: { span: 5 },
}}
wrapperCol={{
xs: { span: 24 },
sm: { span: 19 },
}}
>
{currentCourse.course_mode == 1 &&
<span>{currentCourse.surplus || 0} 课时</span>
}
{currentCourse.course_mode == 2 &&
}
{currentCourse.course_mode == 2 &&
<span>{currentCourse.surplus || 0} </span>
}
</Form.Item>
}
</Form.Item>
) : (
''
)}
<Form.Item
label="消耗课时"
label="本次消耗"
labelCol={{
xs: { span: 24 },
sm: { span: 4 },
sm: { span: 5 },
}}
wrapperCol={{
xs: { span: 24 },
sm: { span: 20 },
sm: { span: 19 },
}}
>
{getFieldDecorator('expend', {
......@@ -141,18 +169,41 @@ class eliminateEdit extends React.Component {
},
],
})(
<InputNumber placeholder="请输入消课次数" style={{ width: 200 }} />,
<InputNumber onBlur={e => this.expendChange(e)} placeholder="请输入消课数量" style={{ width: 200 }} />,
)}
<span className="ant-form-text">{currentCourse.course_mode === 1 ? '课时' : '天'}</span>
</Form.Item>
{getFieldValue('student_course_id') != undefined ? (
<Form.Item
label="消耗后剩余"
labelCol={{
xs: { span: 24 },
sm: { span: 5 },
}}
wrapperCol={{
xs: { span: 24 },
sm: { span: 19 },
}}
>
{currentCourse.course_mode == 1 &&
<span>{expendValue || 0} 课时</span>
}
{currentCourse.course_mode == 2 &&
<span>{expendValue || 0} </span>
}
</Form.Item>
) : (
''
)}
<Form.Item
label={<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>}
labelCol={{
xs: { span: 24 },
sm: { span: 4 },
sm: { span: 5 },
}}
wrapperCol={{
xs: { span: 24 },
sm: { span: 20 },
sm: { span: 19 },
}}
>
{getFieldDecorator('operator_id', {
......
......@@ -151,7 +151,7 @@ class StudentMgt extends React.Component {
values,
},
});
// form.resetFields();
form.resetFields();
}
sureRenewCourse = (values, callBack) => {
const { dispatch } = this.props;
......@@ -234,6 +234,12 @@ class StudentMgt extends React.Component {
selectdeStudent: record,
},
});
dispatch({
type: 'students/studentsList',
payload: {
params: {},
},
});
}
searchCourseRelateClass = (courseId, callBack) => {
const { dispatch } = this.props;
......
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