Authored by 邱骏

新增店铺+商品楼层模板

@@ -14,6 +14,8 @@ exports.index = function(req, res, next) { @@ -14,6 +14,8 @@ exports.index = function(req, res, next) {
14 if (!result) { 14 if (!result) {
15 return next(); 15 return next();
16 } 16 }
  17 +
  18 + // console.log('result=', result, 'component:', result.floors[0].component, result.floors[1].component);
17 let title = stringProcess.paramsFilter(req.query.title) || result.name || '专题活动'; 19 let title = stringProcess.paramsFilter(req.query.title) || result.name || '专题活动';
18 let shareId = _.parseInt(stringProcess.paramsFilter(req.query.share_id)); 20 let shareId = _.parseInt(stringProcess.paramsFilter(req.query.share_id));
19 21
@@ -29,6 +29,7 @@ class featureModel extends global.yoho.BaseModel { @@ -29,6 +29,7 @@ class featureModel extends global.yoho.BaseModel {
29 let skns = []; 29 let skns = [];
30 let list = _.isArray(productArr) ? productArr : [productArr]; 30 let list = _.isArray(productArr) ? productArr : [productArr];
31 31
  32 + console.log('getProductSkns:', list);
32 _.forEach(list, value => { 33 _.forEach(list, value => {
33 let defSkns = value.defaultSkns || value.defaultSkn; 34 let defSkns = value.defaultSkns || value.defaultSkn;
34 35
@@ -349,6 +350,8 @@ class featureModel extends global.yoho.BaseModel { @@ -349,6 +350,8 @@ class featureModel extends global.yoho.BaseModel {
349 }, f.component[0].searchCondition || {}); 350 }, f.component[0].searchCondition || {});
350 351
351 f.component[0].newStyle = _.get(f, 'component[0].newStyle') === '1'; 352 f.component[0].newStyle = _.get(f, 'component[0].newStyle') === '1';
  353 +
  354 + console.log('newStyle:', f.component[0].newStyle);
352 } 355 }
353 356
354 // 新增店铺组 357 // 新增店铺组
@@ -356,6 +359,27 @@ class featureModel extends global.yoho.BaseModel { @@ -356,6 +359,27 @@ class featureModel extends global.yoho.BaseModel {
356 shopGroups.push(self._getShopGroup(f.component[0])); 359 shopGroups.push(self._getShopGroup(f.component[0]));
357 } 360 }
358 361
  362 + // 店铺加商品组
  363 + if (componentType === 'shopAndProduct') {
  364 + let shop = f.component[0];
  365 +
  366 + shop.jumpUrl = `//m.yohobuy.com/product/shop?shop_id=${shop.shopId}&openby:yohobuy=
  367 + {"action":"go.shop","params":{"shop_id":"${shop.shopId}","shop_template_type":"2"}}`;
  368 + shop.numOfOneRow = '3';
  369 + if (shop.searchCondition) {
  370 + shop.searchCondition.limit = '3'; // 强制把数量限制为3个
  371 + if (shop.favourite_prds_enable === '1') {
  372 + shop.searchCondition = Object.assign({
  373 + maybeLike: '1',
  374 + limit: '60'
  375 + }, shop.searchCondition || {});
  376 + shop.newStyle = _.get(f, 'component[0].newStyle') === '1';
  377 + }
  378 + } else if (shop.defaultSkn) {
  379 + componentArr.push(shop);
  380 + }
  381 + }
  382 +
359 if (_.get(f, 'type') === 'bottombar') { 383 if (_.get(f, 'type') === 'bottombar') {
360 f.height = _.get(f, 'param.height') / 20; 384 f.height = _.get(f, 'param.height') / 20;
361 } 385 }
@@ -456,6 +480,10 @@ class featureModel extends global.yoho.BaseModel { @@ -456,6 +480,10 @@ class featureModel extends global.yoho.BaseModel {
456 yield self._getLikedFloorDataMulti(likeArr); 480 yield self._getLikedFloorDataMulti(likeArr);
457 } 481 }
458 482
  483 + _.each(data.floors, ret => {
  484 + console.log(ret.component);
  485 + });
  486 +
459 return data; 487 return data;
460 })(); 488 })();
461 } 489 }
@@ -108,6 +108,31 @@ @@ -108,6 +108,31 @@
108 {{/if}} 108 {{/if}}
109 {{/isEqualOr}} 109 {{/isEqualOr}}
110 110
  111 +
  112 + {{#isEqualOr type 'shopAndProduct'}}
  113 + <!--一个店铺带两个商品-->
  114 + {{!--log .--}}
  115 + <div class="shop-product-container {{#isEqualOr position '1'}}right{{^}}left{{/isEqualOr}}">
  116 + <div class="product-container single-item3 {{#isEqualOr position '1'}}right{{^}}left{{/isEqualOr}} shop-wrapper">
  117 + <a class="shop-container" href="{{jumpUrl}}" target="_blank">
  118 + <div class="feature-shop-info">
  119 + <image class="lazy" data-original="{{image2 shopBgImage w=213 h=224 q=80}}"></image>
  120 + </div>
  121 + </a>
  122 + </div>
  123 + <div class="product-wrapper">
  124 + {{#isEqualOr newStyle '1'}}
  125 + {{> feature/product-new-style}}
  126 + {{^}}
  127 + {{> feature/product-old-style}}
  128 + {{/isEqualOr}}
  129 + </div>
  130 + <div class="clearfix"></div>
  131 + </div>
  132 +
  133 +
  134 + {{/isEqualOr}}
  135 +
111 {{#isEqualOr type 'productGroup'}} 136 {{#isEqualOr type 'productGroup'}}
112 {{! 商品池}} 137 {{! 商品池}}
113 {{#isEqualOr newStyle '1'}} 138 {{#isEqualOr newStyle '1'}}
  1 +{{!--log .--}}
1 <div class="product-container item{{numOfOneRow}}" {{#if proBgImg}} style="background:url({{image2 proBgImg q=85}}) repeat;background-size:100%;" 2 <div class="product-container item{{numOfOneRow}}" {{#if proBgImg}} style="background:url({{image2 proBgImg q=85}}) repeat;background-size:100%;"
2 {{/if}}> 3 {{/if}}>
3 <div class="product-source" condition='{{stringify searchCondition}}' fp="{{getAnalysis ../this @index}}" data-rownum="{{numOfOneRow}}" {{#unless defaultPros.length}} 4 <div class="product-source" condition='{{stringify searchCondition}}' fp="{{getAnalysis ../this @index}}" data-rownum="{{numOfOneRow}}" {{#unless defaultPros.length}}
@@ -881,6 +881,16 @@ function activityPlan() { @@ -881,6 +881,16 @@ function activityPlan() {
881 } 881 }
882 } 882 }
883 883
  884 +// 改变店铺+商品组中店铺的高度
  885 +function changeShopAndProductHeight() {
  886 + $('.shop-product-container').each(function(i) {
  887 + let height = $(this).find('.product-wrapper .feature-product-info').height();
  888 +
  889 + console.log('商铺' + i, height);
  890 + $(this).find('.shop-wrapper .feature-shop-info').height(height);
  891 + });
  892 +}
  893 +
884 $(function() { 894 $(function() {
885 if ($('.over').length) { 895 if ($('.over').length) {
886 // 过期/删除 状态的 活动 896 // 过期/删除 状态的 活动
@@ -945,6 +955,8 @@ $(function() { @@ -945,6 +955,8 @@ $(function() {
945 // 定时计划 955 // 定时计划
946 activityPlan(); 956 activityPlan();
947 957
  958 + setTimeout(changeShopAndProductHeight, 300);
  959 +
948 // 小程序相关处理 960 // 小程序相关处理
949 if (!window.WeixinJSBridge || !window.WeixinJSBridge.invoke) { 961 if (!window.WeixinJSBridge || !window.WeixinJSBridge.invoke) {
950 document.addEventListener('WeixinJSBridgeReady', miniProgramHandleInit, false); 962 document.addEventListener('WeixinJSBridgeReady', miniProgramHandleInit, false);
@@ -51,6 +51,8 @@ @@ -51,6 +51,8 @@
51 } 51 }
52 52
53 .new-price { 53 .new-price {
  54 + text-align: center;
  55 +
54 > .sale-price { 56 > .sale-price {
55 margin-left: 6px; 57 margin-left: 6px;
56 font-size: 24px; 58 font-size: 24px;
@@ -361,6 +363,60 @@ @@ -361,6 +363,60 @@
361 } 363 }
362 } 364 }
363 365
  366 +.shop-product-container {
  367 + padding-bottom: 10px;
  368 + overflow: hidden;
  369 +
  370 + .product-container {
  371 + padding: 0;
  372 + margin: 0;
  373 + }
  374 +
  375 + .product-wrapper {
  376 + overflow: hidden;
  377 + }
  378 +
  379 + .shop-wrapper {
  380 + display: inline-block;
  381 + height: 100%;
  382 +
  383 + a {
  384 + height: 100%;
  385 + }
  386 +
  387 + .feature-shop-info {
  388 + height: 100%;
  389 + }
  390 + }
  391 +
  392 + &.left .shop-wrapper {
  393 + margin-top: 10px;
  394 + }
  395 +
  396 + &.left .product-wrapper {
  397 + .product-source .feature-product-info:nth-child(n+4) {
  398 + display: none;
  399 + }
  400 + }
  401 +
  402 + &.right .shop-wrapper {
  403 + overflow: hidden;
  404 + padding-top: 10px;
  405 + margin-left: 0 !important;
  406 + margin-right: 10px;
  407 + }
  408 +
  409 + &.right .product-wrapper {
  410 + overflow: hidden;
  411 + padding: 0;
  412 + margin-left: 20px;
  413 +
  414 + .product-source .feature-product-info:nth-child(n+4) {
  415 + display: none;
  416 + }
  417 + }
  418 +}
  419 +
364 .is-style-2 { 420 .is-style-2 {
365 padding: 0 30px 10px; 421 padding: 0 30px 10px;
366 422
@@ -114,6 +114,14 @@ $margin-right-3: 7px; @@ -114,6 +114,14 @@ $margin-right-3: 7px;
114 float: left; 114 float: left;
115 width: 203px; 115 width: 203px;
116 116
  117 + &.left {
  118 + float: left;
  119 + }
  120 +
  121 + &.right {
  122 + float: right;
  123 + }
  124 +
117 .shop-container .feature-shop-info { 125 .shop-container .feature-shop-info {
118 margin: 16px 10px 16px 0; 126 margin: 16px 10px 16px 0;
119 127
@@ -124,9 +132,7 @@ $margin-right-3: 7px; @@ -124,9 +132,7 @@ $margin-right-3: 7px;
124 } 132 }
125 } 133 }
126 134
127 -/*  
128 - 个性化店铺组与原有店铺组样式几乎完全不一样  
129 -*/ 135 +/* 个性化店铺组与原有店铺组样式几乎完全不一样 */
130 .shop-individuation { 136 .shop-individuation {
131 &.shop-two, 137 &.shop-two,
132 &.shop-three { 138 &.shop-three {