Commit a35f1495 by wangshuo

一键开团支付的时候创建订单流程完善

parent cb812f10
......@@ -96,19 +96,33 @@ class Order extends Component {
if (!this.state.perfect) {
Toast.info('请完善报名信息!');
}
let url = `${API['base-api']}/m/v34/cart/order?ischeck=${this.state.useBalance}`;
if(this.props.location.state && this.props.location.state.type === 1) {
url += '&type=1'
}
http.get(url).then(res => {
console.log(res);
if(res.data.errno !== 0) {
Toast.info(res.data.msg, 2);
return;
if(this.props.location.state && this.props.location.state.group === 1) {
http.post(`${API['base-api']}/pdd/m`, {course_id: getParam("id")}).then(res => {
console.log(res.data.data);
if(res.data.errno === 200) {
sessionStorage.removeItem('orderUseCacheObj');
this.props.history.replace(`/payorder?oid=${res.data.data.oid}`);
}else {
Toast.info(res.data.msg, 2);
return;
}
});
}else{
let url = `${API['base-api']}/m/v34/cart/order?ischeck=${this.state.useBalance}`;
if(this.props.location.state && this.props.location.state.type === 1) {
url += '&type=1'
}
sessionStorage.removeItem('orderUseCacheObj');
this.props.history.replace(`/payorder?oid=${res.data.data.order_id}`);
});
http.get(url).then(res => {
console.log(res);
if(res.data.errno !== 0) {
Toast.info(res.data.msg, 2);
return;
}
sessionStorage.removeItem('orderUseCacheObj');
this.props.history.replace(`/payorder?oid=${res.data.data.order_id}`);
});
}
}
// 勾选取消勾选 是否使用余额
useBalance = () => {
......@@ -280,7 +294,7 @@ class Order extends Component {
})
}else{
http.get(`${API['base-api']}/m/order/preorder`).then((res) => {
alert('为了验证什么条件下会走这段代码');
console.log('为了验证什么条件下会走这段代码');
if (res.data.errno !== 200) {
Toast.info(res.data.msg, 2);
return;
......
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