...
|
...
|
@@ -8,12 +8,13 @@ const helpers = global.yoho.helpers; |
|
|
|
|
|
const index = (req, res, next)=>{
|
|
|
let uid = '8041246';// req.user.uid;
|
|
|
|
|
|
co(function*() {
|
|
|
let vipInfo = yield userData.getVIPInfoByUid(uid);
|
|
|
|
|
|
let data = vipInfo.data, proportion = '0%';
|
|
|
|
|
|
if (+data.next_need_cost != 0) {
|
|
|
if (+data.next_need_cost !== 0) {
|
|
|
proportion = data.current_year_cost * 100 / data.next_need_cost;
|
|
|
proportion = proportion > 100 ? 100 : proportion;
|
|
|
proportion = proportion + '%';
|
...
|
...
|
@@ -21,11 +22,10 @@ const index = (req, res, next)=>{ |
|
|
|
|
|
let remainDays = Math.floor((Date.now() - (+data.vip_end_time) * 1000) / 86400);
|
|
|
|
|
|
// let preferences={};
|
|
|
// enjoyPreferences=data.enjoy_preferential;
|
|
|
let preferences = [];
|
|
|
|
|
|
if (data.enjoy_preferential) {
|
|
|
data.enjoy_preferential = data.enjoy_preferential.map(function(item, index) {
|
|
|
preferences = data.enjoy_preferential.map(function(item) {
|
|
|
return {
|
|
|
id: item.id,
|
|
|
favTxt: item.title,
|
...
|
...
|
@@ -34,24 +34,28 @@ const index = (req, res, next)=>{ |
|
|
};
|
|
|
});
|
|
|
}
|
|
|
let isVip = data.current_vip_level > 0 ? true : false;
|
|
|
|
|
|
let vip = {
|
|
|
title: data.current_vip_title,
|
|
|
level: data.current_vip_level,
|
|
|
totalCost: (+data.current_total_cost).toFixed(2),
|
|
|
nextTitle: data.next_vip_title,
|
|
|
nextLevel: data.next_vip_level,
|
|
|
nextCost: data.next_need_cost,
|
|
|
enjoyPreferences: data.enjoy_preferential,
|
|
|
yearCost: data.current_year_cost,
|
|
|
upgradeCost: data.upgrade_need_cost,
|
|
|
totalCost: (+data.current_total_cost).toFixed(2),
|
|
|
list: preferences,
|
|
|
level: data.current_vip_level,
|
|
|
platinum: data.upgrade_need_cost > 0 ? false : true,
|
|
|
nextCost: data.next_need_cost,
|
|
|
balan: data.upgrade_need_cost,
|
|
|
proportion: proportion,
|
|
|
vipLevel: data.next_vip_title,
|
|
|
reach: moment(data.vip_reach_time * 1000).format('YYYY-MM-DD'),
|
|
|
start: moment(data.vip_start_time * 1000).format('YYYY-MM-DD'),
|
|
|
valid: moment(data.vip_start_time * 1000).format('YYYY-MM-DD'),
|
|
|
end: moment(data.vip_end_time * 1000).format('YYYY-MM-DD'),
|
|
|
remainDays: remainDays,
|
|
|
platinum: data.upgrade_need_cost > 0 ? false : true,
|
|
|
isVip: data.current_vip_level > 0 ? true : false
|
|
|
doubtLevel: isVip,
|
|
|
commonVip: !isVip,
|
|
|
morePreferences: helpers.urlFormat('/help', {category_id: 91})
|
|
|
};
|
|
|
|
|
|
res.render('vip', vip);
|
...
|
...
|
|