Commit 2be2ca3f by FE

bargain info not update and pay btn

parent ff13374a
...@@ -41,7 +41,7 @@ class BargainMiddlePage extends Component { ...@@ -41,7 +41,7 @@ class BargainMiddlePage extends Component {
min: '', min: '',
sec: '', sec: '',
day: '', day: '',
amount: '', amount: '', // 每次砍掉的价格
firendBaigainPrice: true, firendBaigainPrice: true,
isshowYindao: false, isshowYindao: false,
isLoaidng: true, isLoaidng: true,
...@@ -124,7 +124,7 @@ class BargainMiddlePage extends Component { ...@@ -124,7 +124,7 @@ class BargainMiddlePage extends Component {
} }
// 获取助理好友 // 获取助理好友
getBargainRankList = (id, type) => { getBargainRankList = (id = '', type) => {
const bargain_code = getParam('bargaincode') || ''; const bargain_code = getParam('bargaincode') || '';
let data = { let data = {
courseId: id, courseId: id,
...@@ -236,6 +236,7 @@ class BargainMiddlePage extends Component { ...@@ -236,6 +236,7 @@ class BargainMiddlePage extends Component {
} }
http.post(`${API.home}/m/bargain/toBargain`, data).then((res) => { http.post(`${API.home}/m/bargain/toBargain`, data).then((res) => {
if (res.data.code === 200) { if (res.data.code === 200) {
// is_success =0一切正常 =1 不能在砍了 =2关注公众号,可以再砍一刀! // is_success =0一切正常 =1 不能在砍了 =2关注公众号,可以再砍一刀!
this.setState({ this.setState({
amount: res.data.data.amount amount: res.data.data.amount
...@@ -244,7 +245,9 @@ class BargainMiddlePage extends Component { ...@@ -244,7 +245,9 @@ class BargainMiddlePage extends Component {
this.setState({ this.setState({
isShowOverlay: true, isShowOverlay: true,
status: 6 status: 6
}) });
this.getBargainInfo();
this.getBargainRankList('', 1);
} }
if (res.data.data.is_success === 1) { if (res.data.data.is_success === 1) {
...@@ -635,15 +638,35 @@ function CourseDes(props) { ...@@ -635,15 +638,35 @@ function CourseDes(props) {
} }
function CourseBottom(props) { function CourseBottom(props) {
// bargain_status 砍价状态 0-砍价中,1砍价结束,待支付,2砍价过期(没有砍价记录没有砍价信息),3已购买
const { course_id = '', bargain_status = '', price1 = '', pay_price = '' } = props.item || {};
const price = bargain_status === 2? price1 : pay_price;
let Buttons let Buttons
if (props.item.bargain_status === 2) { // if (props.item.bargain_status === 2) {
// Buttons = <Link to={`/detail?id=${props.item.course_id}`} className={'bargain'}>我要砍价</Link> // // Buttons = <Link to={`/detail?id=${props.item.course_id}`} className={'bargain'}>我要砍价</Link>
Buttons = <a onClick={() => props.toDetail(props.item.course_id)} className={'bargain bargian-study'}>我要砍价</a> // Buttons = (
} else if (props.item.bargain_status === 3) { // <div className="">
Buttons = <Link to={`/play/video?id=${props.item.v_course_id}`} // <a onClick={() => props.toDetail(props.item.course_id)} className={'bargain bargian-study'}>我要砍价</a>
className={classnames('bargain', 'button--study')}>去学习</Link> // </div>
if(props.item.course_id === 139) {
Buttons = <a onClick={() => props.toDetail(props.item.course_id)} className={'bargain bargian-study'}>我要砍价</a> // )
// } else
if (bargain_status === 3) {
if(course_id === 139) {
Buttons = (
<a
onClick={() => props.toDetail(props.item.course_id)}
className={'bargain bargian-study'}
>我要砍价</a>
);
}else {
Buttons = (
<Link
to={`/play/video?id=${props.item.v_course_id}`}
className={classnames('bargain', 'button--study')}
>去学习</Link>
);
} }
} else { } else {
Buttons = ( Buttons = (
...@@ -652,18 +675,19 @@ function CourseBottom(props) { ...@@ -652,18 +675,19 @@ function CourseBottom(props) {
{/*{props.item.bargain_status === 2 ? '砍价结束' : '继续砍价'}*/} {/*{props.item.bargain_status === 2 ? '砍价结束' : '继续砍价'}*/}
{/*</button>*/} {/*</button>*/}
{ {
props.item.bargain_status === 1 && bargain_status === 1 &&
<button className='invalid'>砍价结束</button> <button className='invalid'>砍价结束</button>
} }
{ {
props.item.bargain_status === 0 && (bargain_status === 0 || bargain_status === 2) &&
<a onClick={() => props.toDetail(props.item.course_id)} className={'bargain-btn'}>我要砍价</a> <a onClick={() => props.toDetail(props.item.course_id)} className={'bargain-btn'}>我要砍价</a>
} }
<button
<button onClick={() => props.toCartBottom(props.item.course_id)} onClick={() => props.toCartBottom(props.item.course_id)}
className={'purchase-btn'}>¥{props.item.pay_price}去支付 className={'purchase-btn'}
>
¥{price}去支付
</button> </button>
</div> </div>
) )
......
...@@ -26,7 +26,9 @@ class Bargain extends Component { ...@@ -26,7 +26,9 @@ class Bargain extends Component {
bargainCode: '', bargainCode: '',
time: '', time: '',
barInfo: {}, barInfo: {},
country: '86' country: '86',
price: 0, // 每次砍价砍掉的价格
sum: 0 // 累计砍掉的价格
} }
} }
...@@ -117,7 +119,6 @@ class Bargain extends Component { ...@@ -117,7 +119,6 @@ class Bargain extends Component {
isShowOverlay: true, isShowOverlay: true,
status: 1 status: 1
}); });
this.getBargainInfo(false);
} else { } else {
Toast.info(res.data.msg, 2) Toast.info(res.data.msg, 2)
} }
...@@ -183,6 +184,13 @@ class Bargain extends Component { ...@@ -183,6 +184,13 @@ class Bargain extends Component {
this.setState({ this.setState({
isShowOverlay: true, isShowOverlay: true,
status: 2, status: 2,
price: data.amount,
sum: data.bargain_price
});
this.getBargainInfo(false);
this.getBargainRankList({
type: 0,
bargain_code: data.bargain_code
}); });
}else { }else {
history.push(`/bargain-middle-page?id=${getParam('id')}&bargaincode=${data.bargain_code}&is_originator=1`) history.push(`/bargain-middle-page?id=${getParam('id')}&bargaincode=${data.bargain_code}&is_originator=1`)
...@@ -220,7 +228,7 @@ class Bargain extends Component { ...@@ -220,7 +228,7 @@ class Bargain extends Component {
} }
render() { render() {
const { list, outList, barInfo, country } = this.state; const { list, outList, barInfo, country, price, sum } = 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
return ( return (
...@@ -262,7 +270,11 @@ class Bargain extends Component { ...@@ -262,7 +270,11 @@ class Bargain extends Component {
{/*使用砍价神器*/} {/*使用砍价神器*/}
{ {
this.state.status === 2 && this.state.status === 2 &&
<UseArtifact toCart={this.toCart}/> <UseArtifact
price={price}
sum={sum}
toCart={this.toCart}
/>
} }
{ {
...@@ -434,14 +446,14 @@ function Artifact(props) { ...@@ -434,14 +446,14 @@ function Artifact(props) {
} }
function UseArtifact(props) { function UseArtifact(props) {
const { barInfo: {bargain_price = 0, amount = 0} } = this.props; const { sum, price } = props;
return ( return (
<div className='use-artifact-box'> <div className='use-artifact-box'>
<img className='top-img' src={require('./image/kanjia_cg_icon.png')} alt=""/> <img className='top-img' src={require('./image/kanjia_cg_icon.png')} alt=""/>
<p className='top-tip'>厉害了,又砍掉了10元!</p> <p className='top-tip'>厉害了,又砍掉了{price}元!</p>
<p className='middle-tip'> <p className='middle-tip'>
你已经砍了 你已经砍了
<span className={'indicator'}>{amount - bargain_price}</span> <span className={'indicator'}>{sum}</span>
没见过你这么能砍的人... 没见过你这么能砍的人...
</p> </p>
<p className='btm-tip'> <p className='btm-tip'>
......
...@@ -24,7 +24,7 @@ class Search extends PureComponent { ...@@ -24,7 +24,7 @@ class Search extends PureComponent {
if (errno === 0) { if (errno === 0) {
this.setState({ this.setState({
hot_words: data.info.hot_words, hot_words: data.info.hot_words,
defaultWord: data.info.recommend_word, value: data.info.recommend_word,
isLoading: false isLoading: false
}) })
} }
...@@ -60,7 +60,7 @@ class Search extends PureComponent { ...@@ -60,7 +60,7 @@ class Search extends PureComponent {
<div className="search-page"> <div className="search-page">
<SearchHead <SearchHead
searchHistory={this.state.searchHistory} searchHistory={this.state.searchHistory}
value={this.state.value || this.state.defaultWord} value={this.state.value}
handleChange={this.handleChange} handleChange={this.handleChange}
handleSearch={this.handleSearch} handleSearch={this.handleSearch}
/> />
......
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