Authored by xuqi

presell/common goods cart & tips

... ... @@ -6,6 +6,8 @@
var $ = require('yoho.zepto');
var $cartContent = $('.cart-content');
require('./good');
$('.cart-nav').delegate('li', 'touchstart', function() {
... ... @@ -17,4 +19,10 @@ $('.cart-nav').delegate('li', 'touchstart', function() {
$this.siblings('.active').removeClass('active');
$this.addClass('active');
//切换普通商品和预售商品购物车显示
$cartContent.toggleClass('hide');
//trigger lazyload
$(window).trigger('scroll');
});
\ No newline at end of file
... ...
... ... @@ -6,9 +6,8 @@
.shopping-cart-page {
padding-bottom: 120rem / $pxConvertRem;
}
.cart-nav {
.cart-nav {
height: 30rem / $pxConvertRem;
color: #c6c6c6;
border-bottom: 1px solid #e0e0e0;
... ... @@ -36,17 +35,57 @@
li:first-child span {
border-right: 1px solid #e0e0e0;
}
}
}
.login-info {
height: 46rem / $pxConvertRem;
padding: 17rem / $pxConvertRem 20rem / $pxConvertRem;
color: #24acaa;
text-align: center;
font-size: 28rem / $pxConvertRem;
.btn {
display: inline-block;
background: #ed0010;
color: #fff;
width: 80rem / $pxConvertRem;
height: 46rem / $pxConvertRem;
line-height: 46rem / $pxConvertRem;
}
}
.presell-info {
height: 60rem / $pxConvertRem;
padding: 15rem / $pxConvertRem 30rem / $pxConvertRem;
font-size: 22rem / $pxConvertRem;
background: #f0f0f0;
color: #b7b7b7;
> span {
display: block;
}
.cart-goods {
.iconfont {
float: left;
font-size: 45rem / $pxConvertRem;
}
.txt {
height: 30rem / $pxConvertRem;
line-height: 30rem / $pxConvertRem;
margin-left: 80rem / $pxConvertRem;
}
}
.cart-goods {
border-bottom: 1px solid #e0e0e0;
.shopping-cart-good:last-child .info {
border-bottom: none;
}
}
}
.freebie-and-advance-buy {
.freebie-and-advance-buy {
padding: 20rem / $pxConvertRem;
font-size: 24rem / $pxConvertRem;
border-bottom: 1px solid #e0e0e0;
... ... @@ -75,9 +114,9 @@
.icon-right-arrow {
color: #8f8f8f;
}
}
}
.price-compute {
.price-compute {
padding: 20rem / $pxConvertRem;
border-bottom: 1px solid #e0e0e0;
font-size: 26rem / $pxConvertRem;
... ... @@ -90,9 +129,9 @@
.minus {
float: right;
}
}
}
.balance {
.balance {
position: fixed;
box-sizing: border-box;
bottom: 0;
... ... @@ -137,4 +176,5 @@
border: none;
font-size: 28rem / $pxConvertRem;
}
}
}
... ...
... ... @@ -16,63 +16,32 @@
</ul>
{{/if}}
<div class="cart-goods">
{{# goods}}
{{> shopping-cart/good}}
{{/ goods}}
</div>
{{#if freebieOrAdvanceBuy}}
<ul class="freebie-and-advance-buy">
{{# freebie}}
<li class="freebie">
<span class="iconfont">&#xe620;</span>
赠品
<a href={{url}}>
<span class="count">{{count}}</span>
<span class="iconfont icon-right-arrow">&#xe614;</span>
</a>
</li>
{{/ freebie}}
{{# advanceBuy}}
<li class="advance-buy">
<span class="iconfont">&#xe61b;</span>
加价购
<a href={{url}}>
<span class="count">{{count}}</span>
<span class="iconfont icon-right-arrow">&#xe614;</span>
</a>
</li>
{{/ advanceBuy}}
</ul>
{{#if showLoginInfo}}
<p class="login-info">
<span class="iconfont">&#xe628;</span>
请您先
<a class="btn btn-login">登录</a>
可以同步电脑和手机中的商品
</p>
{{/if}}
<div class="price-compute">
<p class="sum-price">
<span class="title">总价</span>
{{price}}
</p>
<p class="activity-price">
<span class="title">
活动价
<i class="minus">-</i>
</span>
{{activityPrice}}
</p>
{{# commonCart}}
<div class="cart-content common">
{{> shopping-cart/cart-content}}
</div>
{{/ commonCart}}
<div class="balance">
<span class="iconfont icon-cb-checked"></span>
<p>
<span>
{{count}}件总计:¥{{sumPrice}}
</span>
<span class="tip">(不含运费)</span>
{{# preSellCart}}
<div class="cart-content presell hide">
<p class="presell-info">
<span class="iconfont">&#xe61a;</span>
<span class="txt">预售商品全场包邮,到货后立即发货</span>
<span class="txt">预售商品不参加活动,不可使用优惠券</span>
</p>
<button class="btn-balance">
结算
</button>
{{> shopping-cart/cart-content}}
</div>
{{/ preSellCart}}
{{/ shoppingCart}}
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
<div class="cart-goods">
{{# goods}}
{{> shopping-cart/good}}
{{/ goods}}
</div>
{{#if freebieOrAdvanceBuy}}
<ul class="freebie-and-advance-buy">
{{# freebie}}
<li class="freebie">
<span class="iconfont">&#xe620;</span>
赠品
<a href={{url}}>
<span class="count">{{count}}</span>
<span class="iconfont icon-right-arrow">&#xe614;</span>
</a>
</li>
{{/ freebie}}
{{# advanceBuy}}
<li class="advance-buy">
<span class="iconfont">&#xe61b;</span>
加价购
<a href={{url}}>
<span class="count">{{count}}</span>
<span class="iconfont icon-right-arrow">&#xe614;</span>
</a>
</li>
{{/ advanceBuy}}
</ul>
{{/if}}
<div class="price-compute">
<p class="sum-price">
<span class="title">总价</span>
¥{{price}}
</p>
<p class="activity-price">
<span class="title">
活动价
<i class="minus">-</i>
</span>
¥{{activityPrice}}
</p>
</div>
<div class="balance">
<span class="iconfont icon-cb-checked"></span>
<p>
<span>
{{count}}件总计:¥{{sumPrice}}
</span>
<span class="tip">(不含运费)</span>
</p>
<button class="btn-balance">
结算
</button>
</div>
\ No newline at end of file
... ...
... ... @@ -13,6 +13,8 @@ class ShoppingCartController extends AbstractAction
'cartNav' => true,
'commonGoodsCount' => 2,
'presellGoodsCount' => 2,
'showLoginInfo' => true,
'commonCart' => array(
'goods' => array(
array(
'id' => 1,
... ... @@ -49,6 +51,34 @@ class ShoppingCartController extends AbstractAction
'activityPrice' => 0,
'count' => 8,
'sumPrice' => 3192
),
'preSellCart' => array(
'goods' => array(
array(
'id' => 2,
'name' => 'TYAKSHA圣诞树凭借三角领蓝色白条毛衣',
'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/10/03/10/01bc1878f9154e77ac4f7a6003c954f1b8.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'color' => '黄色',
'size' => 'F',
'price' => 553.00,
'count' => 1,
'soldOut' => true
)
),
'freebieOrAdvanceBuy' => true,
'freebie' => array(
'url' => '',
'count' => 2
),
'advanceBuy' => array(
'url' => '',
'count' => 3
),
'price' => 553,
'activityPrice' => 0,
'count' => 1,
'sumPrice' => 553
)
);
// 渲染模板
$this->_view->display('index', array('shoppingCartPage' => true, 'pageHeader' => array(
... ...