...
|
...
|
@@ -15,57 +15,6 @@ const _serverCrash = (res, params) => { |
|
|
res.render('installment/server-crash', params);
|
|
|
};
|
|
|
|
|
|
// 判断是否已经获取到了开通的状态值
|
|
|
const _reviewStatus = (res, req, uid, status) => {
|
|
|
let jumpUrl = helpers.appUrlFormat('/product/new', 'go.new');
|
|
|
|
|
|
if (status === '1') {
|
|
|
return {
|
|
|
review: {
|
|
|
url: jumpUrl
|
|
|
}
|
|
|
};
|
|
|
} else if (status === '2') {
|
|
|
return Promise.all([
|
|
|
installmentModel.getSearchIntallment({
|
|
|
page: 1
|
|
|
}),
|
|
|
installmentModel.getQueryCreditInfo(uid),
|
|
|
installmentModel.getAdvertisement()
|
|
|
]).then((result) => {
|
|
|
return {
|
|
|
success: {
|
|
|
price: result[1].currCreditLimit,
|
|
|
installmentOnly: {
|
|
|
title: {
|
|
|
title: '分期专享',
|
|
|
more_url: helpers.appUrlFormat(req.originalUrl, 'go.instalmentlist', {
|
|
|
title: '分期专享'
|
|
|
})
|
|
|
},
|
|
|
goods: result[0]
|
|
|
},
|
|
|
advertisement: result[2],
|
|
|
url: helpers.appUrlFormat(req.originalUrl, 'go.instalmentlist', {
|
|
|
title: '分期专享'
|
|
|
})
|
|
|
}
|
|
|
};
|
|
|
});
|
|
|
|
|
|
} else if (status === '3') {
|
|
|
return {
|
|
|
error: true
|
|
|
};
|
|
|
} else if (status === '4') {
|
|
|
return {
|
|
|
cancel: {
|
|
|
url: jumpUrl
|
|
|
}
|
|
|
};
|
|
|
}
|
|
|
};
|
|
|
|
|
|
// 还款列表公共处理块
|
|
|
const _repaymentList = (req, res, opt, params) => {
|
|
|
params = _.assign({
|
...
|
...
|
@@ -91,11 +40,14 @@ const _repaymentList = (req, res, opt, params) => { |
|
|
const index = (req, res) => {
|
|
|
let uid = req.query.uid;
|
|
|
|
|
|
Promise.all([installmentModel.getStauts(uid), installmentModel.getSearchIntallment({
|
|
|
page: 1
|
|
|
})]).then((result) => {
|
|
|
Promise.all([
|
|
|
installmentModel.getStauts(uid),
|
|
|
installmentModel.getSearchIntallment({
|
|
|
page: 1
|
|
|
})
|
|
|
]).then((result) => {
|
|
|
|
|
|
// status:0 未申请 1审核中 2已开通 3 审核未通过
|
|
|
// openStatus:0 未申请 1审核中 2已开通 3 审核未通过
|
|
|
let openStatus = result[0];
|
|
|
let installmentOnly = {
|
|
|
title: {
|
...
|
...
|
@@ -108,7 +60,7 @@ const index = (req, res) => { |
|
|
};
|
|
|
|
|
|
if (openStatus === '0') {
|
|
|
return Promise.all([installmentModel.getResources('0876085ff46bed27f1a1eb6ee8b68987'), installmentModel.getNotices()]).then(data => {
|
|
|
return Promise.all([installmentModel.getResources('openN'), installmentModel.getNotices()]).then(data => {
|
|
|
_.forEach(data[0], (item) => {
|
|
|
if (item.singleOne) {
|
|
|
item.data[0].url = 'javascript:void(0)'; //eslint-disable-line
|
...
|
...
|
@@ -126,7 +78,7 @@ const index = (req, res) => { |
|
|
return Promise.all([
|
|
|
installmentModel.getQueryCreditInfo(uid),
|
|
|
installmentModel.getQueryAmtInfo(uid),
|
|
|
installmentModel.getResources('c233ad4ca91fef45ed7d0b26d9953e61'),
|
|
|
installmentModel.getResources('openY'),
|
|
|
installmentModel.getNotices()
|
|
|
]).then((data) => {
|
|
|
let params = _.assign({
|
...
|
...
|
@@ -198,17 +150,61 @@ const review = (req, res) => { |
|
|
page: 'installment',
|
|
|
title: '有货分期'
|
|
|
};
|
|
|
let templete = 'installment/open-result';
|
|
|
let jumpUrl = helpers.appUrlFormat('/product/new', 'go.new');
|
|
|
let params = {};
|
|
|
|
|
|
if (openStatus !== '2') {
|
|
|
res.render('installment/open-result', _.assign(data, _reviewStatus(res, req, uid, openStatus)));
|
|
|
} else {
|
|
|
_reviewStatus(res, req, uid, openStatus).then((params) => {
|
|
|
res.render('installment/open-result', _.assign(data, params));
|
|
|
if (openStatus === '2') {
|
|
|
Promise.all([
|
|
|
installmentModel.getSearchIntallment({
|
|
|
page: 1
|
|
|
}),
|
|
|
installmentModel.getQueryCreditInfo(uid),
|
|
|
installmentModel.getResources('advertisement')
|
|
|
]).then((result) => {
|
|
|
res.render(templete, _.assign({
|
|
|
success: {
|
|
|
price: result[1].currCreditLimit,
|
|
|
installmentOnly: {
|
|
|
title: {
|
|
|
title: '分期专享',
|
|
|
more_url: helpers.appUrlFormat(req.originalUrl, 'go.instalmentlist', {
|
|
|
title: '分期专享'
|
|
|
})
|
|
|
},
|
|
|
goods: result[0]
|
|
|
},
|
|
|
advertisement: result[2][0].data[0],
|
|
|
url: helpers.appUrlFormat(req.originalUrl, 'go.instalmentlist', {
|
|
|
title: '分期专享'
|
|
|
})
|
|
|
}
|
|
|
}, data));
|
|
|
}).catch(() => {
|
|
|
_serverCrash(res, {
|
|
|
url: req.originalUrl
|
|
|
});
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
if (openStatus === '1') {
|
|
|
params = {
|
|
|
review: {
|
|
|
url: jumpUrl
|
|
|
}
|
|
|
};
|
|
|
} else if (openStatus === '3') {
|
|
|
params = {
|
|
|
error: true
|
|
|
};
|
|
|
} else if (openStatus === '4') {
|
|
|
params = {
|
|
|
cancel: {
|
|
|
url: jumpUrl
|
|
|
}
|
|
|
};
|
|
|
}
|
|
|
res.render(templete, _.assign(params, data));
|
|
|
}
|
|
|
};
|
|
|
|
...
|
...
|
|