...
|
...
|
@@ -2,6 +2,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin |
|
|
|
|
|
var Controller = {
|
|
|
index: function () {
|
|
|
//定义全局变量
|
|
|
var order_id = '';
|
|
|
var order_status = 1;
|
|
|
//人民币转换红包券
|
|
|
$('.total').bind('input propertychange', function() {
|
|
|
var total = $(this).val();
|
...
|
...
|
@@ -42,6 +45,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin |
|
|
data:{'admin_id':admin_id,'total':total},
|
|
|
success:function(res){
|
|
|
if(res.code == 1){
|
|
|
order_id = res.data.order_id;
|
|
|
$('.qrcode').show().find('img').first().attr('src',window.location.protocol+"//"+window.location.host+"/admin/pay_view/pay/order_id/"+res.data.order_id);
|
|
|
}else{
|
|
|
top.window.Layer.open({
|
...
|
...
|
@@ -58,6 +62,35 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin |
|
|
}
|
|
|
})
|
|
|
});
|
|
|
setInterval(function(){order_pay()},3000);
|
|
|
function order_pay() {
|
|
|
console.log(order_id);console.log(order_status);
|
|
|
if(order_id != '' && order_status != 2){
|
|
|
$.ajax({
|
|
|
url:"pay_view/order_pay",
|
|
|
type:"POST",
|
|
|
data:{'order_id':order_id},
|
|
|
success:function(res){
|
|
|
console.log(res);
|
|
|
if(res.code == 1){
|
|
|
order_id = '';
|
|
|
order_status = 2;
|
|
|
top.window.Layer.open({
|
|
|
title:'温馨提示',
|
|
|
content:'支付成功',
|
|
|
url:'http://www.baidu.com',
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
error:function(res){
|
|
|
top.window.Layer.open({
|
|
|
title:'温馨提示',
|
|
|
content:'与服务器连接失败'
|
|
|
});
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
|
|
|
Controller.api.bindevent();
|
|
|
},
|
...
|
...
|
|