Authored by 梁志锋

Merge branch 'feature/cart' of http://git.dev.yoho.cn/web/yohobuy into feature/cart

Showing 21 changed files with 91 additions and 60 deletions
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 var $ = require('jquery'), 8 var $ = require('jquery'),
9 Hammer = require('yoho.hammer'), 9 Hammer = require('yoho.hammer'),
10 tip = require('../../plugin/tip'), 10 tip = require('../../plugin/tip'),
11 - chosePanel = require('../../shopping-cart/chose-panel'); 11 + chosePanel = require('../../cart/chose-panel');
12 12
13 var likeEle = document.getElementById('likeBtn'), 13 var likeEle = document.getElementById('likeBtn'),
14 likeHammer = likeEle && new Hammer(likeEle); 14 likeHammer = likeEle && new Hammer(likeEle);
@@ -83,6 +83,3 @@ if (addToCartHammer) { @@ -83,6 +83,3 @@ if (addToCartHammer) {
83 83
84 }); 84 });
85 } 85 }
86 -  
87 -  
88 -  
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 position: absolute; 7 position: absolute;
8 top: 50%; 8 top: 50%;
9 margin-top: -14rem / $pxConvertRem; 9 margin-top: -14rem / $pxConvertRem;
  10 + margin-left: 20rem / $pxConvertRem;
10 font-size: 28rem / $pxConvertRem; 11 font-size: 28rem / $pxConvertRem;
11 color: #f0f0f0; 12 color: #f0f0f0;
12 13
@@ -15,9 +16,40 @@ @@ -15,9 +16,40 @@
15 } 16 }
16 } 17 }
17 18
  19 + .few-tag{
  20 + width: 132rem / $pxConvertRem;
  21 + position: absolute;
  22 + left: 100rem / $pxConvertRem;
  23 + text-align: center;
  24 + top: 75%;
  25 + color: #fff;
  26 + }
  27 +
  28 + .gift-tag {
  29 + background-color: #88BE51;
  30 + }
  31 +
  32 + .plus-tag {
  33 + background-color: #FC1264;
  34 + }
  35 +
  36 + .few-tag-expire {
  37 + position: absolute;
  38 + top: 40%;
  39 + left: 20rem / $pxConvertRem;
  40 + background-color: #7f7f7f;
  41 + display: inline-block;
  42 + color: #fff;
  43 + border-radius: 12rem / $pxConvertRem;
  44 + padding: 4rem / $pxConvertRem;
  45 + font-size: 20rem / $pxConvertRem;
  46 + width: 48rem / $pxConvertRem;
  47 + text-align: center;
  48 + }
  49 +
18 .info { 50 .info {
19 float: left; 51 float: left;
20 - margin-left: 30rem / $pxConvertRem; 52 + margin-left: 60rem / $pxConvertRem;
21 padding: 16rem / $pxConvertRem 0; 53 padding: 16rem / $pxConvertRem 0;
22 padding-right: 20rem / $pxConvertRem; 54 padding-right: 20rem / $pxConvertRem;
23 } 55 }
@@ -32,13 +64,18 @@ @@ -32,13 +64,18 @@
32 64
33 .deps { 65 .deps {
34 margin-left: 173rem / $pxConvertRem; 66 margin-left: 173rem / $pxConvertRem;
35 - padding-bottom: 60rem / $pxConvertRem; 67 + padding-bottom: 72rem / $pxConvertRem;
36 border-bottom: 1px solid #e0e0e0; 68 border-bottom: 1px solid #e0e0e0;
  69 + width: 380rem / $pxConvertRem;
  70 + position: relative;
  71 + min-height: 140rem / $pxConvertRem;
37 } 72 }
38 73
39 .name { 74 .name {
40 font-size: 28rem / $pxConvertRem; 75 font-size: 28rem / $pxConvertRem;
41 color: #5a5a5a; 76 color: #5a5a5a;
  77 + width: 80%;
  78 + display: inline-block;
42 } 79 }
43 80
44 .row:nth-child(2) { 81 .row:nth-child(2) {
@@ -71,9 +108,13 @@ @@ -71,9 +108,13 @@
71 } 108 }
72 109
73 .count { 110 .count {
74 - font-size: 20rem / $pxConvertRem; 111 + font-size: 32rem / $pxConvertRem;
75 color: #999; 112 color: #999;
76 - margin-left: 22rem / $pxConvertRem; 113 + //margin-left: 22rem / $pxConvertRem;
  114 + display: inline-block;
  115 + width: 19%;
  116 + position: absolute;
  117 + text-align: center;
77 } 118 }
78 119
79 .sold-out, .low-stocks { 120 .sold-out, .low-stocks {
@@ -205,7 +246,6 @@ @@ -205,7 +246,6 @@
205 top: 20rem / $pxConvertRem;; 246 top: 20rem / $pxConvertRem;;
206 font-size: 52em / $pxConvertRem; 247 font-size: 52em / $pxConvertRem;
207 } 248 }
208 -  
209 } 249 }
210 } 250 }
211 251
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="gift-advance-page yoho-page"> 2 <div class="gift-advance-page yoho-page">
3 - {{# shoppingCart}}  
4 - {{#if gift}}  
5 - {{# gift}}  
6 - {{> shopping-cart/gift-advance-good}}  
7 - {{/ gift}}  
8 - {{^}}  
9 - {{# advance}} 3 + {{#if advanceBuyPage}}
  4 + {{# advanceBuy}}
10 <div class="advance-block"> 5 <div class="advance-block">
11 <p class="title">{{title}}</p> 6 <p class="title">{{title}}</p>
12 - {{# goods}}  
13 - {{> shopping-cart/gift-advance-good}}  
14 - {{/ goods}} 7 + {{#goods}}
  8 + {{> cart/gift-advance-good}}
  9 + {{/goods}}
15 </div> 10 </div>
16 - {{/ advance}} 11 + {{/ advanceBuy}}
  12 + {{else}}
  13 + {{# gift}}
  14 + {{> cart/gift-advance-good}}
  15 + {{/ gift}}
17 {{/if}} 16 {{/if}}
18 - {{/ shoppingCart}} 17 +
  18 +
19 </div> 19 </div>
20 {{> layout/footer}} 20 {{> layout/footer}}
@@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
27 27
28 {{# commonCart}} 28 {{# commonCart}}
29 <div class="cart-content common"> 29 <div class="cart-content common">
30 - {{> shopping-cart/cart-content}} 30 + {{> cart/cart-content}}
31 </div> 31 </div>
32 {{/ commonCart}} 32 {{/ commonCart}}
33 33
@@ -38,7 +38,7 @@ @@ -38,7 +38,7 @@
38 <span class="txt">预售商品全场包邮,到货后立即发货</span> 38 <span class="txt">预售商品全场包邮,到货后立即发货</span>
39 <span class="txt">预售商品不参加活动,不可使用优惠券</span> 39 <span class="txt">预售商品不参加活动,不可使用优惠券</span>
40 </p> 40 </p>
41 - {{> shopping-cart/cart-content}} 41 + {{> cart/cart-content}}
42 </div> 42 </div>
43 {{/ preSellCart}} 43 {{/ preSellCart}}
44 {{/ shoppingCart}} 44 {{/ shoppingCart}}
@@ -52,5 +52,5 @@ @@ -52,5 +52,5 @@
52 </div> 52 </div>
53 {{> product/recommend-for-you}} 53 {{> product/recommend-for-you}}
54 </div> 54 </div>
55 -{{> shopping-cart/chose-panel}} 55 + {{> cart/chose-panel}}
56 {{> layout/footer}} 56 {{> layout/footer}}
1 <div class="cart-goods"> 1 <div class="cart-goods">
2 {{# goods}} 2 {{# goods}}
3 - {{> shopping-cart/good}} 3 + {{> cart/good}}
4 {{/ goods}} 4 {{/ goods}}
5 5
6 {{# $notValidGoods}} 6 {{# $notValidGoods}}
7 - {{> shopping-cart/good}} 7 + {{> cart/good}}
8 {{/ $notValidGoods}} 8 {{/ $notValidGoods}}
9 9
10 </div> 10 </div>
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 ¥{{price}} 23 ¥{{price}}
24 </span> 24 </span>
25 <span class="price"> 25 <span class="price">
26 - ¥{{salePrice}} 26 + ¥{{marketPrice}}
27 </span> 27 </span>
28 <span class="count"> 28 <span class="count">
29 ×{{count}} 29 ×{{count}}
1 <div class="shopping-cart-good clearfix" data-id={{id}}> 1 <div class="shopping-cart-good clearfix" data-id={{id}}>
2 - <span class="checkbox icon-cb-checked iconfont"></span>  
3 - <!-- {{#if isSoldOut}}  
4 -<p class="">失效</p>  
5 - {{^}}  
6 - {{#if isGift}} 2 + {{#if isSoldOut}}
  3 + <span class="few-tag-expire">失效</span>
7 {{^}} 4 {{^}}
8 -<span class="checkbox icon-cb-checked iconfont"></span> 5 + <span class="checkbox icon-cb-checked iconfont"></span>
9 {{/if}} 6 {{/if}}
10 7
11 - {{/if}}-->  
12 <div class="info"> 8 <div class="info">
13 <img class="thumb lazy" data-original={{thumb}}> 9 <img class="thumb lazy" data-original={{thumb}}>
14 - <!--  
15 - <a class="" href="{{url}}">  
16 - <img class="thumb lazy" data-original="{{thumb}}">  
17 - </a>  
18 {{#if isAdvanceBuy}} 10 {{#if isAdvanceBuy}}
19 - <p class="few-tag">加价购</p> 11 + <p class="few-tag plus-tag">加价购</p>
20 {{^}} 12 {{^}}
21 {{#if isGift}} 13 {{#if isGift}}
22 - <p class="few-tag">赠品</p>  
23 - {{/if}} 14 + <p class="few-tag gift-tag">赠品</p>
24 {{/if}} 15 {{/if}}
25 - {{#if isSoldOut}}  
26 - <p class="few-tag">失效</p>  
27 {{/if}} 16 {{/if}}
28 -  
29 - --> 17 + </a>
30 18
31 <div class="deps show"> 19 <div class="deps show">
32 <p class="name row">{{name}}</p> 20 <p class="name row">{{name}}</p>
  21 + <span class="count">
  22 + ×{{count}}
  23 + </span>
33 <p class="row"> 24 <p class="row">
34 {{#if color}} 25 {{#if color}}
35 <span class="color"> 26 <span class="color">
@@ -48,9 +39,7 @@ @@ -48,9 +39,7 @@
48 <span class="price"> 39 <span class="price">
49 ¥{{price}} 40 ¥{{price}}
50 </span> 41 </span>
51 - <span class="count">  
52 - ×{{count}}  
53 - </span> 42 +
54 {{#if soldOut}} 43 {{#if soldOut}}
55 <span class="sold-out"> 44 <span class="sold-out">
56 已售罄 45 已售罄
@@ -221,29 +221,34 @@ @@ -221,29 +221,34 @@
221 {{!-- 购物车 --}} 221 {{!-- 购物车 --}}
222 {{#if shoppingCartPage}} 222 {{#if shoppingCartPage}}
223 <script> 223 <script>
224 - seajs.use('js/shopping-cart/cart'); 224 + seajs.use('js/cart/cart');
225 seajs.use('js/product/recommend-for-you'); 225 seajs.use('js/product/recommend-for-you');
226 </script> 226 </script>
227 {{/if}} 227 {{/if}}
228 -{{#if giftAdvancePage}} 228 +{{#if giftPage}}
229 <script> 229 <script>
230 - seajs.use('js/shopping-cart/gift-advance'); 230 + seajs.use('js/cart/gift-advance');
  231 +</script>
  232 +{{/if}}
  233 +{{#if advanceBuyPage}}
  234 +<script>
  235 + seajs.use('js/cart/gift-advance');
231 </script> 236 </script>
232 {{/if}} 237 {{/if}}
233 {{#if orderEnsurePage}} 238 {{#if orderEnsurePage}}
234 <script> 239 <script>
235 - seajs.use('js/shopping-cart/order-ensure'); 240 + seajs.use('js/cart/order-ensure');
236 </script> 241 </script>
237 {{/if}} 242 {{/if}}
238 {{#if selectAddressPage}} 243 {{#if selectAddressPage}}
239 <script> 244 <script>
240 seajs.use('js/me/address'); 245 seajs.use('js/me/address');
241 - seajs.use('js/shopping-cart/select-address'); 246 + seajs.use('js/cart/select-address');
242 </script> 247 </script>
243 {{/if}} 248 {{/if}}
244 {{#if selectCouponPage}} 249 {{#if selectCouponPage}}
245 <script> 250 <script>
246 - seajs.use('js/shopping-cart/select-coupon'); 251 + seajs.use('js/cart/select-coupon');
247 </script> 252 </script>
248 {{/if}} 253 {{/if}}
249 {{!-- 个人中心 --}} 254 {{!-- 个人中心 --}}
@@ -674,12 +674,12 @@ class CartModel @@ -674,12 +674,12 @@ class CartModel
674 break; 674 break;
675 } 675 }
676 676
677 - if ($onlyAdvanceBuy) { 677 + if ($onlyGift) {
678 // 赠品 678 // 赠品
679 $result['freebie'] = Helpers::formatAdvanceGoods($data['gift_list']); 679 $result['freebie'] = Helpers::formatAdvanceGoods($data['gift_list']);
680 break; 680 break;
681 } 681 }
682 - if ($onlyGift) { 682 + if ($onlyAdvanceBuy) {
683 // 加价购 683 // 加价购
684 $result['advanceBuy'] = Helpers::formatAdvanceGoods($data['price_gift']); 684 $result['advanceBuy'] = Helpers::formatAdvanceGoods($data['price_gift']);
685 break; 685 break;
@@ -143,11 +143,11 @@ class IndexController extends AbstractAction @@ -143,11 +143,11 @@ class IndexController extends AbstractAction
143 $shoppingKey = Helpers::getShoppingKeyByCookie(); 143 $shoppingKey = Helpers::getShoppingKeyByCookie();
144 $uid = $this->getUid(true); 144 $uid = $this->getUid(true);
145 $cartType = $this->get('cartType', 'ordinary'); 145 $cartType = $this->get('cartType', 'ordinary');
146 - $data = array('shoppingCartPage' => true); 146 + $data = array('giftPage' => true);
147 $data += CartModel::getCartData($uid, $shoppingKey, $cartType, true); 147 $data += CartModel::getCartData($uid, $shoppingKey, $cartType, true);
148 148
149 // 渲染模板 149 // 渲染模板
150 - $this->_view->display('gift-advance-good', $data); 150 + $this->_view->display('gift-advance', $data);
151 } 151 }
152 152
153 /* 153 /*
@@ -161,11 +161,11 @@ class IndexController extends AbstractAction @@ -161,11 +161,11 @@ class IndexController extends AbstractAction
161 $shoppingKey = Helpers::getShoppingKeyByCookie(); 161 $shoppingKey = Helpers::getShoppingKeyByCookie();
162 $uid = $this->getUid(true); 162 $uid = $this->getUid(true);
163 $cartType = $this->get('cartType', 'ordinary'); 163 $cartType = $this->get('cartType', 'ordinary');
164 - $data = array('shoppingCartPage' => true); 164 + $data = array('advanceBuyPage' => true);
165 $data += CartModel::getCartData($uid, $shoppingKey, $cartType, false, true); 165 $data += CartModel::getCartData($uid, $shoppingKey, $cartType, false, true);
166 166
167 // 渲染模板 167 // 渲染模板
168 - $this->_view->display('gift-advance-good', $data); 168 + $this->_view->display('gift-advance', $data);
169 } 169 }
170 170
171 /* 171 /*