Authored by Aiden Xu

Merge remote-tracking branch 'origin/feature/installment' into feature/installment

... ... @@ -196,17 +196,17 @@ const getStauts = (uid) => {
method: 'user.instalment.getStatus',
uid: uid
}).then((result) => {
// result = {
// alg: 'SALT_MD5',
// code: 200,
// data: {
// status: '2',
// isShow: '1',
// currCreditLimit: '3125.20'
// },
// md5: '6d729d4b35f10fc73531210bd7ecff91',
// message: 'success'
// };
result = {
alg: 'SALT_MD5',
code: 200,
data: {
status: '2',
isShow: '1',
currCreditLimit: '3125.20'
},
md5: '6d729d4b35f10fc73531210bd7ecff91',
message: 'success'
};
if (result && result.code === 200) {
return result.data.status;
} else {
... ... @@ -281,47 +281,47 @@ const getQueryAmtList = (params) => {
}, params), {
cache: true
}).then((result) => {
// result = {
// alg: 'SALT_MD5',
// code: 200,
// data: {
// amtList: [
// {
// billNo: 'x00001',
// terms: 3,
// currTerm: 1,
// unExpireDays: -3,
// billInfo: '三叶草运动休闲鞋',
// currAmt: '845.00',
// currNoFeeAmt: '840.00',
// currFee: '5.00'
// }, {
// billNo: 'x00002',
// terms: 3,
// currTerm: 2,
// unExpireDays: 10,
// billInfo: '三叶草运动休闲鞋',
// currAmt: '840.00',
// currNoFeeAmt: '840.00',
// currFee: '0.00'
// }, {
// billNo: 'x00003',
// terms: 3,
// currTerm: 1,
// unExpireDays: -3,
// billInfo: '三叶草运动休闲鞋',
// currAmt: '845.00',
// currNoFeeAmt: '840.00',
// currFee: '5.00'
// }
// ],
// pageNo: 1,
// pageTotal: 1,
// total: 2
// },
// md5: 'c1d725306fb09dcbf504776d276521cb',
// message: 'ok'
// };
result = {
alg: 'SALT_MD5',
code: 200,
data: {
amtList: [
{
billNo: 'x00001',
terms: 3,
currTerm: 1,
unExpireDays: -3,
billInfo: '三叶草运动休闲鞋',
currAmt: '845.00',
currNoFeeAmt: '840.00',
currFee: '0.00'
}, {
billNo: 'x00002',
terms: 3,
currTerm: 2,
unExpireDays: 10,
billInfo: '三叶草运动休闲鞋',
currAmt: '840.00',
currNoFeeAmt: '840.00',
currFee: '5.00'
}, {
billNo: 'x00003',
terms: 3,
currTerm: 1,
unExpireDays: -3,
billInfo: '三叶草运动休闲鞋',
currAmt: '845.00',
currNoFeeAmt: '840.00',
currFee: '0.00'
}
],
pageNo: 1,
pageTotal: 1,
total: 2
},
md5: 'c1d725306fb09dcbf504776d276521cb',
message: 'ok'
};
if (result && result.code === 200) {
return _processAmtList(result.data.amtList, params.queryDays);
} else {
... ...
... ... @@ -9,7 +9,7 @@
{{#data}}
<ul class="repay-list">
{{#each repaymentList}}
<li data-currfee="{{currFee}}" data-curramt="{{currAmt}}" data-billno="{{billNo}}" data-termNo={{currTerm}}>
<li data-currfee="{{currFee}}" data-currNoFeeAmt="{{currNoFeeAmt}}" data-curramt="{{currAmt}}" data-billno="{{billNo}}" data-termNo={{currTerm}}>
<input id="list-{{billNo}}" type="checkbox" class="installment-check-btn" {{#if isChecked}}checked{{/if}}/>
<label for="list-{{billNo}}">
<div class="cont">
... ...
... ... @@ -15,7 +15,7 @@
<input id="repayment-total" type="checkbox" class="installment-check-btn" {{#if isAllChecked}}checked{{/if}}/>
<label for="repayment-total">
<p class="repay-price">待支付:<span>¥<span class="curr-amt">{{round currAmtCount}}</span></span></p>
{{#if isCurrFee}}<p class="serve-price">含服务费¥<span class="curr-fee">{{round currFeeCount}}</span></p>{{/if}}
<p class="serve-price" {{#if isCurrFee}}style="display:block;"{{/if}}>含服务费¥<span class="curr-fee">{{round currFeeCount}}</span></p>
</label>
<a href="" class="repayment-btn">立即还款</a>
</div>
... ...
... ... @@ -8,7 +8,8 @@ var $ = require('yoho-jquery'),
tip = require('../plugin/tip');
var $currAmt = $('.repayment-bottom').find('.curr-amt'),
$currFee = $('.repayment-bottom').find('.curr-fee');
$currFee = $('.repayment-bottom').find('.curr-fee'),
$servePrice = $('.serve-price');
require('./overdue-notice');
... ... @@ -72,13 +73,19 @@ $('.repay-list label').on('click', function() {
}
}
if (parseFloat($currFee.html()) > 0) {
$servePrice.show();
} else {
$servePrice.hide();
}
setTimeout(function() {
count = $('.repay-list input:checked').length;
$('#repayment-total').prop('checked', count === $('.repay-list li').length);
}, 0);
});
// 全选||全不选
//全选||全不选
$('.repayment-bottom label').on('click', function() {
var totalAmt = 0;
var totalFee = 0;
... ... @@ -87,6 +94,7 @@ $('.repayment-bottom label').on('click', function() {
$('.repay-list input').prop('checked', false);
$currAmt.html('0.00');
$currFee.html('0.00');
$servePrice.hide();
} else {
$('.repay-list input').prop('checked', true);
$('.repay-list li').each(function() {
... ... @@ -96,6 +104,12 @@ $('.repayment-bottom label').on('click', function() {
$currAmt.html(totalAmt.toFixed(2));
$currFee.html(totalFee.toFixed(2));
if (parseFloat($currFee.html()) > 0) {
$servePrice.show();
} else {
$servePrice.hide();
}
}
});
... ... @@ -118,6 +132,35 @@ $('.repayment-btn').on('click', function() {
encodeURIComponent(JSON.stringify(list)) + ',"amount":' + (+$currAmt.html()) + '}}');
});
// const repayment = new Repayment({
// onGetSelection: function() {
// const ret = [];
// $(`${CHECKBOX_SELECTOR}:checked`).each(function(key, item) {
// const li = $(item).parents('li');
// const data = {
// index: key,
// orderCode: li.attr('data-billno'),
// termNo: li.attr('data-termNo'),
// amount: parseFloat(li.attr('data-currNoFeeAmt')),
// fee: parseFloat(li.attr('data-currfee')) + 0
// };
// ret.push(data);
// });
// return ret;
// },
// onDeselectAll: function() {
// $(`${CHECKBOX_SELECTOR}:checked`).prop('checked', false);
// return [];
// },
// onSelectAll: function() {
// $(`${CHECKBOX_SELECTOR}:not(:checked)`).prop('checked', true);
// return this.getSelection();
// }
// });
// 跳转到还款详情
window.jumpDetail = function(id) {
... ...
... ... @@ -28,10 +28,12 @@ var Repayment = function(options) {
var params = {
action: 'go.instalmentRepayment',
list: self.getSelection()
list: self.getSelection(),
amount: this.total
};
$(this).attr('href', path + '?openby:yohobuy=' + encodeURIComponent(JSON.stringify(params)));
return false;
});
$('#repayment-total').click(function() {
... ... @@ -113,6 +115,12 @@ Repayment.prototype.update = function() {
this.setTotal(this.total);
this.setFee(this.fee);
if (this.fee > 0) {
$('.serve-price').show();
} else {
$('.serve-price').hide();
}
};
module.exports = Repayment;
... ...
... ... @@ -349,6 +349,7 @@
color: #b0b0b0;
line-height: 40px;
font-size: 26px;
display: none;
}
}
... ...