Authored by Rock Zhang

Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop

Code Review By Rock Zhang
... ... @@ -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,21 +31,27 @@ $basicBtnC:#eb0313;
margin-bottom: pxToRem(20px);
font-size: pxToRem(24px);
line-height: pxToRem(36px);
display: flex;
flex-wrap: wrap;
&.table {
@include flexbox((
display: flex,
flex-wrap: wrap,
justify-content: flex-start
));
width: 100%;
.column {
box-sizing: border-box;
padding: pxToRem(20px) pxToRem(12px);
//padding: pxToRem(20px) pxToRem(12px);
padding: 4% 3%;
//width: 50%;
border-bottom: pxToRem(4px) solid #fff;
border-right: pxToRem(4px) solid #fff;
font-size: pxToRem(24px);
background-color: $tableCellC;
display: flex;
align-items: center;
flex-basis: 49.9%;
@include flexbox((
display: flex,
align-items: center,
flex-basis: 49.9%
))
}
}
}
... ... @@ -97,10 +103,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;
... ... @@ -259,6 +265,11 @@ $basicBtnC:#eb0313;
width: 33.3%;
height: pxToRem(88px);
margin: 0;
&.current-level{
.vip-price{
color:#d0021b;
}
}
span {
vertical-align: middle;
display: inline-block;
... ... @@ -313,10 +324,6 @@ $basicBtnC:#eb0313;
display: none;
}
}
.goodsSubtitle,
.goodsDiscount {
text-indent: pxToRem(-14px);
}
.enter-store {
min-height: pxToRem(100px);
display: table;
... ... @@ -400,6 +407,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);
... ... @@ -156,10 +162,11 @@
.measurement-method {
.detail {
width: 100%;
margin-top:0;
margin-bottom: 0;
img {
width: 100%;
margin-top: pxToRem(18px);
margin-right: pxToRem(28px);
height:auto;
}
}
}
... ...
... ... @@ -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="{{link}}" class="iconfont enter-consult-page">&#xe604;</a>
</div>
{{# consults}}
<div class="goods-consults" id="goods-consults">
... ... @@ -18,7 +18,7 @@
</div>
<div class="answer">
<span class="iconfont">&#xe63c;</span>
<span class="iconfont">&#xe63f;</span>
<p>{{answer}}</p>
</div>
</div>
... ...
... ... @@ -54,10 +54,10 @@
{{# vipLevel}}
<ul class="vip-level clearfix">
{{# list}}
<li class="icons-item">
<span class="vip-img" style="background-size:contain;">
<li class="icons-item {{#if currentLevel}}current-level{{/if}}">
<span class="vip-img " style="background-size:contain;">
</span>
<span class="vip-price">{{text}}</span>
<span class="vip-price ">{{text}}</span>
</li>
{{/ list}}
</ul>
... ... @@ -117,16 +117,22 @@
{{> product/recommend-for-you}}
{{#cartInfo}}
<div class="cart-bar">
{{#if numInCart}}
<span class="num-tag">{{numInCart}}</span>
{{/if}}
<div class="cart-bar">
<span class="num-tag hide"></span>
<a href="{{cartUrl}}" class="num-incart iconfont">&#xe62c;</a>
{{#if goodsInstore}}
<a id="addtoCart" href="{{cartUrl}}" class="addto-cart">加入购物车</a>
{{else}}
<a href="javascript:;" id="addtoCart" class="sold-out">已售罄</a>
{{#if addToCartUrl}}
<a id="addtoCart" href="{{addToCartUrl}}" class="addto-cart">加入购物车</a>
{{/if}}
{{#if soldOut}}
<a href="javascript:;" class="sold-out">已售罄</a>
{{/if}}
{{#if notForSale}}
<a href="javascript:;" class="sold-out">非卖品</a>
{{/if}}
<a href="javascript:;" id="likeBtn" class="favorite iconfont {{#isCollect}}liked{{/isCollect}}">&#xe605;</a>
</div>
{{/cartInfo}}
... ...
... ... @@ -172,7 +172,7 @@
{{!-- 商品详情咨询 --}}
{{#if goodsConsultsPage}}
<script>
seajs.use('js/product/detail/loadmore');
seajs.use('js/product/detail/comments-consults');
</script>
{{/if}}
{{!-- 商品详情我要咨询 --}}
... ...
... ... @@ -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">
... ... @@ -49,7 +49,7 @@
</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>
... ...
... ... @@ -6,7 +6,7 @@
<span class="en-title">{{enTitle}}</span>
</h1>
{{#detail}}
<div class="detail table clearfix">
<div class="detail table">
{{#list}}
<div class="column">{{param}}</div>
{{/list}}
... ...