Authored by huangyCode

修改商品详情

... ... @@ -144,6 +144,7 @@ function goodsDetail(req, res, next) {
finalResult.groupNo = param.groupNo;
finalResult.activityId = param.activityId;
finalResult.isShowPop = result.activityIdDetail.joinLimit === 1 ? true : false;
finalResult.storeUrl = result.storeUrl;
return res.render('group/goodsDetail', {
page: 'group-goodsDetail',
nodownload: true,
... ...
... ... @@ -199,6 +199,9 @@ class GroupService extends global.yoho.BaseModel {
async goodsDetail(params) {
let result = await this.api.getProductData(params);
if (result.shop_id) {
result.storeUrl = `/shop/${_.get(result, 'brand_info.brand_domain')}-${_.get(result, 'shop_id')}.html`;
}
result.shopInfo = await this.api.getShopInfo({brand_id: result.brand_id, shop_id: result.shop_id});
result.activityIdDetail = await this.api.getCollageProductInfo(params);
result.activityGroupDetailList = await this.api.fetchActivityGroups(params);
... ...
... ... @@ -44,6 +44,7 @@
</div>
</div>
{{#if activityGroupDetailList}}
{{#if groupNo}}
<div class="goods-join">
<div class="title">选择下面小伙伴,快速加入</div>
{{#each activityGroupDetailList}}
... ... @@ -61,18 +62,19 @@
data-value="{{leftTime}}">{{formatLeftTime}}</span></div>
</div>
<div class='ibutton' data-value="{{groupNo}}">
<a href="/activity/group/progress?activity={{activityId}}&groupNo={{groupNo}}" class='ibutton' data-value="{{groupNo}}">
立即参团
</div>
</a>
</div>
{{/each}}
</div>
{{/if}}
{{/if}}
{{#if shopInfo}}
<div class="shop-info" data-id="{{shopInfo.shop_id}}">
<img class="shop-icon" src="{{shopInfo.brand_ico}}"/>
<span class="shop-name">{{shopInfo.brand_name}}</span>
<span class="shop-detail">进入店铺</span>
<a class="shop-detail" href="{{storeUrl}}">进入店铺</a>
</div>
{{/if}}
... ... @@ -124,6 +126,7 @@
{{/ifcond}}
{{/each}}
</div>
<div id="productDesc" {{#if limit}}class="limit"{{/if}}> </div>
<div class="bottom">
... ... @@ -143,24 +146,26 @@
{{/if}}
</div>
{{#unless groupNo}}
<div class='shoppint-cart-icon'>
<a href="/activity/group" class='shoppint-cart-icon'>
<img src="//img10.static.yhbimg.com/yhb-img01/2019/02/21/01/016b3f1cbc1b946fa0acbb1523f6386435.png"
class="shoppint-cart-icon-image"/>
</div>
</a>
{{/unless}}
{{#if groupNo}}
{{#if isShowPop}}
<div class='old-customer-tips' id="isShowPop">
<img style='width:100%;height:100%' src='/static/images/group/PT_tip@3x.png'/>
<img src='//img11.static.yhbimg.com/yhb-img01/2019/02/21/23/019f4a96c8d18ab77f21548c4a18baa337.png'/>
</div>
{{/if}}
{{/if}}
{{#if storage_sum}}
<button class='shoppint-cart-add'
bindtap="selfBuy" style='border-radius: 0;'>
<button class='shoppint-cart-add' id="selfBuy"
style='border-radius: 0;'>
{{#if groupNo}}
<span class="bottom-title">{{activityIdDetail.formatCollagePrice}}</span>
<span class="bottom-title">自己开团</span>
{{else}}
<span class="bottom-title">{{realPrice}}</span>
<span class="bottom-title">{{goodsPrice.currentPrice}}</span>
<span class="bottom-title">单人购买</span>
{{/if}}
</button>
... ... @@ -199,7 +204,7 @@
<input id="brand-id" type="hidden" value="{{brandId}}">
<input id="product-limit" type="hidden" value="{{isLimitBuy}}">
<input id="product-coupon-switch" type="hidden" value="{{showCoupon}}">
<input id="groupNo" type="hidden" value="{{groupNo}}"/>
<input type="hidden" class="data-bind" name="loginUrl" id="loginUrl" value="">
<form id="buyNowForm" class="data-bind" method="post" action="">
... ...
/* eslint-disable max-len */
import 'scss/activity/group/group-goodsDetail.page.scss';
import Swiper from 'yoho-swiper';
import $ from 'yoho-jquery';
... ... @@ -65,6 +66,7 @@ class Detail extends Page {
this.toTop();
this.startTimer();
this.actTimer();
this.bindClick();
}
getIntro() {
... ... @@ -114,6 +116,7 @@ class Detail extends Page {
}
});
}
goSwiper() {
setTimeout(() => {
// 顶部swiper
... ... @@ -138,6 +141,7 @@ class Detail extends Page {
});
}, 500);
}
toTop() {
if ($('.good-detail-page').length > 0) {
$('#yoho-footer').css('border-top', '1px solid #e0e0e0');
... ... @@ -174,6 +178,7 @@ class Detail extends Page {
}
});
}
startTimer() {
let list = [];
let activityGroupDetailList = document.querySelectorAll('.left-time');
... ... @@ -188,7 +193,7 @@ class Detail extends Page {
activityGroupDetailList[i].innerText = formatDate(list[i]);
} else {
clearInterval(timer);
window.reload();
window.location.reload();
}
}
}, 1000);
... ... @@ -222,11 +227,35 @@ class Detail extends Page {
--diff;
if (diff < 0) {
clearInterval(time);
window.reload();
window.location.reload();
}
}, 1000);
}
bindClick() {
let selfBuyDom = document.getElementById('selfBuy');
let groupNo = document.getElementById('groupNo').value;
let activityId = document.getElementById('activityId').value;
let productSkn = document.getElementById('productSkn').value;
let isShowPop = document.getElementById('isShowPop');
if (isShowPop) {
setTimeout(function() {
isShowPop.style.display = 'none';
}, 10000);
}
if (groupNo) {
selfBuyDom.onclick = function() {
location.href = '/activity/group/progress?activity=' + activityId + '&groupNo=' + groupNo;
};
} else {
selfBuyDom.onclick = function() {
location.href = '/product/' + productSkn + '.html';
};
}
}
}
$(() => {
new Detail();
});
... ...
... ... @@ -102,7 +102,6 @@
.shop-name {
display: inline-block;
font-family: SanFranciscoText-Regular, sans-serif;
font-size: 32px;
color: #4a4a4a;
letter-spacing: 0;
line-height: 120px;
... ... @@ -233,6 +232,14 @@
border-top: 1px solid rgb(242, 242, 242);
z-index: 1000;
.old-customer-tips {
width: 164px;
height: 60px;
position: absolute;
left: 104px;
bottom: 100px;
}
.count-down {
position: absolute;
top: -88px;
... ...