Authored by Lynnic

Merge branch 'feature/detailFix' into develop

@@ -4,12 +4,17 @@ @@ -4,12 +4,17 @@
4 * @date: 2015/11/18 4 * @date: 2015/11/18
5 */ 5 */
6 var $ = require('jquery'), 6 var $ = require('jquery'),
7 - tip = require('../../plugin/tip');  
8 -var commentsNum; 7 + tip = require('../../plugin/tip'),
  8 + Hammer = require('yoho.hammer');
  9 +
  10 +var commentsNum,consultsNum;
  11 +
  12 +var consultFooterEle = document.getElementById('consult-content-footer'),
  13 + consultFooterHammer = consultFooterEle && new Hammer(consultFooterEle);
9 14
10 15
11 (function() { 16 (function() {
12 - var consultsNum = $('#nav-tab .consults-num').html() - 0; 17 + consultsNum = $('#nav-tab .consults-num').html() - 0;
13 18
14 commentsNum = $('#nav-tab .comments-num').html() - 0; 19 commentsNum = $('#nav-tab .comments-num').html() - 0;
15 20
@@ -51,3 +56,9 @@ $('#nav-tab li').on('touchend', function() { @@ -51,3 +56,9 @@ $('#nav-tab li').on('touchend', function() {
51 } 56 }
52 } 57 }
53 }); 58 });
  59 +
  60 +if (consultFooterHammer) {
  61 + consultFooterHammer.on('tap', function() {
  62 + location.href = $(consultFooterEle).find('a').attr('href');
  63 + });
  64 +}
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 * @author: liangzhifeng<zhifeng.liang@yoho.cn> 3 * @author: liangzhifeng<zhifeng.liang@yoho.cn>
4 * @date: 2015/10/20 4 * @date: 2015/10/20
5 */ 5 */
6 - var $ = require('jquery'), 6 +var $ = require('jquery'),
7 Swiper = require('yoho.iswiper'), 7 Swiper = require('yoho.iswiper'),
8 Hammer = require('yoho.hammer'), 8 Hammer = require('yoho.hammer'),
9 lazyLoad = require('yoho.lazyload'); 9 lazyLoad = require('yoho.lazyload');
@@ -15,6 +15,8 @@ var goodsSwiper, @@ -15,6 +15,8 @@ var goodsSwiper,
15 var goodsDiscountEl = document.getElementById('goodsDiscount'), 15 var goodsDiscountEl = document.getElementById('goodsDiscount'),
16 goodsDiscountHammer = goodsDiscountEl && new Hammer(goodsDiscountEl); 16 goodsDiscountHammer = goodsDiscountEl && new Hammer(goodsDiscountEl);
17 17
  18 +var $cart = $('.cart-bar');
  19 +
18 require('./desc'); 20 require('./desc');
19 require('./comments-consults'); 21 require('./comments-consults');
20 require('../recommend-for-you-product-desc'); 22 require('../recommend-for-you-product-desc');
@@ -69,5 +71,15 @@ if (goodsDiscountHammer) { @@ -69,5 +71,15 @@ if (goodsDiscountHammer) {
69 }); 71 });
70 } 72 }
71 73
  74 +//购物车商品数量
  75 +$.ajax({
  76 + type: 'GET',
  77 + url: '/cart/index/count',
  78 + success: function(data) {
  79 + if (data.code === 200) {
  80 + $cart.find('.num-tag').html(data.data.cart_goods_count).removeClass('hide');
  81 + }
  82 + }
  83 +});
72 84
73 require('./like'); 85 require('./like');
@@ -9,11 +9,15 @@ var $ = require('jquery'), @@ -9,11 +9,15 @@ var $ = require('jquery'),
9 Hammer = require('yoho.hammer'), 9 Hammer = require('yoho.hammer'),
10 tip = require('../../plugin/tip'); 10 tip = require('../../plugin/tip');
11 11
12 -var likeHammer = new Hammer(document.getElementById('likeBtn')),  
13 - addToCartHammer = new Hammer(document.getElementById('addtoCart')), 12 +var likeEle = document.getElementById('likeBtn'),
  13 + likeHammer = likeEle && new Hammer(likeEle);
  14 +
  15 +var addToCartEle = document.getElementById('addtoCart'),
  16 + addToCartHammer = addToCartEle && new Hammer(addToCartEle),
14 productId = $('#productId').val(); 17 productId = $('#productId').val();
15 18
16 -likeHammer.on('tap', function(e) { 19 +if (likeHammer) {
  20 + likeHammer.on('tap', function(e) {
17 var opt, 21 var opt,
18 favorite; 22 favorite;
19 23
@@ -60,10 +64,11 @@ likeHammer.on('tap', function(e) { @@ -60,10 +64,11 @@ likeHammer.on('tap', function(e) {
60 tip.show('网络断开连接了~'); 64 tip.show('网络断开连接了~');
61 } 65 }
62 }); 66 });
  67 + });
  68 +}
63 69
64 -});  
65 -  
66 -addToCartHammer.on('tap', function(e) { 70 +if (addToCartHammer) {
  71 + addToCartHammer.on('tap', function(e) {
67 72
68 // 统计代码:用于统计用户加入购物车的动作 73 // 统计代码:用于统计用户加入购物车的动作
69 if (window._yas) { 74 if (window._yas) {
@@ -72,6 +77,8 @@ addToCartHammer.on('tap', function(e) { @@ -72,6 +77,8 @@ addToCartHammer.on('tap', function(e) {
72 by: 1 77 by: 1
73 }); 78 });
74 } 79 }
75 -}); 80 + });
  81 +}
  82 +
76 83
77 84
@@ -264,11 +264,11 @@ @@ -264,11 +264,11 @@
264 height: pxToRem(200px); 264 height: pxToRem(200px);
265 line-height: pxToRem(200px); 265 line-height: pxToRem(200px);
266 color: #e0e0e0; 266 color: #e0e0e0;
267 - font-size: 20px; 267 + font-size: 16px;
268 text-align: center; 268 text-align: center;
269 span{ 269 span{
270 display: inline-block; 270 display: inline-block;
271 - font-size: 20px; 271 + font-size: 16px;
272 padding-right: 5px; 272 padding-right: 5px;
273 } 273 }
274 } 274 }
@@ -31,8 +31,7 @@ $basicBtnC:#eb0313; @@ -31,8 +31,7 @@ $basicBtnC:#eb0313;
31 margin-bottom: pxToRem(20px); 31 margin-bottom: pxToRem(20px);
32 font-size: pxToRem(24px); 32 font-size: pxToRem(24px);
33 line-height: pxToRem(36px); 33 line-height: pxToRem(36px);
34 - display: flex;  
35 - flex-wrap: wrap; 34 +
36 &.table { 35 &.table {
37 width: 100%; 36 width: 100%;
38 .column { 37 .column {
@@ -97,10 +96,10 @@ $basicBtnC:#eb0313; @@ -97,10 +96,10 @@ $basicBtnC:#eb0313;
97 margin-left: .5px; 96 margin-left: .5px;
98 font-size: pxToRem(18px); 97 font-size: pxToRem(18px);
99 text-align: center; 98 text-align: center;
100 - line-height: pxToRem(24px);  
101 - position: relative;  
102 - vertical-align: middle;  
103 - padding:0 5px; 99 + // line-height: 28px;
  100 + // position: relative;
  101 + // vertical-align: middle;
  102 + padding:1px 5px;
104 } 103 }
105 .new-tag { 104 .new-tag {
106 background-color: #78dc7e; 105 background-color: #78dc7e;
@@ -318,10 +317,6 @@ $basicBtnC:#eb0313; @@ -318,10 +317,6 @@ $basicBtnC:#eb0313;
318 display: none; 317 display: none;
319 } 318 }
320 } 319 }
321 - .goodsSubtitle,  
322 - .goodsDiscount {  
323 - text-indent: pxToRem(-14px);  
324 - }  
325 .enter-store { 320 .enter-store {
326 min-height: pxToRem(100px); 321 min-height: pxToRem(100px);
327 display: table; 322 display: table;
@@ -405,6 +400,9 @@ $basicBtnC:#eb0313; @@ -405,6 +400,9 @@ $basicBtnC:#eb0313;
405 border-radius: 50%; 400 border-radius: 50%;
406 color: #fff; 401 color: #fff;
407 font-size: pxToRem(24px); 402 font-size: pxToRem(24px);
  403 + &.hide{
  404 + display: none;
  405 + }
408 } 406 }
409 } 407 }
410 // .recommend-for-you { 408 // .recommend-for-you {
@@ -2,6 +2,12 @@ @@ -2,6 +2,12 @@
2 .goods-desc { 2 .goods-desc {
3 padding-bottom: pxToRem(20px); 3 padding-bottom: pxToRem(20px);
4 padding-top: pxToRem(20px); 4 padding-top: pxToRem(20px);
  5 + &.page-block{
  6 + .table{
  7 + display: flex;
  8 + flex-wrap: wrap;
  9 + }
  10 + }
5 .service { 11 .service {
6 width: pxToRem(494px); 12 width: pxToRem(494px);
7 height: pxToRem(28px); 13 height: pxToRem(28px);
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 <div class="goto-consult"> 3 <div class="goto-consult">
4 <i class="iconfont consult-logo">&#xe639;</i> 4 <i class="iconfont consult-logo">&#xe639;</i>
5 <span>我要咨询</span> 5 <span>我要咨询</span>
6 - <a href="/product/detail/consultform" class="iconfont enter-consult-page">&#xe604;</a> 6 + <a href="{{consultUrl}}" class="iconfont enter-consult-page">&#xe604;</a>
7 </div> 7 </div>
8 {{# consults}} 8 {{# consults}}
9 <div class="goods-consults" id="goods-consults"> 9 <div class="goods-consults" id="goods-consults">
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 <p class="good-tag sale-tag">SALE</p> 13 <p class="good-tag sale-tag">SALE</p>
14 {{/ is_discount}} 14 {{/ is_discount}}
15 {{# is_yohoood}} 15 {{# is_yohoood}}
16 - <div class="good-tag yohood-tag">新品节</div> 16 + <p class="good-tag yohood-tag">新品节</p>
17 {{/ is_yohoood}} 17 {{/ is_yohoood}}
18 {{# is_limited}} 18 {{# is_limited}}
19 <p class="good-tag limit-tag">限量商品</p> 19 <p class="good-tag limit-tag">限量商品</p>
@@ -118,13 +118,11 @@ @@ -118,13 +118,11 @@
118 118
119 {{#cartInfo}} 119 {{#cartInfo}}
120 <div class="cart-bar"> 120 <div class="cart-bar">
121 - {{#if numInCart}}  
122 - <span class="num-tag">{{numInCart}}</span>  
123 - {{/if}}  
124 - <a href="{{cartList}}" class="num-incart iconfont">&#xe62c;</a> 121 + <span class="num-tag hide"></span>
  122 + <a href="{{cartUrl}}" class="num-incart iconfont">&#xe62c;</a>
125 123
126 {{#if addToCart}} 124 {{#if addToCart}}
127 - <a href="{{cartUrl}}" class="addto-cart">加入购物车</a> 125 + <a id="addtoCart" href="{{addToCartUrl}}" class="addto-cart">加入购物车</a>
128 {{/if}} 126 {{/if}}
129 127
130 {{#if soldOut}} 128 {{#if soldOut}}
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 </div> 23 </div>
24 {{^}} 24 {{^}}
25 <div class="comment-content-main content-main no-item"> 25 <div class="comment-content-main content-main no-item">
26 - <span class="iconfont">&#xe63c;</span>暂无评论 26 + <span class="iconfont">&#xe63d;</span>暂无评论
27 </div> 27 </div>
28 {{/if}} 28 {{/if}}
29 <!-- <div class="comment-content-footer"> 29 <!-- <div class="comment-content-footer">
@@ -44,19 +44,19 @@ @@ -44,19 +44,19 @@
44 </div> 44 </div>
45 45
46 <div class="answer"> 46 <div class="answer">
47 - <span class="iconfont">&#xe63d;</span> 47 + <span class="iconfont comment">&#xe63d;</span>
48 <p>{{answer}}</p> 48 <p>{{answer}}</p>
49 </div> 49 </div>
50 {{/ consults}} 50 {{/ consults}}
51 </div> 51 </div>
52 - <div class="consult-content-footer"> 52 + <div class="consult-content-footer" id="consult-content-footer">
53 <a href="{{link}}"> 53 <a href="{{link}}">
54 查看更多 54 查看更多
55 <span class="iconfont">&#xe604;</span></a> 55 <span class="iconfont">&#xe604;</span></a>
56 </div> 56 </div>
57 {{else}} 57 {{else}}
58 <div class="consult-content-main content-main no-item"> 58 <div class="consult-content-main content-main no-item">
59 - <span class="iconfont">&#xe63d;</span>暂无咨询 59 + <span class="iconfont comment">&#xe63d;</span>暂无咨询
60 </div> 60 </div>
61 <div class="consult-content-footer"> 61 <div class="consult-content-footer">
62 <a href="{{link}}"> 62 <a href="{{link}}">