Authored by OF1706

头部用户更新

@@ -39,23 +39,28 @@ const index = (req, res, next) => { @@ -39,23 +39,28 @@ const index = (req, res, next) => {
39 // 个人信息调用失败返回 39 // 个人信息调用失败返回
40 if (profile) { 40 if (profile) {
41 41
42 - userInfo.result = 1; 42 + // userInfo.result = 1;
  43 + console.log(profile);
43 44
44 - Object.assign(userInfo, { 45 + let curYearCost = parseInt( _.get(profile, 'vip_info.curYearCost', 0));
  46 + let nextVipNeedCost = parseInt( _.get(profile, 'vip_info.nextVipNeedCost', 0));
  47 +
  48 + Object.assign(userInfo, {
45 49
46 // 个人资料 50 // 个人资料
47 profileName: _.get(profile, 'profile_name', ''), 51 profileName: _.get(profile, 'profile_name', ''),
48 headIco: !_.get(profile, 'head_ico') ? helpers.image(_.get(profile, 'head_ico'), 63, 63) : '', 52 headIco: !_.get(profile, 'head_ico') ? helpers.image(_.get(profile, 'head_ico'), 63, 63) : '',
  53 + curTitle: _.get(profile, 'vip_info.title', 0),
49 54
50 // VIP信息 55 // VIP信息
51 - curYearCost: _.get(profile, 'vip_info.curYearCost', 0), 56 + curYearCost: curYearCost,
52 nextLevel: _.get(profile, 'vip_info.next_level', 0), 57 nextLevel: _.get(profile, 'vip_info.next_level', 0),
53 nextVipTitle: _.get(profile, 'vip_info.nextVipTitle', 0), 58 nextVipTitle: _.get(profile, 'vip_info.nextVipTitle', 0),
54 - nextVipNeedCost: _.get(profile, 'vip_info.nextVipNeedCost', 0), 59 + nextVipNeedCost: nextVipNeedCost,
55 60
56 // 升级百分比 61 // 升级百分比
57 - curYearCostPer: userInfo.nextVipNeedCost ?  
58 - Math.round(profile.curYearCost / profile.nextVipNeedCost * 100) : 0, 62 + curYearCostPer: nextVipNeedCost ?
  63 + Math.round(curYearCost / (nextVipNeedCost + curYearCost)* 100): 0,
59 64
60 // 待处理订单 65 // 待处理订单
61 order: _.get(userNum, 'wait_pay_num + wait_cargo_num + send_cargo_num', 0), 66 order: _.get(userNum, 'wait_pay_num + wait_cargo_num + send_cargo_num', 0),