Authored by 毕凯

Merge branch 'feature/goodsDetail' into develop

... ... @@ -475,65 +475,7 @@ class WebAction extends Controller_Abstract
$header = array(
'navbars'=> \Index\HomeModel::getNavBars($channel),
'gobytype'=> 'gobuy'.$channel,
'searchcate'=>'searchcate'.$channel,
'myyoho' => array(
'email'=>'hhh@126.com',
'viptype'=>'普通会员',
'currentscore' => 495,
'totalscore' => 600,
'cardtype' => '银卡',
'infolist' => array(
array(
'name' =>'待处理的订单',
'link' =>'',
'num' => '0'
),
array(
'name' =>'我的收藏',
'link' =>'',
'num' => '1'
),
array(
'name' =>'我的优惠券',
'link' =>'',
'num' => '2'
),
array(
'name' =>'我的YOHO币',
'link' =>'',
'num' => '1'
),
array(
'name' =>'我的退货换货',
'link' =>'',
'num' => '1'
)
),
'updlink' => ''
),
'gobuy'=> array(
'gobuynum' =>3
),
'breadcrumbnav'=> array(
array(
'notend'=>array(
'link' => 'http=>//www.baidu.com',
'name' => 'BOYS首页'
)
),
array(
'notend'=>array(
'link' => 'http=>//www.baidu.com',
'name' => '上衣'
)
),
array(
'isend'=>array(
'link' => 'http=>//www.baidu.com',
'name' => '衬衫'
)
)
)
'searchcate'=>'searchcate'.$channel
);
$this->_view->assign('headerdata', $header);
}
... ...
... ... @@ -44,4 +44,14 @@ class FavoriteData {
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_PRODUCT_FAVORITE, 'delUidProductFav', array($uid, $productSkn));
}
/**
* 根据uid和商品的skn添加或取消收藏品牌
* @param $uid
* @param $productSkn
* @return bool
*/
public static function changeFavoriteBrand($uid, $productSkn)
{
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_PRODUCT_FAVORITE, 'toggleBrandFav', array($uid, $productSkn));
}
}
... ...
... ... @@ -95,7 +95,7 @@ class HelperSearch
$result['leftContent'][]['newSales'] = self::recentShelve($data['recent']['recent']);
}
//品牌banner
$result['brandBanner'] = isset($data['brand']) ? self::getBannerFormat($data['brand'], $options['brandBanner']) : array();
$result['brandBanner'] = isset($data['brand']) && !empty($data['brand']) ? self::getBannerFormat($data['brand'], $options['brandBanner']) : array();
//总记录数
if (isset($data['product']['total'])) {
$result['totalCount'] = $data['product']['total'];
... ...
... ... @@ -101,12 +101,18 @@ exports.init = function(num) {
removeHtmlFn();
ulStr = createColorList(data).colorListStr; //ajax请求的颜色列表
ulNum = createColorList(data).ulNum;//ajax请求的颜色的数量
ulStr = createColorList(data.pics).colorListStr; //ajax请求的颜色列表
ulNum = createColorList(data.pics).ulNum;//ajax请求的颜色的数量
$goodInfoMain.append(event.targetDuplicate);
$goodSelectColor.append($(ulStr));
if (data.isFavorite) {
$goodInfoMain.find('.col-btn').addClass('coled');
} else {
$goodInfoMain.find('.col-btn').removeClass('coled');
}
wrapperPl = $goodItemWrapper.css('paddingLeft');
wrapperPt = $goodItemWrapper.css('paddingTop');
containerPt = $goodsContainer.css('paddingTop');
... ... @@ -134,8 +140,8 @@ exports.init = function(num) {
});
// 鼠标悬浮获取到商品信息后显示第一张图片
if (data[0] && data[0].src) {
$goodInfoMain.find('.good-thumb img').attr('src', data[0].src);
if (data.pics[0] && data.pics[0].src) {
$goodInfoMain.find('.good-thumb img').attr('src', data.pics[0].src);
}
//}, 1000);
... ... @@ -143,6 +149,7 @@ exports.init = function(num) {
});
$goodItemWrapper.mouseleave(function() {
removeHtmlFn();
});
... ... @@ -163,6 +170,19 @@ $(document).on('hover', '.good-select-color li', function() {
$coverImg.attr('src', coverImg);
});
$goodInfoMain.on('click', '.col-btn', function() {
$.ajax({
type: 'POST',
url: '/product/list/changeFavorite',
data: {
skn: $(this).closest('.good-info').data('skn'),
isFavorite: !$(this).hasClass('coled')
}
}).then(function(res) {
console.log(res);
});
});
// 左侧导航
$productListNav.click(function() {
if ($(this).hasClass('active')) {
... ...
... ... @@ -66,6 +66,10 @@
color: #ccc;
font-size: 12px;
display: none;
&.coled {
color: #f95b4f;
}
}
.tag-container {
... ...
... ... @@ -36,10 +36,10 @@ class HomeModel
// 男首首页
const CODE_BOYS_CHANNEL = 'c15bf0cbfbd4893fd70c869c991f6d3d';
// 女首首页
const CODE_GIRLS_CHANNEL = '4d897f3b8eec0c465db0125e5b1f9edf';
const CODE_GIRLS_CHANNEL = 'a519ba44ef3a85cf3c05e405c6ba8e53';//'4d897f3b8eec0c465db0125e5b1f9edf';
// 'a519ba44ef3a85cf3c05e405c6ba8e53';
// 潮童首页
const CODE_KIDS_CHANNEL = '331994d6fa8dc87f92a26dd45c0aa071';
const CODE_KIDS_CHANNEL = 'a7741b94e8bb9d56d0d36e00c05956f7';//'331994d6fa8dc87f92a26dd45c0aa071';
// 'a7741b94e8bb9d56d0d36e00c05956f7';
// 创意生活新
... ...
... ... @@ -221,8 +221,11 @@ class SearchModel
//组织数据结构
$data = HelperSearch::getProductPic($data['data']['product_list'], $options);
}
$data['isFavorite'] = $options['isFavorite'];
echo json_encode($data);
$res = array(
'pics'=>$data,
'isFavorite'=>$options['isFavorite']
);
echo json_encode($res);
}
/**
... ...
<?php
use Action\WebAction;
use LibModels\Web\Product\BrandData;
use LibModels\Web\Product\FavoriteData;
use \LibModels\Web\Product\HotrankData;
use product\HotrankModel;
... ... @@ -50,6 +51,7 @@ class IndexController extends WebAction
//调用模型获得数据
$data = Product\BrandsModel::getBrandSearchData($condition, $options);
$data = array(
//初始化js
'searchListPage' => true,
... ... @@ -106,6 +108,24 @@ class IndexController extends WebAction
//渲染模板
$this->_view->display('list',$data);
}
//收藏品牌
public function favoriteBrandAction()
{
if (!$this->isAjax()) {
return;
}
$uid = $this->post('uid');
$brandId = $this->post('brandId');
if ($uid && $brandId) {
//调用接口收藏或取消收藏
$result = FavoriteData::changeFavoriteBrand($uid, $brandId);
if (isset($result['code']) && $result['code'] == 200) {
$this ->echoJson($result['message']);
}
}
}
/**
* 热销排行
*/
... ...