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'
import {getParam, http, browser, wxShare} from "@/utils";
import { connect } from "react-redux"
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';
@connect()
......@@ -21,6 +21,8 @@ class ToGroup extends Component {
is_success: false, // 是否拼团成功
userInfo: {},
number: 0, // 差几人成团
isBuy: false,
modal: false,
}
}
......@@ -66,6 +68,7 @@ class ToGroup extends Component {
userInfo,
number: res.data.data.number,
countdown: '',
isBuy: res.data.data.is_buy
});
if(res.data.data.is_success === 0) {
......@@ -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() {
const { data: { course_id, course_title, simpledescription, price0, price1 }, pdd_price, is_success, person_num, groupon_member, course_list } = this.state;
const Info = (
......@@ -114,6 +135,24 @@ class ToGroup extends Component {
)
return (
<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>
{
!is_success &&
......@@ -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>
<div className="group-course">
......@@ -222,7 +265,14 @@ function GorupContent(props) {
dec = <p className='dec'>分享到3个群后,成团率高达98%</p>
} else {
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 {
// this.publicLocalStorage();
// })
// }else{
console.log(8);
http.get(`${API['base-api']}/m/order/preorder`).then((res) => {
console.log('为了验证什么条件下会走这段代码');
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