Commit 0019c1c5 by 陈超

T

parent 14eb39a1
...@@ -67,7 +67,8 @@ ...@@ -67,7 +67,8 @@
}, },
methods: { methods: {
onBuy: function(id, type) { onBuy: function(id, type) {
if(this.agree) { let that = this
if(that.agree) {
$.post( $.post(
U("course/PayVideo/checkPayOperat"), U("course/PayVideo/checkPayOperat"),
{ {
...@@ -78,11 +79,54 @@ ...@@ -78,11 +79,54 @@
money: "{$moner_data['oriPrice']}", money: "{$moner_data['oriPrice']}",
}, },
function(data) { function(data) {
console.log(data) if(data.status == 1) {
that.startWxPay()
} else {
ui.error(data.info)
}
}) })
} else { } else {
ui.error('请阅读并同意购买协议') ui.error('请阅读并同意购买协议')
} }
},
startWxPay: function() {
$.ajax({
url: "{:U('course/PayVideo/payLibrary')}",
data:{
check_type: '{$pay_video_type}',
mid: MID,
vid: id,
pay: "wxpay",
money: "{$moner_data['oriPrice']}",
},
async:false,
type:'post',
success: function(data){
console.log(data)
})
},
checkPayStatus: function(num) {
let that = this
$.ajax({
url: "{:U('course/PayVideo/getPayStatus')}",
data:{pay_pass_num: num},
type:'post',
success: function(res){
try{
res = JSON.parse(res);
if(res.status == 1){
ui.success('购买成功')
setTimeout(function(){
window.location.href = res.data
}, 1500)
} else {
setTimeout( () => { that.checkPayStatus(num) }, 1000 )
}
} catch (e){
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