Authored by biao

update to fix below issues: 1. request recommand for you only when there is no g…

…ood in cart. 2. the coupon img could be left up when input focused. code review by XWG.
@@ -78,5 +78,9 @@ $('.chose').on('touchend', function() { @@ -78,5 +78,9 @@ $('.chose').on('touchend', function() {
78 chosePanel.show(); 78 chosePanel.show();
79 }); 79 });
80 80
  81 +if ($('.cart-zero').length > 0) {
  82 + require('../product/recommend-for-you');
  83 +}
  84 +
81 //提前触发lazyload 85 //提前触发lazyload
82 -$(window).scrollTop(1).scrollTop(0);  
  86 +$(window).scrollTop(1).scrollTop(0);
@@ -20,6 +20,21 @@ var conponTmpl = Handlebars.compile($('#tmpl-coupon').html()), @@ -20,6 +20,21 @@ var conponTmpl = Handlebars.compile($('#tmpl-coupon').html()),
20 20
21 // conponNotAvaliableTmpl = Handlebars.compile($('#tmpl-coupon-not-avaliable').html()), 21 // conponNotAvaliableTmpl = Handlebars.compile($('#tmpl-coupon-not-avaliable').html()),
22 22
  23 +function fixedLayOut() {
  24 + var $null = $('.null');
  25 +
  26 + var winH = $(window).height(),
  27 + nullH = $null.height();
  28 +
  29 + if ($null.length === 0) {
  30 + return false;
  31 + }
  32 +
  33 + $null.css({
  34 + top: winH/2 - nullH/2
  35 + });
  36 +}
  37 +
23 ellipsis.init(); 38 ellipsis.init();
24 39
25 $newCoupon.on('submit', function() { 40 $newCoupon.on('submit', function() {
@@ -106,6 +121,7 @@ function getCouponHandle(coupons) { @@ -106,6 +121,7 @@ function getCouponHandle(coupons) {
106 // 第一页张数为 0 ,显示优惠券为空 121 // 第一页张数为 0 ,显示优惠券为空
107 if (!coupons.length && page === 2) { 122 if (!coupons.length && page === 2) {
108 $('.coupin-wrap').html($('#tmpl-no-coupon').html()); 123 $('.coupin-wrap').html($('#tmpl-no-coupon').html());
  124 + fixedLayOut();
109 return; 125 return;
110 } 126 }
111 127
@@ -127,7 +143,9 @@ function getCouponHandle(coupons) { @@ -127,7 +143,9 @@ function getCouponHandle(coupons) {
127 // $('#coupon-list-not').append(conponNotAvaliableTmpl({ 143 // $('#coupon-list-not').append(conponNotAvaliableTmpl({
128 // notAvailableCoupons: notAvailableCoupons 144 // notAvailableCoupons: notAvailableCoupons
129 // })); 145 // }));
  146 +
130 window.rePosFooter(); 147 window.rePosFooter();
  148 +
131 } 149 }
132 150
133 function getCouponDate() { 151 function getCouponDate() {
@@ -159,6 +177,7 @@ function getCouponDate() { @@ -159,6 +177,7 @@ function getCouponDate() {
159 }); 177 });
160 } 178 }
161 179
  180 +
162 getCouponDate(); 181 getCouponDate();
163 182
164 $(window).scroll(function() { 183 $(window).scroll(function() {
@@ -83,7 +83,7 @@ @@ -83,7 +83,7 @@
83 position: absolute; 83 position: absolute;
84 left: 0; 84 left: 0;
85 top:50%; 85 top:50%;
86 - @include transform(translateY(-50%)); 86 + //@include transform(translateY(-50%));
87 i{ 87 i{
88 width: 100%; 88 width: 100%;
89 height: 120rem / $pxConvertRem; 89 height: 120rem / $pxConvertRem;
@@ -222,7 +222,6 @@ @@ -222,7 +222,6 @@
222 {{#if shoppingCartPage}} 222 {{#if shoppingCartPage}}
223 <script> 223 <script>
224 seajs.use('js/cart/cart'); 224 seajs.use('js/cart/cart');
225 - seajs.use('js/product/recommend-for-you');  
226 </script> 225 </script>
227 {{/if}} 226 {{/if}}
228 {{#if giftPage}} 227 {{#if giftPage}}