Authored by hf

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

  1 +<?php
  2 +namespace LibModels\Web\Product;
  3 +
  4 +use Api\Yohobuy;
  5 +use Api\Sign;
  6 +
  7 +
  8 +/**
  9 + * 热销排行
  10 + *
  11 + * */
  12 +class HotrankData extends \LibModels\Wap\Product\SearchData
  13 +{
  14 + const URI_HOTRANK_RES = '/operations/service/v4/resource';
  15 + const URI_HOTRANK_TAG = '/operations/api/v5/resource/get';
  16 +
  17 +
  18 + /**
  19 + 获取热销排行
  20 + * 分类标签
  21 + */
  22 + public static function getHotranktag($client_type = 'web',$channel = 0, $is_concurrent = true, $callback = '')
  23 + {
  24 + // 构建必传参数
  25 + $params = Yohobuy::param();
  26 + $params['client_type'] = 'web';
  27 + $params['channel'] =$channel ;
  28 + $params['is_concurrent'] = true;
  29 + $params['callback'] = $callback;
  30 + $params['client_secret'] = Sign::getSign($params);
  31 + return Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_HOTRANK_TAG, $params);
  32 + }
  33 +
  34 +}
@@ -263,7 +263,8 @@ class Process @@ -263,7 +263,8 @@ class Process
263 'mergeNewReportData', 263 'mergeNewReportData',
264 'mergeSinglehotData2', 264 'mergeSinglehotData2',
265 'mergeHotCategoryData', 265 'mergeHotCategoryData',
266 - 'mergeGirlkidsData' 266 + 'mergeGirlkidsData',
  267 + 'mergeHotBrandsData'
267 ); 268 );
268 foreach ($data as $key => $val) { 269 foreach ($data as $key => $val) {
269 foreach ($mergeProcessList as $merge) { 270 foreach ($mergeProcessList as $merge) {
@@ -807,7 +808,7 @@ class Process @@ -807,7 +808,7 @@ class Process
807 // 排序 808 // 排序
808 uksort($result, function ($a, $b) use($skns) { 809 uksort($result, function ($a, $b) use($skns) {
809 $skn_arr = explode(' ', $skns); 810 $skn_arr = explode(' ', $skns);
810 - return array_search($a, $skn_arr) > array_search($b, $skn_arr); 811 + return array_search($a, $skn_arr) > array_search($b, $skn_arr);
811 }); 812 });
812 $pos = 1; 813 $pos = 1;
813 //添加TOP标示 814 //添加TOP标示
@@ -819,8 +820,61 @@ class Process @@ -819,8 +820,61 @@ class Process
819 break; 820 break;
820 } 821 }
821 $pos ++; 822 $pos ++;
822 - }  
823 - return $result;  
824 - }  
825 - 823 + }
  824 + return $result;
  825 + }
  826 +
  827 + /**
  828 + * 热门品牌数据处理
  829 + *
  830 + * @param array $data
  831 + * @param string $type
  832 + */
  833 + public static function mergeHotBrandsData($key,array &$data,$type)
  834 + {
  835 + $result = array();
  836 + $temp = array();
  837 + if ($data[$key]['template_name'] == 'custom_brands')
  838 + {
  839 + // print_r($data[$key]);
  840 + $result = array(
  841 + 'hotBrands' => array(
  842 + 'name' => '',
  843 + 'brandUrl' => ''
  844 + )
  845 + );
  846 + // text模版
  847 + $result['hotBrands']['name'] = '热门品牌';
  848 + //floor模板
  849 + $floor = array(
  850 + 'logoBrand' => '',
  851 + 'moreBrand' => ''
  852 + );
  853 +
  854 + $brands = $data[$key]['data']['list'];
  855 + foreach ($brands as $val)
  856 + {
  857 + $width = 185;
  858 + $height = 86;
  859 + $type = 'lifestyle';
  860 + $val['src'] = Images::getImageUrl($val['src'], $width, $height, 2);
  861 + $val['url'] = Helpers::transUrl($val['url'], $type);
  862 + $floor['logoBrand'][] = array(
  863 + 'href' => $val['url'],
  864 + 'img' => $val['src']
  865 + );
  866 + }
  867 + $floor['moreBrand'] = 'http://yohobuy.com/brands';
  868 + //$floor['moreBrand'] = 'http://yohobuy.com/brands?gender=1,3&openby:yohobuy={"action":"go.list","params":{"actiontype":0,"gender":"1,3"}}';
  869 + //print_r($floor);
  870 + $type_key = sprintf("%s_%s", $type, $key);
  871 + $cacheKey = sprintf("%s_%s", CacheConfig::KEY_INDEX_BRANDS_LIST_DATA, $type_key);
  872 + //print_r($cacheKey);
  873 + Cache::set($cacheKey, $floor, 7200);
  874 + $result['hotBrands']['brandUrl'] = '/common/getIndexResourceBrand?type=' . $type_key;
  875 + //print_r($result['hotBrands']['brandUrl']);
  876 + }
  877 + return $result;
  878 + }
  879 +
826 } 880 }
@@ -273,9 +273,8 @@ class HelperSearch @@ -273,9 +273,8 @@ class HelperSearch
273 273
274 public static function groupSort($sort) 274 public static function groupSort($sort)
275 { 275 {
276 -  
277 $options = self::$options; 276 $options = self::$options;
278 - if (isset($options['controller']) && $options['controller'] != 'Search') { 277 + if (isset($options['controller']) && $options['controller'] == 'Search') {
279 return array(); 278 return array();
280 } 279 }
281 //设置导航 280 //设置导航
@@ -319,7 +318,7 @@ class HelperSearch @@ -319,7 +318,7 @@ class HelperSearch
319 } 318 }
320 } 319 }
321 $result['list'] = $sortList; 320 $result['list'] = $sortList;
322 - 321 +
323 return $result; 322 return $result;
324 } 323 }
325 324
@@ -327,7 +326,7 @@ class HelperSearch @@ -327,7 +326,7 @@ class HelperSearch
327 { 326 {
328 $result = array(); 327 $result = array();
329 $options = self::$options; 328 $options = self::$options;
330 - if (!isset($options['controller']) || $options['controller'] != 'Search') { 329 + if (!isset($options['controller']) || $options['controller'] == 'Search') {
331 return $result; 330 return $result;
332 } 331 }
333 $params = self::$params; 332 $params = self::$params;

5.23 KB | W: | H:

5.23 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

4.05 KB | W: | H:

4.05 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
@@ -114,6 +114,7 @@ function showChooseGifDialog() { @@ -114,6 +114,7 @@ function showChooseGifDialog() {
114 window.location.href = cartContentShow().find('.freebie > a').attr('href'); 114 window.location.href = cartContentShow().find('.freebie > a').attr('href');
115 }, function() { 115 }, function() {
116 var info = window.cookie('order-info'); 116 var info = window.cookie('order-info');
  117 +
117 if (info) { 118 if (info) {
118 window.setCookie('order-info', ''); 119 window.setCookie('order-info', '');
119 } 120 }
@@ -191,8 +192,10 @@ if ($('.freebie').length > 0) { @@ -191,8 +192,10 @@ if ($('.freebie').length > 0) {
191 } 192 }
192 193
193 $('.btn-balance').on('touchend', function() { 194 $('.btn-balance').on('touchend', function() {
194 - lowStockCount = 0;  
195 var info = window.cookie('order-info'); 195 var info = window.cookie('order-info');
  196 +
  197 + lowStockCount = 0;
  198 +
196 if (shouldLowStocks()) { 199 if (shouldLowStocks()) {
197 tip.show('所选商品中有' + lowStockCount + '种库存不足的商品'); 200 tip.show('所选商品中有' + lowStockCount + '种库存不足的商品');
198 return false; 201 return false;
@@ -105,7 +105,6 @@ $('.icon-del').on('touchstart', function(e) { @@ -105,7 +105,6 @@ $('.icon-del').on('touchstart', function(e) {
105 autoHide: true, 105 autoHide: true,
106 fast: true 106 fast: true
107 }); 107 });
108 - //window.setCookie('order-info', '');  
109 window.setCookie('_yoho-cart-refreshByDelete', true); 108 window.setCookie('_yoho-cart-refreshByDelete', true);
110 window.location.href = '/cart/index/index?cartType=' + $('#cartType').val(); 109 window.location.href = '/cart/index/index?cartType=' + $('#cartType').val();
111 } else { 110 } else {
@@ -46,7 +46,9 @@ if (document.referrer && document.referrer.indexOf('/cart/index/index') !== -1) @@ -46,7 +46,9 @@ if (document.referrer && document.referrer.indexOf('/cart/index/index') !== -1)
46 orderInfo('couponName', null); 46 orderInfo('couponName', null);
47 } 47 }
48 48
49 -orderInfo('cartType', queryString.cartType || queryString.carttype || 'ordinary'); 49 +if (queryString.cartType || queryString.carttype || !orderInfo('cartType')) {
  50 + orderInfo('cartType', queryString.cartType || queryString.carttype || 'ordinary');
  51 +}
50 52
51 function dispacthTapEvt(e) { 53 function dispacthTapEvt(e) {
52 var $cur = $(e.target).closest('li'); 54 var $cur = $(e.target).closest('li');
@@ -77,20 +79,20 @@ $('.checkbox').on('touchstart', function() { @@ -77,20 +79,20 @@ $('.checkbox').on('touchstart', function() {
77 } 79 }
78 }); 80 });
79 81
80 -$('.invoice').on('touchend', '.checkbox', function() { 82 +$invoice.on('touchend', '.checkbox', function() {
81 var $this = $(this); 83 var $this = $(this);
82 84
83 if ($this.hasClass('icon-cb-checked')) { 85 if ($this.hasClass('icon-cb-checked')) {
84 - $('.invoice').addClass('focus'); 86 + $invoice.addClass('focus');
85 } 87 }
86 if ($this.hasClass('icon-checkbox')) { 88 if ($this.hasClass('icon-checkbox')) {
87 - $('.invoice').removeClass('focus'); 89 + $invoice.removeClass('focus');
88 } 90 }
89 - return false;  
90 }); 91 });
91 92
92 function orderCompute() { 93 function orderCompute() {
93 var yohoCoin = orderInfo('yohoCoin'); 94 var yohoCoin = orderInfo('yohoCoin');
  95 +
94 $.ajax({ 96 $.ajax({
95 method: 'POST', 97 method: 'POST',
96 url: '/cart/index/orderCompute', 98 url: '/cart/index/orderCompute',
@@ -240,10 +242,12 @@ $('.coin').on('touchend', function() { @@ -240,10 +242,12 @@ $('.coin').on('touchend', function() {
240 orderCompute(); 242 orderCompute();
241 }); 243 });
242 244
243 -$invoice.on('touchend', function() { 245 +$invoice.on('touchend', '.checkbox', function(e) {
244 var $this = $(this); 246 var $this = $(this);
245 247
246 - orderInfo('invoice', $this.find('.checkbox').hasClass('icon-cb-checked')); 248 + orderInfo('invoice', $this.hasClass('icon-cb-checked'));
  249 + e.preventDefault();
  250 + e.stopPropagation();
247 }); 251 });
248 252
249 $invoice.find('[name="invoice-title"]').on('blur', function() { 253 $invoice.find('[name="invoice-title"]').on('blur', function() {
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 var $ = require('jquery'), 7 var $ = require('jquery'),
8 Hammer = require('yoho.hammer'), 8 Hammer = require('yoho.hammer'),
9 Swiper = require('yoho.iswiper'), 9 Swiper = require('yoho.iswiper'),
  10 + loading = require('../plugin/loading'),
10 lazyLoad = require('yoho.lazyload'); 11 lazyLoad = require('yoho.lazyload');
11 12
12 var swiper, 13 var swiper,
@@ -26,6 +27,8 @@ var brandsData, @@ -26,6 +27,8 @@ var brandsData,
26 $keyword, 27 $keyword,
27 clearTextHammer; 28 clearTextHammer;
28 29
  30 +loading.showLoadingMask();
  31 +
29 //热门品牌滑动 32 //热门品牌滑动
30 hotBrandsSwiper = new Swiper('.brands-swiper', { 33 hotBrandsSwiper = new Swiper('.brands-swiper', {
31 grabCursor: true, 34 grabCursor: true,
@@ -48,9 +51,14 @@ $('.yoho-header').css({ @@ -48,9 +51,14 @@ $('.yoho-header').css({
48 top: 0 51 top: 0
49 }); 52 });
50 53
51 -if ($('.banner-top').length > 0) {  
52 - $('.hot-brands').css('padding-top', '0');  
53 -} 54 +(function() {
  55 + if ($('.banner-top').length > 0) {
  56 + $('.hot-brands').css('padding-top', '0');
  57 + }
  58 +
  59 + $('.hide-when-loading').show();
  60 + loading.hideLoadingMask();
  61 +})();
54 62
55 $fixTitleBar = $('<div class="title-bar fixed-title-bar"><h2></h2></div>'); 63 $fixTitleBar = $('<div class="title-bar fixed-title-bar"><h2></h2></div>');
56 $fixTitleBar.css({ 64 $fixTitleBar.css({
@@ -187,8 +195,15 @@ if ($('.brand-search-page').length) { @@ -187,8 +195,15 @@ if ($('.brand-search-page').length) {
187 195
188 if ($genderItem.length > 0) { 196 if ($genderItem.length > 0) {
189 $genderItem.on('touchstart', function() { 197 $genderItem.on('touchstart', function() {
  198 + var index = $(this).data('id') + 1;
  199 +
190 $('.genderNav ul .active').removeClass('active'); 200 $('.genderNav ul .active').removeClass('active');
191 $(this).addClass('active'); 201 $(this).addClass('active');
192 - window.location.search = 'channel=' + ($(this).data('id') + 1); 202 + $('.hide-when-loading').hide();
  203 + loading.showLoadingMask();
  204 + function reload() {
  205 + window.location.search = 'channel=' + index;
  206 + }
  207 + setTimeout(reload.bind(this), 100);
193 }); 208 });
194 } 209 }
@@ -12,9 +12,6 @@ var commentsNum,consultsNum; @@ -12,9 +12,6 @@ var commentsNum,consultsNum;
12 var navtabEle = document.getElementById('nav-tab'), 12 var navtabEle = document.getElementById('nav-tab'),
13 navtabHammer = navtabEle && new Hammer(navtabEle), 13 navtabHammer = navtabEle && new Hammer(navtabEle),
14 14
15 - // consultFooterEle = $('.consult-content-footer')[0],  
16 - // consultFooterHammer = consultFooterEle && new Hammer(consultFooterEle),  
17 -  
18 gotoConsultEle = document.getElementById('goto-consult'), 15 gotoConsultEle = document.getElementById('goto-consult'),
19 gotoConsultHammer = gotoConsultEle && new Hammer(gotoConsultEle), 16 gotoConsultHammer = gotoConsultEle && new Hammer(gotoConsultEle),
20 17
@@ -2,6 +2,9 @@ @@ -2,6 +2,9 @@
2 .re-pos-search { 2 .re-pos-search {
3 top: 170rem / $pxConvertRem !important; 3 top: 170rem / $pxConvertRem !important;
4 } 4 }
  5 + .hide-when-loading {
  6 + display: none;
  7 + }
5 .genderNav { 8 .genderNav {
6 display: block; 9 display: block;
7 width: 100%; 10 width: 100%;
@@ -21,38 +21,40 @@ @@ -21,38 +21,40 @@
21 </a> 21 </a>
22 </div> 22 </div>
23 </div> 23 </div>
  24 + <div class="hide-when-loading">
  25 + {{# topData}}
  26 + {{! 头部banner}}
  27 + {{# bannerTop}}
  28 + {{> home/banner_top}}
  29 + {{/ bannerTop}}
24 30
25 - {{# topData}}  
26 - {{! 头部banner}}  
27 - {{# bannerTop}}  
28 - {{> home/banner_top}}  
29 - {{/ bannerTop}} 31 + {{! 热门品牌可滑动}}
  32 + {{# hotBrandsScroll}}
  33 + {{> home/hot_brands_swipe}}
  34 + {{/ hotBrandsScroll}}
  35 + {{/ topData}}
30 36
31 - {{! 热门品牌可滑动}}  
32 - {{# hotBrandsScroll}}  
33 - {{> home/hot_brands_swipe}}  
34 - {{/ hotBrandsScroll}}  
35 - {{/ topData}}  
36 -  
37 - {{# brandList}}  
38 - <div class="brand-list bar-{{@index}}">  
39 - <div class="title-bar">  
40 - <h2 style="position: static;">{{title}}</h2> 37 + {{# brandList}}
  38 + <div class="brand-list bar-{{@index}}">
  39 + <div class="title-bar">
  40 + <h2 style="position: static;">{{title}}</h2>
  41 + </div>
  42 + {{# list}}
  43 + <p>
  44 + <a href="{{url}}">{{name}}
  45 + {{# isHot}}
  46 + <i class="icon-hot">HOT</i>
  47 + {{/ isHot}}
  48 + {{# isNew}}
  49 + <i class="icon-new">NEW</i>
  50 + {{/ isNew}}
  51 + </a>
  52 + </p>
  53 + {{/ list}}
41 </div> 54 </div>
42 - {{# list}}  
43 - <p>  
44 - <a href="{{url}}">{{name}}  
45 - {{# isHot}}  
46 - <i class="icon-hot">HOT</i>  
47 - {{/ isHot}}  
48 - {{# isNew}}  
49 - <i class="icon-new">NEW</i>  
50 - {{/ isNew}}  
51 - </a>  
52 - </p>  
53 - {{/ list}} 55 + {{/ brandList}}
54 </div> 56 </div>
55 - {{/ brandList}} 57 +
56 58
57 {{/channel}} 59 {{/channel}}
58 {{> layout/footer}} 60 {{> layout/footer}}
1 <!-- Google Tag Manager --> 1 <!-- Google Tag Manager -->
2 <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-W958MG" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> 2 <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-W958MG" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
3 <script> 3 <script>
4 -var _hmt = _hmt || [];  
5 -(function() { 4 + var _hmt = _hmt || [];
6 function async_load(){ 5 function async_load(){
7 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 6 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
8 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 7 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
@@ -32,7 +31,6 @@ var _hmt = _hmt || []; @@ -32,7 +31,6 @@ var _hmt = _hmt || [];
32 })(); 31 })();
33 } 32 }
34 window.addEventListener('load', async_load, false); 33 window.addEventListener('load', async_load, false);
35 -})();  
36 </script> 34 </script>
37 <script> 35 <script>
38 window._py = window._py||[]; 36 window._py = window._py||[];
@@ -34,6 +34,20 @@ @@ -34,6 +34,20 @@
34 </div> 34 </div>
35 {{/if}} 35 {{/if}}
36 36
  37 + {{#if gender}}
  38 + <div class="channel section">
  39 + <span class="title">性别:</span>
  40 +
  41 + <div class="attr-content clearfix">
  42 + {{#each channel}}
  43 + <a class="attr {{#if checked}}checked{{/if}}" href="{{href}}">
  44 + {{name}}
  45 + </a>
  46 + {{/each}}
  47 + </div>
  48 + </div>
  49 + {{/if}}
  50 +
37 {{#if sort}} 51 {{#if sort}}
38 <div class="sort section"> 52 <div class="sort section">
39 <span class="title">分类:</span> 53 <span class="title">分类:</span>
@@ -1483,308 +1483,308 @@ require("js/product/sort-pager"); @@ -1483,308 +1483,308 @@ require("js/product/sort-pager");
1483 require("js/product/product"); 1483 require("js/product/product");
1484 }); 1484 });
1485 define("js/product/filter", ["jquery"], function(require, exports, module){ 1485 define("js/product/filter", ["jquery"], function(require, exports, module){
1486 -/**  
1487 - * 商品筛选逻辑  
1488 - * @author: xuqi<qi.xu@yoho.cn>  
1489 - * @date: 2015/12/4  
1490 - */  
1491 -  
1492 -var $ = require("jquery");  
1493 -  
1494 -var checkUnicode = {  
1495 - unchecked: '&#xe613;',  
1496 - checked: '&#xe612;'  
1497 -},  
1498 -moreUnicode = {  
1499 - up: '&#xe610;',  
1500 - down: '&#xe600;'  
1501 -};  
1502 -  
1503 -//品牌相关变量  
1504 -var $brandDefault = $('.brand .default'),  
1505 - $brandPanel = $('.brand .brand-panel'),  
1506 - $brandAttrs = $('.brand .attr'),  
1507 - $brandMore = $('#brand-more'),  
1508 - $brandMulti = $('#brand-multi');  
1509 -  
1510 -var $brandMoreTxt, $brandMoreIcon;  
1511 -  
1512 -//价格相关变量  
1513 -var $udPrice = $('.ud-price-range'),  
1514 - interReg = /^\d+$/,  
1515 - $limit, $min, $max, $btn;  
1516 -  
1517 -//分类相关变量  
1518 -var $sortSub = $('.sort-sub-wrap');  
1519 -  
1520 -//高级选项相关变量  
1521 -var $seniorSubWrap = $('.senior-sub-wrap'),  
1522 - $seniorAttrWrap = $('.senior-attr-wrap');  
1523 -  
1524 -var seniorHoverTime, hoveredIndex;  
1525 -  
1526 -//清除checkbox选中状态  
1527 -function clearChecked($checkbox) {  
1528 - $checkbox.removeClass('checked').html(checkUnicode.unchecked);  
1529 -}  
1530 -  
1531 -//显示更多品牌面板  
1532 -function brandShowMore() {  
1533 - $brandDefault.addClass('hide');  
1534 - $brandPanel.removeClass('hide');  
1535 -}  
1536 -  
1537 -//隐藏更多品牌面板  
1538 -function brandHideMore() {  
1539 - $brandPanel.addClass('hide');  
1540 - $brandDefault.removeClass('hide');  
1541 -}  
1542 -  
1543 -//url构造&跳转  
1544 -function uriLoc(attr, val) {  
1545 - var href = decodeURIComponent(window.location.search),  
1546 - query = attr + '=' + val,  
1547 - newHref;  
1548 -  
1549 - if (href === '') {  
1550 - newHref = '?' + query;  
1551 - } else {  
1552 - newHref = href + '&' + query;  
1553 - }  
1554 -  
1555 - window.location.href = newHref;  
1556 -}  
1557 -  
1558 -//隐藏高级选项面板  
1559 -function hideSeniorPanel(index) {  
1560 - $seniorSubWrap.children('.senior-sub:eq(' + hoveredIndex + ')').addClass('hide');  
1561 - $seniorAttrWrap.children('.attr:eq(' + hoveredIndex + ')').removeClass('hover');  
1562 - hoveredIndex = -1;  
1563 -}  
1564 -  
1565 -//屏蔽筛选项双击文字选中  
1566 -$('.filter-box').on('selectstart', '.attr, .brands-index span', function() {  
1567 - return false;  
1568 -});  
1569 -  
1570 -//【分类】  
1571 -$('.sort-pre').on('click', 'li', function() {  
1572 - var $this = $(this),  
1573 - index = $this.index();  
1574 -  
1575 - $this.siblings('.active').removeClass('active');  
1576 - $this.addClass('active');  
1577 -  
1578 - $sortSub.children(':not(.hide)').addClass('hide');  
1579 - $sortSub.children(':eq(' + index + ')').removeClass('hide');  
1580 -});  
1581 -  
1582 -//【品牌】  
1583 -if ($brandMore.length > 0) {  
1584 - $brandMoreTxt = $brandMore.children('em');  
1585 - $brandMoreIcon = $brandMore.children('.iconfont');  
1586 -}  
1587 -  
1588 -//【品牌】多选  
1589 -$brandMulti.click(function() {  
1590 - if ($brandPanel.css('display') === 'none') {  
1591 -  
1592 - //显示品牌面板  
1593 - $brandMore.trigger('click');  
1594 - }  
1595 -  
1596 - $brandPanel.addClass('multi'); //显示出checkbox  
1597 - $(this).addClass('hide');  
1598 -});  
1599 -  
1600 -//【品牌】更多  
1601 -$brandMore.click(function() {  
1602 - var $this = $(this);  
1603 -  
1604 - if ($this.hasClass('more')) {  
1605 - brandHideMore();  
1606 -  
1607 - $brandMoreTxt.text('更多');  
1608 - $brandMoreIcon.html(moreUnicode.down);  
1609 - } else {  
1610 - brandShowMore();  
1611 -  
1612 - $brandMoreTxt.text('收起');  
1613 - $brandMoreIcon.html(moreUnicode.up);  
1614 - }  
1615 -  
1616 - $(this).toggleClass('more');  
1617 -});  
1618 -  
1619 -//【品牌】索引  
1620 -$('.brands-index').on('click', 'span', function() {  
1621 - var $this = $(this),  
1622 - index = $this.data('index');  
1623 -  
1624 - if ($this.index() === 0) {  
1625 -  
1626 - //全部  
1627 - $brandAttrs.removeClass('hide');  
1628 - } else {  
1629 - $brandAttrs.addClass('hide').filter('[data-index=' + index + ']').removeClass('hide');  
1630 - }  
1631 -});  
1632 -  
1633 -//【品牌】搜索  
1634 -$('#brand-search-input').keyup(function() {  
1635 - var val = $(this).val().toLowerCase();  
1636 -  
1637 - if (val === '') {  
1638 - $brandAttrs.removeClass('hide');  
1639 - } else {  
1640 - $brandAttrs.addClass('hide').filter('[data-key*="' + val + '"]').removeClass('hide');  
1641 - }  
1642 -});  
1643 -  
1644 -//【品牌】多选确定  
1645 -$('#brand-multi-ok').click(function() {  
1646 - var val = '';  
1647 -  
1648 - if ($(this).hasClass('dis')) {  
1649 - return;  
1650 - }  
1651 -  
1652 - $brandPanel.find('.checked').each(function() {  
1653 - var id = $(this).data('id');  
1654 -  
1655 - val += (val === '') ? id : (',' + id);  
1656 - });  
1657 -  
1658 - uriLoc('brand', val);  
1659 -});  
1660 -  
1661 -//【品牌/高级选项】多选取消  
1662 -$('.multi-select-cancel').click(function() {  
1663 - var $panel = $(this).closest('.multi');  
1664 -  
1665 - if ($panel.hasClass('brand-panel')) {  
1666 -  
1667 - $brandMulti.removeClass('hide'); //显示多选按钮  
1668 - $brandMore.trigger('click');  
1669 - }  
1670 -  
1671 - $panel.removeClass('multi');  
1672 - clearChecked($panel.find('.checkbox.checked')); //清除选中状态  
1673 -});  
1674 -  
1675 -//【品牌/高级选项】checkbox  
1676 -$('.check-container').on('click', '.attr', function() {  
1677 - var $this = $(this),  
1678 - $check = $this.find('.checkbox'),  
1679 - $btnOk = $this.parent('.check-container').next('.btns').find('.multi-select-ok');  
1680 -  
1681 - $check.toggleClass('checked');  
1682 -  
1683 - if ($check.hasClass('checked')) {  
1684 - $check.html(checkUnicode.checked);  
1685 - } else {  
1686 - $check.html(checkUnicode.unchecked);  
1687 - }  
1688 -  
1689 - //更新按钮状态  
1690 - if ($check.hasClass('checked') ||  
1691 - $this.siblings('.attr').find('.checked').length > 0) {  
1692 - $btnOk.removeClass('dis');  
1693 - } else {  
1694 - $btnOk.addClass('dis');  
1695 - }  
1696 -});  
1697 -  
1698 -//【品牌/高级选项】当多选时阻止链接默认跳转  
1699 -$('.brand, .senior').on('click', '.attr > a', function(e) {  
1700 - if ($(this).closest('.multi').length > 0) {  
1701 - e.preventDefault();  
1702 - }  
1703 -});  
1704 -  
1705 -//【价格】用户定义价格处理  
1706 -if ($udPrice.length > 0) {  
1707 - $limit = $udPrice.find('.limit');  
1708 - $min = $limit.filter('.min');  
1709 - $max = $limit.filter('.max');  
1710 - $btn = $udPrice.find('.price-sure');  
1711 -  
1712 - //【价格】输入  
1713 - $limit.keyup(function() {  
1714 - var min = $.trim($min.val()),  
1715 - max = $.trim($max.val()),  
1716 - isMinInt = interReg.test(min),  
1717 - isMaxInt = interReg.test(max);  
1718 -  
1719 - if (isMaxInt && (min === '' || isMinInt) ||  
1720 - isMinInt && (max === '' || isMaxInt)  
1721 - ) {  
1722 - $btn.removeClass('hide');  
1723 - } else {  
1724 - $btn.addClass('hide');  
1725 - }  
1726 - });  
1727 -  
1728 - //【价格】多项查询  
1729 - $btn.click(function() {  
1730 - var min = $.trim($min.val()),  
1731 - max = $.trim($max.val()),  
1732 - tmp;  
1733 -  
1734 - //对于min大于max的情况,交换位置  
1735 - if (min !== '' && max !== '' && +min > +max) {  
1736 - tmp = max;  
1737 - max = min;  
1738 - min = tmp;  
1739 - }  
1740 -  
1741 - uriLoc('price', min + ',' + max);  
1742 - });  
1743 -}  
1744 -  
1745 -//【高级选项】鼠标移入显示子项  
1746 -$seniorAttrWrap.on('mouseenter', '.attr', function() {  
1747 - var $this = $(this);  
1748 - var index = $this.index();  
1749 -  
1750 - $this.addClass('hover').siblings().removeClass('hover');  
1751 -  
1752 - $seniorSubWrap.children('.senior-sub:eq(' + index + ')').removeClass('hide').siblings().addClass('hide');  
1753 -}).on('mouseleave', '.attr', function() {  
1754 - var $this = $(this),  
1755 - index = $this.index();  
1756 -  
1757 - hoveredIndex = index;  
1758 -  
1759 - seniorHoverTime = setTimeout(function() {  
1760 - hideSeniorPanel();  
1761 - }, 100);  
1762 -});  
1763 -  
1764 -//【高级选项】多选  
1765 -$('.senior-sub').on('click', '.multi-select', function() {  
1766 - $(this).closest('.senior-sub').addClass('multi');  
1767 -}).on('click', '.multi-select-ok', function() {  
1768 - var $btn = $(this),  
1769 - $sub = $btn.closest('.senior-sub'),  
1770 - val = '';  
1771 -  
1772 - if ($btn.hasClass('dis')) {  
1773 - return;  
1774 - }  
1775 -  
1776 - $sub.find('.checked').each(function() {  
1777 - var id = $(this).data('id');  
1778 -  
1779 - val += (val === '') ? id : (',' + id);  
1780 - });  
1781 -  
1782 - uriLoc($sub.data('attr'), val);  
1783 -}).on('mouseenter', function() {  
1784 - clearTimeout(seniorHoverTime);  
1785 -}).on('mouseleave', function() {  
1786 - hideSeniorPanel();  
1787 -}); 1486 +/**
  1487 + * 商品筛选逻辑
  1488 + * @author: xuqi<qi.xu@yoho.cn>
  1489 + * @date: 2015/12/4
  1490 + */
  1491 +
  1492 +var $ = require("jquery");
  1493 +
  1494 +var checkUnicode = {
  1495 + unchecked: '&#xe613;',
  1496 + checked: '&#xe612;'
  1497 +},
  1498 +moreUnicode = {
  1499 + up: '&#xe610;',
  1500 + down: '&#xe600;'
  1501 +};
  1502 +
  1503 +//品牌相关变量
  1504 +var $brandDefault = $('.brand .default'),
  1505 + $brandPanel = $('.brand .brand-panel'),
  1506 + $brandAttrs = $brandPanel.find('.attr'),
  1507 + $brandMore = $('#brand-more'),
  1508 + $brandMulti = $('#brand-multi');
  1509 +
  1510 +var $brandMoreTxt, $brandMoreIcon;
  1511 +
  1512 +//价格相关变量
  1513 +var $udPrice = $('.ud-price-range'),
  1514 + interReg = /^\d+$/,
  1515 + $limit, $min, $max, $btn;
  1516 +
  1517 +//分类相关变量
  1518 +var $sortSub = $('.sort-sub-wrap');
  1519 +
  1520 +//高级选项相关变量
  1521 +var $seniorSubWrap = $('.senior-sub-wrap'),
  1522 + $seniorAttrWrap = $('.senior-attr-wrap');
  1523 +
  1524 +var seniorHoverTime, hoveredIndex;
  1525 +
  1526 +//清除checkbox选中状态
  1527 +function clearChecked($checkbox) {
  1528 + $checkbox.removeClass('checked').html(checkUnicode.unchecked);
  1529 +}
  1530 +
  1531 +//显示更多品牌面板
  1532 +function brandShowMore() {
  1533 + $brandDefault.addClass('hide');
  1534 + $brandPanel.removeClass('hide');
  1535 +}
  1536 +
  1537 +//隐藏更多品牌面板
  1538 +function brandHideMore() {
  1539 + $brandPanel.addClass('hide');
  1540 + $brandDefault.removeClass('hide');
  1541 +}
  1542 +
  1543 +//url构造&跳转
  1544 +function uriLoc(attr, val) {
  1545 + var href = decodeURIComponent(window.location.search),
  1546 + query = attr + '=' + val,
  1547 + newHref;
  1548 +
  1549 + if (href === '') {
  1550 + newHref = '?' + query;
  1551 + } else {
  1552 + newHref = href + '&' + query;
  1553 + }
  1554 +
  1555 + window.location.href = newHref;
  1556 +}
  1557 +
  1558 +//隐藏高级选项面板
  1559 +function hideSeniorPanel(index) {
  1560 + $seniorSubWrap.children('.senior-sub:eq(' + hoveredIndex + ')').addClass('hide');
  1561 + $seniorAttrWrap.children('.attr:eq(' + hoveredIndex + ')').removeClass('hover');
  1562 + hoveredIndex = -1;
  1563 +}
  1564 +
  1565 +//屏蔽筛选项双击文字选中
  1566 +$('.filter-box').on('selectstart', '.attr, .brands-index span', function() {
  1567 + return false;
  1568 +});
  1569 +
  1570 +//【分类】
  1571 +$('.sort-pre').on('click', 'li', function() {
  1572 + var $this = $(this),
  1573 + index = $this.index();
  1574 +
  1575 + $this.siblings('.active').removeClass('active');
  1576 + $this.addClass('active');
  1577 +
  1578 + $sortSub.children(':not(.hide)').addClass('hide');
  1579 + $sortSub.children(':eq(' + index + ')').removeClass('hide');
  1580 +});
  1581 +
  1582 +//【品牌】
  1583 +if ($brandMore.length > 0) {
  1584 + $brandMoreTxt = $brandMore.children('em');
  1585 + $brandMoreIcon = $brandMore.children('.iconfont');
  1586 +}
  1587 +
  1588 +//【品牌】多选
  1589 +$brandMulti.click(function() {
  1590 + if ($brandPanel.css('display') === 'none') {
  1591 +
  1592 + //显示品牌面板
  1593 + $brandMore.trigger('click');
  1594 + }
  1595 +
  1596 + $brandPanel.addClass('multi'); //显示出checkbox
  1597 + $(this).addClass('hide');
  1598 +});
  1599 +
  1600 +//【品牌】更多
  1601 +$brandMore.click(function() {
  1602 + var $this = $(this);
  1603 +
  1604 + if ($this.hasClass('more')) {
  1605 + brandHideMore();
  1606 +
  1607 + $brandMoreTxt.text('更多');
  1608 + $brandMoreIcon.html(moreUnicode.down);
  1609 + } else {
  1610 + brandShowMore();
  1611 +
  1612 + $brandMoreTxt.text('收起');
  1613 + $brandMoreIcon.html(moreUnicode.up);
  1614 + }
  1615 +
  1616 + $(this).toggleClass('more');
  1617 +});
  1618 +
  1619 +//【品牌】索引
  1620 +$('.brands-index').on('click', 'span', function() {
  1621 + var $this = $(this),
  1622 + index = $this.data('index');
  1623 +
  1624 + if ($this.index() === 0) {
  1625 +
  1626 + //全部
  1627 + $brandAttrs.removeClass('hide');
  1628 + } else {
  1629 + $brandAttrs.addClass('hide').filter('[data-index=' + index + ']').removeClass('hide');
  1630 + }
  1631 +});
  1632 +
  1633 +//【品牌】搜索
  1634 +$('#brand-search-input').keyup(function() {
  1635 + var val = $(this).val().toLowerCase();
  1636 +
  1637 + if (val === '') {
  1638 + $brandAttrs.removeClass('hide');
  1639 + } else {
  1640 + $brandAttrs.addClass('hide').filter('[data-key*="' + val + '"]').removeClass('hide');
  1641 + }
  1642 +});
  1643 +
  1644 +//【品牌】多选确定
  1645 +$('#brand-multi-ok').click(function() {
  1646 + var val = '';
  1647 +
  1648 + if ($(this).hasClass('dis')) {
  1649 + return;
  1650 + }
  1651 +
  1652 + $brandPanel.find('.checked').each(function() {
  1653 + var id = $(this).data('id');
  1654 +
  1655 + val += (val === '') ? id : (',' + id);
  1656 + });
  1657 +
  1658 + uriLoc('brand', val);
  1659 +});
  1660 +
  1661 +//【品牌/高级选项】多选取消
  1662 +$('.multi-select-cancel').click(function() {
  1663 + var $panel = $(this).closest('.multi');
  1664 +
  1665 + if ($panel.hasClass('brand-panel')) {
  1666 +
  1667 + $brandMulti.removeClass('hide'); //显示多选按钮
  1668 + $brandMore.trigger('click');
  1669 + }
  1670 +
  1671 + $panel.removeClass('multi');
  1672 + clearChecked($panel.find('.checkbox.checked')); //清除选中状态
  1673 +});
  1674 +
  1675 +//【品牌/高级选项】checkbox
  1676 +$('.check-container').on('click', '.attr', function() {
  1677 + var $this = $(this),
  1678 + $check = $this.find('.checkbox'),
  1679 + $btnOk = $this.parent('.check-container').next('.btns').find('.multi-select-ok');
  1680 +
  1681 + $check.toggleClass('checked');
  1682 +
  1683 + if ($check.hasClass('checked')) {
  1684 + $check.html(checkUnicode.checked);
  1685 + } else {
  1686 + $check.html(checkUnicode.unchecked);
  1687 + }
  1688 +
  1689 + //更新按钮状态
  1690 + if ($check.hasClass('checked') ||
  1691 + $this.siblings('.attr').find('.checked').length > 0) {
  1692 + $btnOk.removeClass('dis');
  1693 + } else {
  1694 + $btnOk.addClass('dis');
  1695 + }
  1696 +});
  1697 +
  1698 +//【品牌/高级选项】当多选时阻止链接默认跳转
  1699 +$('.brand, .senior').on('click', '.attr > a', function(e) {
  1700 + if ($(this).closest('.multi').length > 0) {
  1701 + e.preventDefault();
  1702 + }
  1703 +});
  1704 +
  1705 +//【价格】用户定义价格处理
  1706 +if ($udPrice.length > 0) {
  1707 + $limit = $udPrice.find('.limit');
  1708 + $min = $limit.filter('.min');
  1709 + $max = $limit.filter('.max');
  1710 + $btn = $udPrice.find('.price-sure');
  1711 +
  1712 + //【价格】输入
  1713 + $limit.keyup(function() {
  1714 + var min = $.trim($min.val()),
  1715 + max = $.trim($max.val()),
  1716 + isMinInt = interReg.test(min),
  1717 + isMaxInt = interReg.test(max);
  1718 +
  1719 + if (isMaxInt && (min === '' || isMinInt) ||
  1720 + isMinInt && (max === '' || isMaxInt)
  1721 + ) {
  1722 + $btn.removeClass('hide');
  1723 + } else {
  1724 + $btn.addClass('hide');
  1725 + }
  1726 + });
  1727 +
  1728 + //【价格】多项查询
  1729 + $btn.click(function() {
  1730 + var min = $.trim($min.val()),
  1731 + max = $.trim($max.val()),
  1732 + tmp;
  1733 +
  1734 + //对于min大于max的情况,交换位置
  1735 + if (min !== '' && max !== '' && +min > +max) {
  1736 + tmp = max;
  1737 + max = min;
  1738 + min = tmp;
  1739 + }
  1740 +
  1741 + uriLoc('price', min + ',' + max);
  1742 + });
  1743 +}
  1744 +
  1745 +//【高级选项】鼠标移入显示子项
  1746 +$seniorAttrWrap.on('mouseenter', '.attr', function() {
  1747 + var $this = $(this);
  1748 + var index = $this.index();
  1749 +
  1750 + $this.addClass('hover').siblings().removeClass('hover');
  1751 +
  1752 + $seniorSubWrap.children('.senior-sub:eq(' + index + ')').removeClass('hide').siblings().addClass('hide');
  1753 +}).on('mouseleave', '.attr', function() {
  1754 + var $this = $(this),
  1755 + index = $this.index();
  1756 +
  1757 + hoveredIndex = index;
  1758 +
  1759 + seniorHoverTime = setTimeout(function() {
  1760 + hideSeniorPanel();
  1761 + }, 100);
  1762 +});
  1763 +
  1764 +//【高级选项】多选
  1765 +$('.senior-sub').on('click', '.multi-select', function() {
  1766 + $(this).closest('.senior-sub').addClass('multi');
  1767 +}).on('click', '.multi-select-ok', function() {
  1768 + var $btn = $(this),
  1769 + $sub = $btn.closest('.senior-sub'),
  1770 + val = '';
  1771 +
  1772 + if ($btn.hasClass('dis')) {
  1773 + return;
  1774 + }
  1775 +
  1776 + $sub.find('.checked').each(function() {
  1777 + var id = $(this).data('id');
  1778 +
  1779 + val += (val === '') ? id : (',' + id);
  1780 + });
  1781 +
  1782 + uriLoc($sub.data('attr'), val);
  1783 +}).on('mouseenter', function() {
  1784 + clearTimeout(seniorHoverTime);
  1785 +}).on('mouseleave', function() {
  1786 + hideSeniorPanel();
  1787 +});
1788 1788
1789 }); 1789 });
1790 define("js/product/sort-pager", ["jquery"], function(require, exports, module){ 1790 define("js/product/sort-pager", ["jquery"], function(require, exports, module){
@@ -4011,7 +4011,7 @@ function msgCaptchaAjaxFn(page, callback) { @@ -4011,7 +4011,7 @@ function msgCaptchaAjaxFn(page, callback) {
4011 type: 'POST', 4011 type: 'POST',
4012 url: url, 4012 url: url,
4013 data: { 4013 data: {
4014 - verifyCode: $ca.val(), 4014 + code: $mc.val(),
4015 mobile: $pn.val(), 4015 mobile: $pn.val(),
4016 area: $region.text().split('+')[1] 4016 area: $region.text().split('+')[1]
4017 } 4017 }
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
@@ -174,7 +174,7 @@ function msgCaptchaAjaxFn(page, callback) { @@ -174,7 +174,7 @@ function msgCaptchaAjaxFn(page, callback) {
174 type: 'POST', 174 type: 'POST',
175 url: url, 175 url: url,
176 data: { 176 data: {
177 - verifyCode: $ca.val(), 177 + code: $mc.val(),
178 mobile: $pn.val(), 178 mobile: $pn.val(),
179 area: $region.text().split('+')[1] 179 area: $region.text().split('+')[1]
180 } 180 }
@@ -191,7 +191,7 @@ $('.multi-select-cancel').click(function() { @@ -191,7 +191,7 @@ $('.multi-select-cancel').click(function() {
191 $('.check-container').on('click', '.attr', function() { 191 $('.check-container').on('click', '.attr', function() {
192 var $this = $(this), 192 var $this = $(this),
193 $check = $this.find('.checkbox'), 193 $check = $this.find('.checkbox'),
194 - $btnOk = $this.parent('.check-container').next('.btns').find('.multi-select-ok'); 194 + $btnOk = $this.closest('.brand-panel, .senior-sub').find('.multi-select-ok');
195 195
196 $check.toggleClass('checked'); 196 $check.toggleClass('checked');
197 197
@@ -15,7 +15,7 @@ lazyLoad($('img.lazy')); @@ -15,7 +15,7 @@ lazyLoad($('img.lazy'));
15 $('.slide-container').slider(); 15 $('.slide-container').slider();
16 $('.logo-brand').logoBrand({ 16 $('.logo-brand').logoBrand({
17 showNum: 10, 17 showNum: 10,
18 - url: './getBrand' 18 + url: $('.logo-brand').data('url')
19 }); 19 });
20 20
21 /* 21 /*
@@ -75,7 +75,6 @@ exports.init = function(num) { @@ -75,7 +75,6 @@ exports.init = function(num) {
75 } 75 }
76 76
77 productList.addHandler('MouseEnter', function(event) { 77 productList.addHandler('MouseEnter', function(event) {
78 -  
79 var itemMr = 10, //list的右边距 78 var itemMr = 10, //list的右边距
80 itemMb = 35, //list的下边距 79 itemMb = 35, //list的下边距
81 ulStr = '', 80 ulStr = '',
@@ -134,6 +133,11 @@ exports.init = function(num) { @@ -134,6 +133,11 @@ exports.init = function(num) {
134 display: 'inline-block' 133 display: 'inline-block'
135 }); 134 });
136 135
  136 + // 鼠标悬浮获取到商品信息后显示第一张图片
  137 + if (data[0] && data[0].src) {
  138 + $goodInfoMain.find('.good-thumb img').attr('src', data[0].src);
  139 + }
  140 +
137 //}, 1000); 141 //}, 1000);
138 }); 142 });
139 }); 143 });
@@ -167,4 +171,4 @@ $productListNav.click(function() { @@ -167,4 +171,4 @@ $productListNav.click(function() {
167 $(this).find('.sort-child-list').stop(true, true).slideDown(); 171 $(this).find('.sort-child-list').stop(true, true).slideDown();
168 } 172 }
169 $(this).toggleClass('active'); 173 $(this).toggleClass('active');
170 -});  
  174 +});
@@ -55,7 +55,7 @@ @@ -55,7 +55,7 @@
55 55
56 -moz-user-select: none; 56 -moz-user-select: none;
57 } 57 }
58 - 58 +
59 .color .attr { 59 .color .attr {
60 margin-right: 0; 60 margin-right: 0;
61 } 61 }
@@ -82,6 +82,7 @@ @@ -82,6 +82,7 @@
82 width: 14px; 82 width: 14px;
83 border: 1px solid #fff; 83 border: 1px solid #fff;
84 margin-bottom: -3px; 84 margin-bottom: -3px;
  85 + background-size: 100% !important;
85 } 86 }
86 87
87 .clear-checked { 88 .clear-checked {
@@ -244,6 +245,7 @@ @@ -244,6 +245,7 @@
244 font-size: 14px; 245 font-size: 14px;
245 margin-right: 20px; 246 margin-right: 20px;
246 cursor: pointer; 247 cursor: pointer;
  248 + outline: none;
247 249
248 &.dis { 250 &.dis {
249 background: #ccc; 251 background: #ccc;
@@ -282,6 +284,7 @@ @@ -282,6 +284,7 @@
282 border: 1px solid #ccc; 284 border: 1px solid #ccc;
283 margin-bottom: -6px; 285 margin-bottom: -6px;
284 margin-right: 5px; 286 margin-right: 5px;
  287 + background-size: 100% !important;
285 } 288 }
286 289
287 .senior { 290 .senior {
@@ -361,4 +364,4 @@ @@ -361,4 +364,4 @@
361 .filter-box .brand .attr { 364 .filter-box .brand .attr {
362 width: 25%; 365 width: 25%;
363 } 366 }
364 -}  
  367 +}
@@ -125,9 +125,20 @@ @@ -125,9 +125,20 @@
125 } 125 }
126 } 126 }
127 127
  128 + @keyframes slideRight {
  129 + from {
  130 + width: 0;
  131 + }
  132 + to {
  133 + width: 50px;
  134 + }
  135 + }
  136 +
128 .good-select-color { 137 .good-select-color {
129 float: left; 138 float: left;
130 margin-top: 22px; 139 margin-top: 22px;
  140 + overflow: hidden;
  141 + animation: slideRight 200ms 1;
131 142
132 ul { 143 ul {
133 display: block; 144 display: block;
@@ -175,4 +186,4 @@ @@ -175,4 +186,4 @@
175 } 186 }
176 187
177 188
178 -}  
  189 +}
  1 +<?php
  2 +namespace product;
  3 +
  4 +use Plugin\Images;
  5 +use Plugin\Helpers;
  6 +use Plugin\Cache;
  7 +use Configs\CacheConfig;
  8 +use LibModels\Web\Home\IndexData;
  9 +use \LibModels\Web\Product\HotrankData;
  10 +use \LibModels\Web\Product\SearchData;
  11 +
  12 +class HotrankModel {
  13 +
  14 + /**
  15 + * 人气单品 一周热卖
  16 + */
  17 + static public function getSearchData($condition, $options)
  18 + {
  19 + // 调用接口查询商品数据
  20 + $result = SearchData::searchElasticByCondition($condition);
  21 + //print_r($result);
  22 +
  23 + if(!empty($result)){
  24 + $res = self::getProductList($result);
  25 + if(!empty($res['popular'])){
  26 + $data['popular'] = $res['popular'];
  27 + }
  28 + if(!empty($res['hotWeek'])){
  29 + $data['hotWeek'] = $res['hotWeek'];
  30 + }
  31 + }
  32 + return $data;
  33 + }
  34 +
  35 +
  36 +
  37 + /**
  38 + * 获取分类标签
  39 + */
  40 + static public function getHotranktag($classes)
  41 + {
  42 + $list = SearchData::getClassesData($classes);
  43 + //print_r($list);
  44 + $nav = array();
  45 + if(!empty($list['data']['sort'])){
  46 + foreach($list['data']['sort'] as $li=>$lt){
  47 + $nav[$li]['sid'] = $lt['sort_id'];
  48 + $nav[$li]['textCn'] = $lt['sort_name'];
  49 + }
  50 + }
  51 + //print_r($nav);
  52 + return $nav;
  53 + }
  54 +
  55 +
  56 + /**
  57 + * 人气单品 一周热卖 数据处理
  58 + */
  59 + static public function getProductList($result)
  60 + {
  61 + /*----product start---------*/
  62 + if(empty($result) || empty($result['data']) || empty($result['data']['product_list'])){
  63 + return;
  64 + }
  65 + $data = $result['data']['product_list'];
  66 +
  67 + $popular = array();
  68 + $hotWeek = array();
  69 + foreach($data as $key=>$val){
  70 + if(empty($val['goods_list'])){
  71 + continue;
  72 + }
  73 + $defaultGoodsId = 0;
  74 + foreach ($val['goods_list'] as $v){
  75 + if($v['is_default'] == 'Y'){
  76 + $defaultGoodsId = $v['goods_id'];
  77 + }
  78 + }
  79 + if(empty($defaultGoodsId)){
  80 + $defaultGoodsId = $val['goods_list'][0]['goods_id'];
  81 + }
  82 +
  83 + $product_id = empty($val['product_id']) ? '' : $val['product_id'];
  84 + $re['url'] = 'http://item.yohobuy.com/product/pro_'.$product_id.'_'.$defaultGoodsId.'.html';
  85 +
  86 + $re['marketPrice'] = (int)$val['market_price'] == (int)$val['sales_price'] ? '' : '¥'.$val['market_price'];
  87 + $re['salePrice'] = empty($val['sales_price']) ? '' : '¥'.$val['sales_price'];
  88 + $re['name'] = $val['product_name'];
  89 + if($key <= 9){
  90 + $re['rank'] = $key + 1;
  91 + if($key <= 5){
  92 + $re['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 378, 504, 2);
  93 + $popular['list'][] = $re;
  94 + }else{
  95 + $re['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);
  96 + $popular['list'][] = $re;
  97 + }
  98 + }else{
  99 + $re['rank'] = '';
  100 + $re['thumb'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);
  101 + $hot[] = $re;
  102 + }
  103 + }
  104 + $popular['name'] = '人气单品';
  105 +
  106 + $hotWeek = array(
  107 + 'name'=>'一周热卖',
  108 + 'list'=>$hot,
  109 + );
  110 +
  111 + return array('popular'=>$popular,'hotWeek'=>$hotWeek);
  112 + }
  113 +}
@@ -2,6 +2,10 @@ @@ -2,6 +2,10 @@
2 use Action\WebAction; 2 use Action\WebAction;
3 use LibModels\Web\Product\BrandData; 3 use LibModels\Web\Product\BrandData;
4 4
  5 +use LibModels\Web\Product\HotrankData;
  6 +use product\HotrankModel;
  7 +use LibModels\Web\Home\IndexData;
  8 +
5 class IndexController extends WebAction 9 class IndexController extends WebAction
6 { 10 {
7 /** 11 /**
@@ -47,5 +51,240 @@ class IndexController extends WebAction @@ -47,5 +51,240 @@ class IndexController extends WebAction
47 //渲染模板 51 //渲染模板
48 $this->_view->display('list',$data); 52 $this->_view->display('list',$data);
49 } 53 }
  54 +
  55 + public function hotrankAction() {
  56 + $this->setWebNavHeader(\Index\HomeModel::COOKIE_NAME_LIFESTYLE);
  57 + $data = array(
  58 + 'hotrankPage' => true,
  59 + 'hotrank' => array(
  60 + array(
  61 + 'slide' => array(
  62 + 'list' => array(
  63 + array(
  64 + 'href' => '/?gender=1,3',
  65 + 'img' => 'http://img10.static.yhbimg.com/taobaocms/2015/11/26/12/01c3b99f554ad50d9e5a9900719715c94c.jpg'
  66 + ),
  67 + array(
  68 + 'href' => '/?gender=1,3',
  69 + 'img' => 'http://img12.static.yhbimg.com/taobaocms/2015/11/27/09/02a4f1c10e1e81574520e5c0239741a076.jpg'
  70 + ),
  71 + array(
  72 + 'href' => '/?gender=1,3',
  73 + 'img' => 'http://img10.static.yhbimg.com/taobaocms/2015/11/26/12/01c3b99f554ad50d9e5a9900719715c94c.jpg'
  74 + ),
  75 + array(
  76 + 'href' => '/?gender=1,3',
  77 + 'img' => 'http://img12.static.yhbimg.com/taobaocms/2015/11/27/09/02a4f1c10e1e81574520e5c0239741a076.jpg'
  78 + ),
  79 + array(
  80 + 'href' => '/?gender=1,3',
  81 + 'img' => 'http://img10.static.yhbimg.com/taobaocms/2015/11/26/12/01c3b99f554ad50d9e5a9900719715c94c.jpg'
  82 + ),
  83 + array(
  84 + 'href' => '/?gender=1,3',
  85 + 'img' => 'http://img12.static.yhbimg.com/taobaocms/2015/11/27/09/02a4f1c10e1e81574520e5c0239741a076.jpg'
  86 + ),
  87 + array(
  88 + 'href' => '/?gender=1,3',
  89 + 'img' => 'http://img10.static.yhbimg.com/taobaocms/2015/11/26/12/01c3b99f554ad50d9e5a9900719715c94c.jpg'
  90 + ),
  91 + array(
  92 + 'href' => '/?gender=1,3',
  93 + 'img' => 'http://img12.static.yhbimg.com/taobaocms/2015/11/27/09/02a4f1c10e1e81574520e5c0239741a076.jpg'
  94 + )
  95 + )
  96 + )
  97 + ),
  98 + array(
  99 + 'popular' => array(
  100 + 'name' => '人气单品',
  101 + 'list' => array(
  102 + array(
  103 + 'href' => '',
  104 + 'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
  105 + 'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
  106 + 'price' => '399',
  107 + 'sPrice' => '199',
  108 + 'rank' => '1'
  109 + ),
  110 + array(
  111 + 'href' => '',
  112 + 'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
  113 + 'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
  114 + 'price' => '399',
  115 + 'sPrice' => '199',
  116 + 'rank' => '2'
  117 + ),
  118 + array(
  119 + 'href' => '',
  120 + 'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
  121 + 'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
  122 + 'price' => '399',
  123 + 'sPrice' => '199',
  124 + 'rank' => '3'
  125 + ),
  126 + array(
  127 + 'href' => '',
  128 + 'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
  129 + 'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
  130 + 'price' => '399',
  131 + 'sPrice' => '199',
  132 + 'rank' => '4'
  133 + ),
  134 + array(
  135 + 'href' => '',
  136 + 'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
  137 + 'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
  138 + 'price' => '399',
  139 + 'sPrice' => '199',
  140 + 'rank' => '5'
  141 + ),
  142 + array(
  143 + 'href' => '',
  144 + 'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
  145 + 'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
  146 + 'price' => '399',
  147 + 'sPrice' => '199',
  148 + 'rank' => '6'
  149 + ),
  150 + array(
  151 + 'href' => '',
  152 + 'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
  153 + 'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
  154 + 'price' => '399',
  155 + 'sPrice' => '199',
  156 + 'rank' => '7'
  157 + ),
  158 + array(
  159 + 'href' => '',
  160 + 'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
  161 + 'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
  162 + 'price' => '399',
  163 + 'sPrice' => '199',
  164 + 'rank' => '8'
  165 + ),
  166 + array(
  167 + 'href' => '',
  168 + 'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
  169 + 'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
  170 + 'price' => '399',
  171 + 'sPrice' => '199',
  172 + 'rank' => '9'
  173 + ),
  174 + array(
  175 + 'href' => '',
  176 + 'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
  177 + 'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
  178 + 'price' => '399',
  179 + 'sPrice' => '199',
  180 + 'rank' => '10'
  181 + )
  182 + )
  183 +
  184 + )
  185 + ),
  186 + array(
  187 + 'hotBrands' => array(
  188 + 'name' => '热门品牌',
  189 + )
  190 + ),
  191 + array(
  192 + 'hotWeek' => array(
  193 + 'name' => '一周热卖',
  194 + 'nav' => array(
  195 + array(
  196 + 'textCn' => 'TOP100',
  197 + 'url' => '',
  198 + 'sid' => 1
  199 + ),
  200 + array(
  201 + 'textCn' => '上装',
  202 + 'url' => '',
  203 + 'sid' => 2
  204 + ),
  205 + array(
  206 + 'textCn' => '男生测试',
  207 + 'url' => '',
  208 + 'sid' => 3
  209 + ),
  210 + array(
  211 + 'textCn' => '配饰',
  212 + 'url' => '',
  213 + 'sid' => 4
  214 + )
  215 + ),
  216 + 'list' => array(
  217 + array(
  218 + 'thumb' => 'http://img13.static.yhbimg.com/goodsimg/2015/11/24/10/020dce58a189f3fbfc071b3d5dc7ccc4e9.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90',
  219 + 'url' => 'http://item.yohobuy.com/product/pro_294497_377385.html',
  220 + 'name' => 'MARtube马克图布 暖手宝移动电源萌兔',
  221 + 'marketPrice' => '109',
  222 + 'salePrice' => '129'
  223 + ),
  224 + array(
  225 + 'thumb' => 'http://img13.static.yhbimg.com/goodsimg/2015/11/24/10/020dce58a189f3fbfc071b3d5dc7ccc4e9.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90',
  226 + 'url' => 'http://item.yohobuy.com/product/pro_294497_377385.html',
  227 + 'name' => 'MARtube马克图布 暖手宝移动电源萌兔',
  228 + 'marketPrice' => '109',
  229 + 'salePrice' => '129'
  230 + ),
  231 + array(
  232 + 'thumb' => 'http://img13.static.yhbimg.com/goodsimg/2015/11/24/10/020dce58a189f3fbfc071b3d5dc7ccc4e9.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90',
  233 + 'url' => 'http://item.yohobuy.com/product/pro_294497_377385.html',
  234 + 'name' => 'MARtube马克图布 暖手宝移动电源萌兔',
  235 + 'marketPrice' => '109',
  236 + 'salePrice' => '129'
  237 + ),
  238 + array(
  239 + 'thumb' => 'http://img13.static.yhbimg.com/goodsimg/2015/11/24/10/020dce58a189f3fbfc071b3d5dc7ccc4e9.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90',
  240 + 'url' => 'http://item.yohobuy.com/product/pro_294497_377385.html',
  241 + 'name' => 'MARtube马克图布 暖手宝移动电源萌兔',
  242 + 'marketPrice' => '109',
  243 + 'salePrice' => '129'
  244 + ),
  245 + array(
  246 + 'thumb' => 'http://img13.static.yhbimg.com/goodsimg/2015/11/24/10/020dce58a189f3fbfc071b3d5dc7ccc4e9.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90',
  247 + 'url' => 'http://item.yohobuy.com/product/pro_294497_377385.html',
  248 + 'name' => 'MARtube马克图布 暖手宝移动电源萌兔',
  249 + 'marketPrice' => '109',
  250 + 'salePrice' => '129'
  251 + ),
  252 + array(
  253 + 'thumb' => 'http://img13.static.yhbimg.com/goodsimg/2015/11/24/10/020dce58a189f3fbfc071b3d5dc7ccc4e9.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90',
  254 + 'url' => 'http://item.yohobuy.com/product/pro_294497_377385.html',
  255 + 'name' => 'MARtube马克图布 暖手宝移动电源萌兔',
  256 + 'marketPrice' => '109',
  257 + 'salePrice' => '129'
  258 + ),
  259 + )
  260 + )
  261 + )
  262 + )
  263 + );
  264 + $data = array( 'hotrankPage' => true,
  265 + 'footerTop'=> true,
  266 + 'hotrank' => array()
  267 + );
  268 + //焦点图 热门品牌
  269 + $focus = \Index\HomeModel::getChannelResource('lifestyle', 'd131aba83a84a6977eee3a7403a713de');
  270 + //print_r($focus);
  271 + $data['hotrank']['slide'] = $focus[0]['slide'];
  272 + $data['hotrank']['hotBrands'] = $focus[1]['hotBrands'];
  273 +
  274 + //人气单品 一周热卖
  275 + $page = 1;
  276 + $param = array('order'=>'s_n_desc','viewNum'=>60,'page'=>1,'stocknumber'=>1,'status'=>1,'gender'=>'','attribute_not'=>2);
  277 + $publiclist = \product\HotrankModel::getSearchData($param,$page);
  278 + $data['hotrank']['popular'] = $publiclist['popular'];
  279 + $data['hotrank']['hotWeek'] = $publiclist['hotWeek'];
  280 + //print_r($publiclist);
  281 +
  282 + //分类标签
  283 + $classes = array('gender' => 2);
  284 + $nav = \product\HotrankModel::getHotranktag($classes);
  285 + $data['hotrank']['hotWeek']['nav'] = $nav;
  286 + //print_r($data);
  287 + $this->_view->display('hotrank', $data);
  288 + }
50 } 289 }
51 ?> 290 ?>
@@ -5,11 +5,29 @@ class ListController extends WebAction @@ -5,11 +5,29 @@ class ListController extends WebAction
5 { 5 {
6 public function indexAction() 6 public function indexAction()
7 { 7 {
8 - 8 +
9 } 9 }
10 10
  11 + /**
  12 + * list列表new(模板new-sale)
  13 + */
11 public function newAction(){ 14 public function newAction(){
12 - 15 + $condition = array(
  16 + 'order' => 's_t_desc'
  17 + );
  18 + $options = array(
  19 + 'specialsale_id' => 'Y',
  20 + 'needDay' => 'Y'
  21 + );
  22 +
  23 + $newData = Product\NewModel::getNewSearchData($condition, $options);
  24 + $data = array(
  25 + 'productListPage' => true,
  26 + 'newSale' => $newData
  27 + );
  28 + $this->setWebNavHeader();
  29 + //渲染模板
  30 + $this->_view->display('new-sale', $data);
13 } 31 }
14 32
15 /** 33 /**
1 -<?php  
2 -  
3 -use Action\WebAction;  
4 -  
5 -/**  
6 - * new页  
7 - *  
8 - */  
9 -class NewController extends WebAction  
10 -{  
11 -  
12 - public function indexAction()  
13 - {  
14 - $condition = array(  
15 - 'order' => 's_t_desc'  
16 - );  
17 - $options = array(  
18 - 'specialsale_id' => 'Y',  
19 - 'needDay' => 'Y'  
20 - );  
21 -  
22 - $newData = Product\NewModel::getNewSearchData($condition, $options);  
23 - $data = array(  
24 - 'productListPage' => true,  
25 - 'newSale' => $newData  
26 - );  
27 - $this->setWebNavHeader();  
28 - //渲染模板  
29 - $this->_view->display('new-sale', $data);  
30 - }  
31 -  
32 -}