Authored by 郝肖肖

Merge branch 'feature/optimizeCoin' into release/wap-optim

... ... @@ -17,8 +17,6 @@ const myCurrency = (req, res, next) => {
myCurrencyModel.myCurrency(uid, contentCode).then(result => {
res.render('currency-new', {
module: 'home',
page: 'currency-new',
pageHeader: _.assign(headerModel.setNav({
navTitle: '有货币'
}), {
... ... @@ -28,7 +26,8 @@ const myCurrency = (req, res, next) => {
title: '有货币',
pageFooter: true,
yohoCoin: result.yohoCoin,
banner: result.banner
banner: result.banner,
localCss: true
});
}).catch(next);
};
... ... @@ -38,11 +37,9 @@ const currencyDetail = (req, res, next) => {
let page = 1;
let limit = 10;
myCurrencyModel.currencyDetail(uid, page, limit).then(result => {
myCurrencyModel.currencyDetailIndex(uid, page, limit).then(result => {
res.render('currency-detail', {
module: 'home',
page: 'currency-detail',
pageHeader: _.assign(headerModel.setNav({
navTitle: '有货币明细'
}), {
... ... @@ -51,7 +48,9 @@ const currencyDetail = (req, res, next) => {
}),
title: '有货币明细',
pageFooter: true,
money: result.money
result: result,
money: (result.yohoCoin.yohocoin_num && result.yohoCoin.yohocoin_num > 0),
localCss: true
});
}).catch(next);
};
... ... @@ -62,11 +61,7 @@ let ajaxCurrencyDetail = (req, res, next) => {
let limit = 10;
myCurrencyModel.currencyDetail(uid, page, limit).then((result) => {
res.render('ajax-currency-detail', {
layout: false,
coinlist: _.get(result, 'coinlist', [])
});
res.json(result);
}).catch(next);
};
... ...
... ... @@ -10,12 +10,15 @@ const _yohoCoin = (uid) => {
method: 'app.yoho.yohocoin',
uid: uid
}).then((result) => {
let data = [];
if (result && result.code === 200) {
return result.data;
data = result.data;
} else {
logger.error('youhocoin code no 200');
}
return data;
});
};
... ... @@ -23,6 +26,8 @@ const bannerData = (contentCode) => {
return serviceAPI.get('operations/api/v5/resource/get', {
content_code: contentCode
}, {
cache: true
}).then((result) => {
if (result && result.code === 200) {
... ... @@ -54,44 +59,36 @@ const currencyDetail = (uid, page, limit) => {
page: page,
limit: limit
}).then((result) => {
let data = [];
if (result && result.code === 200) {
let total = parseInt(result.data.page_total, 10) + 1;
data = _.get(result, 'data.coinlist', []);
_.forEach(_.get(result, 'data.coinlist', []), perCoin => {
_.forEach(data, (perCoin, key) => {
if (perCoin.num > 0) {
perCoin.num = '+' + perCoin.num;
data[key].num = '+' + perCoin.num;
}
});
if (page && page <= total) {
return _yohoCoin(uid).then(list => {
if (list.yohocoin_num && list.yohocoin_num !== 0) {
result.data = _.assign(result.data, {
money: true
});
} else {
result.data = _.assign(result.data, {
money: false
});
}
return result.data;
});
} else {
return;
}
} else {
logger.error('youholist code no 200');
}
return data;
});
};
const currencyDetailIndex = (uid, page, limit) => {
return Promise.all(
[currencyDetail(uid, page, limit), _yohoCoin(uid)]
).then(result => {
return {
coinlist: result[0],
yohoCoin: result[1]
};
});
};
module.exports = {
myCurrency,
currencyDetailIndex,
currencyDetail,
bannerData
};
... ...
<div class="yoho-coin-detail-page yoho-page">
{{#unless money}}
<div class="money">你拥有的有货币:<span>0</span></div>
<div class="money">你拥有的有货币:<span>0</span></div>
{{/unless}}
<ul class="coin-detail"></ul>
<ul class="coin-detail">
{{# result.coinlist}}
<li>
<div class="detail-item">
<p class="title">{{message}}</p>
<p class="time">{{date}}</p>
<div class="count">
{{num}}
</div>
</div>
</li>
{{/ result.coinlist}}
</ul>
</div>
\ No newline at end of file
... ...
<div class="yoho-coin-page yoho-page">
{{# yohoCoin}}
<p class="coin-num">
<em>{{coin_num}}</em>
有货币
</p>
<section>
<p class="title">有货币</p>
<hr>
<p>
<span class="sub-title">有货币是什么,有什么用?</span>
有货币是有货商城的虚拟货币,与现金比例1:1,没有任何使用期限,有货币可直接用于有货线上购物使用,不可转让他人,不可兑换为现金。使用有货币支付的金额不可计入消费金额。
</p>
<p>
<span class="sub-title">如何查看自己的有货币?</span>
<span class="path">登录 > 个人中心 > 我的有货币</span>
</p>
<p>
<span class="sub-title">有货币如何购买支付?</span>
在购买支付页面输入您要使用的有货币金额即可完成支付
<div class="remark">
<span></span>
如果超过了我们约定的期限的非正常退货,我们将会于您的退款金额中直接扣除赠送有货币等值的金额。赠送给您的有货币还将保留在您的账户中,敬请谅解。
</div>
</p>
</section>
{{/ yohoCoin}}
</div>
\ No newline at end of file
... ... @@ -17,21 +17,21 @@ module.exports = {
assetUrl: '//127.0.0.1:5001',
testCode: 'yoho4946abcdef#$%&!@',
domains: {
// api: 'http://api-test3.yohops.com:9999/',
// service: 'http://service-test3.yohops.com:9999/',
// liveApi: 'http://testapi.live.yohops.com:9999/',
// singleApi: 'http://api-test3.yohops.com:9999/',
// imSocket: 'ws://im.yohobuy.com:10240',
// imCs: 'http://im.yohobuy.com/api',
// imServer: 'http://im.yohobuy.com/server'
api: 'http://api-test3.yohops.com:9999/',
service: 'http://service-test3.yohops.com:9999/',
liveApi: 'http://testapi.live.yohops.com:9999/',
singleApi: 'http://api-test3.yohops.com:9999/',
imSocket: 'ws://im.yohobuy.com:10240',
imCs: 'http://im.yohobuy.com/api',
imServer: 'http://im.yohobuy.com/server'
api: 'http://api.yoho.cn/',
service: 'http://service.yoho.cn/',
liveApi: 'http://api.live.yoho.cn/',
singleApi: 'http://single.yoho.cn/',
imSocket: 'wss://imsocket.yohobuy.com:443',
imCs: 'https://imhttp.yohobuy.com/api',
imServer: 'https://imhttp.yohobuy.com/server'
// api: 'http://api.yoho.cn/',
// service: 'http://service.yoho.cn/',
// liveApi: 'http://api.live.yoho.cn/',
// singleApi: 'http://single.yoho.cn/',
// imSocket: 'wss://imsocket.yohobuy.com:443',
// imCs: 'https://imhttp.yohobuy.com/api',
// imServer: 'https://imhttp.yohobuy.com/server'
},
subDomains: {
host: '.m.yohobuy.com',
... ...
require('../../scss/home/coin/_yoho-coin-detail.css');
var $ = require('yoho-jquery'),
loading = require('../plugin/loading');
var page = 1;
var flag = true;
loading = require('../plugin/loading'),
currencyDetailHbs = require('home/ajax-currency-detail.hbs');
require('../common');
var page = 1,
flag = true;
loading.showLoadingMask();
require('../common');
function ajaxCurrencyDetail(curPage) {
loading.showLoadingMask();
flag = false;
$.ajax({
type: 'post',
url: '/home/ajaxCurrencyDetail',
dataType: 'html',
dataType: 'json',
data: {
page: curPage
},
success: function(data) {
$('.coin-detail').append(data);
if (data.length <= 0) {
flag = false;
return false;
}
loading.hideLoadingMask();
$('.coin-detail').append(currencyDetailHbs({coinlist: data}));
flag = true;
}
});
... ... @@ -35,6 +44,3 @@ $(window).scroll(function() {
window.requestAnimationFrame(scrollHandler);
});
ajaxCurrencyDetail(page);
$(document).ready(loading.hideLoadingMask);
... ...
/**
* 新有货币界面
*/
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload');
require('../common');
lazyLoad($('img.lazy'));
function getGender() {
return window.cookie('_Channel') || 'boys';
}
require('../channel/maybe-like')(getGender());
if ($('#goods-list').length === 0) {
$('.maybe-like').hide();
}
/**
* 新有货币界面
*/
require('../../scss/home/_currency-index.css');
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload');
require('../common');
function getGender() {
return window.cookie('_Channel') || 'boys';
}
require('../channel/maybe-like')(getGender());
setTimeout(function() {
lazyLoad($('img.lazy'));
if ($('#goods-list').length === 0) {
$('.maybe-like').hide();
}
}, 30);
... ...
@import "../channel/maybe-like";
@import "../common/index";
@import "coin/yoho-coin-new";
... ...
... ... @@ -3,7 +3,6 @@
@import "order";
@import "order-detail";
@import "personal-details";
@import "yoho-coin";
@import "fav";
@import "suggest";
@import "address";
... ... @@ -13,8 +12,6 @@
@import "browse-record";
@import "logistic";
@import "pay";
@import "yoho-coin-new";
@import "yoho-coin-detail";
@import "installment/index";
@import "qrcode";
@import "myqrcode";
... ...
.yoho-coin-page {
.coin-num {
font-size: 1.4em;
text-align: center;
em {
font-size: 4em;
color: #f00;
}
span {
width: 100%;
height: auto;
overflow: hidden;
display: block;
color: #b0b0b0;
margin-top: -0.6rem;
}
}
.check {
width: 100%;
height: auto;
overflow: hidden;
text-align: center;
margin-top: 0.6rem;
padding-bottom: 1rem;
border-bottom: 1px solid #b0b0b0;
a {
line-height: 1.2rem;
border: 1px solid #444;
width: 30%;
height: 100%;
font-size: 1.2em;
display: inline-block;
border-radius: 0.6rem;
}
}
section p {
line-height: 1.5em;
}
.title {
font-size: 16px;
line-height: 20px;
font-weight: bold;
}
.sub-title {
display: block;
font-size: 14px;
line-height: 28px;
font-weight: bold;
}
.path {
color: #f60;
}
.remark {
color: #666;
span {
color: #9c3;
}
}
}
... ... @@ -22,9 +22,9 @@
.dollar {
display: inline-block;
width: 24px;
height: 24px;
background: url("/home/yoho-coin/dollar.png") center center;
width: 22px;
height: 22px;
background: resolve("home/yoho-coin/dollar.png") no-repeat;
background-size: 100% 100%;
}
}
... ...