...
|
...
|
@@ -125,6 +125,17 @@ Repayment.prototype.getSelection = function() { |
|
|
return this.settings.onGetSelection();
|
|
|
};
|
|
|
|
|
|
Repayment.prototype._updateUI = function() {
|
|
|
this.setTotal(this.total);
|
|
|
this.setFee(this.fee);
|
|
|
|
|
|
if (this.fee > 0) {
|
|
|
$('.serve-price').show();
|
|
|
} else {
|
|
|
$('.serve-price').hide();
|
|
|
}
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 更新组件并计算金额
|
|
|
*/
|
...
|
...
|
@@ -132,6 +143,7 @@ Repayment.prototype.update = function() { |
|
|
var values = this.getSelection();
|
|
|
var $repaymentBottom = $('.repayment-bottom');
|
|
|
var self = this;
|
|
|
var total = [], fee = [];
|
|
|
|
|
|
// 是否选择全部
|
|
|
var totalCheck = this.settings.onGetSelectableCount() === values.length;
|
...
|
...
|
@@ -140,10 +152,29 @@ Repayment.prototype.update = function() { |
|
|
this.fee = 0;
|
|
|
|
|
|
if (values && values.length) {
|
|
|
|
|
|
values.forEach(function(value) {
|
|
|
// 计算还款总额和费用
|
|
|
self.total += value.amount + value.fee;
|
|
|
self.fee += value.fee;
|
|
|
// self.total += value.amount + value.fee;
|
|
|
// self.fee += value.fee;
|
|
|
|
|
|
total.push(value.amount);
|
|
|
total.push(value.fee);
|
|
|
fee.push(value.fee);
|
|
|
});
|
|
|
|
|
|
$.get('/home/installment/total-amount.json?prices=' + total.join(',')).then(function(result) {
|
|
|
if (result.code === 200) {
|
|
|
self.total = result.data;
|
|
|
self._updateUI();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$.get('/home/installment/total-amount.json?prices=' + fee.join(',')).then(function(result) {
|
|
|
if (result.code === 200) {
|
|
|
self.fee = result.data;
|
|
|
self._updateUI();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
@@ -155,14 +186,7 @@ Repayment.prototype.update = function() { |
|
|
|
|
|
$('#repayment-total').prop('checked', totalCheck).data('checked', totalCheck);
|
|
|
|
|
|
this.setTotal(this.total);
|
|
|
this.setFee(this.fee);
|
|
|
|
|
|
if (this.fee > 0) {
|
|
|
$('.serve-price').show();
|
|
|
} else {
|
|
|
$('.serve-price').hide();
|
|
|
}
|
|
|
this._updateUI();
|
|
|
};
|
|
|
|
|
|
// 跳转到还款详情
|
...
|
...
|
|