Authored by Rock Zhang

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

Conflicts:
	yohobuy/m.yohobuy.com/application/controllers/Home.php
@@ -576,7 +576,7 @@ class Helpers @@ -576,7 +576,7 @@ class Helpers
576 $oneGoods['id'] = $value['product_sku']; 576 $oneGoods['id'] = $value['product_sku'];
577 $oneGoods['skn'] = $value['product_skn']; 577 $oneGoods['skn'] = $value['product_skn'];
578 $oneGoods['name'] = $value['product_name']; 578 $oneGoods['name'] = $value['product_name'];
579 - $oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 90, 100) : ''; 579 + $oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 120, 160) : '';
580 $oneGoods['color'] = $value['color_name']; 580 $oneGoods['color'] = $value['color_name'];
581 $oneGoods['size'] = $value['size_name']; 581 $oneGoods['size'] = $value['size_name'];
582 $oneGoods['checked'] = $value['selected'] === 'Y'; 582 $oneGoods['checked'] = $value['selected'] === 'Y';
@@ -22,9 +22,14 @@ var navHammer, @@ -22,9 +22,14 @@ var navHammer,
22 freebieHammer, 22 freebieHammer,
23 switchChose = false; 23 switchChose = false;
24 24
25 -require('../product/recommend-for-you');  
26 require('./good'); 25 require('./good');
27 26
  27 +if ($('.cart-zero').length > 0) {
  28 + require('../product/recommend-for-you');
  29 +} else {
  30 + require('./good');
  31 +}
  32 +
28 ellipsis.init(); 33 ellipsis.init();
29 34
30 function cartContentShow() { 35 function cartContentShow() {
@@ -67,11 +67,12 @@ function show(html, cb) { @@ -67,11 +67,12 @@ function show(html, cb) {
67 document.documentElement.scrollLeft || document.body.scrollLeft, 67 document.documentElement.scrollLeft || document.body.scrollLeft,
68 document.documentElement.scrollTop || document.body.scrollTop 68 document.documentElement.scrollTop || document.body.scrollTop
69 ], 69 ],
70 - $html = $('html'); // it would make more sense to apply this to body, but IE7 won't have that 70 + $html = $('html, body'); // it would make more sense to apply this to body, but IE7 won't have that
71 71
72 $html.data('scroll-position', scrollPosition); 72 $html.data('scroll-position', scrollPosition);
73 $html.data('previous-overflow', $html.css('overflow')); 73 $html.data('previous-overflow', $html.css('overflow'));
74 $html.css('overflow', 'hidden'); 74 $html.css('overflow', 'hidden');
  75 + $html.css('height', '100%');
75 window.scrollTo(scrollPosition[0], scrollPosition[1]); 76 window.scrollTo(scrollPosition[0], scrollPosition[1]);
76 77
77 if (html) { 78 if (html) {
@@ -89,11 +90,12 @@ function show(html, cb) { @@ -89,11 +90,12 @@ function show(html, cb) {
89 90
90 //隐藏当前Panel 91 //隐藏当前Panel
91 function hide() { 92 function hide() {
92 - var $html = $('html'), 93 + var $html = $('html, body'),
93 scrollPosition = $html.data('scroll-position'); 94 scrollPosition = $html.data('scroll-position');
94 95
95 // un-lock scroll position 96 // un-lock scroll position
96 $html.css('overflow', $html.data('previous-overflow')); 97 $html.css('overflow', $html.data('previous-overflow'));
  98 + $html.css('height', 'auto');
97 window.scrollTo(scrollPosition[0], scrollPosition[1]); 99 window.scrollTo(scrollPosition[0], scrollPosition[1]);
98 $('.chose-panel').hide(); 100 $('.chose-panel').hide();
99 } 101 }
@@ -104,7 +106,7 @@ function updateConformButtonClassAndText() { @@ -104,7 +106,7 @@ function updateConformButtonClassAndText() {
104 if (2 === $chosed.closest('.zero-stock').length) { 106 if (2 === $chosed.closest('.zero-stock').length) {
105 $('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄'); 107 $('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄');
106 } else { 108 } else {
107 - $('#chose-btn-sure').css('background-color', '#eb0313').html('确定'); 109 + $('#chose-btn-sure').css('background-color', '#eb0313').html('加入购物车');
108 } 110 }
109 } 111 }
110 112
@@ -19,7 +19,7 @@ var $selectAllBtn = $('.balance .checkbox'), @@ -19,7 +19,7 @@ var $selectAllBtn = $('.balance .checkbox'),
19 ellipsis.init(); 19 ellipsis.init();
20 20
21 lazyLoad({ 21 lazyLoad({
22 - try_again_css: 'good-failure' 22 + try_again_css: 'order-failure'
23 }); 23 });
24 24
25 setTimeout(function() { 25 setTimeout(function() {
@@ -75,7 +75,9 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { @@ -75,7 +75,9 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
75 }, function() { 75 }, function() {
76 tip.show('网络异常'); 76 tip.show('网络异常');
77 }); 77 });
78 -}).on('touchstart', '.icon-del', function(e) { 78 +});
  79 +
  80 +$('.icon-del').on('touchstart', function(e) {
79 var $this = $(this); 81 var $this = $(this);
80 82
81 e.stopPropagation(); 83 e.stopPropagation();
@@ -112,6 +114,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { @@ -112,6 +114,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
112 } 114 }
113 }, function() { 115 }, function() {
114 tip.show('网络异常'); 116 tip.show('网络异常');
  117 + window.location.reload();
115 }); 118 });
116 }); 119 });
117 }); 120 });
@@ -24,8 +24,8 @@ $('.address-item').on('touchend', function() { @@ -24,8 +24,8 @@ $('.address-item').on('touchend', function() {
24 }).on('touchend', '.edit', function() { 24 }).on('touchend', '.edit', function() {
25 window.location.href = $(this).data('href'); 25 window.location.href = $(this).data('href');
26 return false; 26 return false;
27 -}).on('touchend', '.del', function() {  
28 - deleteId = $(this).data('address-id'); 27 +}).on('touchstart', '.del', function() {
  28 + deleteId = $(this).data('id');
29 }); 29 });
30 30
31 $confim.on('touchend', '.confim', function() { 31 $confim.on('touchend', '.confim', function() {
@@ -179,7 +179,7 @@ function reMarginFooter(fixedElement) { @@ -179,7 +179,7 @@ function reMarginFooter(fixedElement) {
179 a.async = 1; 179 a.async = 1;
180 a.src = j; 180 a.src = j;
181 m.parentNode.insertBefore(a, m); 181 m.parentNode.insertBefore(a, m);
182 -})(window, document, 'script', 'http://cdn.yoho.cn/yas-jssdk/1.0.13.6.3/yas-debug.js', '_yas'); 182 +})(window, document, 'script', 'http://cdn.yoho.cn/yas-jssdk/1.0.13.6.3/yas.js', '_yas');
183 183
184 (function() { 184 (function() {
185 var uid = getUid(); 185 var uid = getUid();
@@ -17,19 +17,13 @@ var $ = require('jquery'), @@ -17,19 +17,13 @@ var $ = require('jquery'),
17 trendTopicSwiper, 17 trendTopicSwiper,
18 goodsSwiper; 18 goodsSwiper;
19 19
20 -var requestFrame,  
21 - thisFunc,  
22 - start = 0,  
23 - i, 20 +var start = 0,
24 swiperClass, 21 swiperClass,
25 - supportCss3,  
26 $logotrans = $('.home-header .logo'), 22 $logotrans = $('.home-header .logo'),
27 isen = true; 23 isen = true;
28 24
29 var navHammer; 25 var navHammer;
30 26
31 -require('./maybe-like');  
32 -  
33 lazyLoad($('img.lazy')); 27 lazyLoad($('img.lazy'));
34 28
35 navHammer = new Hammer($('.nav-btn')[0]); 29 navHammer = new Hammer($('.nav-btn')[0]);
@@ -39,13 +33,6 @@ navHammer.on('tap', function(event) { @@ -39,13 +33,6 @@ navHammer.on('tap', function(event) {
39 $overlay.show().css('opacity', 0.3); 33 $overlay.show().css('opacity', 0.3);
40 $sideNav.addClass('on'); 34 $sideNav.addClass('on');
41 35
42 - //设置boy高宽,页面不能上下滑动  
43 - $('body').css({  
44 - height: $(window).height(),  
45 - width: $(window).width(),  
46 - overflow: 'hidden'  
47 - });  
48 -  
49 event.srcEvent.stopPropagation(); 36 event.srcEvent.stopPropagation();
50 return false; 37 return false;
51 }); 38 });
@@ -56,10 +43,6 @@ function hideSideBar() { @@ -56,10 +43,6 @@ function hideSideBar() {
56 $('.overlay').hide(); 43 $('.overlay').hide();
57 $('.sub-nav').removeClass('show'); 44 $('.sub-nav').removeClass('show');
58 $sideNav.removeClass('on'); 45 $sideNav.removeClass('on');
59 - $('body').css({  
60 - height: 'auto',  
61 - overflow: 'auto'  
62 - });  
63 } 46 }
64 } 47 }
65 48
@@ -68,6 +51,11 @@ $('.overlay').on('touchstart', function(e) { @@ -68,6 +51,11 @@ $('.overlay').on('touchstart', function(e) {
68 return false; 51 return false;
69 }); 52 });
70 53
  54 +//禁止在侧边栏可以上下滚动
  55 +$('.side-nav').on('touchmove', function() {
  56 + return false;
  57 +});
  58 +
71 //点击一级导航,弹出二级导航 59 //点击一级导航,弹出二级导航
72 $sideNav.on('touchstart', 'li', function(e) { 60 $sideNav.on('touchstart', 'li', function(e) {
73 if ($(this).find('.sub-nav').size() > 0) { 61 if ($(this).find('.sub-nav').size() > 0) {
@@ -161,28 +149,6 @@ $('.category-swiper').each(function(i, index) { @@ -161,28 +149,6 @@ $('.category-swiper').each(function(i, index) {
161 }); 149 });
162 150
163 //logo动画 151 //logo动画
164 -requestFrame = (function() {  
165 - var tempFunc = null,  
166 - prefixList = ['webkit', 'moz', 'ms'];  
167 -  
168 - for (i = 0; i < prefixList.length; i++) {  
169 - thisFunc = prefixList[i] + 'RequestAnimationFrame';  
170 - if (window[thisFunc]) {  
171 - supportCss3 = true;  
172 - tempFunc = thisFunc;  
173 - }  
174 - }  
175 -  
176 - if (supportCss3) {  
177 - return function(callback) {  
178 - window[tempFunc](callback);  
179 - };  
180 - }  
181 - return function(callback) {  
182 - window.setTimeout(callback, 67);  
183 - };  
184 -})();  
185 -  
186 function tsAnimate() { 152 function tsAnimate() {
187 start = start + 10; 153 start = start + 10;
188 $logotrans.css({ 154 $logotrans.css({
@@ -205,9 +171,7 @@ function tsAnimate() { @@ -205,9 +171,7 @@ function tsAnimate() {
205 if (start % 360 === 0) { 171 if (start % 360 === 0) {
206 window.setTimeout(tsAnimate, 60 * 1000); 172 window.setTimeout(tsAnimate, 60 * 1000);
207 } else { 173 } else {
208 - requestFrame(function() {  
209 - tsAnimate();  
210 - }); 174 + window.requestAnimationFrame(tsAnimate);
211 } 175 }
212 } 176 }
213 } 177 }
@@ -230,3 +194,5 @@ exports.set = function(c) { @@ -230,3 +194,5 @@ exports.set = function(c) {
230 domain: '.m.yohobuy.com' 194 domain: '.m.yohobuy.com'
231 }); 195 });
232 }; 196 };
  197 +
  198 +require('./maybe-like');
@@ -243,11 +243,11 @@ function search(opt) { @@ -243,11 +243,11 @@ function search(opt) {
243 break; 243 break;
244 case 'price': 244 case 'price':
245 window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid, 245 window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid,
246 - '', '.new-goods .good-info .good-detail-img .good-thumb'); 246 + '', '.price-goods .good-info .good-detail-img .good-thumb');
247 break; 247 break;
248 case 'discount': 248 case 'discount':
249 window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid, 249 window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid,
250 - '', '.new-goods .good-info .good-detail-img .good-thumb'); 250 + '', '.discount-goods .good-info .good-detail-img .good-thumb');
251 break; 251 break;
252 } 252 }
253 } 253 }
@@ -41,6 +41,7 @@ @@ -41,6 +41,7 @@
41 .thumb { 41 .thumb {
42 float: left; 42 float: left;
43 width: 100rem / $pxConvertRem; 43 width: 100rem / $pxConvertRem;
  44 + margin-right: 20rem / $pxConvertRem;
44 } 45 }
45 46
46 .text-info { 47 .text-info {
@@ -48,7 +49,7 @@ @@ -48,7 +49,7 @@
48 .name { 49 .name {
49 font-size: 28rem / $pxConvertRem; 50 font-size: 28rem / $pxConvertRem;
50 height: 74rem / $pxConvertRem; 51 height: 74rem / $pxConvertRem;
51 - overflow: hidden; 52 + overflow: hidden;
52 display: -webkit-box; 53 display: -webkit-box;
53 -webkit-line-clamp: 2; 54 -webkit-line-clamp: 2;
54 -webkit-box-orient: vertical; 55 -webkit-box-orient: vertical;
@@ -28,12 +28,16 @@ @@ -28,12 +28,16 @@
28 } 28 }
29 29
30 .few-tag { 30 .few-tag {
31 - width: 148rem / $pxConvertRem; 31 + width: 150rem / $pxConvertRem;
32 position: absolute; 32 position: absolute;
33 - left: 92rem / $pxConvertRem;  
34 text-align: center; 33 text-align: center;
35 - top: 75%; 34 + top: 72%;
36 color: #fff; 35 color: #fff;
  36 +
  37 + span {
  38 + display: inline-block;
  39 + @include transform(scale(0.833));
  40 + }
37 } 41 }
38 42
39 .gift-tag { 43 .gift-tag {
@@ -71,8 +75,7 @@ @@ -71,8 +75,7 @@
71 75
72 .thumb { 76 .thumb {
73 float: left; 77 float: left;
74 - width: 180rem / $pxConvertRem;  
75 - height: 200rem / $pxConvertRem; 78 + width: 150rem / $pxConvertRem;
76 background-size: 100%; 79 background-size: 100%;
77 background-repeat: no-repeat; 80 background-repeat: no-repeat;
78 } 81 }
@@ -80,7 +83,7 @@ @@ -80,7 +83,7 @@
80 .deps { 83 .deps {
81 position: relative; 84 position: relative;
82 width: 380rem / $pxConvertRem; 85 width: 380rem / $pxConvertRem;
83 - margin-left: 4.7rem; 86 + margin-left: 180rem / $pxConvertRem;
84 border-bottom: 1px solid #e0e0e0; 87 border-bottom: 1px solid #e0e0e0;
85 padding: 0.5rem 0; 88 padding: 0.5rem 0;
86 } 89 }
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 left: 0; 7 left: 0;
8 right: 100rem / $pxConvertRem; 8 right: 100rem / $pxConvertRem;
9 width: 540rem / $pxConvertRem; 9 width: 540rem / $pxConvertRem;
10 - z-index: 1; 10 + z-index: 4;
11 overflow: hidden; 11 overflow: hidden;
12 @include transition(all .3s); 12 @include transition(all .3s);
13 13
@@ -188,4 +188,4 @@ @@ -188,4 +188,4 @@
188 display: block; 188 display: block;
189 @include transform(translateX(0)); 189 @include transform(translateX(0));
190 @include transition(transform 0.3s); 190 @include transition(transform 0.3s);
191 -}  
  191 +}
@@ -56,13 +56,7 @@ @@ -56,13 +56,7 @@
56 {{/if}} 56 {{/if}}
57 57
58 <div class="price-compute"> 58 <div class="price-compute">
59 - <p>  
60 - <span>总价(¥{{price}})<i>-</i></span>  
61 - <span>活动价(¥{{activityPrice}})</span>  
62 - </p>  
63 - <p>  
64 - <span><i>=</i>商品总计金额 (¥{{sumPrice}})</span>  
65 - </p> 59 + <p>{{formulaPrice}}</p>
66 </div> 60 </div>
67 61
68 <div class="balance"> 62 <div class="balance">
@@ -63,7 +63,7 @@ @@ -63,7 +63,7 @@
63 </div> 63 </div>
64 </div> 64 </div>
65 <div class="btn-wrap"> 65 <div class="btn-wrap">
66 - <button id="chose-btn-sure" class="btn btn-sure">确定</button> 66 + <button id="chose-btn-sure" class="btn btn-sure">加入购物车</button>
67 </div> 67 </div>
68 </div> 68 </div>
69 </div> 69 </div>
@@ -13,10 +13,10 @@ @@ -13,10 +13,10 @@
13 <img class="thumb lazy" data-original="{{thumb}}"> 13 <img class="thumb lazy" data-original="{{thumb}}">
14 </a> 14 </a>
15 {{#if isAdvanceBuy}} 15 {{#if isAdvanceBuy}}
16 - <p class="few-tag plus-tag">加价购</p> 16 + <p class="few-tag plus-tag"><span>加价购</span></p>
17 {{/if}} 17 {{/if}}
18 {{#if isGift}} 18 {{#if isGift}}
19 - <p class="few-tag gift-tag">赠品</p> 19 + <p class="few-tag gift-tag"><span>赠品</span></p>
20 {{/if}} 20 {{/if}}
21 21
22 <div class="deps show"> 22 <div class="deps show">
1 <!-- Google Tag Manager --> 1 <!-- Google Tag Manager -->
2 <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-W958MG" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> 2 <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-W958MG" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
  3 +
3 <script> 4 <script>
4 - (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':  
5 - new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],  
6 - j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=  
7 - '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);  
8 - })(window,document,'script','dataLayer','GTM-W958MG');  
9 -</script>  
10 -<!-- End Google Tag Manager -->  
11 -<script type="text/javascript">  
12 - var _hmt = _hmt || [];  
13 - (function() {  
14 - var hm = document.createElement("script");  
15 - hm.src = "//hm.baidu.com/hm.js?c6ee7218b8321cb65fb2e98f284d8311";  
16 - hm.async = 1;  
17 - var s = document.getElementsByTagName("script")[0];  
18 - s.parentNode.insertBefore(hm, s);  
19 - })();  
20 -</script>  
21 -<script>  
22 - var _hmt = _hmt || [];  
23 - (function() {  
24 - var hm = document.createElement("script");  
25 - hm.src = "//hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841";  
26 - hm.async = 1;  
27 - var s = document.getElementsByTagName("script")[0];  
28 - s.parentNode.insertBefore(hm, s);  
29 - })();  
30 -</script>  
31 -<script src="http://static.yohobuy.com/js/analytics/analysis.js" async="async"></script>  
32 -<script src="http://static.yohobuy.com/m/v1/js/om_code.js" async="async"></script> 5 +var _hmt = _hmt || [];
  6 +(function() {
  7 + function async_load(){
  8 + (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
  9 + new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
  10 + j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
  11 + '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
  12 + })(window,document,'script','dataLayer','GTM-W958MG');
  13 +
  14 + (function() {
  15 + var hm = document.createElement("script");
  16 + hm.src = "//hm.baidu.com/hm.js?c6ee7218b8321cb65fb2e98f284d8311";
  17 + hm.async = 1;
  18 + var s = document.getElementsByTagName("script")[0];
  19 + s.parentNode.insertBefore(hm, s);
  20 + })();
  21 +
  22 + (function() {
  23 + var hm = document.createElement("script");
  24 + hm.src = "//hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841";
  25 + hm.async = 1;
  26 + var s = document.getElementsByTagName("script")[0];
  27 + s.parentNode.insertBefore(hm, s);
  28 + })();
  29 +
  30 + (function() {
  31 + var hm = document.createElement("script");
  32 + hm.src = "http://static.yohobuy.com/js/analytics/analysis.js";
  33 + var s = document.getElementsByTagName("script")[0];
  34 + s.parentNode.insertBefore(hm, s);
  35 + })();
  36 +
  37 + (function() {
  38 + var hm = document.createElement("script");
  39 + hm.src = "http://static.yohobuy.com/m/v1/js/om_code.js";
  40 + hm.async = 1;
  41 + var s = document.getElementsByTagName("script")[0];
  42 + s.parentNode.insertBefore(hm, s);
  43 + })();
  44 + }
  45 + window.addEventListener('load', async_load, false);
  46 +})();
  47 +</script>
@@ -794,8 +794,9 @@ class CartModel @@ -794,8 +794,9 @@ class CartModel
794 } 794 }
795 795
796 // 结算数据 796 // 结算数据
797 - $result['price'] = Helpers::transPrice($data['shopping_cart_data']['order_amount']);  
798 - $result['activityPrice'] = Helpers::transPrice($data['shopping_cart_data']['discount_amount']); 797 + $result['formulaPrice'] = $data['shopping_cart_data']['promotion_formula'];
  798 + /*$result['price'] = Helpers::transPrice($data['shopping_cart_data']['order_amount']);
  799 + $result['activityPrice'] = Helpers::transPrice($data['shopping_cart_data']['discount_amount']);*/
799 $result['count'] = $data['shopping_cart_data']['selected_goods_count']; 800 $result['count'] = $data['shopping_cart_data']['selected_goods_count'];
800 $result['isAllSelected'] = ($data['shopping_cart_data']['goods_count'] === $data['shopping_cart_data']['selected_goods_count']) && ($data['shopping_cart_data']['selected_goods_count'] >0); 801 $result['isAllSelected'] = ($data['shopping_cart_data']['goods_count'] === $data['shopping_cart_data']['selected_goods_count']) && ($data['shopping_cart_data']['selected_goods_count'] >0);
801 $result['sumPrice'] = Helpers::transPrice($data['shopping_cart_data']['last_order_amount']); 802 $result['sumPrice'] = Helpers::transPrice($data['shopping_cart_data']['last_order_amount']);