Authored by 邱骏

新增店铺+商品楼层模板

... ... @@ -14,6 +14,8 @@ exports.index = function(req, res, next) {
if (!result) {
return next();
}
// console.log('result=', result, 'component:', result.floors[0].component, result.floors[1].component);
let title = stringProcess.paramsFilter(req.query.title) || result.name || '专题活动';
let shareId = _.parseInt(stringProcess.paramsFilter(req.query.share_id));
... ...
... ... @@ -29,6 +29,7 @@ class featureModel extends global.yoho.BaseModel {
let skns = [];
let list = _.isArray(productArr) ? productArr : [productArr];
console.log('getProductSkns:', list);
_.forEach(list, value => {
let defSkns = value.defaultSkns || value.defaultSkn;
... ... @@ -349,6 +350,8 @@ class featureModel extends global.yoho.BaseModel {
}, f.component[0].searchCondition || {});
f.component[0].newStyle = _.get(f, 'component[0].newStyle') === '1';
console.log('newStyle:', f.component[0].newStyle);
}
// 新增店铺组
... ... @@ -356,6 +359,27 @@ class featureModel extends global.yoho.BaseModel {
shopGroups.push(self._getShopGroup(f.component[0]));
}
// 店铺加商品组
if (componentType === 'shopAndProduct') {
let shop = f.component[0];
shop.jumpUrl = `//m.yohobuy.com/product/shop?shop_id=${shop.shopId}&openby:yohobuy=
{"action":"go.shop","params":{"shop_id":"${shop.shopId}","shop_template_type":"2"}}`;
shop.numOfOneRow = '3';
if (shop.searchCondition) {
shop.searchCondition.limit = '3'; // 强制把数量限制为3个
if (shop.favourite_prds_enable === '1') {
shop.searchCondition = Object.assign({
maybeLike: '1',
limit: '60'
}, shop.searchCondition || {});
shop.newStyle = _.get(f, 'component[0].newStyle') === '1';
}
} else if (shop.defaultSkn) {
componentArr.push(shop);
}
}
if (_.get(f, 'type') === 'bottombar') {
f.height = _.get(f, 'param.height') / 20;
}
... ... @@ -456,6 +480,10 @@ class featureModel extends global.yoho.BaseModel {
yield self._getLikedFloorDataMulti(likeArr);
}
_.each(data.floors, ret => {
console.log(ret.component);
});
return data;
})();
}
... ...
... ... @@ -108,6 +108,31 @@
{{/if}}
{{/isEqualOr}}
{{#isEqualOr type 'shopAndProduct'}}
<!--一个店铺带两个商品-->
{{!--log .--}}
<div class="shop-product-container {{#isEqualOr position '1'}}right{{^}}left{{/isEqualOr}}">
<div class="product-container single-item3 {{#isEqualOr position '1'}}right{{^}}left{{/isEqualOr}} shop-wrapper">
<a class="shop-container" href="{{jumpUrl}}" target="_blank">
<div class="feature-shop-info">
<image class="lazy" data-original="{{image2 shopBgImage w=213 h=224 q=80}}"></image>
</div>
</a>
</div>
<div class="product-wrapper">
{{#isEqualOr newStyle '1'}}
{{> feature/product-new-style}}
{{^}}
{{> feature/product-old-style}}
{{/isEqualOr}}
</div>
<div class="clearfix"></div>
</div>
{{/isEqualOr}}
{{#isEqualOr type 'productGroup'}}
{{! 商品池}}
{{#isEqualOr newStyle '1'}}
... ...
{{!--log .--}}
<div class="product-container item{{numOfOneRow}}" {{#if proBgImg}} style="background:url({{image2 proBgImg q=85}}) repeat;background-size:100%;"
{{/if}}>
<div class="product-source" condition='{{stringify searchCondition}}' fp="{{getAnalysis ../this @index}}" data-rownum="{{numOfOneRow}}" {{#unless defaultPros.length}}
... ...
... ... @@ -881,6 +881,16 @@ function activityPlan() {
}
}
// 改变店铺+商品组中店铺的高度
function changeShopAndProductHeight() {
$('.shop-product-container').each(function(i) {
let height = $(this).find('.product-wrapper .feature-product-info').height();
console.log('商铺' + i, height);
$(this).find('.shop-wrapper .feature-shop-info').height(height);
});
}
$(function() {
if ($('.over').length) {
// 过期/删除 状态的 活动
... ... @@ -945,6 +955,8 @@ $(function() {
// 定时计划
activityPlan();
setTimeout(changeShopAndProductHeight, 300);
// 小程序相关处理
if (!window.WeixinJSBridge || !window.WeixinJSBridge.invoke) {
document.addEventListener('WeixinJSBridgeReady', miniProgramHandleInit, false);
... ...
... ... @@ -51,6 +51,8 @@
}
.new-price {
text-align: center;
> .sale-price {
margin-left: 6px;
font-size: 24px;
... ... @@ -361,6 +363,60 @@
}
}
.shop-product-container {
padding-bottom: 10px;
overflow: hidden;
.product-container {
padding: 0;
margin: 0;
}
.product-wrapper {
overflow: hidden;
}
.shop-wrapper {
display: inline-block;
height: 100%;
a {
height: 100%;
}
.feature-shop-info {
height: 100%;
}
}
&.left .shop-wrapper {
margin-top: 10px;
}
&.left .product-wrapper {
.product-source .feature-product-info:nth-child(n+4) {
display: none;
}
}
&.right .shop-wrapper {
overflow: hidden;
padding-top: 10px;
margin-left: 0 !important;
margin-right: 10px;
}
&.right .product-wrapper {
overflow: hidden;
padding: 0;
margin-left: 20px;
.product-source .feature-product-info:nth-child(n+4) {
display: none;
}
}
}
.is-style-2 {
padding: 0 30px 10px;
... ...
... ... @@ -114,6 +114,14 @@ $margin-right-3: 7px;
float: left;
width: 203px;
&.left {
float: left;
}
&.right {
float: right;
}
.shop-container .feature-shop-info {
margin: 16px 10px 16px 0;
... ... @@ -124,9 +132,7 @@ $margin-right-3: 7px;
}
}
/*
个性化店铺组与原有店铺组样式几乎完全不一样
*/
/* 个性化店铺组与原有店铺组样式几乎完全不一样 */
.shop-individuation {
&.shop-two,
&.shop-three {
... ...