Authored by 郝肖肖

店铺人气商品

@@ -269,7 +269,21 @@ class DetailData @@ -269,7 +269,21 @@ class DetailData
269 $param['product_skn'] = $skn; 269 $param['product_skn'] = $skn;
270 $param['client_secret'] = Sign::getSign($param); 270 $param['client_secret'] = Sign::getSign($param);
271 271
272 - return Yohobuy::get(API_URL, $param); 272 + return Yohobuy::get(API_URL, $param);
273 } 273 }
274 274
  275 + /**
  276 + * 通过skn查询商品详情
  277 + * @param {[string || array]} $productSkn 商品skn
  278 + * @return {[array]}
  279 + */
  280 + public static function productBatch($productSkn) {
  281 + $productSkn = is_array($productSkn) ? $productSkn : array($productSkn);
  282 + $param = Yohobuy::param();
  283 + $param['method'] = 'h5.product.batch';
  284 + $param['productSkn'] = implode(',', $productSkn);
  285 + $param['client_secret'] = Sign::getSign($param);
  286 +
  287 + return Yohobuy::get(API_URL, $param);
  288 + }
275 } 289 }
@@ -5,7 +5,7 @@ namespace Plugin\DataProcess; @@ -5,7 +5,7 @@ namespace Plugin\DataProcess;
5 use LibModels\Wap\Product\SearchData; 5 use LibModels\Wap\Product\SearchData;
6 use Plugin\Helpers; 6 use Plugin\Helpers;
7 use Plugin\Images; 7 use Plugin\Images;
8 - 8 +use LibModels\Wap\Product\DetailData;
9 /** 9 /**
10 * 店铺楼层数据处理类 10 * 店铺楼层数据处理类
11 */ 11 */
@@ -348,18 +348,22 @@ class ShopProcess @@ -348,18 +348,22 @@ class ShopProcess
348 self::$shopData['hotList'][] = $goods; 348 self::$shopData['hotList'][] = $goods;
349 } 349 }
350 } else { 350 } else {
  351 + $productSkn = array();
351 foreach ($data as $val) { 352 foreach ($data as $val) {
352 - $goods = array(  
353 - 'url' => Helpers::getUrlBySkc($val['productId'], $val['goodsId'], $val['cnAlphabet']),  
354 - 'img' => Helpers::getImageUrl($val['src'], 235, 314) . '?imageView/2/w/235/h/314',  
355 - 'productName' => $val['productName'],  
356 - 'salesPrice' => '¥' . $val['salesPrice'],  
357 - 'presentPrice' => '¥' . $val['salesPrice']  
358 - );  
359 - if (!empty(self::$appVersion)) {  
360 - $goods['url'] .= '?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":' . $val['productSkn'] . '}}'; 353 + $productSkn[] = $val['productSkn'];
  354 + }
  355 +
  356 + $product = DetailData::productBatch($productSkn);
  357 + if ($product['code'] === 200 && isset($product['data']['product_list'])) {
  358 +
  359 + foreach ($product['data']['product_list'] as $key => $value) {
  360 + $goods = Helpers::formatProduct($value, false, false, false, 235, 314, self::$appVersion);
  361 + //店铺人气商品不须要其它标签、即将售罄
  362 + $goods['tags'] = array();
  363 + $goods['is_soon_sold_out'] = false;
  364 + $goods['tags']['is_hot'] = true;
  365 + self::$shopData['hotList'][] = $goods;
361 } 366 }
362 - self::$shopData['hotList'][] = $goods;  
363 } 367 }
364 } 368 }
365 } 369 }
@@ -24,6 +24,12 @@ @@ -24,6 +24,12 @@
24 } 24 }
25 } 25 }
26 26
  27 + .hot-tag {
  28 + width: 60px;
  29 + background-color: #FF575C;
  30 + color: #fff;
  31 + }
  32 +
27 .new-tag { 33 .new-tag {
28 width: 60px; 34 width: 60px;
29 background-color: #78dc7e; 35 background-color: #78dc7e;
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 line-height: 70px; 7 line-height: 70px;
8 text-align: center; 8 text-align: center;
9 font-size: 30px; 9 font-size: 30px;
10 - color: #b1b1b1; 10 + color: #b0b0b0;
11 } 11 }
12 12
13 .floor-header-more { 13 .floor-header-more {
@@ -180,14 +180,15 @@ @@ -180,14 +180,15 @@
180 180
181 li { 181 li {
182 width: 50%; 182 width: 50%;
183 - height: 168px; 183 + height: 160px;
184 float: left; 184 float: left;
185 text-align: center; 185 text-align: center;
186 list-style: none; 186 list-style: none;
187 display: list-item; 187 display: list-item;
188 188
189 img { 189 img {
190 - width: 90%; 190 + width: 275px;
  191 + height: inherit;
191 border-radius: 10px; 192 border-radius: 10px;
192 vertical-align: top; 193 vertical-align: top;
193 } 194 }
@@ -201,7 +202,7 @@ @@ -201,7 +202,7 @@
201 text-align: center; 202 text-align: center;
202 line-height: 98px; 203 line-height: 98px;
203 font-size: 30px; 204 font-size: 30px;
204 - margin-top: 40px; 205 + margin-top: 30px;
205 position: relative; 206 position: relative;
206 } 207 }
207 208
@@ -390,7 +391,7 @@ @@ -390,7 +391,7 @@
390 line-height: 88px; 391 line-height: 88px;
391 font-size: 28px; 392 font-size: 28px;
392 background: #fff; 393 background: #fff;
393 - border-top: 1px solid #eaeaea; 394 + border-top: 1px solid #e0e0e0;
394 z-index: 2; 395 z-index: 2;
395 396
396 397
@@ -407,7 +408,7 @@ @@ -407,7 +408,7 @@
407 height: 28px; 408 height: 28px;
408 margin-top: 30px; 409 margin-top: 30px;
409 float: right; 410 float: right;
410 - border-right: 1px solid #eaeaea; 411 + border-right: 1px solid #e0e0e0;
411 display: inline-block; 412 display: inline-block;
412 } 413 }
413 } 414 }
@@ -415,7 +416,7 @@ @@ -415,7 +416,7 @@
415 .sub-group { 416 .sub-group {
416 position: absolute; 417 position: absolute;
417 background: #fff; 418 background: #fff;
418 - border: 1px solid #eaeaea; 419 + border: 1px solid #e0e0e0;
419 border-radius: 12px; 420 border-radius: 12px;
420 bottom: 104px; 421 bottom: 104px;
421 width: 40%; 422 width: 40%;
@@ -429,7 +430,7 @@ @@ -429,7 +430,7 @@
429 dd { 430 dd {
430 line-height: 80px; 431 line-height: 80px;
431 text-align: center; 432 text-align: center;
432 - border-top: 1px solid #eaeaea; 433 + border-top: 1px solid #e0e0e0;
433 white-space: nowrap; 434 white-space: nowrap;
434 overflow: hidden; 435 overflow: hidden;
435 text-overflow: ellipsis; 436 text-overflow: ellipsis;
@@ -95,27 +95,17 @@ @@ -95,27 +95,17 @@
95 {{/ hotCategory}} 95 {{/ hotCategory}}
96 </div> 96 </div>
97 97
98 - <div class="popularity-title first">  
99 - 人气单品  
100 - <a class="more buriedpoint" href="{{more_url}}" data-bp-id="shop_popularity_{{more_url}}">&#xe618;</a>  
101 - </div>  
102 - <div class="product-warp">  
103 - <ul class="product-list first">  
104 - {{#each hotList}}  
105 - <li class="buriedpoint" data-bp-id="shop_hotList_{{url}}">  
106 - <a href="{{url}}">  
107 - <img src="{{img}}">  
108 - </a>  
109 - <div class="list-price">  
110 - <p>{{productName}}</p>  
111 - <p><span class="red">{{originalPrice}}</span>  
112 - <span>{{presentPrice}}</span>  
113 - </p>  
114 - </div>  
115 - </li>  
116 - {{/each}}  
117 - </ul>  
118 - </div> 98 + {{#if hotList}}
  99 + <div class="popularity-title first">
  100 + 人气单品
  101 + <a class="more buriedpoint" href="{{more_url}}" data-bp-id="shop_popularity_{{more_url}}">&#xe618;</a>
  102 + </div>
  103 + <div class="product-warp">
  104 + {{# hotList}}
  105 + {{> good}}
  106 + {{/ hotList}}
  107 + </div>
  108 + {{/if}}
119 </div> 109 </div>
120 110
121 <div class="discount-area first" id="navlist2"> 111 <div class="discount-area first" id="navlist2">
@@ -6,6 +6,9 @@ @@ -6,6 +6,9 @@
6 {{# is_new}} 6 {{# is_new}}
7 <p class="good-tag new-tag">NEW</p> 7 <p class="good-tag new-tag">NEW</p>
8 {{/ is_new}} 8 {{/ is_new}}
  9 + {{# is_hot}}
  10 + <p class="good-tag hot-tag">HOT</p>
  11 + {{/ is_hot}}
9 {{# is_advance}} 12 {{# is_advance}}
10 <p class="good-tag renew-tag">再到着</p> 13 <p class="good-tag renew-tag">再到着</p>
11 {{/ is_advance}} 14 {{/ is_advance}}