Commit 63a5d142 by zhanghaozhe

定金支付页

parent 32916ae4
......@@ -121,7 +121,7 @@ class Order extends Component {
}).then(res => {
const {data} = res
if(data.errno == 200){
this.props.history.replace({pathname: '/deposit-pay-order',search: `?oid=${data.data['order_id']}`})
}else {
Toast.info(data.msg)
}
......
......@@ -44,31 +44,6 @@ class PayOrder extends Component {
}
}
// 支付成功后,判断并重定向
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 if (parseInt(type, 10) === 4) {
courseId && window.localStorage.setItem('payCourse', courseId)
const courseId = window.localStorage.getItem('payCourse')
courseId && history.push(`/detail?id=${courseId}`, {oid})
} else {
history.push('/purchased')
}
} else {
Toast.info('支付异常', 2)
}
}
}
onChange = (value) => {
this.setState({
payType: value,
......@@ -80,16 +55,6 @@ class PayOrder extends Component {
})
}
}
checkStaging = (item) => {
// console.log(item);
this.setState({
huabei: false,
stageNumber: item.value,
singleMoney: item.everyTotal,
periodNumber: item.stage,
checkPeriod: true,
})
}
print = (...e) => {
console.log(e)
}
......@@ -101,9 +66,6 @@ class PayOrder extends Component {
} else if (payType === 1) {
this.weixinPay(orderId)
}
// else { // 花呗分期暂时不做
// this.huabeiPay(orderId)
// }
}
// 微信支付
weixinPay = (orderId) => {
......@@ -197,16 +159,7 @@ class PayOrder extends Component {
if (res.data.errno === 401) {
clearInterval(_this.intervalPayStatus)
_this.intervalPayStatus = null
// 获取课程类型
http.get(`${API['base-api']}/m/app_order/detail/${getParam('oid')}`).then(res => {
if (Number(res.data.data.course_type) === 2) {
_this.props.history.replace(`/togroup?id=${getParam('oid')}`)
} else {
// 跳转到已购课程 /purchased 不需要传递任何参数
_this.props.history.replace(`/purchased`)
}
})
window.location.href = '/expand/callback?order_id=' + getParam('oid')
}
})
}, 1000)
......@@ -238,6 +191,7 @@ class PayOrder extends Component {
// 支付宝支付
alipayPay = (orderId) => {
http.get(`${API['base-api']}/pay/alipay/wap_charge_new/oid/${orderId}`).then((res) => {
console.log(JSON.stringify(res.data.data))
if (res.data.errno === 0) {
this.payCallback()
window.location = res.data.data.url
......@@ -248,6 +202,12 @@ class PayOrder extends Component {
}
componentDidMount() {
if(getParam('weixinpay')){
this.payCallback()
}
http.post(`${API["base-api"]}/m/deposit/detail`, {
order_id: this.state.orderId
}).then(res => {
......@@ -261,67 +221,7 @@ class PayOrder extends Component {
Toast.info(data.msg)
}
})
/*this.redirectAfterPay()
let data = {}
if(this.props.location.state && this.props.location.state.group){
data = {
order_id: this.state.orderId,
type: 2
}
} else {
data = {
order_id: this.state.orderId,
}
}
http.post(`${API['base-api']}/m/order/detail`,data).then((res) => {
if (res.data.errno !== 200) {
Toast.info(res.data.msg, 2);
return;
}
const {course, pay_amount} = res.data.data;
const fenqiList = [];
[1, 2, 3].map((item) => {
let obj = {};
obj.value = item;
if (item === 1) {
obj.stage = 3; //期数
obj.moneyRate = '2.30%'; // 分期费率展示
obj.rate = 0.023; // 分期费率计算
obj.periodic = (pay_amount / 3).toFixed(2); // 每期本金
} else if (item === 2) {
obj.stage = 6; //期数
obj.moneyRate = '4.50%'; // 分期费率展示
obj.rate = 0.045; // 分期费率计算
obj.periodic = (pay_amount / 6).toFixed(2); // 每期本金
} else {
obj.stage = 12; //期数
obj.moneyRate = '7.50%'; // 分期费率展示
obj.rate = 0.075; // 分期费率计算
obj.periodic = (pay_amount / 9).toFixed(2); // 每期本金
}
obj.serviceFee = ((pay_amount * obj.rate) / obj.stage).toFixed(2); // 每期的手续费 = 总金额 * 费率 / 期数
obj.everyTotal = (parseFloat(obj.periodic) + parseFloat(obj.serviceFee)).toFixed(2);// 每期总费用 = 每期本金 + 每期手续费
fenqiList.push(obj);
});
// console.log(fenqiList);
// { value: 'zhifubao', qishu: '3', lilv: '2.30%', everyMoney: 300, feiyong: 2.3 },
// { value: 'weixin', qishu: '6', lilv: '4.50%', everyMoney: 150, feiyong: 4.5 },
// { value: 'huabei', qishu: '9', lilv: '7.50%', everyMoney: 100, feiyong: 7.5 },
this.setState({
pay_amount,
categoryList: course,
fenqiList,
});
});
if (getParam('is_class') === 1 || getParam('weixinpay')) {
this.payCallback()
}
if (is_weixin()) {
this.setState({
payType: 1
})
this.isweixinPay()
}*/
}
changeAgreement = () => {
......
......@@ -253,7 +253,7 @@ class BtnStatus extends Component {
} else {
if(type == 1){
this.props.history.push(
'/course/smallOrder',
'/deposit-order',
{
id: getParam('id'),
isexpand: 1,
......
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