Showing
5 changed files
with
81 additions
and
131 deletions
@@ -15,57 +15,6 @@ const _serverCrash = (res, params) => { | @@ -15,57 +15,6 @@ const _serverCrash = (res, params) => { | ||
15 | res.render('installment/server-crash', params); | 15 | res.render('installment/server-crash', params); |
16 | }; | 16 | }; |
17 | 17 | ||
18 | -// 判断是否已经获取到了开通的状态值 | ||
19 | -const _reviewStatus = (res, req, uid, status) => { | ||
20 | - let jumpUrl = helpers.appUrlFormat('/product/new', 'go.new'); | ||
21 | - | ||
22 | - if (status === '1') { | ||
23 | - return { | ||
24 | - review: { | ||
25 | - url: jumpUrl | ||
26 | - } | ||
27 | - }; | ||
28 | - } else if (status === '2') { | ||
29 | - return Promise.all([ | ||
30 | - installmentModel.getSearchIntallment({ | ||
31 | - page: 1 | ||
32 | - }), | ||
33 | - installmentModel.getQueryCreditInfo(uid), | ||
34 | - installmentModel.getAdvertisement() | ||
35 | - ]).then((result) => { | ||
36 | - return { | ||
37 | - success: { | ||
38 | - price: result[1].currCreditLimit, | ||
39 | - installmentOnly: { | ||
40 | - title: { | ||
41 | - title: '分期专享', | ||
42 | - more_url: helpers.appUrlFormat(req.originalUrl, 'go.instalmentlist', { | ||
43 | - title: '分期专享' | ||
44 | - }) | ||
45 | - }, | ||
46 | - goods: result[0] | ||
47 | - }, | ||
48 | - advertisement: result[2], | ||
49 | - url: helpers.appUrlFormat(req.originalUrl, 'go.instalmentlist', { | ||
50 | - title: '分期专享' | ||
51 | - }) | ||
52 | - } | ||
53 | - }; | ||
54 | - }); | ||
55 | - | ||
56 | - } else if (status === '3') { | ||
57 | - return { | ||
58 | - error: true | ||
59 | - }; | ||
60 | - } else if (status === '4') { | ||
61 | - return { | ||
62 | - cancel: { | ||
63 | - url: jumpUrl | ||
64 | - } | ||
65 | - }; | ||
66 | - } | ||
67 | -}; | ||
68 | - | ||
69 | // 还款列表公共处理块 | 18 | // 还款列表公共处理块 |
70 | const _repaymentList = (req, res, opt, params) => { | 19 | const _repaymentList = (req, res, opt, params) => { |
71 | params = _.assign({ | 20 | params = _.assign({ |
@@ -91,11 +40,14 @@ const _repaymentList = (req, res, opt, params) => { | @@ -91,11 +40,14 @@ const _repaymentList = (req, res, opt, params) => { | ||
91 | const index = (req, res) => { | 40 | const index = (req, res) => { |
92 | let uid = req.query.uid; | 41 | let uid = req.query.uid; |
93 | 42 | ||
94 | - Promise.all([installmentModel.getStauts(uid), installmentModel.getSearchIntallment({ | ||
95 | - page: 1 | ||
96 | - })]).then((result) => { | 43 | + Promise.all([ |
44 | + installmentModel.getStauts(uid), | ||
45 | + installmentModel.getSearchIntallment({ | ||
46 | + page: 1 | ||
47 | + }) | ||
48 | + ]).then((result) => { | ||
97 | 49 | ||
98 | - // status:0 未申请 1审核中 2已开通 3 审核未通过 | 50 | + // openStatus:0 未申请 1审核中 2已开通 3 审核未通过 |
99 | let openStatus = result[0]; | 51 | let openStatus = result[0]; |
100 | let installmentOnly = { | 52 | let installmentOnly = { |
101 | title: { | 53 | title: { |
@@ -108,7 +60,7 @@ const index = (req, res) => { | @@ -108,7 +60,7 @@ const index = (req, res) => { | ||
108 | }; | 60 | }; |
109 | 61 | ||
110 | if (openStatus === '0') { | 62 | if (openStatus === '0') { |
111 | - return Promise.all([installmentModel.getResources('0876085ff46bed27f1a1eb6ee8b68987'), installmentModel.getNotices()]).then(data => { | 63 | + return Promise.all([installmentModel.getResources('openN'), installmentModel.getNotices()]).then(data => { |
112 | _.forEach(data[0], (item) => { | 64 | _.forEach(data[0], (item) => { |
113 | if (item.singleOne) { | 65 | if (item.singleOne) { |
114 | item.data[0].url = 'javascript:void(0)'; //eslint-disable-line | 66 | item.data[0].url = 'javascript:void(0)'; //eslint-disable-line |
@@ -126,7 +78,7 @@ const index = (req, res) => { | @@ -126,7 +78,7 @@ const index = (req, res) => { | ||
126 | return Promise.all([ | 78 | return Promise.all([ |
127 | installmentModel.getQueryCreditInfo(uid), | 79 | installmentModel.getQueryCreditInfo(uid), |
128 | installmentModel.getQueryAmtInfo(uid), | 80 | installmentModel.getQueryAmtInfo(uid), |
129 | - installmentModel.getResources('c233ad4ca91fef45ed7d0b26d9953e61'), | 81 | + installmentModel.getResources('openY'), |
130 | installmentModel.getNotices() | 82 | installmentModel.getNotices() |
131 | ]).then((data) => { | 83 | ]).then((data) => { |
132 | let params = _.assign({ | 84 | let params = _.assign({ |
@@ -198,17 +150,61 @@ const review = (req, res) => { | @@ -198,17 +150,61 @@ const review = (req, res) => { | ||
198 | page: 'installment', | 150 | page: 'installment', |
199 | title: '有货分期' | 151 | title: '有货分期' |
200 | }; | 152 | }; |
153 | + let templete = 'installment/open-result'; | ||
154 | + let jumpUrl = helpers.appUrlFormat('/product/new', 'go.new'); | ||
155 | + let params = {}; | ||
201 | 156 | ||
202 | - if (openStatus !== '2') { | ||
203 | - res.render('installment/open-result', _.assign(data, _reviewStatus(res, req, uid, openStatus))); | ||
204 | - } else { | ||
205 | - _reviewStatus(res, req, uid, openStatus).then((params) => { | ||
206 | - res.render('installment/open-result', _.assign(data, params)); | 157 | + if (openStatus === '2') { |
158 | + Promise.all([ | ||
159 | + installmentModel.getSearchIntallment({ | ||
160 | + page: 1 | ||
161 | + }), | ||
162 | + installmentModel.getQueryCreditInfo(uid), | ||
163 | + installmentModel.getResources('advertisement') | ||
164 | + ]).then((result) => { | ||
165 | + res.render(templete, _.assign({ | ||
166 | + success: { | ||
167 | + price: result[1].currCreditLimit, | ||
168 | + installmentOnly: { | ||
169 | + title: { | ||
170 | + title: '分期专享', | ||
171 | + more_url: helpers.appUrlFormat(req.originalUrl, 'go.instalmentlist', { | ||
172 | + title: '分期专享' | ||
173 | + }) | ||
174 | + }, | ||
175 | + goods: result[0] | ||
176 | + }, | ||
177 | + advertisement: result[2][0].data[0], | ||
178 | + url: helpers.appUrlFormat(req.originalUrl, 'go.instalmentlist', { | ||
179 | + title: '分期专享' | ||
180 | + }) | ||
181 | + } | ||
182 | + }, data)); | ||
207 | }).catch(() => { | 183 | }).catch(() => { |
208 | _serverCrash(res, { | 184 | _serverCrash(res, { |
209 | url: req.originalUrl | 185 | url: req.originalUrl |
210 | }); | 186 | }); |
211 | }); | 187 | }); |
188 | + | ||
189 | + } else { | ||
190 | + if (openStatus === '1') { | ||
191 | + params = { | ||
192 | + review: { | ||
193 | + url: jumpUrl | ||
194 | + } | ||
195 | + }; | ||
196 | + } else if (openStatus === '3') { | ||
197 | + params = { | ||
198 | + error: true | ||
199 | + }; | ||
200 | + } else if (openStatus === '4') { | ||
201 | + params = { | ||
202 | + cancel: { | ||
203 | + url: jumpUrl | ||
204 | + } | ||
205 | + }; | ||
206 | + } | ||
207 | + res.render(templete, _.assign(params, data)); | ||
212 | } | 208 | } |
213 | }; | 209 | }; |
214 | 210 |
@@ -13,6 +13,11 @@ const api = global.yoho.API; | @@ -13,6 +13,11 @@ const api = global.yoho.API; | ||
13 | const serviceAPI = global.yoho.ServiceAPI; | 13 | const serviceAPI = global.yoho.ServiceAPI; |
14 | const logger = global.yoho.logger; | 14 | const logger = global.yoho.logger; |
15 | const API_TIMEOUT = 10000; | 15 | const API_TIMEOUT = 10000; |
16 | +const codeContent = { | ||
17 | + openN: '0876085ff46bed27f1a1eb6ee8b68987', | ||
18 | + openY: 'c233ad4ca91fef45ed7d0b26d9953e61', | ||
19 | + advertisement: 'f3fe0793a7d59479542a14b15359c47d' | ||
20 | +}; | ||
16 | 21 | ||
17 | // 处理还款列表数据 | 22 | // 处理还款列表数据 |
18 | const _processAmtList = (listData, queryDays) => { | 23 | const _processAmtList = (listData, queryDays) => { |
@@ -145,21 +150,8 @@ const _processBankCards = (list) => { | @@ -145,21 +150,8 @@ const _processBankCards = (list) => { | ||
145 | list = list || []; | 150 | list = list || []; |
146 | 151 | ||
147 | _.forEach(list, (data) => { | 152 | _.forEach(list, (data) => { |
148 | - // let newCardNo = data.cardNo.split(''); | ||
149 | - // let cardNo = newCardNo.length; | ||
150 | - // data.cardNo = ''; | ||
151 | - // | ||
152 | - // | ||
153 | - // for (let i = 1; i < cardNo; i++) { | ||
154 | - // if (i < (cardNo - 4)) { | ||
155 | - // data.cardNo += '*'; | ||
156 | - // } else { | ||
157 | - // data.cardNo += newCardNo[i - 1]; | ||
158 | - // } | ||
159 | - // } | ||
160 | data.url = '/home/installment/card-detail?cardIdNo=' + data.cardIdNo; | 153 | data.url = '/home/installment/card-detail?cardIdNo=' + data.cardIdNo; |
161 | 154 | ||
162 | - | ||
163 | // 正则替换卡号,保留后4位 | 155 | // 正则替换卡号,保留后4位 |
164 | data.cardNo = data.cardNo.replace(/(\d+)(\d{4})$/, function(a, b, c) { | 156 | data.cardNo = data.cardNo.replace(/(\d+)(\d{4})$/, function(a, b, c) { |
165 | return b.replace(/\d/g, '*') + c; | 157 | return b.replace(/\d/g, '*') + c; |
@@ -186,7 +178,7 @@ const _processCardDetail = (list) => { | @@ -186,7 +178,7 @@ const _processCardDetail = (list) => { | ||
186 | */ | 178 | */ |
187 | const getResources = (code) => { | 179 | const getResources = (code) => { |
188 | return serviceAPI.get('/operations/api/v5/resource/get', { | 180 | return serviceAPI.get('/operations/api/v5/resource/get', { |
189 | - content_code: code, | 181 | + content_code: codeContent[code], |
190 | platform: 'iphone' | 182 | platform: 'iphone' |
191 | }, { | 183 | }, { |
192 | cache: true | 184 | cache: true |
@@ -509,24 +501,6 @@ const getCardDetail = (uid, cardIdNo) => { | @@ -509,24 +501,6 @@ const getCardDetail = (uid, cardIdNo) => { | ||
509 | timeout: API_TIMEOUT, | 501 | timeout: API_TIMEOUT, |
510 | cache: true | 502 | cache: true |
511 | }).then((result) => { | 503 | }).then((result) => { |
512 | - // result = { | ||
513 | - // alg: 'SALT_MD5', | ||
514 | - // code: 200, | ||
515 | - // data: [ | ||
516 | - // { | ||
517 | - // id: '1', | ||
518 | - // userName: '*三', | ||
519 | - // cardNo: '0000', | ||
520 | - // bankCode: 'ABC', | ||
521 | - // bankName: '农业银行', | ||
522 | - // mobile: '18021200000', | ||
523 | - // cardIdNo: 'BK201610204789114', | ||
524 | - // masterType: '1' | ||
525 | - // } | ||
526 | - // ], | ||
527 | - // md5: '6d729d4b35f10fc73531210bd7ecff91', | ||
528 | - // message: 'success' | ||
529 | - // }; | ||
530 | if (result && result.code === 200) { | 504 | if (result && result.code === 200) { |
531 | return _processCardDetail(result.data); | 505 | return _processCardDetail(result.data); |
532 | } else { | 506 | } else { |
@@ -574,29 +548,6 @@ const getNotices = () => { | @@ -574,29 +548,6 @@ const getNotices = () => { | ||
574 | }); | 548 | }); |
575 | }; | 549 | }; |
576 | 550 | ||
577 | -// 开通成功后的广告 | ||
578 | -const getAdvertisement = () => { | ||
579 | - return api.get('', { | ||
580 | - method: '' | ||
581 | - }, { | ||
582 | - cache: true | ||
583 | - }).then(res => { | ||
584 | - res = { | ||
585 | - code: 200, | ||
586 | - data: { | ||
587 | - url: '', | ||
588 | - img: '//img13.static.yhbimg.com/article/2016/10/27/12/028982cc003a447c4cf59342efd4468bea.jpg?imageView2/2/w/266/h/266/q/90' | ||
589 | - } | ||
590 | - }; | ||
591 | - if (res && res.code === 200) { | ||
592 | - return res.data; | ||
593 | - } else { | ||
594 | - logger.error('getAdvertisement return code is not 200'); | ||
595 | - return {}; | ||
596 | - } | ||
597 | - }); | ||
598 | -}; | ||
599 | - | ||
600 | module.exports = { | 551 | module.exports = { |
601 | getStauts, | 552 | getStauts, |
602 | getQueryCreditInfo, | 553 | getQueryCreditInfo, |
@@ -617,8 +568,7 @@ module.exports = { | @@ -617,8 +568,7 @@ module.exports = { | ||
617 | getCardDetail, | 568 | getCardDetail, |
618 | delBankCard, | 569 | delBankCard, |
619 | setMasterCard, | 570 | setMasterCard, |
620 | - getNotices, | ||
621 | - getAdvertisement | 571 | + getNotices |
622 | }; | 572 | }; |
623 | 573 | ||
624 | 574 |
@@ -22,7 +22,7 @@ | @@ -22,7 +22,7 @@ | ||
22 | <div class="mask-bg"></div> | 22 | <div class="mask-bg"></div> |
23 | <a class="advertisement-box" href="{{url}}"> | 23 | <a class="advertisement-box" href="{{url}}"> |
24 | <i class="close-box"></i> | 24 | <i class="close-box"></i> |
25 | - <img src="{{img}}"/> | 25 | + <div style="background-image: url('{{image src 540 550}}');" class="advertisement-img"></div> |
26 | </a> | 26 | </a> |
27 | </div> | 27 | </div> |
28 | {{/ advertisement}} | 28 | {{/ advertisement}} |
@@ -21,15 +21,15 @@ module.exports = { | @@ -21,15 +21,15 @@ module.exports = { | ||
21 | // liveApi: 'http://api.live.yoho.cn/', | 21 | // liveApi: 'http://api.live.yoho.cn/', |
22 | // singleApi: 'http://single.yoho.cn/' | 22 | // singleApi: 'http://single.yoho.cn/' |
23 | 23 | ||
24 | - // api: 'http://api-test3.yohops.com:9999/', | ||
25 | - // service: 'http://service-test3.yohops.com:9999/', | ||
26 | - // liveApi: 'http://testapi.live.yohops.com:9999/', | ||
27 | - // singleApi: 'http://api-test3.yohops.com:9999/' | 24 | + api: 'http://api-test3.yohops.com:9999/', |
25 | + service: 'http://service-test3.yohops.com:9999/', | ||
26 | + liveApi: 'http://testapi.live.yohops.com:9999/', | ||
27 | + singleApi: 'http://api-test3.yohops.com:9999/' | ||
28 | 28 | ||
29 | - favApi: 'http://192.168.102.31:8092/brower', | ||
30 | - api: 'http://192.168.102.205:8080/gateway/', | ||
31 | - service: 'http://192.168.102.205:8080/gateway/', | ||
32 | - search: 'http://192.168.102.216:8080/yohosearch/' | 29 | + // favApi: 'http://192.168.102.31:8092/brower', |
30 | + // api: 'http://192.168.102.205:8080/gateway/', | ||
31 | + // service: 'http://192.168.102.205:8080/gateway/', | ||
32 | + // search: 'http://192.168.102.216:8080/yohosearch/' | ||
33 | 33 | ||
34 | // api: 'http://api.yoho.yohoops.org/', | 34 | // api: 'http://api.yoho.yohoops.org/', |
35 | // service: 'http://service.yoho.yohoops.org/', | 35 | // service: 'http://service.yoho.yohoops.org/', |
@@ -294,12 +294,16 @@ | @@ -294,12 +294,16 @@ | ||
294 | margin: -275px 0 0 -270px; | 294 | margin: -275px 0 0 -270px; |
295 | overflow: hidden; | 295 | overflow: hidden; |
296 | 296 | ||
297 | - img { | 297 | + .advertisement-img { |
298 | position: absolute; | 298 | position: absolute; |
299 | - width: 100%; | 299 | + width: 540px; |
300 | + height: 550px; | ||
300 | left: 50%; | 301 | left: 50%; |
301 | top: 50%; | 302 | top: 50%; |
302 | transform: translateY(-50%) translateX(-50%); | 303 | transform: translateY(-50%) translateX(-50%); |
304 | + background-size: contain; | ||
305 | + background-position: center; | ||
306 | + background-repeat: no-repeat; | ||
303 | } | 307 | } |
304 | } | 308 | } |
305 | } | 309 | } |
@@ -452,7 +456,7 @@ | @@ -452,7 +456,7 @@ | ||
452 | display: none; | 456 | display: none; |
453 | 457 | ||
454 | .banner-center { | 458 | .banner-center { |
455 | - margin-top: 30px; | 459 | + margin: 30px auto; |
456 | height: 210px; | 460 | height: 210px; |
457 | 461 | ||
458 | .banner-list { | 462 | .banner-list { |
-
Please register or login to post a comment