Commit 96352f1f by FE

alipay modify

parent 57b9163f
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
right: 0; right: 0;
bottom: 0; bottom: 0;
background-color: rgba(0, 0, 0, .6); background-color: rgba(0, 0, 0, .6);
z-index: 2; z-index: 15;
.content { .content {
width: 300px; width: 300px;
......
...@@ -7,6 +7,7 @@ import {HeaderBar, CallApp} from '../../common' ...@@ -7,6 +7,7 @@ import {HeaderBar, CallApp} from '../../common'
import ShareRank from "./shareRank" import ShareRank from "./shareRank"
import Audition from "./audition" import Audition from "./audition"
import Single from "./single" import Single from "./single"
import SingleSuccess from './single/singleSuccess';
import BtnStatus from "./btnstatus" import BtnStatus from "./btnstatus"
import Carouselw from "./carousel" import Carouselw from "./carousel"
import {connect} from "react-redux" import {connect} from "react-redux"
...@@ -25,7 +26,10 @@ class Detail extends Component { ...@@ -25,7 +26,10 @@ class Detail extends Component {
isbuy: 0, isbuy: 0,
isvip: 0, isvip: 0,
auditionBox: false, auditionBox: false,
singleBox: false, singleBox: false,
singleType: 1,
shareRank: false, shareRank: false,
singMess: '', singMess: '',
barInfo: '', barInfo: '',
...@@ -39,6 +43,45 @@ class Detail extends Component { ...@@ -39,6 +43,45 @@ class Detail extends Component {
componentDidMount() { componentDidMount() {
this.fetchCourseInfo(); this.fetchCourseInfo();
const { location: { state = {} } } = this.props;
if(state.oid) {
this.check(state.oid);
}
}
// 判断支付是否成功
check = (oid) => {
http.get(`${API['base-api']}/class_order_status/${oid}`).then((res) => {
if (Number(res.data.data.errno) === 200) {
// 正常购买单集成功
this.setState({
singleType: 6,
})
} else if (Number(res.data.data.errno) === 201) {
// 0元参团
this.setState({
singleType: 4,
})
} else if (Number(res.data.data.errno) === 202) {
// 0元购
this.setState({
singleType: 3,
})
} else if (Number(res.data.data.errno) === 203) {
// 三天内特价
this.setState({
nowPrice: res.data.data.data.now_price,
laterPrice: res.data.data.data.three_day_later_price,
singleType: 2,
})
} else {
Toast.info(res.data.data.msg, 2)
}
})
} }
fetchCourseInfo = () => { fetchCourseInfo = () => {
...@@ -88,6 +131,7 @@ class Detail extends Component { ...@@ -88,6 +131,7 @@ class Detail extends Component {
} }
// 点击子组件单集购买按钮 // 点击子组件单集购买按钮
toSingleset = (item) => { toSingleset = (item) => {
console.log(this.props);
const {user} = this.props const {user} = this.props
const uid = user && user.data && user.data.uid const uid = user && user.data && user.data.uid
if (!uid) { if (!uid) {
...@@ -95,8 +139,9 @@ class Detail extends Component { ...@@ -95,8 +139,9 @@ class Detail extends Component {
} else { } else {
this.setState({ this.setState({
singleBox: true, singleBox: true,
singleType: 1,
singMess: item singMess: item
}) });
} }
} }
...@@ -207,11 +252,17 @@ class Detail extends Component { ...@@ -207,11 +252,17 @@ class Detail extends Component {
// 自组件传给父组件的boxHide // 自组件传给父组件的boxHide
boxHide = (val) => { boxHide = (val) => {
this.setState({auditionBox: val, singleBox: val}) this.setState({
auditionBox: val,
singleBox: val,
singleType: 1
})
this.props.history.push(`/detail?id=${getParam('id')}`);
} }
render() { render() {
const { course: { course_info={} }, barInfo } = this.state; const { course: { course_info={} }, barInfo, singleBox, singleType } = this.state;
console.log(course_info); console.log(course_info);
let courseInfo = '', let courseInfo = '',
service = '', service = '',
...@@ -225,8 +276,14 @@ class Detail extends Component { ...@@ -225,8 +276,14 @@ class Detail extends Component {
} }
// } // }
const {share, countdown, list, outList} = this.state; const {share, countdown, list, outList} = this.state;
const href = this.props.location && this.props.location.state? this.props.location.state.href : undefined; let href = this.props.location && this.props.location.state? this.props.location.state.href : undefined;
const { location: { state = {}} } = this.props;
if(state.oid) {
href='/classify'
}
return ( return (
<div>
<div className='detail-box'> <div className='detail-box'>
<HeaderBar <HeaderBar
title='课程详情' title='课程详情'
...@@ -302,15 +359,28 @@ class Detail extends Component { ...@@ -302,15 +359,28 @@ class Detail extends Component {
<Audition auditionBox={this.state.auditionBox} boxHide={this.boxHide}/> <Audition auditionBox={this.state.auditionBox} boxHide={this.boxHide}/>
{/*单集购买弹窗*/} {/*单集购买弹窗*/}
{
singleBox &&
<Single <Single
singleType={this.state.singleType}
singleBox={this.state.singleBox} singleBox={this.state.singleBox}
boxHide={this.boxHide} boxHide={this.boxHide}
data={this.state.singMess} data={this.state.singMess}
vcourseId={course_info.v_course_id} vcourseId={course_info.v_course_id}
videoId={this.state.singMess.video_id} videoId={this.state.singMess.video_id}
title={course_info.course_title} title={course_info.course_title}
/> check={this.check}
/>}
{/* 单集购买成功弹窗 */}
{
singleType != 1 &&
<SingleSuccess
boxHide={this.boxHide}
data={this.state.singMess}
singleType={singleType}
videoId={this.state.singMess.video_id}
/>
}
{/*分享赚钱*/} {/*分享赚钱*/}
{ {
course_info.is_dist && course_info.is_dist &&
...@@ -376,6 +446,7 @@ class Detail extends Component { ...@@ -376,6 +446,7 @@ class Detail extends Component {
) : null ) : null
} }
</div> </div>
</div>
) )
} }
......
...@@ -12,7 +12,7 @@ class Single extends Component { ...@@ -12,7 +12,7 @@ class Single extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
status: 1, // status: 1,
orderId: '', orderId: '',
nowPrice: '', nowPrice: '',
laterPrice: '', laterPrice: '',
...@@ -22,55 +22,25 @@ class Single extends Component { ...@@ -22,55 +22,25 @@ class Single extends Component {
endTime: '', endTime: '',
groupOrderId: '', groupOrderId: '',
payType: '0', // 1支付宝 0微信 payType: '0', // 1支付宝 0微信
singleBox: false, // singleBox: false,
} }
} }
componentDidMount() { componentDidMount() {
if (getParam('is_class') === 1 || getParam('weixinpay')) { // if (getParam('is_class') === 1 || getParam('weixinpay')) {
this.payCallback() // console.log(0);
} // this.payCallback()
if (browser.isWeixin) { // }
this.isweixinPay() // if (browser.isWeixin) {
} // this.isweixinPay()
// }
const { location: { state = {} } } = this.props;
console.log(state);
if(state.oid) {
http.get(`${API['base-api']}/sys/orderStatus/${state.oid}`).then((res) => {
if (res.data.data.errno == '200') {
// 正常购买单集成功
this.setState({
status: 6
})
} else if (res.data.data.errno == '201') {
// 0元参团
this.setState({
status: 4
})
} else if (res.data.data.errno == '202') {
// 0元购
this.setState({
status: 3
})
} else if (res.data.data.errno == '203') {
// 三天内特价
this.setState({
nowPrice: res.data.data.data.now_price,
laterPrice: res.data.data.data.three_day_later_price,
status: 2
})
} else {
Toast.info(res.data.data.msg, 2)
}
})
}
} }
componentWillReceiveProps(nextProps, nextContext) { componentWillReceiveProps(nextProps, nextContext) {
this.setState({ // console.log(nextProps);
singleBox: nextProps.singleBox // this.setState({
}) // singleBox: nextProps.singleBox
// })
} }
// 选择支付方式 // 选择支付方式
...@@ -344,14 +314,15 @@ class Single extends Component { ...@@ -344,14 +314,15 @@ class Single extends Component {
}) })
}, 1000) }, 1000)
} }
const { singleType } = this.props;
console.log(this.state.singleBox);
return ( return (
<div> <div>
{
singleBox &&
<div className='popup-box'> <div className='popup-box'>
{ {
this.state.status === 1 && singleType === 1 &&
<div className='content singleset-payment'> <div className='content singleset-payment'>
<div className='price-box'> <div className='price-box'>
<span>实付款:</span> <span>实付款:</span>
...@@ -386,7 +357,7 @@ class Single extends Component { ...@@ -386,7 +357,7 @@ class Single extends Component {
</div> </div>
} }
{ {
this.state.status === 2 && singleType === 2 &&
<div className='content payment-success'> <div className='content payment-success'>
<div className="header"> <div className="header">
<i className='iconfont icondanseshixintubiao-5'></i> <i className='iconfont icondanseshixintubiao-5'></i>
...@@ -400,7 +371,7 @@ class Single extends Component { ...@@ -400,7 +371,7 @@ class Single extends Component {
</div> </div>
} }
{ {
this.state.status === 3 && singleType === 3 &&
<div className='content zero'> <div className='content zero'>
<div className="header"> <div className="header">
<i className='iconfont icondanseshixintubiao-5'></i> <i className='iconfont icondanseshixintubiao-5'></i>
...@@ -411,7 +382,7 @@ class Single extends Component { ...@@ -411,7 +382,7 @@ class Single extends Component {
</div> </div>
} }
{ {
this.state.status === 4 && singleType === 4 &&
<div className='content zero'> <div className='content zero'>
<div className="header"> <div className="header">
<i className='iconfont icondanseshixintubiao-5'></i> <i className='iconfont icondanseshixintubiao-5'></i>
...@@ -422,7 +393,7 @@ class Single extends Component { ...@@ -422,7 +393,7 @@ class Single extends Component {
</div> </div>
} }
{ {
this.state.status === 6 && singleType === 6 &&
<div className='content zero'> <div className='content zero'>
<div className="header"> <div className="header">
<i className='iconfont icondanseshixintubiao-5'></i> <i className='iconfont icondanseshixintubiao-5'></i>
...@@ -432,7 +403,7 @@ class Single extends Component { ...@@ -432,7 +403,7 @@ class Single extends Component {
</div> </div>
} }
{ {
this.state.status === 7 && singleType === 7 &&
<div className='content group'> <div className='content group'>
<div className="header"> <div className="header">
<i className='iconfont icondanseshixintubiao-5'></i> <i className='iconfont icondanseshixintubiao-5'></i>
...@@ -456,7 +427,7 @@ class Single extends Component { ...@@ -456,7 +427,7 @@ class Single extends Component {
} }
<i onClick={this.colse} className={'iconfont iconiconfront-2 close'}></i> <i onClick={this.colse} className={'iconfont iconiconfront-2 close'}></i>
</div> </div>
}
</div> </div>
); );
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
right: 0; right: 0;
bottom: 0; bottom: 0;
background-color: rgba(0, 0, 0, .6); background-color: rgba(0, 0, 0, .6);
z-index: 2; z-index: 5;
.content { .content {
width: 300px; width: 300px;
......
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