Commit 9002dfc5 by xuzhenghua

detail

parent aee2b63b
...@@ -135,31 +135,42 @@ class BargainMiddlePage extends Component { ...@@ -135,31 +135,42 @@ class BargainMiddlePage extends Component {
}) })
} }
// 加入购物车 // 直接支付
toCart = () => { toCart = () => {
let data = { http.get(`${API['base-api']}/m/cart/addtopreorder/[${getParam('id')}]`).then((res) => {
course_id: getParam('id') if (res.data.errno === 0) {
} this.props.history.push(`/order?id=[${getParam('id')}]`, {bargain: 1});
http.post(`${API.home}/m/cart/add`, data).then((res) => {
if (res.data.code === 200 || res.data.code === 15001) {
this.props.history.push('/shopcart')
} else { } else {
Toast.info(res.data.msg, 2); Toast.info(res.data.msg, 2);
} }
}) })
// let data = {
// course_id: getParam('id')
// }
// http.post(`${API.home}/m/cart/add`, data).then((res) => {
// if (res.data.code === 200 || res.data.code === 15001) {
// this.props.history.push('/shopcart')
// } else {
// Toast.info(res.data.msg, 2);
// }
// })
} }
// 我要砍价列表的去支付 // 我要砍价列表的去支付
toCartBottom=(id)=>{ toCartBottom=(id)=>{
let data = { http.get(`${API['base-api']}/m/cart/addtopreorder/[${id}]`).then((res) => {
course_id: id if (res.data.errno === 0) {
} this.props.history.push(`/order?id=[${getParam('id')}]`, {bargain: 1});
http.post(`${API.home}/m/cart/add`, data).then((res) => {
if (res.data.code === 200 || res.data.code === 15001) {
this.props.history.push('/shopcart')
} else { } else {
Toast.info(res.data.msg, 2); Toast.info(res.data.msg, 2);
} }
}) })
// http.post(`${API.home}/m/cart/add`, data).then((res) => {
// if (res.data.code === 200 || res.data.code === 15001) {
// this.props.history.push('/shopcart')
// } else {
// Toast.info(res.data.msg, 2);
// }
// })
} }
// 查看更多 // 查看更多
...@@ -565,7 +576,7 @@ function CourseBottom(props) { ...@@ -565,7 +576,7 @@ function CourseBottom(props) {
} }
<button onClick={props.toCartBottom} <button onClick={() => props.toCartBottom(props.item.course_id)}
className={'purchase-btn'}>¥{props.item.pay_price}去支付 className={'purchase-btn'}>¥{props.item.pay_price}去支付
</button> </button>
</div> </div>
......
...@@ -29,10 +29,7 @@ class Bargain extends Component { ...@@ -29,10 +29,7 @@ class Bargain extends Component {
} }
componentDidMount() { componentDidMount() {
const { user= {} } = this.props; this.getBargainInfo();
if(user.data && user.data.uid) {
this.getBargainInfo();
}
} }
// 获取助理好友 // 获取助理好友
...@@ -184,7 +181,6 @@ class Bargain extends Component { ...@@ -184,7 +181,6 @@ class Bargain extends Component {
render() { render() {
const { list, outList, barInfo } = this.state; const { list, outList, barInfo } = this.state;
console.log(barInfo)
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 (
...@@ -260,7 +256,7 @@ function BargainIntro(props) { ...@@ -260,7 +256,7 @@ function BargainIntro(props) {
<Flex direction={'column'} justify={'center'} className={'intro-wrapper'}> <Flex direction={'column'} justify={'center'} className={'intro-wrapper'}>
<p> <p>
邀请 邀请
<span className={'indicator'}>{props.limit_people}</span> <span className={'indicator'}>{props.limitPeople}</span>
好友帮忙砍价可获得 好友帮忙砍价可获得
<span className={'indicator'}>【砍价神器】</span> <span className={'indicator'}>【砍价神器】</span>
</p> </p>
......
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