repayment-list.page.js
1.21 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
/**
* 分期还款
* @author: wsl<shuiling.wang@yoho.cn>
* @date: 2016/08/04
*/
var $ = require('yoho-jquery');
var $notice = $('.installment-overdue-notice');
$('.repay-list .notice').on('click', function() {
$notice.show();
return false;
});
$('.think-ok, .mask-bg').on('click', function() {
$notice.hide();
});
$('.repay-list .cont').on('click', function() {
var $currAmt = $('.repayment-bottom').find('.curr-amt');
var $currFee = $('.repayment-bottom').find('.curr-fee');
var $input = $(this).parent().prev();
var currAmt = +$currAmt.html();
var currFee = +$currFee.html();
var amt = +$(this).parents('li').attr('data-curramt');
var fee = +$(this).parents('li').attr('data-currfee');
var count = 1;
if ($input.is(':checked')) {
$currAmt.html(currAmt - amt);
$currFee.html(currFee - fee);
} else {
$currAmt.html(amt + currAmt);
$currFee.html(fee + currFee);
}
$('.repay-list input').each(function() {
if ($(this).is(':checked')) {
count++;
}
});
if (count === $('.repay-list li').length) {
$('#repayment-total').click();
} else {
$('#repayment-total').click();
}
});