|
@@ -2,6 +2,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin |
|
@@ -2,6 +2,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin |
2
|
|
2
|
|
3
|
var Controller = {
|
3
|
var Controller = {
|
4
|
index: function () {
|
4
|
index: function () {
|
|
|
5
|
+ //定义全局变量
|
|
|
6
|
+ var order_id = '';
|
|
|
7
|
+ var order_status = 1;
|
5
|
//人民币转换红包券
|
8
|
//人民币转换红包券
|
6
|
$('.total').bind('input propertychange', function() {
|
9
|
$('.total').bind('input propertychange', function() {
|
7
|
var total = $(this).val();
|
10
|
var total = $(this).val();
|
|
@@ -42,6 +45,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin |
|
@@ -42,6 +45,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin |
42
|
data:{'admin_id':admin_id,'total':total},
|
45
|
data:{'admin_id':admin_id,'total':total},
|
43
|
success:function(res){
|
46
|
success:function(res){
|
44
|
if(res.code == 1){
|
47
|
if(res.code == 1){
|
|
|
48
|
+ order_id = res.data.order_id;
|
45
|
$('.qrcode').show().find('img').first().attr('src',window.location.protocol+"//"+window.location.host+"/admin/pay_view/pay/order_id/"+res.data.order_id);
|
49
|
$('.qrcode').show().find('img').first().attr('src',window.location.protocol+"//"+window.location.host+"/admin/pay_view/pay/order_id/"+res.data.order_id);
|
46
|
}else{
|
50
|
}else{
|
47
|
top.window.Layer.open({
|
51
|
top.window.Layer.open({
|
|
@@ -58,6 +62,35 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin |
|
@@ -58,6 +62,35 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin |
58
|
}
|
62
|
}
|
59
|
})
|
63
|
})
|
60
|
});
|
64
|
});
|
|
|
65
|
+ setInterval(function(){order_pay()},3000);
|
|
|
66
|
+ function order_pay() {
|
|
|
67
|
+ console.log(order_id);console.log(order_status);
|
|
|
68
|
+ if(order_id != '' && order_status != 2){
|
|
|
69
|
+ $.ajax({
|
|
|
70
|
+ url:"pay_view/order_pay",
|
|
|
71
|
+ type:"POST",
|
|
|
72
|
+ data:{'order_id':order_id},
|
|
|
73
|
+ success:function(res){
|
|
|
74
|
+ console.log(res);
|
|
|
75
|
+ if(res.code == 1){
|
|
|
76
|
+ order_id = '';
|
|
|
77
|
+ order_status = 2;
|
|
|
78
|
+ top.window.Layer.open({
|
|
|
79
|
+ title:'温馨提示',
|
|
|
80
|
+ content:'支付成功',
|
|
|
81
|
+ url:'http://www.baidu.com',
|
|
|
82
|
+ });
|
|
|
83
|
+ }
|
|
|
84
|
+ },
|
|
|
85
|
+ error:function(res){
|
|
|
86
|
+ top.window.Layer.open({
|
|
|
87
|
+ title:'温馨提示',
|
|
|
88
|
+ content:'与服务器连接失败'
|
|
|
89
|
+ });
|
|
|
90
|
+ }
|
|
|
91
|
+ })
|
|
|
92
|
+ }
|
|
|
93
|
+ }
|
61
|
|
94
|
|
62
|
Controller.api.bindevent();
|
95
|
Controller.api.bindevent();
|
63
|
},
|
96
|
},
|