Commit 96352f1f by FE

alipay modify

parent 57b9163f
......@@ -6,7 +6,7 @@
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, .6);
z-index: 2;
z-index: 15;
.content {
width: 300px;
......
......@@ -7,6 +7,7 @@ import {HeaderBar, CallApp} from '../../common'
import ShareRank from "./shareRank"
import Audition from "./audition"
import Single from "./single"
import SingleSuccess from './single/singleSuccess';
import BtnStatus from "./btnstatus"
import Carouselw from "./carousel"
import {connect} from "react-redux"
......@@ -25,7 +26,10 @@ class Detail extends Component {
isbuy: 0,
isvip: 0,
auditionBox: false,
singleBox: false,
singleType: 1,
shareRank: false,
singMess: '',
barInfo: '',
......@@ -39,6 +43,45 @@ class Detail extends Component {
componentDidMount() {
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 = () => {
......@@ -88,6 +131,7 @@ class Detail extends Component {
}
// 点击子组件单集购买按钮
toSingleset = (item) => {
console.log(this.props);
const {user} = this.props
const uid = user && user.data && user.data.uid
if (!uid) {
......@@ -95,8 +139,9 @@ class Detail extends Component {
} else {
this.setState({
singleBox: true,
singleType: 1,
singMess: item
})
});
}
}
......@@ -207,11 +252,17 @@ class Detail extends Component {
// 自组件传给父组件的boxHide
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() {
const { course: { course_info={} }, barInfo } = this.state;
const { course: { course_info={} }, barInfo, singleBox, singleType } = this.state;
console.log(course_info);
let courseInfo = '',
service = '',
......@@ -225,8 +276,14 @@ class Detail extends Component {
}
// }
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 (
<div>
<div className='detail-box'>
<HeaderBar
title='课程详情'
......@@ -302,15 +359,28 @@ class Detail extends Component {
<Audition auditionBox={this.state.auditionBox} boxHide={this.boxHide}/>
{/*单集购买弹窗*/}
{
singleBox &&
<Single
singleType={this.state.singleType}
singleBox={this.state.singleBox}
boxHide={this.boxHide}
data={this.state.singMess}
vcourseId={course_info.v_course_id}
videoId={this.state.singMess.video_id}
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 &&
......@@ -376,6 +446,7 @@ class Detail extends Component {
) : null
}
</div>
</div>
)
}
......
......@@ -12,7 +12,7 @@ class Single extends Component {
constructor(props) {
super(props)
this.state = {
status: 1,
// status: 1,
orderId: '',
nowPrice: '',
laterPrice: '',
......@@ -22,55 +22,25 @@ class Single extends Component {
endTime: '',
groupOrderId: '',
payType: '0', // 1支付宝 0微信
singleBox: false,
// singleBox: false,
}
}
componentDidMount() {
if (getParam('is_class') === 1 || getParam('weixinpay')) {
this.payCallback()
}
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)
}
})
}
// if (getParam('is_class') === 1 || getParam('weixinpay')) {
// console.log(0);
// this.payCallback()
// }
// if (browser.isWeixin) {
// this.isweixinPay()
// }
}
componentWillReceiveProps(nextProps, nextContext) {
this.setState({
singleBox: nextProps.singleBox
})
// console.log(nextProps);
// this.setState({
// singleBox: nextProps.singleBox
// })
}
// 选择支付方式
......@@ -344,14 +314,15 @@ class Single extends Component {
})
}, 1000)
}
const { singleType } = this.props;
console.log(this.state.singleBox);
return (
<div>
{
singleBox &&
<div className='popup-box'>
{
this.state.status === 1 &&
singleType === 1 &&
<div className='content singleset-payment'>
<div className='price-box'>
<span>实付款:</span>
......@@ -386,7 +357,7 @@ class Single extends Component {
</div>
}
{
this.state.status === 2 &&
singleType === 2 &&
<div className='content payment-success'>
<div className="header">
<i className='iconfont icondanseshixintubiao-5'></i>
......@@ -400,7 +371,7 @@ class Single extends Component {
</div>
}
{
this.state.status === 3 &&
singleType === 3 &&
<div className='content zero'>
<div className="header">
<i className='iconfont icondanseshixintubiao-5'></i>
......@@ -411,7 +382,7 @@ class Single extends Component {
</div>
}
{
this.state.status === 4 &&
singleType === 4 &&
<div className='content zero'>
<div className="header">
<i className='iconfont icondanseshixintubiao-5'></i>
......@@ -422,7 +393,7 @@ class Single extends Component {
</div>
}
{
this.state.status === 6 &&
singleType === 6 &&
<div className='content zero'>
<div className="header">
<i className='iconfont icondanseshixintubiao-5'></i>
......@@ -432,7 +403,7 @@ class Single extends Component {
</div>
}
{
this.state.status === 7 &&
singleType === 7 &&
<div className='content group'>
<div className="header">
<i className='iconfont icondanseshixintubiao-5'></i>
......@@ -456,7 +427,7 @@ class Single extends Component {
}
<i onClick={this.colse} className={'iconfont iconiconfront-2 close'}></i>
</div>
}
</div>
);
......
......@@ -5,7 +5,7 @@
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, .6);
z-index: 2;
z-index: 5;
.content {
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