pay.js
2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/**
* 支付页面
*/
//切换选项卡
var $ = require('yoho.jquery'),
$choseTag = $('.mode div'),
$mode = $('.mode'),
$showPayImg = $('#show-pay-img'),
$btnty = $('#btnby'),
$lightBox = $('.light-box'),
$choosePay = $('#choosePay').val(),
$chooseMoid = $('.mode div[id="' + $choosePay + '"]').parent().data('value'),
$showValue = $choosePay ? $chooseMoid : $('.mode').eq(0).data('value'),
$payUrl = $('#payUrl').val(),
$modeData,
activeTab,
showDiv,
imgAlt,
imgSrc,
orderCode;
$.jqtab = function(tabtit, tabcon) {
$(tabtit + ' li').click(function() {
activeTab = $(this).find('a').attr('tab');
$(tabtit + ' li').removeClass('thistab');
$(this).addClass('thistab');
$(tabcon).hide();
$('#' + activeTab).fadeIn();
return false;
});
};
$.jqtab('#tabs', '.tab-con');
//选项卡点击
function choosed() {
if ($choosePay) {
$('.mode div[id="' + $choosePay + '"]').addClass('choosed-tag').parent().addClass('choose-type');
} else {
$mode.eq(0).addClass('choose-type').show();
$mode.eq(0).find('div').addClass('choosed-tag');
}
$btnty.attr('value', '前往' + $('#' + $chooseMoid).attr('alt'));
$showPayImg.attr('src', $('#' + $chooseMoid).attr('src'));
}
choosed();
$mode.click(function() {
$modeData = $(this).data();
showDiv = $modeData.id;
$showValue = $modeData.value;
imgAlt = $('#' + $showValue).attr('alt');
imgSrc = $('#' + $showValue).attr('src');
$mode.removeClass('choose-type');
$(this).addClass('choose-type');
$choseTag.removeClass('choosed-tag');
$('#' + showDiv).addClass('choosed-tag');
$btnty.attr('value', '前往' + imgAlt);
$showPayImg.attr('src', imgSrc);
return false;
});
$('.close').click(function() {
$lightBox.hide();
});
$('.change').click(function() {
$lightBox.hide();
});
//支付方式选择按钮
function getData(payment, orderCode) {
$.ajax({
type: 'get',
url: '/common/addpaymentinterval',
dataType: 'json',
data: {
orderCode: orderCode,
payment: payment
}
});
}
$('#btnby').click(function() {
var payment = $('.choose-type').attr('data-id');
orderCode = $('.order-num').text();
getData(payment, orderCode);
window.open($payUrl + '?order_code=' + orderCode + '&payment_type=' + $showValue);
$lightBox.show();
});