Commit 2be2ca3f by FE

bargain info not update and pay btn

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