Authored by lijing

VIP

... ... @@ -91,8 +91,14 @@ exports.record = (req, res) => {
};
/**
* 浏览记录列表
* @param req
* @param res
* @param next
*/
exports.recordContent = (req, res, next) => {
let uid = req.user.uid;
let uid = req.user.uid || 6228593;
let udid = req.user.udid;
... ... @@ -112,6 +118,12 @@ exports.recordContent = (req, res, next) => {
}).catch(next);
};
/**
* 删除浏览记录
* @param req
* @param res
* @param next
*/
exports.delRecord = (req, res, next) => {
let uid = req.user.uid;
... ... @@ -122,4 +134,35 @@ exports.delRecord = (req, res, next) => {
}).catch(next);
};
/**
* 会员等级展示页
* @param req
* @param res
* @param next
*/
exports.grade = (req, res, next) => {
let headerData = headerModel.setNav({
navTitle: '会员等级'
});
let responseData = {
pageHeader: headerData,
module: 'home',
page: 'grade',
title: '会员等级',
pageFooter: true
};
indexModel.getGrade({
uid: req.user.uid || 8039759,
channel: req.query.channel || 1
}).then((result) => {
console.log(result);
res.render('vip-grade/vip-grade', Object.assign(result, responseData));
}).catch(next);
};
... ...
... ... @@ -22,7 +22,7 @@ app.engine('.hbs', hbs({
extname: '.hbs',
defaultLayout: 'layout',
layoutsDir: doraemon,
partialsDir: ['./views/partial', `${doraemon}/partial`],
partialsDir: [path.join(__dirname, './views/partial'), `${doraemon}/partial`],
helpers: global.yoho.helpers
}));
... ...
... ... @@ -202,6 +202,10 @@ const recordContent = (uid, udid, page, limit) => {
});
};
/**
* 删除浏览记录
* @param params
*/
const delRecord = (uid, skn) => {
return api.get('', {
method: 'app.browse.delete',
... ... @@ -210,9 +214,58 @@ const delRecord = (uid, skn) => {
});
};
/**
* 会员等级
* @param params
*/
const getGradeGrade = (channel, uid) => {
return api.get('', {
method: 'app.passport.vip',
uid: uid || 6228593,
channel: channel || 1
}, {code: 200});
};
const getGradeUser = (channel, uid) => {
return api.get('', {
method: 'app.passport.profile',
uid: uid || 6228593,
channel: channel || 1
}, {code: 200});
};
const getGrade = (channel, uid) => {
return api.all([
getGradeGrade(channel, uid),
getGradeUser(channel, uid)
]).then((result) => {
let resu = {
vipGrade: []
};
if (result[0] && result[0].data) {
resu = {
vipGrade: [
{
costOfThisYear: result[0].data.current_year_cost,
sumCost: result[0].data.current_total_cost,
vip1: true,
name: '1111'
}
]
};
}
return resu;
});
};
module.exports = {
index,
myDetails,
recordContent,
delRecord
delRecord,
getGrade
};
... ...
... ... @@ -44,6 +44,8 @@ router.get('/cancelOrder', orderDetailController.cancelOrder); // 取消订单
router.get('/', homeController.index); // 个人中心首页
router.get('/mydetails', homeController.myDetails); // 个人基本资料页面
router.get('/grade', homeController.grade); // 会员等级页
router.get('/mycurrency', currencyController.myCurrency); // yoho币总数
router.get('/currencyDetail', currencyController.currencyDetail); // yoho币列表
router.post('/ajaxCurrencyDetail', currencyController.ajaxCurrencyDetail); // yoho币列表
... ...
<div class="vip-grade-page yoho-page">
{{# vipGrade}}
<div class="basic-info block">
{{> vip-grade/basic-info}}
</div>
<ul class="cost block">
<li>
年度累计金额:
<span>{{costOfThisYear}}</span>
</li>
<li>
历史消费总金额:
<span>{{sumCost}}</span>
</li>
</ul>
{{#unless vip0}}
<div class="privilege block">
<h3 class="title">当前可享受的特权</h3>
{{> vip-grade/privilege}}
</div>
{{/unless}}
<a class="all-privilege block tap-hightlight" href="{{allUrl}}">
查看全部VIP特权
<span class="iconfont">&#xe604;</span>
</a>
{{/ vipGrade}}
</div>
... ...
{{#if vip3}}
<p>
<span class="user-name">{{name}}</span>
<span class="vip-icon vip-3"></span>
</p>
<p class="grade-desc">
您已升级至最高的等级啦!
</p>
<p class="sum-cost">
年度累计金额<span>{{costOfThisYear}}</span>
</p>
<div class="progresser">
<div class="outer"></div>
<div class="inner" style="width: {{percent}}%;"></div>
<span class="beacon beacon-min">
白金卡会员
</span>
</div>
{{/if}}
{{#if vip2}}
<p>
<span class="user-name">{{name}}</span>
<span class="vip-icon vip-2"></span>
</p>
<p class="grade-desc">
还差<span class="cost-gap">{{costGap}}</span>就可以升级为白金会员!
<span class="sub-desc">(VIP金额累计需订单成功签收满15天并无退换货)</span>
</p>
<p class="sum-cost">
年度累计金额<span>{{costOfThisYear}}</span>
</p>
<div class="progresser">
<div class="outer"></div>
<div class="inner" style="width: {{percent}}%;"></div>
<span class="beacon beacon-min">
金卡会员
</span>
<span class="beacon beacon-max">白金卡会员</span>
<span class="cost-limit">¥5000.00</span>
</div>
{{/if}}
{{#if vip1}}
<p>
<span class="user-name">{{name}}</span>
<span class="vip-icon vip-1"></span>
</p>
<p class="grade-desc">
还差<span class="cost-gap">{{costGap}}</span>就可以升级为金卡会员!
<span class="sub-desc">(VIP金额累计需订单成功签收满15天并无退换货)</span>
</p>
<p class="sum-cost">
年度累计金额<span>{{costOfThisYear}}</span>
</p>
<div class="progresser">
<div class="outer"></div>
<div class="inner" style="width: {{percent}}%;"></div>
<span class="beacon beacon-min">
银卡会员
</span>
<span class="beacon beacon-max">金卡会员</span>
<span class="cost-limit">¥2000.00</span>
</div>
{{/if}}
{{#if vip0}}
<p>
<span class="user-name">{{name}}</span>
<span>普通会员</span>
</p>
<p class="grade-desc">
还差<span class="cost-gap">{{costGap}}</span>就可以升级为银卡会员!
<span class="sub-desc">(VIP金额累计需订单成功签收满15天并无退换货)</span>
</p>
<p class="sum-cost">
年度累计金额<span>{{costOfThisYear}}</span>
</p>
<div class="progresser">
<div class="outer"></div>
<div class="inner" style="width: {{percent}}%;"></div>
<span class="beacon beacon-min">
普通
</span>
<span class="beacon beacon-max">银卡会员</span>
<span class="cost-limit">¥600.00</span>
</div>
{{/if}}
... ...
333
<ul class="privilege-list">
{{#each privilege}}
<li>
<img class="icon" src="{{pic}}">
<p>
{{title}}
<span>{{description}}</span>
</p>
</li>
{{/each}}
</ul>
\ No newline at end of file
... ...
require('../common');
... ...
... ... @@ -72,7 +72,6 @@
.progresser {
position: relative;
width: 100%;
height: 20px;
padding: 20px 0;
}
... ...