Commit c7d02352 by FE

solve question that btn of kanjia not show,because modify to course detial question

parent 2b4d789c
......@@ -18,7 +18,7 @@ class BtnStatus extends Component {
group_status: 3,
in_cart: false,
countdown: 0,
barInfo: ''
// barInfo: ''
}
}
......@@ -40,9 +40,9 @@ class BtnStatus extends Component {
// }
componentWillReceiveProps(nextProps) {
if(nextProps.data && nextProps.data.is_bargain) {
this.getBargainInfo()
}
// if(nextProps.data && nextProps.data.is_bargain) {
// this.getBargainInfo()
// }
this.setState({
...nextProps.data.course_info,
countdown: nextProps.countdown,
......@@ -110,12 +110,12 @@ class BtnStatus extends Component {
};
// 直接购买
tobuy = () => {
const {user} = this.props
const {user, barInfo} = this.props
const uid = user && user.data && user.data.uid
if (!uid) {
this.props.history.push('/passport/login')
} else {
if (this.state.barInfo.bargain_status === 2) {
if (barInfo.bargain_status === 2) {
// this.toCart(2)
// 新需求 不需要加入购物车 直接走普通课程的立即报名流程 跳到订单页
this.simpleCourse();
......@@ -228,7 +228,8 @@ class BtnStatus extends Component {
const {countdown} = this.state;
const {user} = this.props
const uid = user && user.data && user.data.uid
const { barInfo = {} } = this.props;
console.log(this.props);
return (
<div>
......@@ -312,15 +313,15 @@ class BtnStatus extends Component {
<span onClick={this.tobuy}>直接购买</span>
</button>
{
(this.state.barInfo.bargain_status === 2 || !uid) &&
(barInfo.bargain_status === 2 || !uid) &&
<button className='btn btn-s bg-E02E24' onClick={this.toKanjia}>
我要砍价
</button>
}
{
(this.state.barInfo.bargain_status === 0 || this.state.barInfo.bargain_status === 1) && (uid) &&
(barInfo.bargain_status === 0 || barInfo.bargain_status === 1) && (uid) &&
<button className='btn btn-s bg-E02E24'>
<span>¥{this.state.barInfo.amount}</span>
<span>¥{barInfo.amount}</span>
<span onClick={this.bargainToOrder}>去支付</span>
</button>
}
......
......@@ -37,6 +37,10 @@ class Detail extends Component {
if(getParam('isIn')) {
this.props.getCourses();
}
const { courseInfo } = this.props;
if(courseInfo.is_bargain) {
this.getBargainInfo();
}
}
// 点击子组件试听按钮
......@@ -274,7 +278,6 @@ class Detail extends Component {
data={this.props.courseInfo}
user={this.props.user}
barInfo={this.state.barInfo}
getBargainInfo={this.getBargainInfo}
invitedFriends={this.invitedFriends}
addCourseToCart={this.props.addCourseToCart}
history={this.props.history}></BtnStatus>
......
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