Commit 8ab73bd5 by FE

modify redirect after alipay sucess

parent e56f3a26
...@@ -47,6 +47,28 @@ export default class PayOrder extends Component { ...@@ -47,6 +47,28 @@ export default class PayOrder extends Component {
categoryList: [], categoryList: [],
} }
} }
// 支付成功后,判断并重定向
redirectAfterPay = () => {
// status:0成功,1失败
const status = getParam('status');
const type = getParam('type');
const oid = getParam('oid');
const { history } = this.props;
if(status || type) {
if(parseInt(status, 10) === 0) {
// type订单类型 0普通订单 1团购 2小团 3砍价 4单集购买 5定金课定金 6定金课尾款
if(parseInt(type, 10) === 2) {
history.push(`/togroup?id=${oid}`);
}else {
history.push('/purchased');
}
}else {
Toast.info('支付异常', 2);
}
}
}
onChange = (value) => { onChange = (value) => {
this.setState({ this.setState({
payType: value, payType: value,
...@@ -178,6 +200,7 @@ export default class PayOrder extends Component { ...@@ -178,6 +200,7 @@ export default class PayOrder extends Component {
} }
componentDidMount() { componentDidMount() {
this.redirectAfterPay()
http.post(`${API['base-api']}/m/order/detail`, { order_id: this.state.orderId }).then((res) => { http.post(`${API['base-api']}/m/order/detail`, { order_id: this.state.orderId }).then((res) => {
console.log(res); console.log(res);
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