...
|
...
|
@@ -11,7 +11,7 @@ const _ = require('lodash'); |
|
|
const helpers = global.yoho.helpers;
|
|
|
|
|
|
// 判断是否已经获取到了开通的状态值
|
|
|
const _reviewStatus = (status) => {
|
|
|
const _reviewStatus = (uid, status) => {
|
|
|
if (status === 1) {
|
|
|
return {
|
|
|
review: {
|
...
|
...
|
@@ -19,13 +19,13 @@ const _reviewStatus = (status) => { |
|
|
}
|
|
|
};
|
|
|
} else if (status === 2) {
|
|
|
return installmentModel.getSearchIntallment().then((goods) => {
|
|
|
return Promise.all([installmentModel.getSearchIntallment(), installmentModel.getQueryCreditInfo(uid)]).then((result) => {
|
|
|
return {
|
|
|
success: {
|
|
|
price: '5000',
|
|
|
price: result[1].initCreditLimit,
|
|
|
installmentOnly: {
|
|
|
title: '分期专享',
|
|
|
goods: goods
|
|
|
goods: result[0]
|
|
|
}
|
|
|
}
|
|
|
};
|
...
|
...
|
@@ -51,11 +51,7 @@ const _repaymentList = (req, res, next, title, params) => { |
|
|
module: 'home',
|
|
|
page: 'repayment-list',
|
|
|
title: title,
|
|
|
data: result,
|
|
|
pageHeader: headerModel.setNav({
|
|
|
navTitle: title,
|
|
|
navBtn: false
|
|
|
})
|
|
|
data: result
|
|
|
});
|
|
|
}).catch(next);
|
|
|
};
|
...
|
...
|
@@ -72,13 +68,7 @@ const index = (req, res, next) => { |
|
|
if (openStatus === 0) {
|
|
|
return installmentModel.getResources().then(data => {
|
|
|
return {
|
|
|
bannerTop: {
|
|
|
// data: [{
|
|
|
// src: '', //eslint-disable-line
|
|
|
// url: ''
|
|
|
// }]
|
|
|
data: data
|
|
|
},
|
|
|
bannerTop: data,
|
|
|
notOpen: true,
|
|
|
installmentOnly: {
|
|
|
title: '分期专享',
|
...
|
...
|
@@ -112,12 +102,12 @@ const index = (req, res, next) => { |
|
|
res.redirect('/home/installment/review?status=' + openStatus);
|
|
|
}
|
|
|
}).then((result) => {
|
|
|
result.pageHeader = _.assign({
|
|
|
installmentPage: true
|
|
|
}, headerModel.setNav({
|
|
|
navTitle: '有货分期',
|
|
|
navBtn: false
|
|
|
}));
|
|
|
// result.pageHeader = _.assign({
|
|
|
// installmentPage: true
|
|
|
// }, headerModel.setNav({
|
|
|
// navTitle: '有货分期',
|
|
|
// navBtn: false
|
|
|
// }));
|
|
|
|
|
|
res.render('installment/open-index', _.assign({
|
|
|
module: 'home',
|
...
|
...
|
@@ -134,18 +124,14 @@ const review = (req, res, next) => { |
|
|
let data = {
|
|
|
module: 'home',
|
|
|
page: 'installment',
|
|
|
title: '有货分期',
|
|
|
pageHeader: headerModel.setNav({
|
|
|
navTitle: '有货分期',
|
|
|
navBtn: false
|
|
|
})
|
|
|
title: '有货分期'
|
|
|
};
|
|
|
|
|
|
if (openStatus) {
|
|
|
res.render('installment/open-result', _.assign(data, _reviewStatus(+openStatus)));
|
|
|
res.render('installment/open-result', _.assign(data, _reviewStatus(uid, +openStatus)));
|
|
|
} else {
|
|
|
installmentModel.getStauts(uid).then((status) => {
|
|
|
return _reviewStatus(status);
|
|
|
return _reviewStatus(uid, status);
|
|
|
}).then((params) => {
|
|
|
res.render('installment/open-result', _.assign(data, params));
|
|
|
}).catch(next);
|
...
|
...
|
@@ -185,11 +171,7 @@ const repayRecordPage = (req, res) => { |
|
|
res.render('installment/repay-record', {
|
|
|
module: 'home',
|
|
|
page: 'repay-record',
|
|
|
title: '还款记录',
|
|
|
pageHeader: headerModel.setNav({
|
|
|
navTitle: '还款记录',
|
|
|
navBtn: false
|
|
|
})
|
|
|
title: '还款记录'
|
|
|
});
|
|
|
};
|
|
|
|
...
|
...
|
@@ -220,11 +202,7 @@ const account = (req, res, next) => { |
|
|
res.render('installment/account', {
|
|
|
accountList: result,
|
|
|
title: '账号管理',
|
|
|
repaymentList: result,
|
|
|
pageHeader: headerModel.setNav({
|
|
|
navTitle: '账号管理',
|
|
|
navBtn: false
|
|
|
})
|
|
|
repaymentList: result
|
|
|
});
|
|
|
}).catch(next);
|
|
|
};
|
...
|
...
|
@@ -309,6 +287,11 @@ const orderDetail = (req, res) => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
// 还款详情
|
|
|
const repayDetail = (req, res) => {
|
|
|
res.render('installment/repay-detail');
|
|
|
};
|
|
|
|
|
|
module.exports = {
|
|
|
index,
|
|
|
review,
|
...
|
...
|
@@ -325,5 +308,6 @@ module.exports = { |
|
|
account,
|
|
|
orderIndex,
|
|
|
orderList,
|
|
|
orderDetail
|
|
|
orderDetail,
|
|
|
repayDetail
|
|
|
}; |
...
|
...
|
|