|
@@ -8,6 +8,15 @@ var Repayment = function(options) { |
|
@@ -8,6 +8,15 @@ var Repayment = function(options) { |
8
|
onDeselectAll: $.noop,
|
8
|
onDeselectAll: $.noop,
|
9
|
|
9
|
|
10
|
/**
|
10
|
/**
|
|
|
11
|
+ * 返回可选择数目
|
|
|
12
|
+ *
|
|
|
13
|
+ * @returns {number}
|
|
|
14
|
+ */
|
|
|
15
|
+ onGetSelectableCount: function() {
|
|
|
16
|
+ return 0;
|
|
|
17
|
+ },
|
|
|
18
|
+
|
|
|
19
|
+ /**
|
11
|
* 获取选择
|
20
|
* 获取选择
|
12
|
*
|
21
|
*
|
13
|
* @returns {Array}
|
22
|
* @returns {Array}
|
|
@@ -116,11 +125,17 @@ Repayment.prototype.getSelection = function() { |
|
@@ -116,11 +125,17 @@ Repayment.prototype.getSelection = function() { |
116
|
return this.settings.onGetSelection();
|
125
|
return this.settings.onGetSelection();
|
117
|
};
|
126
|
};
|
118
|
|
127
|
|
|
|
128
|
+/**
|
|
|
129
|
+ * 更新组件并计算金额
|
|
|
130
|
+ */
|
119
|
Repayment.prototype.update = function() {
|
131
|
Repayment.prototype.update = function() {
|
120
|
var values = this.getSelection();
|
132
|
var values = this.getSelection();
|
121
|
var $repaymentBottom = $('.repayment-bottom');
|
133
|
var $repaymentBottom = $('.repayment-bottom');
|
122
|
var self = this;
|
134
|
var self = this;
|
123
|
|
135
|
|
|
|
136
|
+ // 是否选择全部
|
|
|
137
|
+ var totalCheck = this.settings.onGetSelectableCount() === values.length;
|
|
|
138
|
+
|
124
|
this.total = 0;
|
139
|
this.total = 0;
|
125
|
this.fee = 0;
|
140
|
this.fee = 0;
|
126
|
|
141
|
|
|
@@ -138,6 +153,8 @@ Repayment.prototype.update = function() { |
|
@@ -138,6 +153,8 @@ Repayment.prototype.update = function() { |
138
|
$repaymentBottom.slideDown();
|
153
|
$repaymentBottom.slideDown();
|
139
|
}
|
154
|
}
|
140
|
|
155
|
|
|
|
156
|
+ $('#repayment-total').prop('checked', totalCheck).data('checked', totalCheck);
|
|
|
157
|
+
|
141
|
this.setTotal(this.total);
|
158
|
this.setTotal(this.total);
|
142
|
this.setFee(this.fee);
|
159
|
this.setFee(this.fee);
|
143
|
|
160
|
|