Authored by 王水玲

有货分期

... ... @@ -14,7 +14,9 @@ const index = (req, res) => {
let query = req.query.query || '';
let uid = req.user.uid || 3236556;
installmentModel.getStauts(uid).then((openStatus) => {
Promise.all([installmentModel.getStauts(uid), installmentModel.getSearchIntallment()]).then((result) => {
let openStatus = result[0];
if (openStatus === 0) {
return {
bannerTop: {
... ... @@ -28,18 +30,24 @@ const index = (req, res) => {
notOpen: true,
installmentOnly: {
title: '分期专享',
goods: [
{
}
]
goods: result[1]
}
};
} else if (openStatus === 2) {
if (query === 'usable') {
return installmentModel.getQueryCreditInfo(uid).then((data) => {
if (data.status === 2) {
data.replayStatus = '逾期';
} else if (data.status === 3) {
data.replayStatus = '不可用';
}
return _.assign({
isUnable: true
isUnable: true,
installmentOnly: {
title: '分期专享',
goods: result[1]
}
}, data);
});
} else {
... ... @@ -49,17 +57,19 @@ const index = (req, res) => {
}, data);
});
}
}
}).then((result) => {
result.pageHeader = _.assign({
installmentPage: true
}, headerModel.setNav({
navTitle: '有货分期',
navBtn: false
}));
res.render('installment/open-index', _.assign({
module: 'home',
page: 'installment',
title: '有货分期',
pageHeader: headerModel.setNav({
navTitle: '有货分期',
navBtn: false
})
title: '有货分期'
}, result));
});
};
... ... @@ -70,33 +80,32 @@ const review = (req, res) => {
installmentModel.getStauts(uid).then((status) => {
if (status === 1) {
params = {
return {
review: {
url: helpers.urlFormat('/?go=1')
url: helpers.urlFormat('//m.yohobuy.com/product/new')
}
};
} else if (status === 2) {
params = {
return installmentModel.getSearchIntallment().then((goods) => {
return {
success: {
price: '5000',
installmentOnly: {
title: '分期专享',
goods: [
{
}
]
goods: goods
}
}
};
} else {
params = {
});
} else if (status === 3) {
return {
error: {
url: helpers.urlFormat('/?go=1')
url: helpers.urlFormat('//m.yohobuy.com/product/new')
}
};
}
}).then((params) => {
res.render('installment/open-result', _.assign({
module: 'home',
page: 'installment',
... ...
... ... @@ -47,7 +47,7 @@ const getQueryCreditInfo = (uid) => {
data: {
initCredit: '8000.00',
currCredit: '5000.00',
status: 1
status: 2
},
md5: 'c1d725306fb09dcbf504776d276521cb',
message: 'ok'
... ... @@ -89,8 +89,25 @@ const getQueryAmtInfo = (uid) => {
});
};
// 分期专享推荐商品
const getSearchIntallment = () => {
return api.get('', {
method: 'app.search.instalment',
limit: '50',
cache: true
}).then((result) => {
if (result && result.code === 200) {
return result.data;
} else {
logger.error('get instalment promote goods return is not 200');
return '';
}
});
};
module.exports = {
getStauts,
getQueryCreditInfo,
getQueryAmtInfo
getQueryAmtInfo,
getSearchIntallment
};
... ...
<div class="installment-page">
<div class="installment-page installment-bg">
{{#if notOpen}}
{{# bannerTop}}
{{> resources/banner-top}}
... ... @@ -34,7 +34,7 @@
<div class="repay-area detail-bg">
<p class="detail-txt1">近7日代还款</p>
<p class="detail-txt1">¥<span class="detail-txt2">{{round dayAmt}}</span></p>
<P class="detail-txt3">您有¥{{round dayAmt}}已逾期3天,点击<a href="">查看详情</a></P>
<p class="detail-txt3">您有¥{{round dayAmt}}已逾期3天,点击<a href="">查看详情</a></p>
<a href="" class="see-btn">明细</a>
</div>
<ul class="group-list">
... ...
... ... @@ -16,6 +16,9 @@
{{#currencyDetailPage}}
<a href="/home/helpDetail?code=20111130-152530&caption=如何使用YOHO币支付" class="iconfont nav-home">&#xe639;</a>
{{/currencyDetailPage}}
{{#installmentPage}}
<a href="/home/helpDetail?code=20151230-102233&caption=有货分期" class="iconfont nav-home">&#xe639;</a>
{{/installmentPage}}
{{#navPhone}}
<a href="{{.}}" class="iconfont nav-home">&#xe641;</a>
{{/navPhone}}
... ...
... ... @@ -73,3 +73,9 @@ if ($installmentOnly.length > 0) {
search();
}
if ($('.installment-bg').length > 0) {
$('body').css({
background: '#efefef'
});
}
\ No newline at end of file
... ...