Authored by Lynnic

修改了收藏商品的bug

... ... @@ -27,14 +27,11 @@ goodsSwiper = new Swiper('.banner-swiper', {
});
(function() {
//初始化goods-discount
if (0 === $('.goods-discount .discount-folder').children().length) {
$('.goods-discount .discount-folder').css('display', 'none');
$('.goods-discount .first-item span').html('');
}
})();
//初始化goods-discount
if (0 === $('.goods-discount .discount-folder').children().length) {
$('.goods-discount .discount-folder').css('display', 'none');
$('.goods-discount .first-item span').html('');
}
//goods-discount下拉按钮点击事件
$('.goodsDiscount .dropdown').on('click', function() {
... ... @@ -50,5 +47,4 @@ $('.goodsDiscount .dropdown').on('click', function() {
$('.goodsDiscount .discount-folder').slideUp();
}
});
require('./like');
\ No newline at end of file
... ...
... ... @@ -3,12 +3,14 @@
* @author: Lynnic
* @date: 2015/11/24
*/
var $ = require('jquery'),
Hammer = require('yoho.hammer'),
tip = require('../../plugin/tip');
var likeHammer = new Hammer(document.getElementById('likeBtn')),
addToCartHammer = new Hammer(document.getElementById('addtoCart'));
var likeHammer = new Hammer(document.getElementById('likeBtn'));
var addToCartHammer = new Hammer(document.getElementById('addtoCart'));
var productId = $('#productId').val();
... ... @@ -16,8 +18,7 @@ likeHammer.on('tap', function(e) {
var opt,
favorite;
var $this = $(this);
var $this = $(e.target);
if ($this.hasClass('liked')) {
opt = 'cancel';
... ... @@ -26,7 +27,6 @@ likeHammer.on('tap', function(e) {
opt = 'ok';
favorite = 1;
}
$.ajax({
type: 'POST',
url: '/product/opt/favoriteProduct',
... ...
... ... @@ -124,11 +124,10 @@
{{/if}}
<a href="{{cartUrl}}" class="num-incart iconfont">&#xe62c;</a>
{{#if goodsInstore}}
<a href="{{cartUrl}}" id="addtoCart" class="addto-cart">加入购物车</a>
<a id="addtoCart" href="{{cartUrl}}" class="addto-cart">加入购物车</a>
{{else}}
<a href="javascript:;" class="sold-out">已售罄</a>
<a href="javascript:;" id="addtoCart" class="sold-out">已售罄</a>
{{/if}}
<a href="javascript:;" id="likeBtn" class="favorite iconfont {{#isCollect}}liked{{/isCollect}}">&#xe605;</a>
</div>
{{/cartInfo}}
... ...