Authored by 王水玲

有货分期

@@ -14,7 +14,9 @@ const index = (req, res) => { @@ -14,7 +14,9 @@ const index = (req, res) => {
14 let query = req.query.query || ''; 14 let query = req.query.query || '';
15 let uid = req.user.uid || 3236556; 15 let uid = req.user.uid || 3236556;
16 16
17 - installmentModel.getStauts(uid).then((openStatus) => { 17 + Promise.all([installmentModel.getStauts(uid), installmentModel.getSearchIntallment()]).then((result) => {
  18 + let openStatus = result[0];
  19 +
18 if (openStatus === 0) { 20 if (openStatus === 0) {
19 return { 21 return {
20 bannerTop: { 22 bannerTop: {
@@ -28,18 +30,24 @@ const index = (req, res) => { @@ -28,18 +30,24 @@ const index = (req, res) => {
28 notOpen: true, 30 notOpen: true,
29 installmentOnly: { 31 installmentOnly: {
30 title: '分期专享', 32 title: '分期专享',
31 - goods: [  
32 - {  
33 -  
34 - }  
35 - ] 33 + goods: result[1]
36 } 34 }
37 }; 35 };
38 } else if (openStatus === 2) { 36 } else if (openStatus === 2) {
39 if (query === 'usable') { 37 if (query === 'usable') {
40 return installmentModel.getQueryCreditInfo(uid).then((data) => { 38 return installmentModel.getQueryCreditInfo(uid).then((data) => {
  39 + if (data.status === 2) {
  40 + data.replayStatus = '逾期';
  41 + } else if (data.status === 3) {
  42 + data.replayStatus = '不可用';
  43 + }
  44 +
41 return _.assign({ 45 return _.assign({
42 - isUnable: true 46 + isUnable: true,
  47 + installmentOnly: {
  48 + title: '分期专享',
  49 + goods: result[1]
  50 + }
43 }, data); 51 }, data);
44 }); 52 });
45 } else { 53 } else {
@@ -49,17 +57,19 @@ const index = (req, res) => { @@ -49,17 +57,19 @@ const index = (req, res) => {
49 }, data); 57 }, data);
50 }); 58 });
51 } 59 }
52 -  
53 } 60 }
54 }).then((result) => { 61 }).then((result) => {
  62 + result.pageHeader = _.assign({
  63 + installmentPage: true
  64 + }, headerModel.setNav({
  65 + navTitle: '有货分期',
  66 + navBtn: false
  67 + }));
  68 +
55 res.render('installment/open-index', _.assign({ 69 res.render('installment/open-index', _.assign({
56 module: 'home', 70 module: 'home',
57 page: 'installment', 71 page: 'installment',
58 - title: '有货分期',  
59 - pageHeader: headerModel.setNav({  
60 - navTitle: '有货分期',  
61 - navBtn: false  
62 - }) 72 + title: '有货分期'
63 }, result)); 73 }, result));
64 }); 74 });
65 }; 75 };
@@ -70,33 +80,32 @@ const review = (req, res) => { @@ -70,33 +80,32 @@ const review = (req, res) => {
70 80
71 installmentModel.getStauts(uid).then((status) => { 81 installmentModel.getStauts(uid).then((status) => {
72 if (status === 1) { 82 if (status === 1) {
73 - params = { 83 + return {
74 review: { 84 review: {
75 - url: helpers.urlFormat('/?go=1') 85 + url: helpers.urlFormat('//m.yohobuy.com/product/new')
76 } 86 }
77 }; 87 };
78 } else if (status === 2) { 88 } else if (status === 2) {
79 - params = { 89 + return installmentModel.getSearchIntallment().then((goods) => {
  90 + return {
80 success: { 91 success: {
81 price: '5000', 92 price: '5000',
82 installmentOnly: { 93 installmentOnly: {
83 title: '分期专享', 94 title: '分期专享',
84 - goods: [  
85 - {  
86 -  
87 - }  
88 - ] 95 + goods: goods
89 } 96 }
90 } 97 }
91 }; 98 };
92 - } else {  
93 - params = { 99 + });
  100 +
  101 + } else if (status === 3) {
  102 + return {
94 error: { 103 error: {
95 - url: helpers.urlFormat('/?go=1') 104 + url: helpers.urlFormat('//m.yohobuy.com/product/new')
96 } 105 }
97 }; 106 };
98 } 107 }
99 - 108 + }).then((params) => {
100 res.render('installment/open-result', _.assign({ 109 res.render('installment/open-result', _.assign({
101 module: 'home', 110 module: 'home',
102 page: 'installment', 111 page: 'installment',
@@ -47,7 +47,7 @@ const getQueryCreditInfo = (uid) => { @@ -47,7 +47,7 @@ const getQueryCreditInfo = (uid) => {
47 data: { 47 data: {
48 initCredit: '8000.00', 48 initCredit: '8000.00',
49 currCredit: '5000.00', 49 currCredit: '5000.00',
50 - status: 1 50 + status: 2
51 }, 51 },
52 md5: 'c1d725306fb09dcbf504776d276521cb', 52 md5: 'c1d725306fb09dcbf504776d276521cb',
53 message: 'ok' 53 message: 'ok'
@@ -89,8 +89,25 @@ const getQueryAmtInfo = (uid) => { @@ -89,8 +89,25 @@ const getQueryAmtInfo = (uid) => {
89 }); 89 });
90 }; 90 };
91 91
  92 +// 分期专享推荐商品
  93 +const getSearchIntallment = () => {
  94 + return api.get('', {
  95 + method: 'app.search.instalment',
  96 + limit: '50',
  97 + cache: true
  98 + }).then((result) => {
  99 + if (result && result.code === 200) {
  100 + return result.data;
  101 + } else {
  102 + logger.error('get instalment promote goods return is not 200');
  103 + return '';
  104 + }
  105 + });
  106 +};
  107 +
92 module.exports = { 108 module.exports = {
93 getStauts, 109 getStauts,
94 getQueryCreditInfo, 110 getQueryCreditInfo,
95 - getQueryAmtInfo 111 + getQueryAmtInfo,
  112 + getSearchIntallment
96 }; 113 };
1 -<div class="installment-page"> 1 +<div class="installment-page installment-bg">
2 {{#if notOpen}} 2 {{#if notOpen}}
3 {{# bannerTop}} 3 {{# bannerTop}}
4 {{> resources/banner-top}} 4 {{> resources/banner-top}}
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 <div class="repay-area detail-bg"> 34 <div class="repay-area detail-bg">
35 <p class="detail-txt1">近7日代还款</p> 35 <p class="detail-txt1">近7日代还款</p>
36 <p class="detail-txt1">¥<span class="detail-txt2">{{round dayAmt}}</span></p> 36 <p class="detail-txt1">¥<span class="detail-txt2">{{round dayAmt}}</span></p>
37 - <P class="detail-txt3">您有¥{{round dayAmt}}已逾期3天,点击<a href="">查看详情</a></P> 37 + <p class="detail-txt3">您有¥{{round dayAmt}}已逾期3天,点击<a href="">查看详情</a></p>
38 <a href="" class="see-btn">明细</a> 38 <a href="" class="see-btn">明细</a>
39 </div> 39 </div>
40 <ul class="group-list"> 40 <ul class="group-list">
@@ -16,6 +16,9 @@ @@ -16,6 +16,9 @@
16 {{#currencyDetailPage}} 16 {{#currencyDetailPage}}
17 <a href="/home/helpDetail?code=20111130-152530&caption=如何使用YOHO币支付" class="iconfont nav-home">&#xe639;</a> 17 <a href="/home/helpDetail?code=20111130-152530&caption=如何使用YOHO币支付" class="iconfont nav-home">&#xe639;</a>
18 {{/currencyDetailPage}} 18 {{/currencyDetailPage}}
  19 + {{#installmentPage}}
  20 + <a href="/home/helpDetail?code=20151230-102233&caption=有货分期" class="iconfont nav-home">&#xe639;</a>
  21 + {{/installmentPage}}
19 {{#navPhone}} 22 {{#navPhone}}
20 <a href="{{.}}" class="iconfont nav-home">&#xe641;</a> 23 <a href="{{.}}" class="iconfont nav-home">&#xe641;</a>
21 {{/navPhone}} 24 {{/navPhone}}
@@ -73,3 +73,9 @@ if ($installmentOnly.length > 0) { @@ -73,3 +73,9 @@ if ($installmentOnly.length > 0) {
73 73
74 search(); 74 search();
75 } 75 }
  76 +
  77 +if ($('.installment-bg').length > 0) {
  78 + $('body').css({
  79 + background: '#efefef'
  80 + });
  81 +}