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