Authored by Lynnic

Merge branch 'feature/detailFix' into develop

... ... @@ -4,12 +4,17 @@
* @date: 2015/11/18
*/
var $ = require('jquery'),
tip = require('../../plugin/tip');
var commentsNum;
tip = require('../../plugin/tip'),
Hammer = require('yoho.hammer');
var commentsNum,consultsNum;
var consultFooterEle = document.getElementById('consult-content-footer'),
consultFooterHammer = consultFooterEle && new Hammer(consultFooterEle);
(function() {
var consultsNum = $('#nav-tab .consults-num').html() - 0;
consultsNum = $('#nav-tab .consults-num').html() - 0;
commentsNum = $('#nav-tab .comments-num').html() - 0;
... ... @@ -50,4 +55,10 @@ $('#nav-tab li').on('touchend', function() {
$('#feedback-content .content:eq(' + index + ')').removeClass('hide');
}
}
});
\ No newline at end of file
});
if (consultFooterHammer) {
consultFooterHammer.on('tap', function() {
location.href = $(consultFooterEle).find('a').attr('href');
});
}
\ No newline at end of file
... ...
... ... @@ -3,7 +3,7 @@
* @author: liangzhifeng<zhifeng.liang@yoho.cn>
* @date: 2015/10/20
*/
var $ = require('jquery'),
var $ = require('jquery'),
Swiper = require('yoho.iswiper'),
Hammer = require('yoho.hammer'),
lazyLoad = require('yoho.lazyload');
... ... @@ -15,6 +15,8 @@ var goodsSwiper,
var goodsDiscountEl = document.getElementById('goodsDiscount'),
goodsDiscountHammer = goodsDiscountEl && new Hammer(goodsDiscountEl);
var $cart = $('.cart-bar');
require('./desc');
require('./comments-consults');
require('../recommend-for-you-product-desc');
... ... @@ -69,5 +71,15 @@ if (goodsDiscountHammer) {
});
}
//购物车商品数量
$.ajax({
type: 'GET',
url: '/cart/index/count',
success: function(data) {
if (data.code === 200) {
$cart.find('.num-tag').html(data.data.cart_goods_count).removeClass('hide');
}
}
});
require('./like');
... ...
... ... @@ -9,69 +9,76 @@ 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 likeEle = document.getElementById('likeBtn'),
likeHammer = likeEle && new Hammer(likeEle);
var addToCartEle = document.getElementById('addtoCart'),
addToCartHammer = addToCartEle && new Hammer(addToCartEle),
productId = $('#productId').val();
likeHammer.on('tap', function(e) {
var opt,
favorite;
if (likeHammer) {
likeHammer.on('tap', function(e) {
var opt,
favorite;
var $this = $(e.target);
var $this = $(e.target);
if ($this.hasClass('liked')) {
opt = 'cancel';
favorite = 0;
} else {
opt = 'ok';
favorite = 1;
}
$.ajax({
type: 'POST',
url: '/product/opt/favoriteProduct',
data: {
id: productId,
opt: opt
},
success: function(data) {
if (data.code === 200) {
$this.toggleClass('liked');
if ($this.hasClass('liked')) {
opt = 'cancel';
favorite = 0;
} else {
opt = 'ok';
favorite = 1;
}
$.ajax({
type: 'POST',
url: '/product/opt/favoriteProduct',
data: {
id: productId,
opt: opt
},
success: function(data) {
if (data.code === 200) {
$this.toggleClass('liked');
if ('cancel' === opt) {
tip.show('取消收藏成功');
} else if ('ok' === opt) {
tip.show('收藏成功');
if ('cancel' === opt) {
tip.show('取消收藏成功');
} else if ('ok' === opt) {
tip.show('收藏成功');
}
} else if (data.code === 400) {
location.href = data.data;//未登录跳转登录页
} else {
tip.show(data.message);
}
} else if (data.code === 400) {
location.href = data.data;//未登录跳转登录页
} else {
tip.show(data.message);
}
// 统计代码:用于统计用户加入或取消商品收藏的动作
if (window._yas) {
window._yas.sendCustomInfo({
pd: productId,
fa: favorite
});
// 统计代码:用于统计用户加入或取消商品收藏的动作
if (window._yas) {
window._yas.sendCustomInfo({
pd: productId,
fa: favorite
});
}
},
error: function() {
tip.show('网络断开连接了~');
}
},
error: function() {
tip.show('网络断开连接了~');
}
});
});
}
});
if (addToCartHammer) {
addToCartHammer.on('tap', function(e) {
addToCartHammer.on('tap', function(e) {
// 统计代码:用于统计用户加入购物车的动作
if (window._yas) {
window._yas.sendCustomInfo({
pd: productId,
by: 1
});
}
});
}
// 统计代码:用于统计用户加入购物车的动作
if (window._yas) {
window._yas.sendCustomInfo({
pd: productId,
by: 1
});
}
});
... ...
... ... @@ -264,11 +264,11 @@
height: pxToRem(200px);
line-height: pxToRem(200px);
color: #e0e0e0;
font-size: 20px;
font-size: 16px;
text-align: center;
span{
display: inline-block;
font-size: 20px;
font-size: 16px;
padding-right: 5px;
}
}
... ...
... ... @@ -31,8 +31,7 @@ $basicBtnC:#eb0313;
margin-bottom: pxToRem(20px);
font-size: pxToRem(24px);
line-height: pxToRem(36px);
display: flex;
flex-wrap: wrap;
&.table {
width: 100%;
.column {
... ... @@ -97,10 +96,10 @@ $basicBtnC:#eb0313;
margin-left: .5px;
font-size: pxToRem(18px);
text-align: center;
line-height: pxToRem(24px);
position: relative;
vertical-align: middle;
padding:0 5px;
// line-height: 28px;
// position: relative;
// vertical-align: middle;
padding:1px 5px;
}
.new-tag {
background-color: #78dc7e;
... ... @@ -318,10 +317,6 @@ $basicBtnC:#eb0313;
display: none;
}
}
.goodsSubtitle,
.goodsDiscount {
text-indent: pxToRem(-14px);
}
.enter-store {
min-height: pxToRem(100px);
display: table;
... ... @@ -405,6 +400,9 @@ $basicBtnC:#eb0313;
border-radius: 50%;
color: #fff;
font-size: pxToRem(24px);
&.hide{
display: none;
}
}
}
// .recommend-for-you {
... ...
... ... @@ -2,6 +2,12 @@
.goods-desc {
padding-bottom: pxToRem(20px);
padding-top: pxToRem(20px);
&.page-block{
.table{
display: flex;
flex-wrap: wrap;
}
}
.service {
width: pxToRem(494px);
height: pxToRem(28px);
... ...
... ... @@ -3,7 +3,7 @@
<div class="goto-consult">
<i class="iconfont consult-logo">&#xe639;</i>
<span>我要咨询</span>
<a href="/product/detail/consultform" class="iconfont enter-consult-page">&#xe604;</a>
<a href="{{consultUrl}}" class="iconfont enter-consult-page">&#xe604;</a>
</div>
{{# consults}}
<div class="goods-consults" id="goods-consults">
... ...
... ... @@ -13,7 +13,7 @@
<p class="good-tag sale-tag">SALE</p>
{{/ is_discount}}
{{# is_yohoood}}
<div class="good-tag yohood-tag">新品节</div>
<p class="good-tag yohood-tag">新品节</p>
{{/ is_yohoood}}
{{# is_limited}}
<p class="good-tag limit-tag">限量商品</p>
... ... @@ -117,14 +117,12 @@
{{> product/recommend-for-you}}
{{#cartInfo}}
<div class="cart-bar">
{{#if numInCart}}
<span class="num-tag">{{numInCart}}</span>
{{/if}}
<a href="{{cartList}}" class="num-incart iconfont">&#xe62c;</a>
<div class="cart-bar">
<span class="num-tag hide"></span>
<a href="{{cartUrl}}" class="num-incart iconfont">&#xe62c;</a>
{{#if addToCart}}
<a href="{{cartUrl}}" class="addto-cart">加入购物车</a>
<a id="addtoCart" href="{{addToCartUrl}}" class="addto-cart">加入购物车</a>
{{/if}}
{{#if soldOut}}
... ...
... ... @@ -23,7 +23,7 @@
</div>
{{^}}
<div class="comment-content-main content-main no-item">
<span class="iconfont">&#xe63c;</span>暂无评论
<span class="iconfont">&#xe63d;</span>暂无评论
</div>
{{/if}}
<!-- <div class="comment-content-footer">
... ... @@ -44,19 +44,19 @@
</div>
<div class="answer">
<span class="iconfont">&#xe63d;</span>
<span class="iconfont comment">&#xe63d;</span>
<p>{{answer}}</p>
</div>
{{/ consults}}
</div>
<div class="consult-content-footer">
<div class="consult-content-footer" id="consult-content-footer">
<a href="{{link}}">
查看更多
<span class="iconfont">&#xe604;</span></a>
</div>
{{else}}
<div class="consult-content-main content-main no-item">
<span class="iconfont">&#xe63d;</span>暂无咨询
<span class="iconfont comment">&#xe63d;</span>暂无咨询
</div>
<div class="consult-content-footer">
<a href="{{link}}">
... ...