Authored by Lynnic

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

... ... @@ -382,23 +382,27 @@ class AbstractAction extends Controller_Abstract
$header['navHome'] = $homeUrl . '?go=1&t=' . time();
}
// 根据COOKIE记录的频道进行导航定位
$channel = Helpers::getChannelByCookie();
switch ($channel) {
default:
case 1:
$header['boys'] = true;
break;
case 2:
$header['girls'] = true;
break;
case 3:
$header['kids'] = true;
break;
case 4:
$header['lifeStyle'] = true;
break;
}
$controller = $this->getRequest()->getControllerName();
if ($controller !== 'Home') {
// 根据COOKIE记录的频道进行导航定位
$channel = Helpers::getChannelByCookie();
switch ($channel) {
default:
case 1:
$header['boys'] = true;
break;
case 2:
$header['girls'] = true;
break;
case 3:
$header['kids'] = true;
break;
case 4:
$header['lifeStyle'] = true;
break;
}
}
$this->_view->assign('pageHeader', $header);
}
/**
... ...
... ... @@ -16,10 +16,33 @@ var $action = $('.action'),
$area = $('.area'),
$footer = $('#yoho-footer'),
$confim = $('.confim-mask'),
$pageWrap = $('.page-wrap'),
$backBtn = $('.nav-back'),
isSubmiting,
deleteId,
currentPage = 'address',
newArea = [];
// 清除原有链接
$backBtn.attr('href', 'javascript:void(0);');
// 自定义事件
$backBtn.on('touchend', function(e) {
if (currentPage === 'edit') {
$pageWrap.hide();
$pageWrap.first().show();
e.preventDefault();
currentPage = 'address';
} else if (currentPage === 'list') {
$pageWrap.hide();
$editAddressPage.show();
e.preventDefault();
currentPage = 'edit';
} else {
window.history.go(-1);
}
});
function editAddress(data) {
data = data || {};
$addressForm.find('[name="id"]').val(data.id || '');
... ... @@ -28,10 +51,11 @@ function editAddress(data) {
$addressForm.find('[name="area_code"]').val(data.areaCode || '');
$addressForm.find('[name="area"]').val(data.area || '');
$addressForm.find('[name="address"]').val(data.address || '');
$editAddressPage.show();
// $addressForm.find('[name="address"]').blur();
// $addressForm.find('[name="consignee"]').focus();
currentPage = 'edit';
$footer.hide();
$pageWrap.hide();
$editAddressPage.show();
}
$confim.on('touchend', '.cancel', function() {
... ... @@ -130,11 +154,15 @@ $addressForm.on('submit', function() {
// 省市区
$area.on('touchend', function() {
$footer.hide();
$pageWrap.hide();
$addressListPage.show();
currentPage = 'list';
});
$addressListPage.on('touchend', '.address', function() {
newArea.push($(this).children('.caption').text());
var caption = $(this).children('.caption').text();
newArea.push(caption);
$(this).siblings().hide();
$(this).children('ul').show();
return false;
... ... @@ -145,11 +173,13 @@ $addressListPage.on('touchend', '.address', function() {
$('[name="area"]').val(newArea.join(' '));
$('[name="area_code"]').val($(this).data('id'));
$editAddressPage.show();
currentPage = 'edit';
// 恢复默认的三级选择
$addressListPage.hide();
$addressListPage.find('ul').hide();
$addressListPage.children('ul').show().children('li').show();
$footer.show();
newArea = [];
return false;
});
... ...
.my-address-page {
position: absolute;
bottom: 0;
top: pxToRem(90px);
width: 100%;
background: #f0f0f0;
padding-bottom: pxToRem(20px);
.address-item {
padding: pxToRem(20px) pxToRem(30px);
... ... @@ -41,6 +39,7 @@
.add-address {
display: block;
margin-top: pxToRem(30px);
margin-bottom: pxToRem(30px);
font-size: pxToRem(32px);
line-height: pxToRem(88px);
color: #444;
... ... @@ -100,9 +99,6 @@
}
.my-edit-address-page {
position: absolute;
bottom: 0;
top: 0;
width: 100%;
color: #d0d0d0;
background: #f0f0f0;
... ... @@ -176,9 +172,6 @@
}
.my-address-list-page {
position: absolute;
bottom: 0;
top: 0;
width: 100%;
color: #444;
background: #fff;
... ...
.my-page {
color: #444;
background: #f0f0f0;
padding-bottom: pxToRem(20px);
a {
color: #444;
... ...
... ... @@ -25,7 +25,7 @@
background-size: 100%;
}
span{
>span{
&:first-of-type{
color: #444;
line-height:100rem / $pxConvertRem;
... ... @@ -45,11 +45,24 @@
border:1px solid #eee;
}
.grade{
width:85rem / $pxConvertRem;
height: 30rem / $pxConvertRem;
overflow: hidden;
display: inline-block;
margin-top: 25rem / $pxConvertRem;
width: 100%;
height: 100%;
overflow: hidden;
display: block;
position: relative;
i{
width:80rem / $pxConvertRem;
height: 30rem / $pxConvertRem;
overflow: hidden;
display: block;
position: absolute;
right: 40rem / $pxConvertRem;
top:50%;
@include transform(translateY(-50%))
}
span{
color: #b0b0b0;
}
}
.vip-3 {
@include rem-sprite($vip, vip-3);
... ...
... ... @@ -13,7 +13,7 @@
}
.swiper-container {
padding: pxToRem(20px) 0;
padding: pxToRem(30px) 0 pxToRem(20px);
width: 100%;
height: pxToRem(252px);
overflow: hidden;
... ...
{{> layout/header}}
<div class="my-address-page yoho-page">
{{# address}}
<div class="address-item">
<span class="name">{{consignee}}</span>
<span class="tel">{{mobile}}</span>
<p class="address-info">{{area}} {{address}}</p>
<div class="action iconfont">
<span class="edit" data-id="{{address_id}}" data-consignee="{{consignee}}" data-mobile="{{mobile}}" data-area-code="{{area_code}}" data-area="{{area}}" data-address="{{address}}">&#xe61e;</span>
<span class="del" data-id="{{address_id}}">&#xe621;</span>
<div class="page-wrap">
{{# address}}
<div class="address-item">
<span class="name">{{consignee}}</span>
<span class="tel">{{mobile}}</span>
<p class="address-info">{{area}} {{address}}</p>
<div class="action iconfont">
<span class="edit" data-id="{{address_id}}" data-consignee="{{consignee}}" data-mobile="{{mobile}}" data-area-code="{{area_code}}" data-area="{{area}}" data-address="{{address}}">&#xe61e;</span>
<span class="del" data-id="{{address_id}}">&#xe621;</span>
</div>
</div>
</div>
{{/ address}}
<a class="add-address">
添加新地址
</a>
{{/ address}}
<a class="add-address">
添加新地址
</a>
<div class="confim-mask hide">
<div class="confim-box">
<div class="content">
你确定要删除地址吗?
</div>
<div class="action">
<span class="cancel">
取消
</span>
<span class="confim">
确认
</span>
<div class="confim-mask hide">
<div class="confim-box">
<div class="content">
你确定要删除地址吗?
</div>
<div class="action">
<span class="cancel">
取消
</span>
<span class="confim">
确认
</span>
</div>
</div>
</div>
</div>
... ...
... ... @@ -5,28 +5,28 @@
</div>
{{# couponsUrl}}
<div class="employ-list">
{{# unused}}
{{# used}}
<div class="employ-main">
<span>{{ money}}</span>
<p>{{ coupon_name}}</p>
<p>{{ couponValidity}}</p>
</div>
{{/ unused}}
{{^ unused}}
{{/ used}}
{{^ used}}
<p class="null">未找到相关相关优惠券</p>
{{/ unused}}
{{/ used}}
</div>
<div class="employ-list not none">
{{# used}}
{{# unused}}
<div class="employ-main">
<span>{{ money}}</span>
<p>{{ coupon_name}}</p>
<p>{{ couponValidity}}</p>
</div>
{{/ used}}
{{^ used}}
{{/ unused}}
{{^ unused}}
<p class="null">未找到相关相关优惠券</p>
{{/ used}}
{{/ unused}}
</div>
{{/ couponsUrl}}
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -8,40 +8,7 @@
<div class="fav-content" id="fav-content">
<div class="fav-type">
<ul class="fav-product-list">
{{# hasFavProduct}}
<li data-id="{{fav_id}}">
<a href="{{link}}">
<div class="fav-img-box">
<img src="{{imgUrl}}" alt=""/>
</div>
<div class="fav-info-list">
<h2>{{title}}</h2>
<div class="fav-price">
{{# discountPrice}}
<span class="new-price">{{.}}</span>
{{/ discountPrice}}
<span class="fav-price {{# discountPrice}}price-underline{{/ discountPrice}}">{{price}}</span>
</div>
{{# savePrice}}
<div class="save-price save-price-number">
比收藏时降价了<span>{{.}}</span>
<span class="del-fav"></span>
</div>
{{/ savePrice}}
{{^ savePrice}}
<div class="save-price">
{{# sellOut}}
<span class="sell-out">已售罄</span>
{{/ sellOut}}
<span class="del-fav"></span>
</div>
{{/ savePrice}}
</div>
</a>
</li>
{{/ hasFavProduct}}
{{> home/favorite_product_list}}
</ul>
{{^ hasFavProduct}}
... ... @@ -50,43 +17,7 @@
{{/ hasFavProduct}}
</div>
<div class="fav-type">
{{# hasFavBrand}}
<div class="fav-brand-swiper">
<div class="swiper-header">
<div class="swiper-logo">
<img src="{{brandImg}}" alt=""/>
</div>
<div class="brand-info">
<span class="brand-name">{{brandName}}</span>
<div class="brand-update">
{{# update}}
<span class="brand-new">上新<b>{{.}}</b></span>
{{/ update}}
{{# discount}}
<span class="brand-discount">折扣<b>{{.}}</b></span>
{{/ discount}}
</div>
</div>
<a class="fav-more" href="{{link}}"></a>
</div>
<div id="swiper-container-{{id}}" class="swiper-container" data-id="{{id}}">
<ul class="swiper-wrapper swiper-wrapper-{{id}}">
{{# productList}}
<li class="swiper-slide">
<img class="swiper-lazy" data-src="{{imgUrl}}" alt=""/>
<div class="brand-product">
<p class="{{# discount}}price-discount{{/ discount}}">
{{price}}
{{# discount}}<span>{{.}}{{/ discount}}<span>
</p>
</div>
<div class="swiper-lazy-preloader"></div>
</li>
{{/ productList}}
</ul>
</div>
</div>
{{/ hasFavBrand}}
{{> home/favorite_brand_list}}
{{^ hasFavBrand}}
<span class="fav-null">您暂无收藏任何品牌</span>
... ...
{{> home/favorite_brand_list}}
\ No newline at end of file
... ...
{{> home/favorite_product_list}}
\ No newline at end of file
... ...
... ... @@ -6,7 +6,7 @@
<span class="user-avatar" data-avatar="{{head_ico}}"></span>
<span class="username">{{profile_name}}</span>
{{#vip_info}}
<span class="vip-icon vip-{{next_level}}"></span>
<span class="vip-icon vip-{{cur_level}}"></span>
{{/vip_info}}
<div class="iconfont more-icon">&#xe604;</div>
</a>
... ...
... ... @@ -7,10 +7,11 @@
<li><span>生日</span><span>{{ birthday }}</span></li>
<li><span>会员等级</span>
<span>
<a href="grade">
<a href="grade" class="grade">
{{# vip_info}}
<i class="grade vip-icon vip-{{ next_level }}"></i>
<i class="vip-icon vip-{{ cur_level}}"></i>
{{/ vip_info}}
<span class="iconfont">&#xe604;</span>
</a>
</span>
</li>
... ...
{{# hasFavBrand}}
<div class="fav-brand-swiper">
<div class="swiper-header">
<div class="swiper-logo">
<img src="{{brandImg}}" alt=""/>
</div>
<div class="brand-info">
<span class="brand-name">{{brandName}}</span>
<div class="brand-update">
{{# update}}
<span class="brand-new">上新<b>{{.}}</b></span>
{{/ update}}
{{# discount}}
<span class="brand-discount">折扣<b>{{.}}</b></span>
{{/ discount}}
</div>
</div>
<a class="fav-more" href="{{link}}"></a>
</div>
<div id="swiper-container-{{id}}" class="swiper-container" data-id="{{id}}">
<ul class="swiper-wrapper swiper-wrapper-{{id}}">
{{# productList}}
<li class="swiper-slide">
<img class="swiper-lazy" data-src="{{imgUrl}}" alt=""/>
<div class="brand-product">
<p class="{{# discount}}price-discount{{/ discount}}">
{{price}}
{{# discount}}<span>{{.}}{{/ discount}}<span>
</p>
</div>
<div class="swiper-lazy-preloader"></div>
</li>
{{/ productList}}
</ul>
</div>
</div>
{{/ hasFavBrand}}
\ No newline at end of file
... ...
{{# hasFavProduct}}
<li data-id="{{fav_id}}">
<a href="{{link}}">
<div class="fav-img-box">
<img src="{{imgUrl}}" alt=""/>
</div>
<div class="fav-info-list">
<h2>{{title}}</h2>
<div class="fav-price">
{{# discountPrice}}
<span class="new-price">{{.}}</span>
{{/ discountPrice}}
<span class="fav-price {{# discountPrice}}price-underline{{/ discountPrice}}">{{price}}</span>
</div>
{{# savePrice}}
<div class="save-price save-price-number">
比收藏时降价了<span>{{.}}</span>
<span class="del-fav"></span>
</div>
{{/ savePrice}}
{{^ savePrice}}
<div class="save-price">
{{# sellOut}}
<span class="sell-out">已售罄</span>
{{/ sellOut}}
<span class="del-fav"></span>
</div>
{{/ savePrice}}
</div>
</a>
</li>
{{/ hasFavProduct}}
\ No newline at end of file
... ...
<div class="my-address-list-page hide">
<div class="my-address-list-page page-wrap hide">
<ul class="address-list">
{{# addressList}}
<li class="address">
... ...
<div class="my-edit-address-page hide">
<div class="my-edit-address-page page-wrap hide">
<form class="edit-address">
<input type="hidden" name="id" value="">
<label class="username">
收件人
收件人姓名
<input type="text" name="consignee" value="">
</label>
<label class="mobile">
... ...
<div class="recommend-for-you">
<div class="recommend-for-you hide">
</div>
\ No newline at end of file
... ...
... ... @@ -28,9 +28,9 @@ class HomeController extends AbstractAction
// 检查用户是否登录, 未登录则跳转到登录页
// @todo 为了方便测试,支持传uid参数
$uid = $this->getUid();
if (!$uid) {
/*if (!$uid) {
$uid = $this->_uid = $this->get('uid', 8826435); //$this->getUid(true);
}
}*/
$action = $this->getRequest()->getActionName();
if (!$uid && $action !== 'index') {
... ... @@ -61,7 +61,7 @@ class HomeController extends AbstractAction
$data += UserModel::getUserProfileData($uid);
$data += UserModel::getInfoNumData($uid);
}
$this->_view->display('index', $data);
}
... ... @@ -98,8 +98,8 @@ class HomeController extends AbstractAction
$uid = $this->getUid();
$gender = Helpers::getGenderByCookie();
$favProducts = UserModel::getFavProductData($uid);
$favBrands = UserModel::getFavBrandData($uid, $gender);
$favProducts = UserModel::getFavProductData($this->_uid, 1, 10);
$favBrands = UserModel::getFavBrandData($this->_uid, 10, 1, 10);
$data = array(
'favPage' => true, //加载js
... ... @@ -119,6 +119,44 @@ class HomeController extends AbstractAction
}
/**
* 用户收藏的商品数据获取接口
*/
public function favProductAction() {
$result = array();
if ($this->isAjax()) {
$page = $this->post('page', 1);
$result = UserModel::getFavProductData($this->_uid, $page, 10);
}
if (empty($result)) {
echo ' ';
} else {
$this->_view->display('favorite_product', $result);
}
}
/**
* 用户收藏的品牌数据获取接口
*/
public function favBrandAction() {
$result = array();
if ($this->isAjax()) {
$page = $this->post('page', 1);
$result = UserModel::getFavBrandData($this->_uid, 10, $page, 10);
}
if (empty($result)) {
echo ' ';
} else {
$this->_view->display('favorite_brand', $result);
}
}
/**
* 用户收藏的商品-删除
*/
public function favoriteDelAction()
... ... @@ -205,6 +243,7 @@ class HomeController extends AbstractAction
'couponsUrl' => UserModel::getCouponData($uid),
'couponsPage' => true
);
$this->_view->display('coupons', $coupons);
}
... ...
... ... @@ -145,14 +145,16 @@ class UserModel
* 处理用户收藏的商品数据
*
* @param int $uid 用户ID
* @param int $page 第几页
* @param int $limit 限制读取的数目,默认10
* @return array|mixed 处理之后的收藏的商品数据
*/
public static function getFavProductData($uid)
public static function getFavProductData($uid, $page, $limit)
{
$result = array();
// 调用接口获取用户收藏的商品数据
$favProduct = UserData::favoriteProductData($uid);
$favProduct = UserData::favoriteProductData($uid, $page, $limit);
// 处理用户收藏的商品数据
if (isset($favProduct['data']) && !empty($favProduct['data'])) {
... ...