Authored by 梁志锋

购物车功能

... ... @@ -44,18 +44,18 @@ $('.btn-balance').on('touchend', function() {
window.location.href = '/shoppingCart/orderEnsure?cartType=' + cartType;
});
$('.advance-buy').on('touchend', function() {
var $advanceBuy = $('#advanceBuy'),
$mainCart = $('#mainCart');
if ($advanceBuy.hasClass('hide')) {
$mainCart.removeClass('show').addClass('hide');
$advanceBuy.removeClass('hide').addClass('show');
} else {
$advanceBuy.removeClass('show').addClass('hide');
$mainCart.removeClass('hide').addClass('show');
}
});
//$('.advance-buy').on('touchend', function() {
// var $advanceBuy = $('#advanceBuy'),
// $mainCart = $('#mainCart');
//
// if ($advanceBuy.hasClass('hide')) {
// $mainCart.removeClass('show').addClass('hide');
// $advanceBuy.removeClass('hide').addClass('show');
// } else {
// $advanceBuy.removeClass('show').addClass('hide');
// $mainCart.removeClass('hide').addClass('show');
// }
//});
$('.chose').on('touchend', function() {
... ...
... ... @@ -2,6 +2,11 @@
{{# goods}}
{{> shopping-cart/good}}
{{/ goods}}
{{# $notValidGoods}}
{{> shopping-cart/good}}
{{/ $notValidGoods}}
</div>
{{#if freebieOrAdvanceBuy}}
... ...
<div class="shopping-cart-good clearfix" data-id={{id}}>
<span class="checkbox icon-cb-checked iconfont"></span>
{{#if isSoldOut}}
<p class="">失效</p>
{{^}}
{{#if isGift}}
{{^}}
<span class="checkbox icon-cb-checked iconfont"></span>
{{/if}}
{{/if}}
<div class="info">
<div class="">
<a class="" href="{{url}}">
<img class="thumb lazy" data-original="{{thumb}}">
</a>
{{#if isGift}}
<p class="few-tag">赠品</p>
{{/if}}
{{#if isAdvanceBuy}}
<p class="few-tag">加价购</p>
<p class="few-tag">加价购</p>
{{^}}
{{#if isGift}}
<p class="few-tag">赠品</p>
{{/if}}
{{/if}}
{{#if isSoldOut}}
<p class="few-tag">失效</p>
... ...
... ... @@ -25,11 +25,10 @@ class ShoppingCartController extends AbstractAction
'shoppingCartPage' => true,
'shoppingCart' => CartModel::getCartData($uid, $shoppingKey)
);
//print_r($data);
// 渲染模板
$this->_view->display('index', $data);
}
/*
* 异步获取购物车数据
*/
... ... @@ -136,47 +135,6 @@ class ShoppingCartController extends AbstractAction
}
/*
* 赠品页面
*/
public function giftAction()
{
$this->setTitle('赠品');
$this->setNavHeader('赠品');
$shoppingKey = Helpers::getShoppingKeyByCookie();
$uid = $this->getUid(true);
$data = array(
'shoppingCartPage' => true,
'shoppingCart' => CartModel::getCartData($uid, $shoppingKey, true)
);
// 渲染模板
$this->_view->display('gift-advance-good', $data);
}
/*
* 加价购页面
*/
public function advanceBuyAction()
{
$this->setTitle('加价购');
$this->setNavHeader('加价购');
$shoppingKey = Helpers::getShoppingKeyByCookie();
$uid = $this->getUid(true);
$data = array(
'shoppingCartPage' => true,
'shoppingCart' => CartModel::getCartData($uid, $shoppingKey, false, true)
);
print_r($data);
// 渲染模板
$this->_view->display('gift-advance-good', $data);
}
/*
* 获取购物车加价购商品数据
*/
public function giftinfoAction()
... ...