Authored by Aiden Xu

开通有货分期

@@ -253,7 +253,8 @@ const activateService = (req, res, next) => { @@ -253,7 +253,8 @@ const activateService = (req, res, next) => {
253 253
254 const getBankInfo = (req, res, next) => { 254 const getBankInfo = (req, res, next) => {
255 installmentModel.getBankInfo({ 255 installmentModel.getBankInfo({
256 - cardNo: req.query.cardNo 256 + cardNo: req.query.cardNo,
  257 + uid: req.user.uid || 0 // TODO: fix uid
257 }).then((result)=> { 258 }).then((result)=> {
258 res.json(result); 259 res.json(result);
259 }).catch(next); 260 }).catch(next);
@@ -125,20 +125,27 @@ const _processBankCards = (list) => { @@ -125,20 +125,27 @@ const _processBankCards = (list) => {
125 list = list || []; 125 list = list || [];
126 126
127 _.forEach(list, (data) => { 127 _.forEach(list, (data) => {
128 - let newCardNo = data.cardNo.split('');  
129 - let cardNo = newCardNo.length;  
130 -  
131 - data.cardNo = '';  
132 -  
133 - for (let i = 1; i < cardNo; i++) {  
134 - if (i < (cardNo - 4)) {  
135 - data.cardNo += '*';  
136 - } else {  
137 - data.cardNo += newCardNo[i - 1];  
138 - }  
139 - } 128 + // let newCardNo = data.cardNo.split('');
  129 + // let cardNo = newCardNo.length;
  130 + // data.cardNo = '';
  131 + //
  132 + //
  133 + // for (let i = 1; i < cardNo; i++) {
  134 + // if (i < (cardNo - 4)) {
  135 + // data.cardNo += '*';
  136 + // } else {
  137 + // data.cardNo += newCardNo[i - 1];
  138 + // }
  139 + // }
  140 +
  141 +
  142 + // 正则替换卡号,保留后4位
  143 + data.cardNo = data.cardNo.replace(/(\d+)(\d{4})$/, function(a, b, c) {
  144 + return b.replace(/\d/g, '*') + c;
  145 + });
140 }); 146 });
141 147
  148 +
142 return list; 149 return list;
143 }; 150 };
144 151
@@ -478,12 +485,14 @@ const activateService = (params) => { @@ -478,12 +485,14 @@ const activateService = (params) => {
478 * 获取银行信息 485 * 获取银行信息
479 * 486 *
480 * @param cardNo 487 * @param cardNo
  488 + * @param uid
481 * @returns {*} 489 * @returns {*}
482 */ 490 */
483 -const getBankInfo = (cardNo) => { 491 +const getBankInfo = (cardNo, uid) => {
484 return api.get('', { 492 return api.get('', {
485 method: 'user.instalment.getBankInfoByCardNo', 493 method: 'user.instalment.getBankInfoByCardNo',
486 - cardNo: cardNo 494 + cardNo: cardNo,
  495 + uid: uid
487 }); 496 });
488 }; 497 };
489 498
@@ -232,6 +232,15 @@ @@ -232,6 +232,15 @@
232 "desc":"已还款", 232 "desc":"已还款",
233 "curr_date":"【1/3期】", 233 "curr_date":"【1/3期】",
234 "sort_id":"1" 234 "sort_id":"1"
  235 + },
  236 + {
  237 + "curr_amt": "¥599.00",
  238 + "curr_principal_amt": "¥590.00",
  239 + "curr_fee_amt": "¥5.00",
  240 + "curr_dealy_fee_amt": "¥4.00",
  241 + "desc":"逾期2天",
  242 + "curr_date":"【1/3期】",
  243 + "sort_id":"1"
235 } 244 }
236 ] 245 ]
237 }, 246 },
@@ -19,10 +19,13 @@ router.get('/installment/starting-service', installment.startingService); // 分 @@ -19,10 +19,13 @@ 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 +
  23 +// TODO: Use dashed-lower-case only!
22 router.get('/installment/monthRepayList', installment.monthRepayList); // 本月待还款列表 24 router.get('/installment/monthRepayList', installment.monthRepayList); // 本月待还款列表
23 router.get('/installment/totalRepayList', installment.totalRepayList); // 待还总金额列表 25 router.get('/installment/totalRepayList', installment.totalRepayList); // 待还总金额列表
24 router.get('/installment/repayRecord', installment.repayRecordPage); // 还款记录 26 router.get('/installment/repayRecord', installment.repayRecordPage); // 还款记录
25 router.get('/installment/getRepayRecord', installment.getRepayRecord); // ajax请求还款记录 27 router.get('/installment/getRepayRecord', installment.getRepayRecord); // ajax请求还款记录
  28 +
26 router.get('/installment/account', installment.account); // 账户管理 29 router.get('/installment/account', installment.account); // 账户管理
27 router.get('/installment/bank-info', installment.getBankInfo); 30 router.get('/installment/bank-info', installment.getBankInfo);
28 router.post('/installment/activate-service', installment.activateService); 31 router.post('/installment/activate-service', installment.activateService);
@@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
31 <span class="on is-repay">待还款金额</span> 31 <span class="on is-repay">待还款金额</span>
32 <span class="is-usable">可用额度</span> 32 <span class="is-usable">可用额度</span>
33 </div> 33 </div>
34 - <div class="repay installment-cont"> 34 + <div class="repay installment-cont">
35 <div class="repay-area detail-bg"> 35 <div class="repay-area detail-bg">
36 <p class="detail-txt1">近7日代还款</p> 36 <p class="detail-txt1">近7日代还款</p>
37 <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>
@@ -44,7 +44,7 @@ @@ -44,7 +44,7 @@
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> 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> 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="/home/installment/repayRecord">还款记录:<div class="list-right iconfont">&#xe604;</div></a></li>
47 - <li><a href="">分期订单:<div class="list-right iconfont">&#xe604;</div></a></li> 47 + <li><a href="/home/installment/order">分期订单:<div class="list-right iconfont">&#xe604;</div></a></li>
48 </ul> 48 </ul>
49 49
50 <ul class="group-list"> 50 <ul class="group-list">
@@ -54,6 +54,7 @@ @@ -54,6 +54,7 @@
54 </div> 54 </div>
55 <div class="status"> 55 <div class="status">
56 {{desc}} 56 {{desc}}
  57 + <span class="iconfont notice">&#xe639;</span>
57 </div> 58 </div>
58 <div class="clearfix"></div> 59 <div class="clearfix"></div>
59 </li> 60 </li>
@@ -2,9 +2,13 @@ @@ -2,9 +2,13 @@
2 * 订单状态样式 2 * 订单状态样式
3 */ 3 */
4 $('.status').each(function() { 4 $('.status').each(function() {
5 - const text = $(this).text(); 5 + const text = $(this).text().trim();
  6 + const fade = text.match(/已还款|已退款/) || [];
  7 + const expire = text.match(/逾期/) || [];
6 8
7 - if (text.indexOf(/已还款|已退款/)) { 9 + if (fade.length > 0) {
8 $(this).addClass('faded'); 10 $(this).addClass('faded');
  11 + } else if (expire.length > 0) {
  12 + $(this).addClass('expired');
9 } 13 }
10 }); 14 });
@@ -137,4 +137,5 @@ $('#apply-form').submit(function() { @@ -137,4 +137,5 @@ $('#apply-form').submit(function() {
137 $.post('/home/installment/activate-service', formModel).then((result)=> { 137 $.post('/home/installment/activate-service', formModel).then((result)=> {
138 console.log(result); 138 console.log(result);
139 }); 139 });
  140 + return false;
140 }); 141 });
@@ -156,8 +156,16 @@ @@ -156,8 +156,16 @@
156 position: absolute; 156 position: absolute;
157 right: 30px; 157 right: 30px;
158 158
159 - .faded { 159 + &.faded {
160 color: #b0b0b0; 160 color: #b0b0b0;
  161 +
  162 + .iconfont {
  163 + display: none;
  164 + }
  165 + }
  166 +
  167 + &.expired {
  168 + color: #d0021b;
161 } 169 }
162 } 170 }
163 } 171 }