Authored by yangyang

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

... ... @@ -943,7 +943,8 @@
{
name: '',
active: true,
typeId: 1
typeId: 1,
url: ''
},
...
]
... ...
/**
* 我的逛
* @author xuqi<qi.xu@yoho.cn>
* @date: 2015/11/17
*/
var $ = require('jquery');
var info = require('../guang/info');
info.initInfoEvt($('#info-list'));
\ No newline at end of file
... ...
... ... @@ -17,27 +17,32 @@ var winH = $(window).height();
var activeType = $navLi.filter('.active').data('type'); //当前active的项的index
var orderPage = {};
var order = {
page: 0,
end: false
};
var inAjax = false;
var loading = require('../plugin/loading');
var navHammer, orderHammer;
var orderHammer;
//加载订单
function getOrders() {
function getOrders(option) {
var opt = {
type: activeType,
page: orderPage[activeType] ? (orderPage[activeType] + 1) : 1
page: order.page + 1
};
var show = option && option.showLoadingMask;
if (inAjax) {
return;
}
inAjax = true;
loading.showLoadingMask();
show && loading.showLoadingMask();
$.ajax({
type: 'GET',
... ... @@ -46,23 +51,27 @@ function getOrders() {
success: function(data) {
var num;
if (data.code === 200) {
orderPage[opt.type] = opt.page;
if (data !== ' ') {
order.page = opt.page;
if (opt.page === 1) {
$curContainer.html(data.data);
$curContainer.html(data);
lazyLoad($curContainer.find('.lazy'));
} else {
num = $curContainer.children('.order').length;
$curContainer.append(data.data);
$curContainer.append(data);
//lazyload
lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ') .lazy'));
lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ')').find('.lazy'));
}
window.rePosFooter(); //重新计算底部位置
} else {
order.end = true;
}
inAjax = false;
loading.hideLoadingMask();
show && loading.hideLoadingMask();
}
});
}
... ... @@ -83,33 +92,6 @@ lazyLoad();
loading.init($('body')); //满屏loading
//导航切换
navHammer = new Hammer(document.getElementById('order-nav'));
navHammer.on('tap', function(e) {
var $cur = $(e.target).closest('li'),
index;
if ($cur.length === 0 || $cur.hasClass('active')) {
return;
}
index = $cur.index();
$navLi.filter('.active').removeClass('active');
$cur.addClass('active');
$curContainer.addClass('hide');
$curContainer = $orderContainer.children(':eq(' + index + ')').removeClass('hide');
activeType = $cur.data('type');
if (orderPage[activeType]) {
return;
} else {
getOrders();
}
});
//点击订单区域跳转订单详情页
orderHammer = new Hammer(document.getElementById('order-container'));
orderHammer.on('tap', function(e) {
... ... @@ -168,9 +150,13 @@ orderHammer.on('tap', function(e) {
});
$(window).scroll(function() {
if ($(window).scrollTop() + winH >
if (order.end === false && $(window).scrollTop() + winH >
$(document).height() - 0.25 * $orderContainer.height()) {
getOrders();
//下拉请求时不显示mask
getOrders({
noLoadingMask: true
});
}
});
... ...
... ... @@ -78,7 +78,7 @@
font-size: pxToRem(32px);
line-height: pxToRem(88px);
span {
a {
color: #e0e0e0;
float: right;
}
... ... @@ -110,6 +110,7 @@
background: #fff;
.list-item {
display: block;
position: relative;
padding: 0 pxToRem(30px);
font-size: pxToRem(32px);
... ...
... ... @@ -106,7 +106,14 @@
border-bottom: 1px solid #e0e0e0;
background: #fff;
> li{
a {
display: block;
height: 100%;
width: 100%;
color: #b0b0b0;
}
> li {
float: left;
height: 90rem / $pxConvertRem;
width: 25%;
... ... @@ -115,7 +122,7 @@
font-size: 26rem / $pxConvertRem;
text-align: center;
&.active {
&.active a {
color: #000;
}
}
... ...
... ... @@ -11,15 +11,15 @@
</div>
</div>
<div class="my-link clearfix">
<a class="link-item" href="/home">
<a class="link-item" href="/home/">
{{product_favorite_total}}
<p>收藏的商品</p>
</a>
<a class="link-item" href="/home">
<a class="link-item" href="/home/">
{{brand_favorite_total}}
<p>收藏的品牌</p>
</a>
<a class="link-item" href="/home">
<a class="link-item" href="/home/">
{{product_browse}}
<p>浏览记录</p>
</a>
... ... @@ -27,9 +27,9 @@
<div class="my-order">
<div class="order-title">
我的订单
<span class="iconfont">
<a class="iconfont" href="/home/order">
查看全部订单 &#xe604;
</span>
</a>
</div>
<div class="order-type clearfix">
<a class="type-item" href="/home/order">
... ... @@ -47,44 +47,44 @@
</div>
</div>
<div class="group-list">
<div class="list-item">
<a class="list-item" href="/home/address">
<span class="iconfont icon">&#xe637;</span>
地址管理
<span class="iconfont num">3 &#xe604;</span>
</div>
</a>
</div>
<div class="group-list">
<div class="list-item">
<a class="list-item" href="/home/">
<span class="iconfont icon">&#xe63a;</span>
优惠券
<span class="iconfont num">{{coupon_num}} &#xe604;</span>
</div>
<div class="list-item">
</a>
<a class="list-item" href="/home/">
<span class="iconfont icon">&#xe635;</span>
YOHO
<span class="iconfont num">{{yoho_coin_num}} &#xe604;</span>
</div>
</a>
</div>
<div class="group-list">
<div class="list-item">
<a class="list-item" href="/home/">
<span class="iconfont icon">&#xe636;</span>
消息
<span class="iconfont num">{{inbox_total}} &#xe604;</span>
</div>
</a>
</div>
<div class="group-list">
<div class="list-item">
<a class="list-item" href="/home/">
<span class="iconfont icon">&#xe63c;</span>
在线客服
<span class="iconfont num">&#xe604;</span>
</div>
</a>
</div>
<div class="group-list">
<div class="list-item">
<a class="list-item" href="/home/">
<span class="iconfont icon">&#xe639;</span>
帮助
<span class="iconfont num">&#xe604;</span>
</div>
</a>
</div>
{{> product/recommend-for-you}}
... ...
... ... @@ -4,7 +4,7 @@
<ul id="order-nav" class="order-nav clearfix">
{{#each navs}}
<li {{#if active}}class="active"{{/if}} data-type="{{typeId}}">
{{name}}
<a href="{{url}}">{{name}}</a>
</li>
{{/each}}
</ul>
... ...
... ... @@ -456,7 +456,7 @@ class HomeController extends AbstractAction
}
//ajax请求订单页面
public function getOrderAction() {
public function getOrdersAction() {
//判断是不是ajax请求
if (!$this->isAjax()) {
$this->error();
... ...