Commit a35f1495 by wangshuo

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

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