Commit d0d4d922 by FE

judge is buy after get into share page throught share link

parent d866e55f
...@@ -5,7 +5,7 @@ import { HeaderBar, VList } from '../../../common' ...@@ -5,7 +5,7 @@ import { HeaderBar, VList } from '../../../common'
import {getParam, http, browser, wxShare} from "@/utils"; import {getParam, http, browser, wxShare} from "@/utils";
import { connect } from "react-redux" import { connect } from "react-redux"
import { Link } from "react-router-dom" import { Link } from "react-router-dom"
import { WingBlank, WhiteSpace, Flex, Toast } from 'antd-mobile' import { WingBlank, WhiteSpace, Flex, Toast, Modal } from 'antd-mobile'
import {getCourses} from './../../detail/actions'; import {getCourses} from './../../detail/actions';
@connect() @connect()
...@@ -21,6 +21,8 @@ class ToGroup extends Component { ...@@ -21,6 +21,8 @@ class ToGroup extends Component {
is_success: false, // 是否拼团成功 is_success: false, // 是否拼团成功
userInfo: {}, userInfo: {},
number: 0, // 差几人成团 number: 0, // 差几人成团
isBuy: false,
modal: false,
} }
} }
...@@ -66,6 +68,7 @@ class ToGroup extends Component { ...@@ -66,6 +68,7 @@ class ToGroup extends Component {
userInfo, userInfo,
number: res.data.data.number, number: res.data.data.number,
countdown: '', countdown: '',
isBuy: res.data.data.is_buy
}); });
if(res.data.data.is_success === 0) { if(res.data.data.is_success === 0) {
...@@ -94,6 +97,24 @@ class ToGroup extends Component { ...@@ -94,6 +97,24 @@ class ToGroup extends Component {
// })); // }));
} }
handleToGroup = () => {
const { isBuy = false, data={} } = this.state;
const { history } = this.props;
if(!isBuy){
history.push(
`/order?id=${data.course_id}`,
{
group: 1
}
)
}else {
this.setState({
modal: true
})
}
console.log(this.state);
}
render() { render() {
const { data: { course_id, course_title, simpledescription, price0, price1 }, pdd_price, is_success, person_num, groupon_member, course_list } = this.state; const { data: { course_id, course_title, simpledescription, price0, price1 }, pdd_price, is_success, person_num, groupon_member, course_list } = this.state;
const Info = ( const Info = (
...@@ -114,6 +135,24 @@ class ToGroup extends Component { ...@@ -114,6 +135,24 @@ class ToGroup extends Component {
) )
return ( return (
<div className='to-group-box'> <div className='to-group-box'>
<Modal
transparent
visible={this.state.modal}
title="提示"
footer={[
{
text: '确定',
onPress: () => {
this.setState({
modal: false
});
this.props.history.push('/');
}
}
]}
>
<p>您已经购买过该课程~</p>
</Modal>
<HeaderBar title='拼团' cart={false} toHref={() => this.toCourseDetail(course_id)}></HeaderBar> <HeaderBar title='拼团' cart={false} toHref={() => this.toCourseDetail(course_id)}></HeaderBar>
{ {
!is_success && !is_success &&
...@@ -125,7 +164,11 @@ class ToGroup extends Component { ...@@ -125,7 +164,11 @@ class ToGroup extends Component {
/> />
} }
<GorupContent data={this.state} invitedFriends={this.invitedFriends} /> <GorupContent
data={this.state}
invitedFriends={this.invitedFriends}
handleToGroup={this.handleToGroup}
/>
<WhiteSpace></WhiteSpace> <WhiteSpace></WhiteSpace>
<div className="group-course"> <div className="group-course">
...@@ -222,7 +265,14 @@ function GorupContent(props) { ...@@ -222,7 +265,14 @@ function GorupContent(props) {
dec = <p className='dec'>分享到3个群后,成团率高达98%</p> dec = <p className='dec'>分享到3个群后,成团率高达98%</p>
} else { } else {
tip = <p className='tip'>{`拼团省¥${data.price1-pdd_price}元`}</p> tip = <p className='tip'>{`拼团省¥${data.price1-pdd_price}元`}</p>
btn = <Link to={`/order?id=${data.course_id}`} className='group-btn'>一键参团</Link> // btn = <Link to={{
// pathname: '/order',
// search: `?id=${data.course_id}`,
// state: {
// group: 1
// }
// }} className='group-btn'>一键参团</Link>
btn = <a href="javascript:;" className='group-btn' onClick={props.handleToGroup}>一键参团</a>
} }
} }
......
...@@ -349,6 +349,7 @@ class Order extends Component { ...@@ -349,6 +349,7 @@ class Order extends Component {
// this.publicLocalStorage(); // this.publicLocalStorage();
// }) // })
// }else{ // }else{
console.log(8);
http.get(`${API['base-api']}/m/order/preorder`).then((res) => { http.get(`${API['base-api']}/m/order/preorder`).then((res) => {
console.log('为了验证什么条件下会走这段代码'); console.log('为了验证什么条件下会走这段代码');
if (res.data.errno !== 200) { if (res.data.errno !== 200) {
......
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