Merge branch 'feature/detailFix' into develop
Showing
9 changed files
with
113 additions
and
81 deletions
@@ -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 | ||
@@ -50,4 +55,10 @@ $('#nav-tab li').on('touchend', function() { | @@ -50,4 +55,10 @@ $('#nav-tab li').on('touchend', function() { | ||
50 | $('#feedback-content .content:eq(' + index + ')').removeClass('hide'); | 55 | $('#feedback-content .content:eq(' + index + ')').removeClass('hide'); |
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,69 +9,76 @@ var $ = require('jquery'), | @@ -9,69 +9,76 @@ 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) { | ||
17 | - var opt, | ||
18 | - favorite; | 19 | +if (likeHammer) { |
20 | + likeHammer.on('tap', function(e) { | ||
21 | + var opt, | ||
22 | + favorite; | ||
19 | 23 | ||
20 | - var $this = $(e.target); | 24 | + var $this = $(e.target); |
21 | 25 | ||
22 | - if ($this.hasClass('liked')) { | ||
23 | - opt = 'cancel'; | ||
24 | - favorite = 0; | ||
25 | - } else { | ||
26 | - opt = 'ok'; | ||
27 | - favorite = 1; | ||
28 | - } | ||
29 | - $.ajax({ | ||
30 | - type: 'POST', | ||
31 | - url: '/product/opt/favoriteProduct', | ||
32 | - data: { | ||
33 | - id: productId, | ||
34 | - opt: opt | ||
35 | - }, | ||
36 | - success: function(data) { | ||
37 | - if (data.code === 200) { | ||
38 | - $this.toggleClass('liked'); | 26 | + if ($this.hasClass('liked')) { |
27 | + opt = 'cancel'; | ||
28 | + favorite = 0; | ||
29 | + } else { | ||
30 | + opt = 'ok'; | ||
31 | + favorite = 1; | ||
32 | + } | ||
33 | + $.ajax({ | ||
34 | + type: 'POST', | ||
35 | + url: '/product/opt/favoriteProduct', | ||
36 | + data: { | ||
37 | + id: productId, | ||
38 | + opt: opt | ||
39 | + }, | ||
40 | + success: function(data) { | ||
41 | + if (data.code === 200) { | ||
42 | + $this.toggleClass('liked'); | ||
39 | 43 | ||
40 | - if ('cancel' === opt) { | ||
41 | - tip.show('取消收藏成功'); | ||
42 | - } else if ('ok' === opt) { | ||
43 | - tip.show('收藏成功'); | 44 | + if ('cancel' === opt) { |
45 | + tip.show('取消收藏成功'); | ||
46 | + } else if ('ok' === opt) { | ||
47 | + tip.show('收藏成功'); | ||
48 | + } | ||
49 | + } else if (data.code === 400) { | ||
50 | + location.href = data.data;//未登录跳转登录页 | ||
51 | + } else { | ||
52 | + tip.show(data.message); | ||
44 | } | 53 | } |
45 | - } else if (data.code === 400) { | ||
46 | - location.href = data.data;//未登录跳转登录页 | ||
47 | - } else { | ||
48 | - tip.show(data.message); | ||
49 | - } | ||
50 | 54 | ||
51 | - // 统计代码:用于统计用户加入或取消商品收藏的动作 | ||
52 | - if (window._yas) { | ||
53 | - window._yas.sendCustomInfo({ | ||
54 | - pd: productId, | ||
55 | - fa: favorite | ||
56 | - }); | 55 | + // 统计代码:用于统计用户加入或取消商品收藏的动作 |
56 | + if (window._yas) { | ||
57 | + window._yas.sendCustomInfo({ | ||
58 | + pd: productId, | ||
59 | + fa: favorite | ||
60 | + }); | ||
61 | + } | ||
62 | + }, | ||
63 | + error: function() { | ||
64 | + tip.show('网络断开连接了~'); | ||
57 | } | 65 | } |
58 | - }, | ||
59 | - error: function() { | ||
60 | - tip.show('网络断开连接了~'); | ||
61 | - } | 66 | + }); |
62 | }); | 67 | }); |
68 | +} | ||
63 | 69 | ||
64 | -}); | 70 | +if (addToCartHammer) { |
71 | + addToCartHammer.on('tap', function(e) { | ||
65 | 72 | ||
66 | -addToCartHammer.on('tap', function(e) { | 73 | + // 统计代码:用于统计用户加入购物车的动作 |
74 | + if (window._yas) { | ||
75 | + window._yas.sendCustomInfo({ | ||
76 | + pd: productId, | ||
77 | + by: 1 | ||
78 | + }); | ||
79 | + } | ||
80 | + }); | ||
81 | +} | ||
67 | 82 | ||
68 | - // 统计代码:用于统计用户加入购物车的动作 | ||
69 | - if (window._yas) { | ||
70 | - window._yas.sendCustomInfo({ | ||
71 | - pd: productId, | ||
72 | - by: 1 | ||
73 | - }); | ||
74 | - } | ||
75 | -}); | ||
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"></i> | 4 | <i class="iconfont consult-logo"></i> |
5 | <span>我要咨询</span> | 5 | <span>我要咨询</span> |
6 | - <a href="/product/detail/consultform" class="iconfont enter-consult-page"></a> | 6 | + <a href="{{consultUrl}}" class="iconfont enter-consult-page"></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> |
@@ -117,14 +117,12 @@ | @@ -117,14 +117,12 @@ | ||
117 | {{> product/recommend-for-you}} | 117 | {{> product/recommend-for-you}} |
118 | 118 | ||
119 | {{#cartInfo}} | 119 | {{#cartInfo}} |
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"></a> | 120 | + <div class="cart-bar"> |
121 | + <span class="num-tag hide"></span> | ||
122 | + <a href="{{cartUrl}}" class="num-incart iconfont"></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"></span>暂无评论 | 26 | + <span class="iconfont"></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"></span> | 47 | + <span class="iconfont comment"></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"></span></a> | 55 | <span class="iconfont"></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"></span>暂无咨询 | 59 | + <span class="iconfont comment"></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}}"> |
-
Please register or login to post a comment