Authored by 梁志锋

Merge remote-tracking branch 'remotes/origin/release/4.4'

@@ -21,7 +21,7 @@ class ListProcess @@ -21,7 +21,7 @@ class ListProcess
21 $result = array(); 21 $result = array();
22 22
23 if (isset($data['product_list'])) { 23 if (isset($data['product_list'])) {
24 - $result['new'] = self::getProductData($data['product_list'], $showTag, $tagNew, $tagSale); 24 + $result['new'] = self::getProductData($data['product_list'], false, $showTag, $tagNew, $tagSale);
25 } 25 }
26 if ($returnFilter && isset($data['filter'])) { 26 if ($returnFilter && isset($data['filter'])) {
27 $result['filter'] = self::getFilterData($data['filter']); 27 $result['filter'] = self::getFilterData($data['filter']);
@@ -36,13 +36,13 @@ class ListProcess @@ -36,13 +36,13 @@ class ListProcess
36 * @param $data 36 * @param $data
37 * @return array 处理之后的商品数据 37 * @return array 处理之后的商品数据
38 */ 38 */
39 - public static function getProductData($data, $isApp = false) 39 + public static function getProductData($data, $isApp = false, $showTag = true, $tagNew = true, $tagSale = true)
40 { 40 {
41 // 处理商品 41 // 处理商品
42 $products = array(); 42 $products = array();
43 43
44 foreach ($data as $value) { 44 foreach ($data as $value) {
45 - $products[] = Helpers::formatProduct($value, true, true, true, 235, 314, true); 45 + $products[] = Helpers::formatProduct($value, $showTag, $tagNew, $tagSale, 235, 314, true);
46 } 46 }
47 47
48 return $products; 48 return $products;
@@ -13,7 +13,10 @@ class ShopProcess @@ -13,7 +13,10 @@ class ShopProcess
13 private static $shopData = array(); 13 private static $shopData = array();
14 private static $shopId = 0; 14 private static $shopId = 0;
15 private static $appVersion = 0; 15 private static $appVersion = 0;
  16 + //店铺品牌
16 private static $brandId; 17 private static $brandId;
  18 + //单品店
  19 + private static $single = false;
17 20
18 /** 21 /**
19 * 组织店铺页面数据 22 * 组织店铺页面数据
@@ -25,7 +28,7 @@ class ShopProcess @@ -25,7 +28,7 @@ class ShopProcess
25 */ 28 */
26 public static function formShopData($data, $shopId, $appVersion) 29 public static function formShopData($data, $shopId, $appVersion)
27 { 30 {
28 - self::$shopId = $shopId; 31 + self::$shopData['shopId'] = self::$shopId = $shopId;
29 self::$shopData['appVersion'] = self::$appVersion = $appVersion; 32 self::$shopData['appVersion'] = self::$appVersion = $appVersion;
30 foreach ($data as $key => $val) { 33 foreach ($data as $key => $val) {
31 if (empty($val) || !is_callable("self::$key")) { 34 if (empty($val) || !is_callable("self::$key")) {
@@ -47,15 +50,23 @@ class ShopProcess @@ -47,15 +50,23 @@ class ShopProcess
47 self::$shopData['storeName'] = $data['data']['is_show_shop_name'] == 'Y' ? $data['data']['shop_name'] : ''; 50 self::$shopData['storeName'] = $data['data']['is_show_shop_name'] == 'Y' ? $data['data']['shop_name'] : '';
48 //用户是否收藏店铺 51 //用户是否收藏店铺
49 self::$shopData['collect'] = $data['data']['is_favorite'] == 'Y' ? true : false; 52 self::$shopData['collect'] = $data['data']['is_favorite'] == 'Y' ? true : false;
50 - //店铺id  
51 - self::$shopData['shopId'] = self::$shopId; 53 +
  54 + //全部商品链接
  55 + $allGoodsParam['title'] = '全部商品';
  56 + //单品店
  57 + if (self::$single) {
  58 + $allGoodsParam['brand'] = self::$brandId;
  59 + } else {
  60 + //店铺id
  61 + self::$shopData['shopId'] = self::$shopId;
  62 + $allGoodsParam['shop_id'] = self::$shopId;
  63 + }
52 if (empty(self::$appVersion)) { 64 if (empty(self::$appVersion)) {
53 - //全部商品链接  
54 - self::$shopData['allGoods'] = Helpers::url('', array('shop_id' => self::$shopId, 'title' => '全部商品'), 'search'); 65 + self::$shopData['allGoods'] = Helpers::url('', $allGoodsParam, 'search');
55 //店铺简介页地址 66 //店铺简介页地址
56 self::$shopData['shopIntroHref'] = Helpers::url('/product/index/intro', array('shop_id' => self::$shopId)); 67 self::$shopData['shopIntroHref'] = Helpers::url('/product/index/intro', array('shop_id' => self::$shopId));
57 } else { 68 } else {
58 - self::$shopData['allGoods'] = Helpers::url('', array('shop_id' => self::$shopId, 'title' => '全部商品'), 'search').'&openby:yohobuy={"action":"go.list","params":{"title":"全部商品", "actiontype":"0","shop_id":"'.self::$shopId.'","page":"1"}}'; 69 + self::$shopData['allGoods'] = Helpers::url('', $allGoodsParam, 'search').'&openby:yohobuy={"action":"go.list","params":{"title":"全部商品", "actiontype":"0","shop_id":"'.self::$shopId.'","page":"1"}}';
59 self::$shopData['shopIntroHref'] = Helpers::url('/product/index/intro', array('shop_id' => self::$shopId, 'app_version' => self::$appVersion)); 70 self::$shopData['shopIntroHref'] = Helpers::url('/product/index/intro', array('shop_id' => self::$shopId, 'app_version' => self::$appVersion));
60 } 71 }
61 //搜索链接 72 //搜索链接
@@ -125,8 +136,9 @@ class ShopProcess @@ -125,8 +136,9 @@ class ShopProcess
125 $brandNumber = count($data); 136 $brandNumber = count($data);
126 //少于2个不展示 单品店:单品店根据品牌id查询 137 //少于2个不展示 单品店:单品店根据品牌id查询
127 if ($brandNumber < 2) { 138 if ($brandNumber < 2) {
128 - self::$shopData['brand'] = $data[0]['id'];  
129 - self::$shopData['shopId']= ''; 139 + self::$brandId = self::$shopData['brand'] = $data[0]['id'];
  140 + self::$single = true;
  141 +// self::$shopData['shopId']= '';
130 return; 142 return;
131 } 143 }
132 foreach ($data as $val) { 144 foreach ($data as $val) {
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
@@ -145,12 +145,12 @@ function getPageGoods(info) { @@ -145,12 +145,12 @@ function getPageGoods(info) {
145 } 145 }
146 146
147 function getParam(req) { 147 function getParam(req) {
148 - if (shopId) {  
149 - req.data.shop_id = shopId;  
150 - }  
151 -  
152 if (brand) { 148 if (brand) {
153 req.data.brand = brand; 149 req.data.brand = brand;
  150 + } else {
  151 + if (shopId) {
  152 + req.data.shop_id = shopId;
  153 + }
154 } 154 }
155 } 155 }
156 156
@@ -393,49 +393,51 @@ function search(opt) { @@ -393,49 +393,51 @@ function search(opt) {
393 } 393 }
394 } 394 }
395 395
396 - switch (opt.type) {  
397 - case 'shop_id':  
398 - ext = {  
399 - shop_id: opt.id  
400 - };  
401 - break;  
402 - case 'gender':  
403 - ext = {  
404 - gender: opt.id  
405 - };  
406 - break;  
407 - case 'brand':  
408 - ext = {  
409 - brand: opt.id  
410 - };  
411 - break;  
412 - case 'sort':  
413 - ext = {  
414 - sort: opt.id  
415 - };  
416 - break;  
417 - case 'color':  
418 - ext = {  
419 - color: opt.id  
420 - };  
421 - break;  
422 - case 'size':  
423 - ext = {  
424 - size: opt.id  
425 - };  
426 - break;  
427 - case 'price':  
428 - ext = {  
429 - price: opt.id  
430 - };  
431 - break;  
432 - case 'discount':  
433 - ext = {  
434 - discount: opt.id  
435 - };  
436 - break; 396 + if (opt.id) {
  397 + switch (opt.type) {
  398 + case 'shop_id':
  399 + ext = {
  400 + shop_id: opt.id
  401 + };
  402 + break;
  403 + case 'gender':
  404 + ext = {
  405 + gender: opt.id
  406 + };
  407 + break;
  408 + case 'brand':
  409 + ext = {
  410 + brand: opt.id
  411 + };
  412 + break;
  413 + case 'sort':
  414 + ext = {
  415 + sort: opt.id
  416 + };
  417 + break;
  418 + case 'color':
  419 + ext = {
  420 + color: opt.id
  421 + };
  422 + break;
  423 + case 'size':
  424 + ext = {
  425 + size: opt.id
  426 + };
  427 + break;
  428 + case 'price':
  429 + ext = {
  430 + price: opt.id
  431 + };
  432 + break;
  433 + case 'discount':
  434 + ext = {
  435 + discount: opt.id
  436 + };
  437 + break;
  438 + }
  439 + $.extend(defaultOpt, ext); //扩展筛选项
437 } 440 }
438 - $.extend(defaultOpt, ext); //扩展筛选项  
439 } 441 }
440 442
441 //导航类别 443 //导航类别
@@ -464,10 +466,10 @@ function search(opt) { @@ -464,10 +466,10 @@ function search(opt) {
464 466
465 if (brand) { 467 if (brand) {
466 setting.brand = brand; 468 setting.brand = brand;
467 - }  
468 -  
469 - if (shopId) {  
470 - setting.shop_id = shopId; 469 + } else {
  470 + if (shopId) {
  471 + setting.shop_id = shopId;
  472 + }
471 } 473 }
472 474
473 searching = true; 475 searching = true;
@@ -537,7 +539,7 @@ $.ajax({ @@ -537,7 +539,7 @@ $.ajax({
537 type: 'GET', 539 type: 'GET',
538 url: '/search/filter', 540 url: '/search/filter',
539 data: { 541 data: {
540 - shop_id: shopId, 542 + shop_id: brand ? '' : shopId,
541 brand: brand 543 brand: brand
542 }, 544 },
543 success: function(data) { 545 success: function(data) {
@@ -466,19 +466,43 @@ @@ -466,19 +466,43 @@
466 &:first-child { 466 &:first-child {
467 border-left: none; 467 border-left: none;
468 } 468 }
  469 +
  470 + a {
  471 + display: block;
  472 + box-sizing: border-box;
  473 + text-align: center;
  474 + width: 100%;
  475 + height: 100%;
  476 + color: #999;
  477 + }
469 } 478 }
  479 +
470 .active .cur { 480 .active .cur {
471 color: #000; 481 color: #000;
472 } 482 }
473 - 483 +
474 .active a { 484 .active a {
475 color: #000; 485 color: #000;
476 } 486 }
477 -  
478 - .iconfont { 487 +
  488 +
  489 + .new .iconfont {
  490 + transform: scale(0.8);
479 font-weight: bold; 491 font-weight: bold;
480 } 492 }
481 - }  
482 493
483 - 494 + .price .iconfont {
  495 + transform: scale(0.8);
  496 + font-weight: bold;
  497 + }
  498 +
  499 + .filter .iconfont {
  500 + font-size: 22px;
  501 + transition: transform 0.1 ease-in;
  502 + }
  503 +
  504 + .filter.active .iconfont {
  505 + transform: rotate(-180deg);
  506 + }
  507 + }
484 } 508 }
@@ -295,10 +295,10 @@ class SearchController extends AbstractAction @@ -295,10 +295,10 @@ class SearchController extends AbstractAction
295 $showTag = $this->get('showTag', 0); 295 $showTag = $this->get('showTag', 0);
296 $showTag = $showTag === 0 ? true : false; 296 $showTag = $showTag === 0 ? true : false;
297 //显示标签new 297 //显示标签new
298 - $tagNew = $this->get('newTag', 0); 298 + $tagNew = $this->get('tagNew', 0);
299 $tagNew = $tagNew === 0 ? true : false; 299 $tagNew = $tagNew === 0 ? true : false;
300 //显示标签sale 300 //显示标签sale
301 - $tagSale = $this->get('saleTag', 0); 301 + $tagSale = $this->get('tagSale', 0);
302 $tagSale = $tagSale === 0 ? true : false; 302 $tagSale = $tagSale === 0 ? true : false;
303 // 过滤掉值为空的条件 303 // 过滤掉值为空的条件
304 $condition = array_filter($condition); 304 $condition = array_filter($condition);
@@ -414,10 +414,11 @@ class ListModel @@ -414,10 +414,11 @@ class ListModel
414 public static function shopData($shopId, $uid, $appVersion = '') 414 public static function shopData($shopId, $uid, $appVersion = '')
415 { 415 {
416 $data = array(); 416 $data = array();
417 - //店铺信息  
418 - $data['shopInfo'] = ListData::getShopInfo($shopId, $uid); 417 +
419 //店铺装修资源数据 418 //店铺装修资源数据
420 $data['decorator'] = ListData::getShopDecorator($shopId); 419 $data['decorator'] = ListData::getShopDecorator($shopId);
  420 + //店铺信息
  421 + $data['shopInfo'] = ListData::getShopInfo($shopId, $uid);
421 //店铺分类 422 //店铺分类
422 $channel = Helpers::getChannelByCookie(); 423 $channel = Helpers::getChannelByCookie();
423 $data['shopCategory'] = ListData::getShopCategory($shopId, $channel); 424 $data['shopCategory'] = ListData::getShopCategory($shopId, $channel);