...
|
...
|
@@ -15,6 +15,7 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
return userDataModel.getVIPInfoByUid(uid).then(vipInfo => {
|
|
|
let vip = {};
|
|
|
let data = {};
|
|
|
let scale = 1 / 3; // 分三等份
|
|
|
|
|
|
if (vipInfo.code !== 200) {
|
|
|
return vip;
|
...
|
...
|
@@ -30,13 +31,24 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
{name: '白金会员', val: 7000}
|
|
|
];
|
|
|
|
|
|
// 还须要成长值
|
|
|
if (vip.grades[vip.level + 1]) {
|
|
|
vip.need_total_growth = vip.grades[vip.level + 1].val - vip.current_total_growth;
|
|
|
vip.need_total_growth = vip.need_total_growth > 0 ? vip.need_total_growth : 0;
|
|
|
}
|
|
|
|
|
|
vip.current_total_percent = ((vip.current_total_growth / vip.grades[3].val) * 100).toFixed(2);
|
|
|
vip.current_total_percent = vip.current_total_percent > 100 ? 100 : vip.current_total_percent;
|
|
|
// 进度条百分比
|
|
|
vip.current_total_percent = 100;
|
|
|
if (vip.current_total_growth <= vip.grades[1].val) {
|
|
|
vip.current_total_percent = (vip.current_total_growth * scale / vip.grades[1].val);
|
|
|
} else if (vip.current_total_growth <= vip.grades[2].val) {
|
|
|
vip.current_total_percent = (vip.current_total_growth * scale / vip.grades[2].val + scale);
|
|
|
} else if (vip.current_total_growth <= vip.grades[3].val) {
|
|
|
vip.current_total_percent = (vip.current_total_growth * scale / vip.grades[3].val + scale * 2);
|
|
|
}
|
|
|
|
|
|
vip.current_total_percent = (vip.current_total_percent * 100).toFixed(2);
|
|
|
|
|
|
vip.user_name = decodeURIComponent(this.ctx && this.ctx.req && this.ctx.req.user.name || '');
|
|
|
|
|
|
return vip;
|
...
|
...
|
|