...
|
...
|
@@ -220,7 +220,7 @@ const delRecord = (uid, skn) => { |
|
|
* 会员等级
|
|
|
* @param params
|
|
|
*/
|
|
|
const getGradeGrade = (channel, uid) => {
|
|
|
const getGradeGrade = (uid, channel) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.passport.vip',
|
|
|
uid: uid,
|
...
|
...
|
@@ -228,108 +228,119 @@ const getGradeGrade = (channel, uid) => { |
|
|
}, {code: 200});
|
|
|
};
|
|
|
|
|
|
const getGradeUser = (channel, uid) => {
|
|
|
if (uid) {
|
|
|
return api.get('', {
|
|
|
method: 'app.passport.profile',
|
|
|
uid: uid,
|
|
|
channel: channel || 1
|
|
|
}, {code: 200});
|
|
|
}
|
|
|
const getGradeUser = (uid, channel) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.passport.profile',
|
|
|
uid: uid,
|
|
|
channel: channel || 1
|
|
|
}, {code: 200});
|
|
|
};
|
|
|
|
|
|
const getGrade = (channel, uid) => {
|
|
|
const getGrade = (param) => {
|
|
|
if (param.uid) {
|
|
|
return api.all([
|
|
|
getGradeGrade(param.uid, param.channel),
|
|
|
getGradeUser(param.uid, param.channel)
|
|
|
]).then((result) => {
|
|
|
|
|
|
return api.all([
|
|
|
getGradeGrade(channel, uid),
|
|
|
getGradeUser(channel, uid)
|
|
|
]).then((result) => {
|
|
|
let resu = {
|
|
|
vipGrade: []
|
|
|
};
|
|
|
|
|
|
let resu = {
|
|
|
vipGrade: []
|
|
|
};
|
|
|
let enp = {};
|
|
|
|
|
|
let enp = {};
|
|
|
let obj = {
|
|
|
privilege: []
|
|
|
};
|
|
|
|
|
|
let obj = {
|
|
|
privilege: []
|
|
|
};
|
|
|
if (result[0] && result[0].data) {
|
|
|
|
|
|
if (result[0] && result[0].data) {
|
|
|
_.forEach(result[0].data.enjoy_preferential, function(val) {
|
|
|
|
|
|
_.forEach(result[0].data.enjoy_preferential, function(val) {
|
|
|
enp = {
|
|
|
description: val.description,
|
|
|
pic: val.pic,
|
|
|
title: val.title
|
|
|
};
|
|
|
|
|
|
enp = {
|
|
|
description: val.description,
|
|
|
pic: val.pic,
|
|
|
title: val.title
|
|
|
};
|
|
|
obj.privilege.push(enp);
|
|
|
|
|
|
obj.privilege.push(enp);
|
|
|
});
|
|
|
|
|
|
});
|
|
|
switch (result[0].data.current_vip_level) {
|
|
|
case '0':// 普通会员
|
|
|
obj = _.assign(obj, {
|
|
|
vip0: true
|
|
|
});
|
|
|
break;
|
|
|
case '1':// 银卡会员
|
|
|
obj = _.assign(obj, {
|
|
|
vip1: true
|
|
|
});
|
|
|
break;
|
|
|
case '2':// 金卡会员
|
|
|
obj = _.assign(obj, {
|
|
|
vip2: true
|
|
|
});
|
|
|
break;
|
|
|
case '3':// 白金会员
|
|
|
obj = _.assign(obj, {
|
|
|
vip3: true
|
|
|
});
|
|
|
break;
|
|
|
default :
|
|
|
|
|
|
switch (result[0].data.current_vip_level) {
|
|
|
case '0':// 普通会员
|
|
|
obj = _.assign(obj, {
|
|
|
vip0: true
|
|
|
});
|
|
|
break;
|
|
|
case '1':// 银卡会员
|
|
|
obj = _.assign(obj, {
|
|
|
vip1: true
|
|
|
});
|
|
|
break;
|
|
|
case '2':// 金卡会员
|
|
|
}
|
|
|
|
|
|
let upg = (1 * (result[0].data.upgrade_need_cost)).toFixed(2);
|
|
|
|
|
|
obj = _.assign(obj, {
|
|
|
costOfThisYear: result[0].data.current_year_cost,
|
|
|
sumCost: result[0].data.current_total_cost,
|
|
|
allUrl: helpers.urlFormat('/home/preferential'),
|
|
|
costGap: upg
|
|
|
});
|
|
|
|
|
|
if (result[0].data.next_need_cost === 0) {
|
|
|
// 当vip等级升至顶级时,进度条满格
|
|
|
obj = _.assign(obj, {
|
|
|
vip2: true
|
|
|
percent: 100
|
|
|
});
|
|
|
break;
|
|
|
case '3':// 白金会员
|
|
|
} else {
|
|
|
|
|
|
let perf = (100 * (result[0].data.current_year_cost / result[0].data.next_need_cost)).toFixed(2);
|
|
|
|
|
|
obj = _.assign(obj, {
|
|
|
vip3: true
|
|
|
percent: perf
|
|
|
});
|
|
|
break;
|
|
|
default :
|
|
|
|
|
|
}
|
|
|
|
|
|
let upg = (1 * (result[0].data.upgrade_need_cost)).toFixed(2);
|
|
|
}
|
|
|
|
|
|
obj = _.assign(obj, {
|
|
|
costOfThisYear: result[0].data.current_year_cost,
|
|
|
sumCost: result[0].data.current_total_cost,
|
|
|
allUrl: helpers.urlFormat('/home/preferential'),
|
|
|
costGap: upg
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if (result[0].data.next_need_cost === 0) {
|
|
|
// 当vip等级升至顶级时,进度条满格
|
|
|
if (result[0] && result[0].data) {
|
|
|
obj = _.assign(obj, {
|
|
|
percent: 100
|
|
|
name: result[1].data.nickname
|
|
|
});
|
|
|
} else {
|
|
|
|
|
|
let perf = (100 * (result[0].data.current_year_cost / result[0].data.next_need_cost)).toFixed(2);
|
|
|
}
|
|
|
|
|
|
obj = _.assign(obj, {
|
|
|
percent: perf
|
|
|
});
|
|
|
resu.vipGrade.push(obj);
|
|
|
|
|
|
}
|
|
|
return resu;
|
|
|
});
|
|
|
} else {
|
|
|
return api.get('', {
|
|
|
|
|
|
}
|
|
|
}).then(() => {
|
|
|
|
|
|
if (result[0] && result[0].data) {
|
|
|
obj = _.assign(obj, {
|
|
|
name: result[1].data.nickname
|
|
|
});
|
|
|
}
|
|
|
let resu = {
|
|
|
vipGrade: []
|
|
|
};
|
|
|
|
|
|
resu.vipGrade.push(obj);
|
|
|
return resu;
|
|
|
});
|
|
|
|
|
|
return resu;
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
/**
|
...
|
...
|
|