Authored by 刘传洋

m

... ... @@ -238,7 +238,7 @@ const formatPriceGiftOne = (it) => {
id: g.product_id,
skn: g.product_skn,
subjoinTitle: g.product_name,
imgCover: it.goods_images ? helpers.image(it.goods_images, 60, 60) : '',
imgCover: g.goods_images ? helpers.image(g.goods_images, 60, 60) : '',
subjoinPrice: transPrice(g.last_price),
marketPrice: gift.isGift ? '' : transPrice(g.market_price),
yohoIcon: 0,
... ...
... ... @@ -96,11 +96,11 @@
{{# size}}
<table>
<thead>
<tr>
{{# thead}}
<td width="{{width}}">{{name}}</td>
{{/ thead}}
</tr>
<tr>
{{# thead}}
<td width="{{width}}">{{name}}</td>
{{/ thead}}
</tr>
</thead>
<tbody>
{{# tbody}}
... ...
... ... @@ -32,7 +32,7 @@
</div>
</div>
</div>
<div class="product-detail-info">
<div class="product-detail-info" data-promotionid="{{promotionId}}">
{{#productInfo}}
{{> cart-product-info-tpl}}
{{/productInfo}}
... ...
... ... @@ -52,11 +52,11 @@
<ul>
{{#each colors}}
<li class="color"><!--active-->
<p class="{{#if focus}}atcive{{/if}}">
<p class="{{#if focus}}active{{/if}}">
<span></span>
<img src="{{src}}">
</p>
<span>{{name}}</span>
{{!--<span>{{name}}</span>--}}
</li>
{{/each}}
</ul>
... ... @@ -69,7 +69,7 @@
{{#each colors}}
<div class="showSizeBox">
{{#each size}}
<span data-sku="{{sku}}" data-num="{{num}}" class="disabled">{{name}}</span>
<span data-sku="{{sku}}" data-num="{{num}}">{{name}}</span>
{{/each}}
</div>
{{/each}}
... ... @@ -81,8 +81,8 @@
<dt>
<div class="amount_wrapper">
<input type="text" id="num" class="num" value="1" readonly="readonly">
<a class="amount cut"><i class="iconfont">&#xe6c0;</i></a>
<a class="amount add"><i class="iconfont">&#xe6c1;</i></a>
<a class="amount cut"><i class="iconfont">&#xe6c1;</i></a>
<a class="amount add"><i class="iconfont">&#xe6c0;</i></a>
</div>
</dt>
</dl>
... ...
... ... @@ -368,20 +368,143 @@ function getProductByPromotionId(promotionId) {
function bindGiftWinAction($el) {
var pacList = 0;
$el.on('click', '.slide-img .img-list .img-item', function() {
var id = $(this).data('id');
var skn = $(this).data('skn');
/* getProductInfo(id, skn).then(res => {
getProductInfo(id, skn).then(res => {
$el.find('.product-detail-info').empty().append(productInfoTpl(res));
});*/
});
});
$el.on('click', '.piclist li', function() {
var $this = $(this);
var idx = $(this).index();
$el.find('.detail-bigpic:not(.none) .piclist li').removeClass('active');
$this.addClass('active');
$el.find('.detail-bigpic:not(.none) .bigpic').hide().eq(idx).show();
});
$el.on('click', '.pre, .next', function(){
var $this = $(this);
var $detailBigpic = $this.closest('.detail-bigpic');
var curIndex = Number($detailBigpic.data('_index') || 0);
var $lis = $this.siblings('.con').find('li');
if ($this.hasClass('next')) {
if (curIndex >= $lis.length - 1) {
return false;
}
curIndex++;
} else {
if (curIndex < 1) {
return false;
}
curIndex--;
}
$detailBigpic.data('_index', curIndex);
$lis.removeClass('active').eq(curIndex).addClass('active');
$detailBigpic.find('.bigpic').hide().eq(curIndex).show();
});
$el.on('click', '.color', function(){
var $this = $(this);
var idx = $this.index();
var $detail = $this.closest('.detail-goods');
var $sizes = $detail.find('.showSizeBox');
var $detailBigpic = $detail.find('.detail-bigpic');
var $curSize = $sizes.eq(idx);
var $curDetailBig = $detailBigpic.eq(idx);
var bigPicIndex = 0; //默认显示大图中的第一个图
$curDetailBig.data('_index', bigPicIndex);
$this.siblings('.color').find('p').removeClass('active');
$this.find('p').addClass('active');
$sizes.addClass('none').eq(idx).removeClass('none');
if ($curSize.find('span').length < 2) {
$curSize.find('span:first').addClass('active');
}
getProductHtmlInfo(id).then(res => {
$el.find('.product-detail-info').empty().append(res);
$detailBigpic.addClass('none');
$curDetailBig.removeClass('active');
$curDetailBig.find('.bigpic').hide();
$curDetailBig.find('.bigpic').eq(bigPicIndex).show();
$curDetailBig.find('.con li').removeClass('active');
$curDetailBig.find('.con li').eq(bigPicIndex).addClass('active');
$sizes.eq(idx).find('span').each(function() {
if ($(this).hasClass('null-atcivec')) {
$el.find('.addcart').addClass('none');
$el.find('.btn_sellout').removeClass('none');
} else {
$el.find('.addcart').removeClass('none');
$el.find('.btn_sellout').addClass('none');
return false;
}
});
});
$el.on('click', '.showSizeBox span', function(){
var $this = $(this);
var idx = $this.index();
var shopNumAll = $this.data('num');
$this.siblings('span').removeClass('active');
$this.addClass('active');
if (shopNumAll > 0) {
$el.find('.addcart').removeClass('none');
$el.find('.btn_sellout').addClass('none');
} else {
$el.find('.addcart').addClass('none');
$el.find('.btn_sellout').removeClass('none');
}
});
$el.on('click', '.cut, .add', function() {
var $this = $(this);
var $pinfo = $this.closest('.product-detail-info');
// var count = $this.hasClass('minus') ? 'decreaseNum' : 'increaseNum';
var promotionId = $pinfo.data('promotionid');
var $num = $el.find('#num');
var shopNum = Number($num.val() || 1);
if (promotionId) {
if ($this.hasClass('cut')) {
new Alert('-_-,已经是最后一件,不能再减了!').show();
} else {
new Alert('最多只能购买一件,您好像购买的太多了!').show();
}
} else {
if ($this.hasClass('add')) {
shopNum++;
} else {
shopNum--;
}
if (shopNum < 1) {
new Alert('-_-,已经是最后一件,不能在减了!').show();
shopNum = 1;
return false;
}
$num.val(shopNum);
}
});
}
function renderAndShowGiftWin(plist) {
... ...
... ... @@ -205,7 +205,7 @@ $(function() {
// ----------------底部 为你优选,最近浏览 end--------------
// 凑单弹框 详情切换
$('body').on('click', '.piclist li', function() {
/*$('body').on('click', '.piclist li', function() {
pacList = $(this).index();
$('.detail-bigpic:not(.none) .piclist li').removeClass('active');
$(this).addClass('active');
... ... @@ -289,7 +289,7 @@ $('body').on('click', '.cut, .add', function() {
$('#num').val(shopNum);
}
});
});*/
// 凑单弹框 商品信息弹出框,加入收藏夹
$cartGoodsDetail.on('click', '.btn-favCount', function() {
... ... @@ -317,12 +317,12 @@ $cartGoodsDetail.on('click', '.btn-favCount', function() {
// 购物车列表 赠品
// 购物车列表 显示
$('.shop-cart').on('click', '.gift-sell .btn-clear', function() {
/*$('.shop-cart').on('click', '.gift-sell .btn-clear', function() {
var tid = $(this).attr('data-together-id');
showPromotion(tid);
});
});*/
// 购物车列表 显示
/*
... ...