Commit 22d27f71 by wangshuo

单集购买

parent 6c926cda
...@@ -80,25 +80,7 @@ class Single extends Component { ...@@ -80,25 +80,7 @@ class Single extends Component {
} }
}) })
} }
onBridgeReady = (data) => {
WeixinJSBridge.invoke(
'getBrandWCPayRequest', {
"appId": data.appId, //公众号名称,由商户传入
"timeStamp": data.timeStamp, //时间戳,自1970年以来的秒数
"nonceStr": data.nonceStr, //随机串
"package": data.package,
"signType": data.signType, //微信签名方式:
"paySign": data.paySign //微信签名
},
function (res) {
if (res.err_msg == "get_brand_wcpay_request:ok") {
this.payCallback()
} else {
alert('支付失败')
}
}
)
}
// 微信内部支付 // 微信内部支付
isweixinPay = () => { isweixinPay = () => {
let _this = this; let _this = this;
...@@ -130,6 +112,7 @@ class Single extends Component { ...@@ -130,6 +112,7 @@ class Single extends Component {
_this.intervalPayStatus = null; _this.intervalPayStatus = null;
// 获取课程类型 // 获取课程类型
http.get(`${API['base-api']}/class_order_status/${getParam('oid')}`).then((res) => { http.get(`${API['base-api']}/class_order_status/${getParam('oid')}`).then((res) => {
Toast.info(Number(res.data.data.errno));
if (Number(res.data.data.errno) === 200) { if (Number(res.data.data.errno) === 200) {
// 正常购买单集成功 // 正常购买单集成功
this.setState({ this.setState({
...@@ -186,42 +169,45 @@ class Single extends Component { ...@@ -186,42 +169,45 @@ class Single extends Component {
// 支付完成之后获取状态 // 支付完成之后获取状态
payCallback = () => { payCallback = () => {
const _this = this; const _this = this;
_this.intervalPayStatus = setInterval(function () { if(getParam('oid')) {
http.get(`${API['base-api']}/m/orderState/oid/${getParam('oid')}`).then(res => { _this.intervalPayStatus = setInterval(function () {
if (res.data.errno === 401) { http.get(`${API['base-api']}/m/orderState/oid/${getParam('oid')}`).then(res => {
clearInterval(_this.intervalPayStatus); if (res.data.errno === 401) {
_this.intervalPayStatus = null; clearInterval(_this.intervalPayStatus);
// 获取课程类型 _this.intervalPayStatus = null;
http.get(`${API['base-api']}/class_order_status/${getParam('oid')}`).then((res) => { // 获取课程类型
if (Number(res.data.data.errno) === 200) { http.get(`${API['base-api']}/class_order_status/${getParam('oid')}`).then((res) => {
// 正常购买单集成功 if (Number(res.data.data.errno) === 200) {
this.setState({ // 正常购买单集成功
status: 6 this.setState({
}) status: 6
} else if (Number(res.data.data.errno) === 201) { })
// 0元参团 } else if (Number(res.data.data.errno) === 201) {
this.setState({ // 0元参团
status: 4 this.setState({
}) status: 4
} else if (Number(res.data.data.errno) === 202) { })
// 0元购 } else if (Number(res.data.data.errno) === 202) {
this.setState({ // 0元购
status: 3 this.setState({
}) status: 3
} else if (Number(res.data.data.errno) === 203) { })
// 三天内特价 } else if (Number(res.data.data.errno) === 203) {
this.setState({ // 三天内特价
nowPrice: res.data.data.data.now_price, this.setState({
laterPrice: res.data.data.data.three_day_later_price, nowPrice: res.data.data.data.now_price,
status: 2 laterPrice: res.data.data.data.three_day_later_price,
}) status: 2
} else { })
Toast.info(res.data.data.msg, 2) } else {
} Toast.info(res.data.data.msg, 2)
}) }
} })
}) }
}, 1000) })
}, 1000)
}
} }
......
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