Authored by 王水玲

有货分期

@@ -40,6 +40,27 @@ const _reviewStatus = (status) => { @@ -40,6 +40,27 @@ const _reviewStatus = (status) => {
40 } 40 }
41 }; 41 };
42 42
  43 +// 还款列表公共处理块
  44 +const _repaymentList = (req, res, next, title, params) => {
  45 + params = _.assign({
  46 + uid: req.user.uid || 1
  47 + }, params);
  48 +
  49 + installmentModel.getQueryAmtList(params).then((result) => {
  50 + res.render('installment/repayment-list', {
  51 + module: 'home',
  52 + page: 'repayment-list',
  53 + title: title,
  54 + data: result,
  55 + pageHeader: headerModel.setNav({
  56 + navTitle: title,
  57 + navBtn: false
  58 + })
  59 + });
  60 + }).catch(next);
  61 +};
  62 +
  63 +// 开通分期首页
43 const index = (req, res, next) => { 64 const index = (req, res, next) => {
44 let uid = req.user.uid || 3236556; 65 let uid = req.user.uid || 3236556;
45 66
@@ -52,10 +73,11 @@ const index = (req, res, next) => { @@ -52,10 +73,11 @@ const index = (req, res, next) => {
52 return installmentModel.getResources().then(data => { 73 return installmentModel.getResources().then(data => {
53 return { 74 return {
54 bannerTop: { 75 bannerTop: {
55 - data: [{  
56 - src: '//img10.static.yhbimg.com/yhb-img01/2016/08/03/11/0131193afdd030b09af40b93eeb1c33ae5.jpg?imageView2/2/w/640/h/240/q/70',  
57 - url: ''  
58 - }] 76 + // data: [{
  77 + // src: '', //eslint-disable-line
  78 + // url: ''
  79 + // }]
  80 + data: data
59 }, 81 },
60 notOpen: true, 82 notOpen: true,
61 installmentOnly: { 83 installmentOnly: {
@@ -65,7 +87,7 @@ const index = (req, res, next) => { @@ -65,7 +87,7 @@ const index = (req, res, next) => {
65 }; 87 };
66 }); 88 });
67 } else if (openStatus === 2) { 89 } else if (openStatus === 2) {
68 - return Promise.all([installmentModel.getQueryCreditInfo(uid), installmentModel.getQueryAmtInfo(uid)]).then((data) => { 90 + return Promise.all([installmentModel.getQueryCreditInfo(uid), installmentModel.getQueryAmtInfo(uid)]).then((data) => { //eslint-disable-line
69 let params = _.assign({ 91 let params = _.assign({
70 isOverdue: false, 92 isOverdue: false,
71 installmentOnly: { 93 installmentOnly: {
@@ -74,13 +96,11 @@ const index = (req, res, next) => { @@ -74,13 +96,11 @@ const index = (req, res, next) => {
74 } 96 }
75 }, data[0], data[1]); 97 }, data[0], data[1]);
76 98
77 - console.log(data[0]);  
78 -  
79 // status: 1 正常 2 逾期 3 不可用 4 未开通 99 // status: 1 正常 2 逾期 3 不可用 4 未开通
80 - if (data[0].status === 2) { 100 + if (data[0].status === '2') {
81 params.replayStatus = '逾期'; 101 params.replayStatus = '逾期';
82 params.isOverdue = true; 102 params.isOverdue = true;
83 - } else if (data[0].status === 3) { 103 + } else if (data[0].status === '3') {
84 params.replayStatus = '不可用'; 104 params.replayStatus = '不可用';
85 } 105 }
86 106
@@ -107,6 +127,7 @@ const index = (req, res, next) => { @@ -107,6 +127,7 @@ const index = (req, res, next) => {
107 }).catch(next); 127 }).catch(next);
108 }; 128 };
109 129
  130 +// 开通结果显示
110 const review = (req, res, next) => { 131 const review = (req, res, next) => {
111 let openStatus = req.query.status || false; 132 let openStatus = req.query.status || false;
112 let uid = req.user.uid || 20000032; 133 let uid = req.user.uid || 20000032;
@@ -133,25 +154,79 @@ const review = (req, res, next) => { @@ -133,25 +154,79 @@ const review = (req, res, next) => {
133 154
134 // 逾期未还款列表 155 // 逾期未还款列表
135 const overdueList = (req, res, next) => { 156 const overdueList = (req, res, next) => {
136 - let params = {  
137 - uid: req.user.uid || 0,  
138 - queryDays: -1,  
139 - pageNo: '1'  
140 - };  
141 - installmentModel.getQueryAmtList(params).then((result) => {  
142 - res.render('installment/repayment-list', {  
143 - repaymentList: result,  
144 - pageHeader: headerModel.setNav({  
145 - navTitle: '逾期未还金额',  
146 - navBtn: false  
147 - })  
148 - }); 157 + _repaymentList(req, res, next, '逾期未还金额', {
  158 + queryDays: -1
149 }); 159 });
150 }; 160 };
151 161
152 // 7日待还款列表 162 // 7日待还款列表
153 const sevenDayList = (req, res, next) => { 163 const sevenDayList = (req, res, next) => {
154 - res.send('1'); 164 + _repaymentList(req, res, next, '近7日待还款', {
  165 + queryDays: 7
  166 + });
  167 +};
  168 +
  169 +// 本月待还款列表
  170 +const monthRepayList = (req, res, next) => {
  171 + _repaymentList(req, res, next, '本月待还金额', {
  172 + queryDays: 30
  173 + });
  174 +};
  175 +
  176 +// 待还总金额列表
  177 +const totalRepayList = (req, res, next) => {
  178 + _repaymentList(req, res, next, '待还总金额', {
  179 + queryDays: 0
  180 + });
  181 +};
  182 +
  183 +// 还款记录页面渲染
  184 +const repayRecordPage = (req, res) => {
  185 + res.render('installment/repay-record', {
  186 + module: 'home',
  187 + page: 'repay-record',
  188 + title: '还款记录',
  189 + pageHeader: headerModel.setNav({
  190 + navTitle: '还款记录',
  191 + navBtn: false
  192 + })
  193 + });
  194 +};
  195 +
  196 +// ajax 请求还款记录
  197 +const getRepayRecord = (req, res, next) => {
  198 + let params = _.assign({
  199 + uid: req.user.uid || 1,
  200 + pageNo: req.query.page || 1
  201 + });
  202 +
  203 + installmentModel.getQueryRePayList(params).then((result) => {
  204 + if (result) {
  205 + res.render('installment/record-template', {
  206 + layout: false,
  207 + recordData: result
  208 + });
  209 + } else {
  210 + res.json();
  211 + }
  212 + }).catch(next);
  213 +};
  214 +
  215 +// 账号管理
  216 +const account = (req, res, next) => {
  217 + let uid = req.user.uid || 0;
  218 +
  219 + installmentModel.getBankCards(uid).then((result) => {
  220 + res.render('installment/account', {
  221 + accountList: result,
  222 + title: '账号管理',
  223 + repaymentList: result,
  224 + pageHeader: headerModel.setNav({
  225 + navTitle: '账号管理',
  226 + navBtn: false
  227 + })
  228 + });
  229 + }).catch(next);
155 }; 230 };
156 231
157 const startingService = (req, res) => { 232 const startingService = (req, res) => {
@@ -212,11 +287,16 @@ module.exports = { @@ -212,11 +287,16 @@ module.exports = {
212 index, 287 index,
213 review, 288 review,
214 overdueList, 289 overdueList,
215 - sevenDayList 290 + sevenDayList,
  291 + monthRepayList,
  292 + totalRepayList,
  293 + repayRecordPage,
  294 + getRepayRecord,
216 startingService, 295 startingService,
217 activateService, 296 activateService,
218 verifyCode, 297 verifyCode,
219 getBankInfo, 298 getBankInfo,
220 order, 299 order,
221 - orderDetail 300 + orderDetail,
  301 + account
222 }; 302 };
@@ -14,12 +14,140 @@ const logger = global.yoho.logger; @@ -14,12 +14,140 @@ const logger = global.yoho.logger;
14 14
15 // const camelCase = global.yoho.camelCase; 15 // const camelCase = global.yoho.camelCase;
16 16
  17 +// 处理还款列表数据
  18 +const _processAmtList = (list, queryDays) => {
  19 + let overduecount = 0;
  20 + let formartData = {
  21 + currAmtCount: 0,
  22 + currFeeCount: 0
  23 + };
  24 +
  25 + list = list || [];
  26 +
  27 + if (list.length > 0) {
  28 + _.forEach(list, (data, key) => {
  29 + // 第一条选中
  30 + if (key === 0) {
  31 + data.isChecked = true;
  32 + }
  33 +
  34 + // 组装分期的显示格式
  35 + if (data.terms === 1) {
  36 + data.stage = data.terms;
  37 + } else {
  38 + data.stage = data.currTerm + '/' + data.terms;
  39 + }
  40 +
  41 + // 判断是否逾期
  42 + if (data.unExpireDays < 0) {
  43 + data.isOverdue = true;
  44 + overduecount++;
  45 + }
  46 +
  47 + data.day = Math.abs(data.unExpireDays);
  48 + });
  49 +
  50 +
  51 + if (overduecount === 0) {
  52 + if (queryDays === 0) { // 待还总金额
  53 + list[0].isChecked = true;
  54 + formartData.currAmtCount = (+list[0].currAmt);
  55 + formartData.currFeeCount = (+list[0].currFee);
  56 +
  57 + if (list.length === 1) {
  58 + formartData.isAllChecked = true;
  59 + }
  60 + } else if (queryDays === 7 || queryDays === 30) { // 近7日待还金额和本月待还金额
  61 + _.forEach(list, (data) => {
  62 + data.isChecked = true;
  63 + formartData.currAmtCount += (+data.currAmt);
  64 + formartData.currFeeCount += (+data.currFee);
  65 + });
  66 +
  67 + formartData.isAllChecked = true;
  68 + }
  69 + } else { // 只要有逾期的记录,走这里
  70 + _.forEach(list, (data) => {
  71 + if (data.unExpireDays < 0) {
  72 + data.isChecked = true;
  73 + formartData.currAmtCount += (+data.currAmt);
  74 + formartData.currFeeCount += (+data.currFee);
  75 + }
  76 + });
  77 +
  78 + if (overduecount === list.length) {
  79 + formartData.isAllChecked = true;
  80 + }
  81 + }
  82 +
  83 + // 逾期未还款金额
  84 + if (queryDays === -1) {
  85 + formartData.isAllChecked = true;
  86 + }
  87 +
  88 + if (formartData.currFeeCount > 0) {
  89 + formartData.isCurrFee = true;
  90 + } else {
  91 + formartData.isCurrFee = false;
  92 + }
  93 +
  94 + return _.assign({
  95 + repaymentList: list
  96 + }, formartData);
  97 + } else {
  98 + return {
  99 + isNoResult: true
  100 + };
  101 + }
  102 +};
  103 +
  104 +// 处理还款记录数据
  105 +const _processRepayList = (list) => {
  106 + list = list || [];
  107 +
  108 + if (list.length > 0) {
  109 + _.forEach(list, (data) => {
  110 + // 组装分期的显示格式
  111 + if (data.terms === 1) {
  112 + data.stage = data.terms;
  113 + } else {
  114 + data.stage = data.termNo + '/' + data.terms;
  115 + }
  116 + });
  117 +
  118 + return list;
  119 + } else {
  120 + return '';
  121 + }
  122 +};
  123 +
  124 +// 银行卡号处理
  125 +const _processBankCards = (list) => {
  126 + list = list || [];
  127 +
  128 + _.forEach(list, (data) => {
  129 + let newCardNo = data.cardNo.split('');
  130 + let cardNo = newCardNo.length;
  131 +
  132 + data.cardNo = '';
  133 +
  134 + for (let i = 1; i < cardNo; i++) {
  135 + if (i < (cardNo - 4)) {
  136 + data.cardNo += '*';
  137 + } else {
  138 + data.cardNo += newCardNo[i - 1];
  139 + }
  140 + }
  141 + });
  142 +
  143 + return list;
  144 +};
  145 +
17 /** 146 /**
18 * 获取资源位数据 147 * 获取资源位数据
19 - * @param {[string]} page  
20 * @return {[array]} 148 * @return {[array]}
21 */ 149 */
22 -const getResources = (page, channel) => { 150 +const getResources = () => {
23 return serviceAPI.get('operations/api/v5/resource/get', { 151 return serviceAPI.get('operations/api/v5/resource/get', {
24 content_code: '0876085ff46bed27f1a1eb6ee8b68987' 152 content_code: '0876085ff46bed27f1a1eb6ee8b68987'
25 }, { 153 }, {
@@ -62,21 +190,21 @@ const getStauts = (uid) => { @@ -62,21 +190,21 @@ const getStauts = (uid) => {
62 // 获取用户可用额度信息 190 // 获取用户可用额度信息
63 const getQueryCreditInfo = (uid) => { 191 const getQueryCreditInfo = (uid) => {
64 return api.get('', { 192 return api.get('', {
65 - method: 'app.order.queryCreditInfo', 193 + method: 'user.instalment.queryCreditLimit',
66 uid: uid 194 uid: uid
67 }).then((result) => { 195 }).then((result) => {
68 result = { 196 result = {
69 alg: 'SALT_MD5', 197 alg: 'SALT_MD5',
70 code: 200, 198 code: 200,
71 data: { 199 data: {
72 - initCredit: '8000.00',  
73 - currCredit: '5000.00',  
74 - status: 2 200 + initCreditLimit: '5000',
  201 + currCreditLimit: '2000',
  202 + status: '2',
  203 + maxOverdueDay: '5'
75 }, 204 },
76 md5: 'c1d725306fb09dcbf504776d276521cb', 205 md5: 'c1d725306fb09dcbf504776d276521cb',
77 message: 'ok' 206 message: 'ok'
78 }; 207 };
79 - console.log('11');  
80 if (result && result.code === 200) { 208 if (result && result.code === 200) {
81 return result.data; 209 return result.data;
82 } else { 210 } else {
@@ -92,18 +220,20 @@ const getQueryAmtInfo = (uid) => { @@ -92,18 +220,20 @@ const getQueryAmtInfo = (uid) => {
92 method: 'app.order.queryAmtInfo', 220 method: 'app.order.queryAmtInfo',
93 uid: uid 221 uid: uid
94 }).then((result) => { 222 }).then((result) => {
95 - result = {  
96 - alg: 'SALT_MD5',  
97 - code: 200,  
98 - data: {  
99 - totalAmt: '2000.00',  
100 - monthAmt: '800.00',  
101 - _7daysAmt: '400.00',  
102 - overAmt: '400.00'  
103 - },  
104 - md5: 'c1d725306fb09dcbf504776d276521cb',  
105 - message: 'ok'  
106 - }; 223 + // result = {
  224 + // alg: 'SALT_MD5',
  225 + // code: 200,
  226 + // data: {
  227 + // totalAmt: '2000.00',
  228 + // monthAmt: '800.00',
  229 + // _7daysAmt: '400.00',
  230 + // overAmt: '400.00'
  231 + // },
  232 + // md5: 'c1d725306fb09dcbf504776d276521cb',
  233 + // message: 'ok'
  234 + // };
  235 +
  236 + console.log(result);
107 if (result && result.code === 200) { 237 if (result && result.code === 200) {
108 result.data.dayAmt = result.data._7daysAmt; 238 result.data.dayAmt = result.data._7daysAmt;
109 return result.data; 239 return result.data;
@@ -114,28 +244,6 @@ const getQueryAmtInfo = (uid) => { @@ -114,28 +244,6 @@ const getQueryAmtInfo = (uid) => {
114 }); 244 });
115 }; 245 };
116 246
117 -// 处理还款列表数据  
118 -const _processAmtList = (list) => {  
119 - let formatData = [];  
120 -  
121 - list = list || [];  
122 -  
123 - _.forEach(list, (data) => {  
124 - if (data.terms === 1) {  
125 - data.stage = data.terms;  
126 - } else {  
127 - data.stage = data.currTerm + '/' + data.terms;  
128 - }  
129 -  
130 - if (data.unExpireDays < 0) {  
131 - data.isOverdue = true;  
132 - }  
133 -  
134 - data.day = data.unExpireDays;  
135 - });  
136 -  
137 - return list;  
138 -};  
139 247
140 // 获取用户待还列表信息 queryDays -1:逾期待还;0:全部待还;7:七日待还;30:本月待还 248 // 获取用户待还列表信息 queryDays -1:逾期待还;0:全部待还;7:七日待还;30:本月待还
141 const getQueryAmtList = (params) => { 249 const getQueryAmtList = (params) => {
@@ -160,7 +268,7 @@ const getQueryAmtList = (params) => { @@ -160,7 +268,7 @@ const getQueryAmtList = (params) => {
160 currNoFeeAmt: '840.00', 268 currNoFeeAmt: '840.00',
161 currFee: '5.00' 269 currFee: '5.00'
162 }, { 270 }, {
163 - billNo: 'x00001', 271 + billNo: 'x00002',
164 terms: 3, 272 terms: 3,
165 currTerm: 2, 273 currTerm: 2,
166 unExpireDays: 10, 274 unExpireDays: 10,
@@ -168,6 +276,15 @@ const getQueryAmtList = (params) => { @@ -168,6 +276,15 @@ const getQueryAmtList = (params) => {
168 currAmt: '840.00', 276 currAmt: '840.00',
169 currNoFeeAmt: '840.00', 277 currNoFeeAmt: '840.00',
170 currFee: '0.00' 278 currFee: '0.00'
  279 + }, {
  280 + billNo: 'x00003',
  281 + terms: 3,
  282 + currTerm: 1,
  283 + unExpireDays: -3,
  284 + billInfo: '三叶草运动休闲鞋',
  285 + currAmt: '845.00',
  286 + currNoFeeAmt: '840.00',
  287 + currFee: '5.00'
171 } 288 }
172 ], 289 ],
173 pageNo: 1, 290 pageNo: 1,
@@ -178,7 +295,7 @@ const getQueryAmtList = (params) => { @@ -178,7 +295,7 @@ const getQueryAmtList = (params) => {
178 message: 'ok' 295 message: 'ok'
179 }; 296 };
180 if (result && result.code === 200) { 297 if (result && result.code === 200) {
181 - return _processAmtList(result.data.amtList); 298 + return _processAmtList(result.data.amtList, params.queryDays);
182 } else { 299 } else {
183 logger.error('get queryAmtList data return code is not 200'); 300 logger.error('get queryAmtList data return code is not 200');
184 return ''; 301 return '';
@@ -367,6 +484,95 @@ const getBankInfo = (cardNo) => { @@ -367,6 +484,95 @@ const getBankInfo = (cardNo) => {
367 }, cardNo); 484 }, cardNo);
368 }; 485 };
369 486
  487 +// 还款记录查询
  488 +const getQueryRePayList = (params) => {
  489 + return api.get('', _.assign({
  490 + method: 'app.order.queryRePayList',
  491 + pageSize: '10'
  492 + }, params), {
  493 + cache: true
  494 + }).then((result) => {
  495 + // result = {
  496 + // alg: "SALT_MD5",
  497 + // code: 200,
  498 + // data: {
  499 + // rePayList: [
  500 + // {
  501 + // billNo: "00001",
  502 + // terms: 3,
  503 + // termNo: 1,
  504 + // time: "2016.06.01",
  505 + // status: 1,
  506 + // amt: "200.00",
  507 + // billInfo: "三叶草运动休闲鞋"
  508 + // },
  509 + // {
  510 + // billNo: "00001",
  511 + // terms: 3,
  512 + // termNo: 1,
  513 + // time: "2016.06.01",
  514 + // status: 1,
  515 + // amt: "200.00",
  516 + // billInfo: "三叶草运动休闲鞋"
  517 + // },
  518 + // {
  519 + // billNo: "00001",
  520 + // terms: 3,
  521 + // termNo: 1,
  522 + // time: "2016.06.01",
  523 + // status: 1,
  524 + // amt: "200.00",
  525 + // billInfo: "三叶草运动休闲鞋"
  526 + // },
  527 + // ],
  528 + // pageNo: 1,
  529 + // pageTotal: 1,
  530 + // total: 3
  531 + // },
  532 + // md5: "c1d725306fb09dcbf504776d276521cb",
  533 + // message: "ok"
  534 + // };
  535 + if (result && result.code === 200) {
  536 + return _processRepayList(result.data.rePayList);
  537 + } else {
  538 + logger.error('get queryRePayList data return code is not 200');
  539 + return '';
  540 + }
  541 + });
  542 +};
  543 +
  544 +// 账号管理
  545 +const getBankCards = (uid) => {
  546 + return api.get('', {
  547 + method: 'user.instalment.getBankCards',
  548 + uid: uid
  549 + }, {
  550 + cache: true
  551 + }).then((result) => {
  552 + result = {
  553 + alg: 'SALT_MD5',
  554 + code: 200,
  555 + data: [
  556 + {
  557 + userName: '张三',
  558 + cardNo: '25202200000',
  559 + bankCode: 'ABC',
  560 + bankName: '农业银行',
  561 + mobile: '18021200000'
  562 + }
  563 + ],
  564 + md5: '6d729d4b35f10fc73531210bd7ecff91',
  565 + message: 'success'
  566 + };
  567 + if (result && result.code === 200) {
  568 + return _processBankCards(result.data);
  569 + } else {
  570 + logger.error('get getBankCards data return code is not 200');
  571 + return '';
  572 + }
  573 + });
  574 +};
  575 +
370 module.exports = { 576 module.exports = {
371 getStauts, 577 getStauts,
372 getQueryCreditInfo, 578 getQueryCreditInfo,
@@ -376,5 +582,7 @@ module.exports = { @@ -376,5 +582,7 @@ module.exports = {
376 activateService, 582 activateService,
377 getResources, 583 getResources,
378 getQueryAmtList, 584 getQueryAmtList,
379 - getBankInfo 585 + getBankInfo,
  586 + getQueryRePayList,
  587 + getBankCards
380 }; 588 };
@@ -19,6 +19,11 @@ router.get('/installment/starting-service', installment.startingService); // 分 @@ -19,6 +19,11 @@ router.get('/installment/starting-service', installment.startingService); // 分
19 router.get('/installment/starting-service/verify-code', installment.verifyCode); 19 router.get('/installment/starting-service/verify-code', installment.verifyCode);
20 router.get('/installment/overdue', installment.overdueList); // 逾期未还款列表 20 router.get('/installment/overdue', installment.overdueList); // 逾期未还款列表
21 router.get('/installment/7daylist', installment.sevenDayList); // 7日待还款列表 21 router.get('/installment/7daylist', installment.sevenDayList); // 7日待还款列表
  22 +router.get('/installment/monthRepayList', installment.monthRepayList); // 本月待还款列表
  23 +router.get('/installment/totalRepayList', installment.totalRepayList); // 待还总金额列表
  24 +router.get('/installment/repayRecord', installment.repayRecordPage); // 还款记录
  25 +router.get('/installment/getRepayRecord', installment.getRepayRecord); // ajax请求还款记录
  26 +router.get('/installment/account', installment.account); // 账户管理
22 router.get('/installment/bank-info', installment.getBankInfo); 27 router.get('/installment/bank-info', installment.getBankInfo);
23 router.post('/installment/activate-service', installment.activateService); 28 router.post('/installment/activate-service', installment.activateService);
24 router.get('/installment/order', installment.order); 29 router.get('/installment/order', installment.order);
  1 +<div class="account-page">
  2 + <ul class="account-list">
  3 + {{#accountList}}
  4 + <li>我的银行卡:<div class="list-right">{{cardNo}}</div></li>
  5 + {{/accountList}}
  6 + </ul>
  7 +</div>
@@ -26,6 +26,7 @@ @@ -26,6 +26,7 @@
26 {{> installment/installment-only}} 26 {{> installment/installment-only}}
27 {{/ installmentOnly}} 27 {{/ installmentOnly}}
28 {{else}} 28 {{else}}
  29 + {{log this}}
29 <div class="detail-tab"> 30 <div class="detail-tab">
30 <span class="on is-repay">待还款金额</span> 31 <span class="on is-repay">待还款金额</span>
31 <span class="is-usable">可用额度</span> 32 <span class="is-usable">可用额度</span>
@@ -35,27 +36,27 @@ @@ -35,27 +36,27 @@
35 <p class="detail-txt1">近7日代还款</p> 36 <p class="detail-txt1">近7日代还款</p>
36 <p class="detail-txt1">¥<span class="detail-txt2">{{round dayAmt}}</span></p> 37 <p class="detail-txt1">¥<span class="detail-txt2">{{round dayAmt}}</span></p>
37 {{#if isOverdue}} 38 {{#if isOverdue}}
38 - <p class="detail-txt3">您有¥{{round dayAmt}}已逾期,点击<a href="/home/installment/overdue">查看详情</a></p> 39 + <p class="detail-txt3">您有¥{{round overAmt}}已逾期,点击<a href="/home/installment/overdue">查看详情</a></p>
39 {{/if}} 40 {{/if}}
40 <a href="/home/installment/7daylist" class="see-btn">明细</a> 41 <a href="/home/installment/7daylist" class="see-btn">明细</a>
41 </div> 42 </div>
42 <ul class="group-list"> 43 <ul class="group-list">
43 - <li><a href="">本月待还金额:<div class="list-right"><span class="list-r-txt">¥{{monthAmt}}</span><span class="iconfont"> &#xe604;</span></div></a></li>  
44 - <li><a href="">待还总金额:<div class="list-right"><span class="list-r-txt">¥{{totalAmt}}</span><span class="iconfont"> &#xe604;</span></div></a></li>  
45 - <li><a href="">还款记录:<div class="list-right iconfont">&#xe604;</div></a></li> 44 + <li><a href="/home/installment/monthRepayList">本月待还金额:<div class="list-right"><span class="list-r-txt">¥{{monthAmt}}</span><span class="iconfont"> &#xe604;</span></div></a></li>
  45 + <li><a href="/home/installment/totalRepayList">待还总金额:<div class="list-right"><span class="list-r-txt">¥{{totalAmt}}</span><span class="iconfont"> &#xe604;</span></div></a></li>
  46 + <li><a href="/home/installment/repayRecord">还款记录:<div class="list-right iconfont">&#xe604;</div></a></li>
46 <li><a href="">分期订单:<div class="list-right iconfont">&#xe604;</div></a></li> 47 <li><a href="">分期订单:<div class="list-right iconfont">&#xe604;</div></a></li>
47 </ul> 48 </ul>
48 49
49 <ul class="group-list"> 50 <ul class="group-list">
50 - <li><a href="">账户管理:<span class="list-right">&#xe604;</span></a></li> 51 + <li><a href="/home/installment/account">账户管理:<span class="list-right iconfont">&#xe604;</span></a></li>
51 </ul> 52 </ul>
52 </div> 53 </div>
53 <div class="usable installment-cont"> 54 <div class="usable installment-cont">
54 <div class="usable-area detail-bg"> 55 <div class="usable-area detail-bg">
55 {{#replayStatus}}<div class="replay-status">{{.}}</div>{{/replayStatus}} 56 {{#replayStatus}}<div class="replay-status">{{.}}</div>{{/replayStatus}}
56 <p class="detail-txt1">可用额度</p> 57 <p class="detail-txt1">可用额度</p>
57 - <p class="detail-txt1">¥<span class="detail-txt2">{{round currCredit}}</span></p>  
58 - <p class="detail-txt1">总额度:¥{{round initCredit}}</p> 58 + <p class="detail-txt1">¥<span class="detail-txt2">{{round currCreditLimit}}</span></p>
  59 + <p class="detail-txt1">总额度:¥{{round initCreditLimit}}</p>
59 <a href="" class="terms">服务条款</a> 60 <a href="" class="terms">服务条款</a>
60 </div> 61 </div>
61 {{# installmentOnly}} 62 {{# installmentOnly}}
  1 +{{#recordData}}
  2 + <li>
  3 + <div class="repay-time">{{time}}</div>
  4 + <div class="record-cont">
  5 + <p>{{round amt}}</p>
  6 + <p>【全{{stage}}期】{{billInfo}}</p>
  7 + </div>
  8 + <div class="record-right">已还清</div>
  9 + </li>
  10 +{{/recordData}}
  1 +<div class="repayment-list-page">
  2 + <ul class="record-list"></ul>
  3 + <div class="no-result" style="display: none;">
  4 + <i class="result-icon"></i>
  5 + <p class="txt">暂无待还款记录</p>
  6 + <a href="/product/new" class="guang-btn">去逛逛</a>
  7 + </div>
  8 +</div>
1 <div class="repayment-list-page"> 1 <div class="repayment-list-page">
2 - <ul class="repay-list">  
3 - {{#each repaymentList}}  
4 - <li>  
5 - <span></span>  
6 - <div class="cont">  
7 - <p>¥{{round currNoFeeAmt}}</p>  
8 - <p>【全{{stage}}期】{{billInfo}}</p>  
9 - </div>  
10 - <div class="list-right">  
11 - {{#if isOverdue}}  
12 - <div class="color-r">逾期{{day}}<span class="iconfont">&#xe639;</span></div>  
13 - {{else}}  
14 - 剩余{{day}}  
15 - {{/if}}  
16 - <span class="iconfont">&#xe604;</span>  
17 - </div>  
18 - </li>  
19 - {{/each}}  
20 - </ul> 2 + {{#if isNoResult}}
  3 + <div class="no-result">
  4 + <i class="result-icon"></i>
  5 + <p class="txt">暂无待还款订单</p>
  6 + <a href="/product/new" class="guang-btn">去逛逛</a>
  7 + </div>
  8 + {{else}}
  9 + {{#data}}
  10 + <ul class="repay-list">
  11 + {{#each repaymentList}}
  12 + <li data-currfee="{{currFee}}" data-curramt="{{currAmt}}">
  13 + <input id="list-{{billNo}}" type="checkbox" class="installment-check-btn" {{#if isChecked}}checked{{/if}}/>
  14 + <label for="list-{{billNo}}">
  15 + <div class="cont">
  16 + <p>¥{{round currNoFeeAmt}}</p>
  17 + <p>【全{{stage}}期】{{billInfo}}</p>
  18 + </div>
  19 + </label>
  20 + <div class="list-right">
  21 + <a href="{{url}}">
  22 + {{#if isOverdue}}
  23 + <div class="color-r">逾期{{day}}<span class="iconfont notice">&#xe639;</span></div>
  24 + {{else}}
  25 + 剩余{{day}}
  26 + {{/if}}
  27 + <span class="iconfont">&#xe604;</span>
  28 + </a>
  29 + </div>
  30 + </li>
  31 + {{/each}}
  32 + </ul>
  33 + {{> installment/repayment-bottom}}
  34 + {{/data}}
  35 + {{/if}}
21 </div> 36 </div>
@@ -48,7 +48,7 @@ @@ -48,7 +48,7 @@
48 </div> 48 </div>
49 49
50 <div class="agreements"> 50 <div class="agreements">
51 - <input id="accept-agreements" name="agreements" type="checkbox"/> 51 + <input id="accept-agreements" name="agreements" type="checkbox" class="installment-check-btn" />
52 <label for="accept-agreements"> 52 <label for="accept-agreements">
53 <span>免费开通,详情见 <a href="#">《有货分期服务协议》&《第三方支付协议》</a></span> 53 <span>免费开通,详情见 <a href="#">《有货分期服务协议》&《第三方支付协议》</a></span>
54 </label> 54 </label>
  1 +<div class="installment-overdue-notice">
  2 + <div class="mask-bg"></div>
  3 + <div class="notice-area">
  4 + <div class="notice-cont">
  5 + <h2>逾期服务费信息</h2>
  6 + <p>如果您到期未还款:需要加收逾期利息费和延迟还款费</p>
  7 + <p>逾期利息费:待还本金 *利息率*延迟还款天数,利息率=0.025%/天</p>
  8 + <p>延迟还款费:逾期3天内还款免收延迟还款服务费,逾期4天,从第一天逾期开始算,500元之内,加收1元/天延迟还款服务费。每500元增加1元/天。</p>
  9 + </div>
  10 + <div class="think-ok">我知道了</div>
  11 + </div>
  12 +</div>
  13 +
  14 +<div class="repayment-bottom">
  15 + <input id="repayment-total" type="checkbox" class="installment-check-btn" {{#if isAllChecked}}checked{{/if}}/>
  16 + <label for="repayment-total">
  17 + <p class="repay-price">待支付:<span>¥<span class="curr-amt">{{round currAmtCount}}</span></span></p>
  18 + {{#if isCurrFee}}<p class="serve-price">含服务费¥<span class="curr-fee">{{round currFeeCount}}</span></p>{{/if}}
  19 + </label>
  20 + <input type="button" value="立即还款" class="repayment-btn">
  21 +</div>
@@ -17,9 +17,11 @@ module.exports = { @@ -17,9 +17,11 @@ module.exports = {
17 domains: { 17 domains: {
18 // api: 'http://devapi.yoho.cn:58078/', 18 // api: 'http://devapi.yoho.cn:58078/',
19 // service: 'http://devservice.yoho.cn:58077/' 19 // service: 'http://devservice.yoho.cn:58077/'
20 - api: 'http://api.yoho.cn/', 20 + api: 'http://172.16.6.235:8484',
  21 +
21 // service: 'http://service.yoho.cn/' 22 // service: 'http://service.yoho.cn/'
22 service: 'http://testservice.yoho.cn:28077' 23 service: 'http://testservice.yoho.cn:28077'
  24 +
23 // api: 'http://testapi.yoho.cn:28078/', 25 // api: 'http://testapi.yoho.cn:28078/',
24 }, 26 },
25 subDomains: { 27 subDomains: {
  1 +/**
  2 + * 还款记录
  3 + * @author: wsl<shuiling.wang@yoho.cn>
  4 + * @date: 2016/08/04
  5 + */
  6 +
  7 +var $ = require('yoho-jquery'),
  8 + tip = require('../plugin/tip'),
  9 + loading = require('../plugin/loading');
  10 +
  11 +var stopLoading = false,
  12 + winH = $(window).height(),
  13 + previousScrollTop = 0,
  14 + page = 0,
  15 + $recordList = $('.record-list');
  16 +
  17 +function getListData(pageData) {
  18 + if (stopLoading) {
  19 + return;
  20 + }
  21 + stopLoading = true;
  22 + pageData++;
  23 +
  24 + page = pageData;
  25 +
  26 + loading.showLoadingMask();
  27 + $.ajax({
  28 + type: 'GET',
  29 + url: '/home/installment/getRepayRecord',
  30 + data: {
  31 + page: pageData
  32 + },
  33 + dataType: 'html',
  34 + success: function(data) {
  35 + stopLoading = false;
  36 +
  37 + if (data === '') {
  38 + stopLoading = true;
  39 + if (pageData === 1) {
  40 + $('.no-result').show();
  41 + }
  42 + } else {
  43 + $('.no-result').hide();
  44 + $recordList.append(data);
  45 + }
  46 +
  47 + loading.hideLoadingMask();
  48 + },
  49 + error: function() {
  50 + tip.show('网络断开连接了~');
  51 + stopLoading = false;
  52 + loading.hideLoadingMask();
  53 + }
  54 + });
  55 +}
  56 +
  57 +function scrollHandler() {
  58 + var curScrollTop = $(window).scrollTop();
  59 +
  60 + // 当scroll到1/4$repayList高度后继续请求下一页数据
  61 + if (curScrollTop > previousScrollTop &&
  62 + (curScrollTop + winH >
  63 + $(document).height() - 0.25 * $recordList.height() - 50)) {
  64 + getListData(page);
  65 + }
  66 +
  67 + previousScrollTop = curScrollTop;
  68 +}
  69 +
  70 +$(window).scroll(function() {
  71 + window.requestAnimationFrame(scrollHandler);
  72 +});
  73 +
  74 +getListData(0);
  1 +/**
  2 + * 分期还款
  3 + * @author: wsl<shuiling.wang@yoho.cn>
  4 + * @date: 2016/08/04
  5 + */
  6 +
  7 +var $ = require('yoho-jquery');
  8 +
  9 +var $notice = $('.installment-overdue-notice');
  10 +
  11 +$('.repay-list .notice').on('click', function() {
  12 + $notice.show();
  13 +
  14 + return false;
  15 +});
  16 +
  17 +$('.think-ok, .mask-bg').on('click', function() {
  18 + $notice.hide();
  19 +});
  20 +
  21 +$('.repay-list .cont').on('click', function() {
  22 + var $currAmt = $('.repayment-bottom').find('.curr-amt');
  23 + var $currFee = $('.repayment-bottom').find('.curr-fee');
  24 + var $input = $(this).parent().prev();
  25 + var currAmt = +$currAmt.html();
  26 + var currFee = +$currFee.html();
  27 + var amt = +$(this).parents('li').attr('data-curramt');
  28 + var fee = +$(this).parents('li').attr('data-currfee');
  29 + var count = 1;
  30 +
  31 + if ($input.is(':checked')) {
  32 + $currAmt.html(currAmt - amt);
  33 + $currFee.html(currFee - fee);
  34 + } else {
  35 + $currAmt.html(amt + currAmt);
  36 + $currFee.html(fee + currFee);
  37 + }
  38 +
  39 + $('.repay-list input').each(function() {
  40 + if ($(this).is(':checked')) {
  41 + count++;
  42 + }
  43 + });
  44 +
  45 + if (count === $('.repay-list li').length) {
  46 + $('#repayment-total').click();
  47 + } else {
  48 + $('#repayment-total').click();
  49 + }
  50 +});
@@ -2,21 +2,277 @@ @@ -2,21 +2,277 @@
2 .repay-list li { 2 .repay-list li {
3 height: 120px; 3 height: 120px;
4 background: #fff; 4 background: #fff;
  5 + border-bottom: 1px solid #e0e0e0;
5 6
6 .cont { 7 .cont {
7 width: 370px; 8 width: 370px;
8 overflow: hidden; 9 overflow: hidden;
9 height: 120px; 10 height: 120px;
10 float: left; 11 float: left;
  12 + margin-top: 20px;
  13 +
  14 + p {
  15 + line-height: 40px;
  16 + font-size: 26px;
  17 + }
  18 +
  19 + p:first-child {
  20 + margin-left: 10px;
  21 + }
  22 +
  23 + p:last-child {
  24 + width: 100%;
  25 + height: 40px;
  26 + text-overflow: ellipsis;
  27 + white-space: nowrap;
  28 + overflow: hidden;
  29 + }
11 } 30 }
12 31
13 .list-right { 32 .list-right {
14 float: right; 33 float: right;
15 color: #b0b0b0; 34 color: #b0b0b0;
  35 + line-height: 120px;
  36 + margin-right: 30px;
  37 + font-size: 24px;
16 } 38 }
17 39
18 .color-r { 40 .color-r {
19 color: #d0021b; 41 color: #d0021b;
  42 + float: left;
  43 +
  44 + .iconfont {
  45 + color: #d0021b;
  46 + font-size: 24px;
  47 + }
  48 + }
  49 +
  50 + .iconfont {
  51 + color: #e0e0e0;
  52 + margin-left: 5px;
  53 + }
  54 +
  55 + label {
  56 + margin-left: 60px;
  57 + width: 390px;
  58 + height: 120px;
  59 + float: left;
  60 + }
  61 + }
  62 +
  63 + .record-list li {
  64 + height: 120px;
  65 + background: #fff;
  66 + border-bottom: 1px solid #e0e0e0;
  67 +
  68 + .repay-time {
  69 + width: 200px;
  70 + line-height: 120px;
  71 + float: left;
  72 + padding-left: 30px;
  73 + box-sizing: border-box;
  74 + }
  75 +
  76 + .record-cont {
  77 + width: 265px;
  78 + height: 120px;
  79 + float: left;
  80 + overflow: hidden;
  81 +
  82 + p {
  83 + line-height: 40px;
  84 + font-size: 26px;
  85 +
  86 + }
  87 +
  88 + p:first-child {
  89 + margin: 20px 0 0 10px;
  90 + }
  91 +
  92 + p:last-child {
  93 + width: 100%;
  94 + height: 40px;
  95 + text-overflow: ellipsis;
  96 + white-space: nowrap;
  97 + overflow: hidden;
  98 + }
  99 + }
  100 +
  101 + .record-right {
  102 + float: right;
  103 + color: #ccc;
  104 + padding-right: 30px;
  105 + line-height: 120px;
  106 + }
  107 + }
  108 +
  109 + .installment-check-btn {
  110 + & + label {
  111 + &:before {
  112 + margin-top: 40px;
  113 + }
  114 + }
  115 + }
  116 +
  117 + .no-result {
  118 + .result-icon {
  119 + width: 153px;
  120 + height: 197px;
  121 + background: resolve("home/review-img-3.png") no-repeat;
  122 + background-size: contain;
  123 + margin: 198px auto 36px;
  124 + display: block;
  125 + }
  126 +
  127 + .txt {
  128 + text-align: center;
  129 + color: #444;
  130 + }
  131 +
  132 + .guang-btn {
  133 + width: 472px;
  134 + height: 88px;
  135 + background: #444;
  136 + color: #fff;
  137 + text-align: center;
  138 + line-height: 88px;
  139 + border-radius: 6px;
  140 + margin: 110px auto 0;
  141 + display: block;
  142 + }
  143 + }
  144 +}
  145 +
  146 +.installment-overdue-notice {
  147 + position: fixed;
  148 + left: 0;
  149 + right: 0;
  150 + top: 0;
  151 + bottom: 0;
  152 + display: none;
  153 + z-index: 9;
  154 +
  155 + .mask-bg {
  156 + background: rgba(0, 0, 0, 0.4);
  157 + position: absolute;
  158 + top: 0;
  159 + left: 0;
  160 + right: 0;
  161 + bottom: 0;
  162 + }
  163 +
  164 + .notice-area {
  165 + width: 540px;
  166 + background: #fafafa;
  167 + border-radius: 10px;
  168 + transform: translate(-50%, -50%);
  169 + position: absolute;
  170 + top: 50%;
  171 + left: 50%;
  172 +
  173 + .notice-cont {
  174 + padding: 40px;
  175 + }
  176 +
  177 + h2 {
  178 + font-weight: bold;
  179 + text-align: center;
  180 + font-size: 30px;
  181 + color: #444;
  182 + padding-bottom: 4px;
  183 + }
  184 +
  185 + p {
  186 + font-size: 24px;
  187 + color: #444;
  188 + line-height: 38px;
  189 + }
  190 +
  191 + .think-ok {
  192 + width: 100%;
  193 + border-top: 1px solid #c5c5c5;
  194 + height: 90px;
  195 + line-height: 90px;
  196 + box-sizing: border-box;
  197 + text-align: center;
  198 + color: #d1021c;
  199 + font-size: 34px;
  200 + }
  201 + }
  202 +}
  203 +
  204 +.repayment-bottom {
  205 + position: fixed;
  206 + bottom: 0;
  207 + left: 0;
  208 + right: 0;
  209 + background: #fff;
  210 + height: 115px;
  211 + border-top: 1px solid #e0e0e0;
  212 +
  213 + label {
  214 + margin-left: 60px;
  215 + width: 320px;
  216 + height: 120px;
  217 + float: left;
  218 + }
  219 +
  220 + .installment-check-btn {
  221 + & + label {
  222 + &:before {
  223 + margin-top: 40px;
  224 + }
  225 + }
  226 + }
  227 +
  228 + .repayment-btn {
  229 + width: 170px;
  230 + height: 88px;
  231 + background: #d2000d;
  232 + color: #fff;
  233 + text-align: center;
  234 + line-height: 88px;
  235 + font-size: 26px;
  236 + margin: 13px 30px 0 0;
  237 + border: none;
  238 + float: right;
  239 + border-radius: 8px;
  240 + }
  241 +
  242 + .repay-price {
  243 + font-size: 32px;
  244 + line-height: 40px;
  245 + margin-top: 20px;
  246 +
  247 + span {
  248 + color: #d2000d;
  249 + }
  250 + }
  251 +
  252 + .serve-price {
  253 + color: #b0b0b0;
  254 + line-height: 40px;
  255 + font-size: 26px;
  256 + }
  257 +}
  258 +
  259 +.account-page {
  260 + .account-list {
  261 + height: 120px;
  262 + background: #fff;
  263 + border-bottom: 1px solid #e0e0e0;
  264 +
  265 + li {
  266 + color: #444;
  267 + font-size: 26px;
  268 + line-height: 120px;
  269 + padding: 0 30px;
  270 + box-sizing: border-box;
  271 +
  272 + .list-right {
  273 + float: right;
  274 + color: #b1b1b1;
  275 + }
20 } 276 }
21 } 277 }
22 -}  
  278 +}
1 .installment-starting-service-page { 1 .installment-starting-service-page {
2 background: #fff; 2 background: #fff;
3 3
4 - input[type=checkbox] {  
5 - display: none;  
6 -  
7 - & + label {  
8 - &:before {  
9 - position: absolute;  
10 - content: "";  
11 - display: inline-block;  
12 - width: 32px;  
13 - height: 32px;  
14 - font-size: 27px;  
15 - background: url("/img/home/circle-check-off.png");  
16 - background-size: cover;  
17 - margin-left: -40px;  
18 - }  
19 - }  
20 -  
21 - &:checked {  
22 - & + label:before {  
23 - background: url("/img/home/circle-check-on.png");  
24 - background-size: cover;  
25 - }  
26 - }  
27 - }  
28 -  
29 .exclamation { 4 .exclamation {
30 background-color: #ff7f7f; 5 background-color: #ff7f7f;
31 color: white; 6 color: white;
@@ -117,3 +92,29 @@ @@ -117,3 +92,29 @@
117 bottom: 0; 92 bottom: 0;
118 } 93 }
119 } 94 }
  95 +
  96 +
  97 +.installment-check-btn {
  98 + display: none;
  99 +
  100 + & + label {
  101 + &:before {
  102 + position: absolute;
  103 + content: "";
  104 + display: inline-block;
  105 + width: 32px;
  106 + height: 32px;
  107 + font-size: 27px;
  108 + background: url("/img/home/circle-check-off.png");
  109 + background-size: cover;
  110 + margin-left: -40px;
  111 + }
  112 + }
  113 +
  114 + &:checked {
  115 + & + label:before {
  116 + background: url("/img/home/circle-check-on.png");
  117 + background-size: cover;
  118 + }
  119 + }
  120 +}