Authored by 郝肖肖

会员成长值详情数据模拟

... ... @@ -12,7 +12,7 @@ const index = (req, res, next) => {
const details = (req, res, next) => {
let uid = req.user.uid;
vipModel.vipIndex(uid).then(result => {
vipModel.getVipRecord(uid, req.query || {}).then(result => {
res.render('vip-details', result);
}).catch(next);
};
... ...
... ... @@ -25,6 +25,15 @@ const getVipRecord = (params)=>{
return api.get('', Object.assign(options, params));
};
const getVipRecordDemo = (params)=>{
let options = {
method: 'app.inbox.getlistnew'
};
return api.get('', Object.assign(options, params));
};
const getCouponsList = (uid, type, page, limit)=>{
page = page || 1;
type = type || 'notuse';
... ... @@ -44,5 +53,6 @@ const getCouponsList = (uid, type, page, limit)=>{
module.exports = {
getVIPInfoByUid,
getCouponsList,
getVipRecord
getVipRecord,
getVipRecordDemo
};
... ...
... ... @@ -5,6 +5,8 @@ const co = Promise.coroutine;
const userData = require('./user-data');
const moment = require('moment');
const helpers = global.yoho.helpers;
const _ = require('lodash');
const setPager = require(`${global.utils}/pager`).setPager;
const vipIndex = (uid)=>{
... ... @@ -62,8 +64,35 @@ const vipIndex = (uid)=>{
})();
};
const getVipRecord = (params) => {
return userData.getVipRecord(params);
const getVipRecord = (uid, params) => {
let page = parseInt(params.page, 10) || 1;
let size = parseInt(params.size, 10) || 1;
let type = parseInt(params.type, 10) || 1;
type = type > 0 && type < 3 ? type : 1;//1 or 2
return userData.getVipRecordDemo({
uid: uid,
page: page,
size: size || 10
}).then(d => {
var resData = {type: type};
if (d.code !== 200) {
return resData;
}
let pagerList = setPager(_.get(d.data, 'page_total', 1), Object.assign(params, {page: page}));
resData.data = d.data.list;
resData.pager = Object.assign({
count: _.get(d.data, 'total', 0),
curPage: page,
totalPages: _.get(d.data, 'page_total', 0)
}, pagerList);
return resData;
});
};
module.exports = {
... ...
... ... @@ -6,33 +6,44 @@
<h2 class="title"></h2>
<div class="msg-tabs-wrap">
<ul class="tabs-list clearfix">
<li class="active">
<a href="{{href}}">我的成长值详情</a>
<li class="{{#isEqual type 1}}active{{/isEqual}}">
<a href="/home/vip/details?type=1">我的成长值详情</a>
</li>
<li>
<a href="{{href}}">我的成长值记录</a>
<li class="{{#isEqual type 2}}active{{/isEqual}}">
<a href="/home/vip/details?type=2">我的成长值记录</a>
</li>
</ul>
</div>
<div class="message-container">
<div class="t-table">
<div class="t-header">
<div>时间</div>
<div>成长记录</div>
{{#isEqual type 1}}
<div class="t-table">
<div class="t-header">
<div>来源</div>
<div>变化量</div>
<div>变化日期</div>
</div>
{{#each ../data}}
<div class="t-list">
<div>{{from}}</div>
<div>{{body.content}}</div>
<div>{{create_date}}</div>
</div>
{{/each}}
</div>
<div class="t-list">
<div>2017-04-12</div>
<div>成长普通卡会员</div>
{{else}}
<div class="t-table type-2">
<div class="t-header">
<div>时间</div>
<div>成长记录</div>
</div>
{{#each ../data}}
<div class="t-list">
<div>{{create_date}}</div>
<div>{{body.content}}</div>
</div>
{{/each}}
</div>
<div class="t-list">
<div>2017-04-12</div>
<div>成长普通卡会员</div>
</div>
<div class="t-list">
<div>2017-04-12</div>
<div>成长普通卡会员</div>
</div>
</div>
{{/isEqual}}
</div>
{{> pager}}
</div>
... ...
... ... @@ -48,7 +48,7 @@
</div>
<div class="user-info">
<p>会员等级介绍:</p>
<p>1.注册成功即为普通会员,各会员等级均按照历史累计有效的成长值升降级,会员等级越高可享受会员权益越多。<a class="ident">了解等级规则></a></p>
<p>1.注册成功即为普通会员,各会员等级均按照历史累计有效的成长值升降级,会员等级越高可享受会员权益越多。<a class="ident" href="/help/detail?id=7">了解等级规则></a></p>
<p>2.成长值为有货会员通过购物、评价、登录等获得的经验累积值。</p>
<p>3.会员升级后,会员等级有效期一年。每365天进行累计成长值扣减,扣减后的成长值不满足当前级别条件的,直接降级至对应成长值级别。</p>
<p>
... ...
... ... @@ -165,6 +165,7 @@
td {
width: 33.33%;
text-align: center;
line-height: 18px;
}
tfoot td {
... ... @@ -253,11 +254,21 @@
display: table-row;
div {
width: 33.33%;
display: table-cell;
height: 30px;
vertical-align: middle;
border-top: 1px solid #dedede;
border-left: 1px solid #dedede;
padding: 10px 0;
line-height: 18px;
}
}
&.type-2 .t-header,
&.type-2 .t-list {
div {
width: 50%;
}
}
}
... ...