Authored by zhangxiaoru

我的返利

... ... @@ -38,16 +38,16 @@ exports.detail = (req, res, next) => {
}).catch(next);
};
exports.myRebeat = (req, res) => {
// let uid = req.user.uid;
// req.ctx(shareBuyModel).myRebeat(uid).then(data => {
res.render('share-buy/my-rebeat', {
localCss: true,
width750: true,
title: '我的返利收益',
page: 'my-rebeat'
});
// }).catch(next);
exports.myRebeat = (req, res, next) => {
let uid = req.user.uid;
req.ctx(shareBuyModel).myRebeat(uid).then(data => {
res.render('share-buy/my-rebeat', {
localCss: true,
width750: true,
title: '我的返利收益',
page: 'my-rebeat',
rebeatData: data
});
}).catch(next);
};
... ...
... ... @@ -121,21 +121,32 @@ module.exports = class extends global.yoho.BaseModel {
/**
* 我的返利页数据
*/
// myRebeat(uid) {
// return api.get('', {
// method: 'app.yohocoinrebeat.detail',
// uid: uid
// }, {
// code: 200
// }).then((result) => {
// if (result && result.code === 200 && result.data) {
// return result.data;
// } else {
// return {};
// }
// });
// }
myRebeat(uid) {
return api.get('', {
method: 'app.yohocoinrebeat.detail',
uid: uid
}, {
code: 200
}).then((result) => {
if (result && result.code === 200 && result.data) {
let dateTime;
_.forEach(result.data.detail, function(val) {
val.cancel = parseInt(val.status, 10) === 0 ? true : false;
dateTime = new Date(val.createTime);
val.createTime = dateTime.getFullYear() + '.' + (dateTime.getMonth() + 1) +
'.' + dateTime.getDate();
});
return result.data;
} else {
return {};
}
});
}
};
... ...
<div class="my-rebeat-page">
{{# rebeatData}}
<ul class="gross-earnings">
<li>累计返利有货币
<p>
<span class="amount">50</span>
<span class="amount">{{haveRebeatNum}}</span>
</p>
</li>
<li>等待返利到账的有货币
<p>
<span class="amount">50</span>
<span class="amount">{{waitingRebeatNum}}</span>
</p>
</li>
<li>返利取消
<span class="reason">(返利订单因退货等原因取消)</span>
<p>
<span class="amount">50</span>
<span class="amount">{{cancleRebeatNum}}</span>
</p>
</li>
</ul>
<ul class="earnings-detail">
<p class="title">返利明细</p>
<li>
<p class="earnings-info">
<span class="num">+10</span>
<span>121***22 <i>已发放</i></span>
<p class="title">返利明细</p>
</p>
<p class="order-info">
<span class="time">2012.1.1</span>
<span class="order-code">订单号:11111111</span>
</p>
</li>
{{#if detail}}
<ul class="earnings-detail">
{{# detail}}
<li>
<p class="earnings-info">
<span class="num">+10</span>
<span>121***22 <i class="cancel">已发放</i></span>
<span class="num">{{#if cancel}}-{{else}}+{{/if}}{{coinNum}}</span>
<span>{{nickName}} <i {{#if cancel}}class="cancel"{{/if}}>{{statusStr}}</i></span>
</p>
<p class="order-info">
<span class="time">2012.1.1</span>
<span class="order-code">订单号:11111111</span>
<span class="time">{{createTime}}</span>
<span class="order-code">订单号:{{orderCode}}</span>
</p>
</li>
{{/ detail}}
</ul>
<div class="hints">
... ... @@ -51,4 +44,10 @@
</p>
<p>有货币是什么?<a>了解详情</a></p>
</div>
{{else}}
<a class="no-rebeat" href="//m.yohobuy.com/activity/share-buy">暂时没有相关返利信息,立即参与分享赢返利<i class="iconfont">&#xe614;</i></a>
{{/if}}
{{/ rebeatData}}
</div>
... ...
/**
* app版本判断
* @date: 2017/5/10
*/
'use strict';
// const helpers = global.yoho.helpers;
// module.exports = (req, res, next) => {
// if (req.query.app_version || req.query.appVersion) {
// console
// }
// next();
// };
... ...
'use strict';
require('activity/share-detail.page.css');
let $ = require('yoho-jquery');
let $ = require('yoho-jquery'),
yoho = require('yoho-app');
let $activityTime = $('.activity-time'),
endTime = $activityTime ? $activityTime.data('time-s') : '',
... ... @@ -20,7 +22,16 @@ let params = {
let noResultHbs = require('product/search/no-result-new.hbs');
require('activity/share-detail.page.css');
let shareData = {
title: '【有货】童鞋们一起来有货玩潮流,超级专享优惠福利速来领~',
link: location.href,
desc: '有货发福利啦!甄选好货等你来BUY~',
imgUrl: 'http://img11.static.yhbimg.com/yhb-img01/2017/05/10/16/011568a808f9b10e098b6542d3a8cb3d6b.png'
};
require('common/share');
yoho.invokeMethod('set.shareInfo', shareData);
function division(time) {
time = time > 10 ? time + '' : '0' + time;
... ... @@ -86,6 +97,7 @@ if ($activityTime.data('id')) {
});
}
// 商品数据
function productData() {
if (!onloading) {
... ... @@ -120,6 +132,7 @@ function productData() {
page = page + 1;
}
// 滚动加载
function scrollHandler() {
// 当scroll到1/2$goodsContainer高度后继续请求下一页数据
... ...
.my-rebeat-page {
background-color: #f0f0f0;
.gross-earnings {
width: 100%;
font-size: 34px;
... ... @@ -28,21 +26,21 @@
}
}
.title {
height: 70px;
line-height: 70px;
color: #b0b0b0;
padding-left: 30px;
font-size: 24px;
border-bottom: 1px solid #e0e0e0;
background-color: #f0f0f0;
}
.earnings-detail {
background-color: #fff;
width: 100%;
font-family: PingFang;
.title {
height: 70px;
line-height: 70px;
color: #b0b0b0;
padding-left: 30px;
font-size: 24px;
border-bottom: 1px solid #e0e0e0;
background-color: #f0f0f0;
}
li {
height: 105px;
border-bottom: 1px solid #e0e0e0;
... ... @@ -104,4 +102,15 @@
text-decoration: underline;
}
}
.no-rebeat {
font-size: 24px;
color: #b0b0b0;
text-align: center;
line-height: 70px;
height: 70px;
width: 100%;
background-color: #fff;
display: inline-block;
}
}
... ...