Authored by 郝肖肖

'会员成长进度条等分'

@@ -15,6 +15,7 @@ module.exports = class extends global.yoho.BaseModel { @@ -15,6 +15,7 @@ module.exports = class extends global.yoho.BaseModel {
15 return userDataModel.getVIPInfoByUid(uid).then(vipInfo => { 15 return userDataModel.getVIPInfoByUid(uid).then(vipInfo => {
16 let vip = {}; 16 let vip = {};
17 let data = {}; 17 let data = {};
  18 + let scale = 1 / 3; // 分三等份
18 19
19 if (vipInfo.code !== 200) { 20 if (vipInfo.code !== 200) {
20 return vip; 21 return vip;
@@ -30,13 +31,24 @@ module.exports = class extends global.yoho.BaseModel { @@ -30,13 +31,24 @@ module.exports = class extends global.yoho.BaseModel {
30 {name: '白金会员', val: 7000} 31 {name: '白金会员', val: 7000}
31 ]; 32 ];
32 33
  34 + // 还须要成长值
33 if (vip.grades[vip.level + 1]) { 35 if (vip.grades[vip.level + 1]) {
34 vip.need_total_growth = vip.grades[vip.level + 1].val - vip.current_total_growth; 36 vip.need_total_growth = vip.grades[vip.level + 1].val - vip.current_total_growth;
35 vip.need_total_growth = vip.need_total_growth > 0 ? vip.need_total_growth : 0; 37 vip.need_total_growth = vip.need_total_growth > 0 ? vip.need_total_growth : 0;
36 } 38 }
37 39
38 - vip.current_total_percent = ((vip.current_total_growth / vip.grades[3].val) * 100).toFixed(2);  
39 - vip.current_total_percent = vip.current_total_percent > 100 ? 100 : vip.current_total_percent; 40 + // 进度条百分比
  41 + vip.current_total_percent = 100;
  42 + if (vip.current_total_growth <= vip.grades[1].val) {
  43 + vip.current_total_percent = (vip.current_total_growth * scale / vip.grades[1].val);
  44 + } else if (vip.current_total_growth <= vip.grades[2].val) {
  45 + vip.current_total_percent = (vip.current_total_growth * scale / vip.grades[2].val + scale);
  46 + } else if (vip.current_total_growth <= vip.grades[3].val) {
  47 + vip.current_total_percent = (vip.current_total_growth * scale / vip.grades[3].val + scale * 2)
  48 + }
  49 +
  50 + vip.current_total_percent = (vip.current_total_percent * 100).toFixed(2);
  51 +
40 vip.user_name = decodeURIComponent(this.ctx && this.ctx.req && this.ctx.req.user.name || ''); 52 vip.user_name = decodeURIComponent(this.ctx && this.ctx.req && this.ctx.req.user.name || '');
41 53
42 return vip; 54 return vip;
@@ -141,18 +141,6 @@ @@ -141,18 +141,6 @@
141 .p-footer p { 141 .p-footer p {
142 margin-top: 3px; 142 margin-top: 3px;
143 } 143 }
144 -  
145 - &:first-child {  
146 - width: 11.4%;  
147 - }  
148 -  
149 - &:first-child + li {  
150 - width: 31.4%;  
151 - }  
152 -  
153 - &:first-child + li + li {  
154 - width: 57.1%;  
155 - }  
156 } 144 }
157 } 145 }
158 } 146 }