Merge branch 'feature/goodsDetail' into develop
Showing
8 changed files
with
67 additions
and
68 deletions
@@ -475,65 +475,7 @@ class WebAction extends Controller_Abstract | @@ -475,65 +475,7 @@ class WebAction extends Controller_Abstract | ||
475 | $header = array( | 475 | $header = array( |
476 | 'navbars'=> \Index\HomeModel::getNavBars($channel), | 476 | 'navbars'=> \Index\HomeModel::getNavBars($channel), |
477 | 'gobytype'=> 'gobuy'.$channel, | 477 | 'gobytype'=> 'gobuy'.$channel, |
478 | - 'searchcate'=>'searchcate'.$channel, | ||
479 | - 'myyoho' => array( | ||
480 | - 'email'=>'hhh@126.com', | ||
481 | - 'viptype'=>'普通会员', | ||
482 | - 'currentscore' => 495, | ||
483 | - 'totalscore' => 600, | ||
484 | - 'cardtype' => '银卡', | ||
485 | - 'infolist' => array( | ||
486 | - array( | ||
487 | - 'name' =>'待处理的订单', | ||
488 | - 'link' =>'', | ||
489 | - 'num' => '0' | ||
490 | - ), | ||
491 | - array( | ||
492 | - 'name' =>'我的收藏', | ||
493 | - 'link' =>'', | ||
494 | - 'num' => '1' | ||
495 | - ), | ||
496 | - array( | ||
497 | - 'name' =>'我的优惠券', | ||
498 | - 'link' =>'', | ||
499 | - 'num' => '2' | ||
500 | - ), | ||
501 | - array( | ||
502 | - 'name' =>'我的YOHO币', | ||
503 | - 'link' =>'', | ||
504 | - 'num' => '1' | ||
505 | - ), | ||
506 | - array( | ||
507 | - 'name' =>'我的退货换货', | ||
508 | - 'link' =>'', | ||
509 | - 'num' => '1' | ||
510 | - ) | ||
511 | - ), | ||
512 | - 'updlink' => '' | ||
513 | - ), | ||
514 | - 'gobuy'=> array( | ||
515 | - 'gobuynum' =>3 | ||
516 | - ), | ||
517 | - 'breadcrumbnav'=> array( | ||
518 | - array( | ||
519 | - 'notend'=>array( | ||
520 | - 'link' => 'http=>//www.baidu.com', | ||
521 | - 'name' => 'BOYS首页' | ||
522 | - ) | ||
523 | - ), | ||
524 | - array( | ||
525 | - 'notend'=>array( | ||
526 | - 'link' => 'http=>//www.baidu.com', | ||
527 | - 'name' => '上衣' | ||
528 | - ) | ||
529 | - ), | ||
530 | - array( | ||
531 | - 'isend'=>array( | ||
532 | - 'link' => 'http=>//www.baidu.com', | ||
533 | - 'name' => '衬衫' | ||
534 | - ) | ||
535 | - ) | ||
536 | - ) | 478 | + 'searchcate'=>'searchcate'.$channel |
537 | ); | 479 | ); |
538 | $this->_view->assign('headerdata', $header); | 480 | $this->_view->assign('headerdata', $header); |
539 | } | 481 | } |
@@ -44,4 +44,14 @@ class FavoriteData { | @@ -44,4 +44,14 @@ class FavoriteData { | ||
44 | return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_PRODUCT_FAVORITE, 'delUidProductFav', array($uid, $productSkn)); | 44 | return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_PRODUCT_FAVORITE, 'delUidProductFav', array($uid, $productSkn)); |
45 | } | 45 | } |
46 | 46 | ||
47 | + /** | ||
48 | + * 根据uid和商品的skn添加或取消收藏品牌 | ||
49 | + * @param $uid | ||
50 | + * @param $productSkn | ||
51 | + * @return bool | ||
52 | + */ | ||
53 | + public static function changeFavoriteBrand($uid, $productSkn) | ||
54 | + { | ||
55 | + return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_PRODUCT_FAVORITE, 'toggleBrandFav', array($uid, $productSkn)); | ||
56 | + } | ||
47 | } | 57 | } |
@@ -95,7 +95,7 @@ class HelperSearch | @@ -95,7 +95,7 @@ class HelperSearch | ||
95 | $result['leftContent'][]['newSales'] = self::recentShelve($data['recent']['recent']); | 95 | $result['leftContent'][]['newSales'] = self::recentShelve($data['recent']['recent']); |
96 | } | 96 | } |
97 | //品牌banner | 97 | //品牌banner |
98 | - $result['brandBanner'] = isset($data['brand']) ? self::getBannerFormat($data['brand'], $options['brandBanner']) : array(); | 98 | + $result['brandBanner'] = isset($data['brand']) && !empty($data['brand']) ? self::getBannerFormat($data['brand'], $options['brandBanner']) : array(); |
99 | //总记录数 | 99 | //总记录数 |
100 | if (isset($data['product']['total'])) { | 100 | if (isset($data['product']['total'])) { |
101 | $result['totalCount'] = $data['product']['total']; | 101 | $result['totalCount'] = $data['product']['total']; |
@@ -101,12 +101,18 @@ exports.init = function(num) { | @@ -101,12 +101,18 @@ exports.init = function(num) { | ||
101 | removeHtmlFn(); | 101 | removeHtmlFn(); |
102 | 102 | ||
103 | 103 | ||
104 | - ulStr = createColorList(data).colorListStr; //ajax请求的颜色列表 | ||
105 | - ulNum = createColorList(data).ulNum;//ajax请求的颜色的数量 | 104 | + ulStr = createColorList(data.pics).colorListStr; //ajax请求的颜色列表 |
105 | + ulNum = createColorList(data.pics).ulNum;//ajax请求的颜色的数量 | ||
106 | 106 | ||
107 | $goodInfoMain.append(event.targetDuplicate); | 107 | $goodInfoMain.append(event.targetDuplicate); |
108 | $goodSelectColor.append($(ulStr)); | 108 | $goodSelectColor.append($(ulStr)); |
109 | 109 | ||
110 | + if (data.isFavorite) { | ||
111 | + $goodInfoMain.find('.col-btn').addClass('coled'); | ||
112 | + } else { | ||
113 | + $goodInfoMain.find('.col-btn').removeClass('coled'); | ||
114 | + } | ||
115 | + | ||
110 | wrapperPl = $goodItemWrapper.css('paddingLeft'); | 116 | wrapperPl = $goodItemWrapper.css('paddingLeft'); |
111 | wrapperPt = $goodItemWrapper.css('paddingTop'); | 117 | wrapperPt = $goodItemWrapper.css('paddingTop'); |
112 | containerPt = $goodsContainer.css('paddingTop'); | 118 | containerPt = $goodsContainer.css('paddingTop'); |
@@ -134,8 +140,8 @@ exports.init = function(num) { | @@ -134,8 +140,8 @@ exports.init = function(num) { | ||
134 | }); | 140 | }); |
135 | 141 | ||
136 | // 鼠标悬浮获取到商品信息后显示第一张图片 | 142 | // 鼠标悬浮获取到商品信息后显示第一张图片 |
137 | - if (data[0] && data[0].src) { | ||
138 | - $goodInfoMain.find('.good-thumb img').attr('src', data[0].src); | 143 | + if (data.pics[0] && data.pics[0].src) { |
144 | + $goodInfoMain.find('.good-thumb img').attr('src', data.pics[0].src); | ||
139 | } | 145 | } |
140 | 146 | ||
141 | //}, 1000); | 147 | //}, 1000); |
@@ -143,6 +149,7 @@ exports.init = function(num) { | @@ -143,6 +149,7 @@ exports.init = function(num) { | ||
143 | }); | 149 | }); |
144 | 150 | ||
145 | $goodItemWrapper.mouseleave(function() { | 151 | $goodItemWrapper.mouseleave(function() { |
152 | + | ||
146 | removeHtmlFn(); | 153 | removeHtmlFn(); |
147 | }); | 154 | }); |
148 | 155 | ||
@@ -163,6 +170,19 @@ $(document).on('hover', '.good-select-color li', function() { | @@ -163,6 +170,19 @@ $(document).on('hover', '.good-select-color li', function() { | ||
163 | $coverImg.attr('src', coverImg); | 170 | $coverImg.attr('src', coverImg); |
164 | }); | 171 | }); |
165 | 172 | ||
173 | +$goodInfoMain.on('click', '.col-btn', function() { | ||
174 | + $.ajax({ | ||
175 | + type: 'POST', | ||
176 | + url: '/product/list/changeFavorite', | ||
177 | + data: { | ||
178 | + skn: $(this).closest('.good-info').data('skn'), | ||
179 | + isFavorite: !$(this).hasClass('coled') | ||
180 | + } | ||
181 | + }).then(function(res) { | ||
182 | + console.log(res); | ||
183 | + }); | ||
184 | +}); | ||
185 | + | ||
166 | // 左侧导航 | 186 | // 左侧导航 |
167 | $productListNav.click(function() { | 187 | $productListNav.click(function() { |
168 | if ($(this).hasClass('active')) { | 188 | if ($(this).hasClass('active')) { |
@@ -36,10 +36,10 @@ class HomeModel | @@ -36,10 +36,10 @@ class HomeModel | ||
36 | // 男首首页 | 36 | // 男首首页 |
37 | const CODE_BOYS_CHANNEL = 'c15bf0cbfbd4893fd70c869c991f6d3d'; | 37 | const CODE_BOYS_CHANNEL = 'c15bf0cbfbd4893fd70c869c991f6d3d'; |
38 | // 女首首页 | 38 | // 女首首页 |
39 | - const CODE_GIRLS_CHANNEL = '4d897f3b8eec0c465db0125e5b1f9edf'; | 39 | + const CODE_GIRLS_CHANNEL = 'a519ba44ef3a85cf3c05e405c6ba8e53';//'4d897f3b8eec0c465db0125e5b1f9edf'; |
40 | // 'a519ba44ef3a85cf3c05e405c6ba8e53'; | 40 | // 'a519ba44ef3a85cf3c05e405c6ba8e53'; |
41 | // 潮童首页 | 41 | // 潮童首页 |
42 | - const CODE_KIDS_CHANNEL = '331994d6fa8dc87f92a26dd45c0aa071'; | 42 | + const CODE_KIDS_CHANNEL = 'a7741b94e8bb9d56d0d36e00c05956f7';//'331994d6fa8dc87f92a26dd45c0aa071'; |
43 | // 'a7741b94e8bb9d56d0d36e00c05956f7'; | 43 | // 'a7741b94e8bb9d56d0d36e00c05956f7'; |
44 | 44 | ||
45 | // 创意生活新 | 45 | // 创意生活新 |
@@ -221,8 +221,11 @@ class SearchModel | @@ -221,8 +221,11 @@ class SearchModel | ||
221 | //组织数据结构 | 221 | //组织数据结构 |
222 | $data = HelperSearch::getProductPic($data['data']['product_list'], $options); | 222 | $data = HelperSearch::getProductPic($data['data']['product_list'], $options); |
223 | } | 223 | } |
224 | - $data['isFavorite'] = $options['isFavorite']; | ||
225 | - echo json_encode($data); | 224 | + $res = array( |
225 | + 'pics'=>$data, | ||
226 | + 'isFavorite'=>$options['isFavorite'] | ||
227 | + ); | ||
228 | + echo json_encode($res); | ||
226 | } | 229 | } |
227 | 230 | ||
228 | /** | 231 | /** |
1 | <?php | 1 | <?php |
2 | use Action\WebAction; | 2 | use Action\WebAction; |
3 | use LibModels\Web\Product\BrandData; | 3 | use LibModels\Web\Product\BrandData; |
4 | +use LibModels\Web\Product\FavoriteData; | ||
4 | 5 | ||
5 | use \LibModels\Web\Product\HotrankData; | 6 | use \LibModels\Web\Product\HotrankData; |
6 | use product\HotrankModel; | 7 | use product\HotrankModel; |
@@ -50,6 +51,7 @@ class IndexController extends WebAction | @@ -50,6 +51,7 @@ class IndexController extends WebAction | ||
50 | 51 | ||
51 | //调用模型获得数据 | 52 | //调用模型获得数据 |
52 | $data = Product\BrandsModel::getBrandSearchData($condition, $options); | 53 | $data = Product\BrandsModel::getBrandSearchData($condition, $options); |
54 | + | ||
53 | $data = array( | 55 | $data = array( |
54 | //初始化js | 56 | //初始化js |
55 | 'searchListPage' => true, | 57 | 'searchListPage' => true, |
@@ -106,6 +108,24 @@ class IndexController extends WebAction | @@ -106,6 +108,24 @@ class IndexController extends WebAction | ||
106 | //渲染模板 | 108 | //渲染模板 |
107 | $this->_view->display('list',$data); | 109 | $this->_view->display('list',$data); |
108 | } | 110 | } |
111 | + | ||
112 | + //收藏品牌 | ||
113 | + public function favoriteBrandAction() | ||
114 | + { | ||
115 | + if (!$this->isAjax()) { | ||
116 | + return; | ||
117 | + } | ||
118 | + $uid = $this->post('uid'); | ||
119 | + $brandId = $this->post('brandId'); | ||
120 | + if ($uid && $brandId) { | ||
121 | + //调用接口收藏或取消收藏 | ||
122 | + $result = FavoriteData::changeFavoriteBrand($uid, $brandId); | ||
123 | + if (isset($result['code']) && $result['code'] == 200) { | ||
124 | + $this ->echoJson($result['message']); | ||
125 | + } | ||
126 | + } | ||
127 | + } | ||
128 | + | ||
109 | /** | 129 | /** |
110 | * 热销排行 | 130 | * 热销排行 |
111 | */ | 131 | */ |
-
Please register or login to post a comment