Authored by 梁志锋

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

Showing 29 changed files with 109 additions and 67 deletions
... ... @@ -620,7 +620,7 @@ class Helpers
foreach ($value['goods_list'] as $single) {
$oneGoods['id'] = $single['product_skn'];
$oneGoods['name'] = $single['product_name'];
$oneGoods['thumb'] = !empty($single['goods_images']) ? Images::getImageUrl($single['goods_images'], 120, 120) : '';
$oneGoods['thumb'] = !empty($single['goods_images']) ? Images::getImageUrl($single['goods_images'], 120, 160) : '';
$oneGoods['appearDate'] = '12月'; // 目前app接口没有返回该数据
$oneGoods['price'] = $single['last_price'];
$oneGoods['marketPrice'] = $single['market_price'];
... ...
... ... @@ -8,7 +8,7 @@
var $ = require('jquery'),
Hammer = require('yoho.hammer'),
tip = require('../../plugin/tip'),
chosePanel = require('../../shopping-cart/chose-panel');
chosePanel = require('../../cart/chose-panel');
var likeEle = document.getElementById('likeBtn'),
likeHammer = likeEle && new Hammer(likeEle);
... ... @@ -83,6 +83,3 @@ if (addToCartHammer) {
});
}
... ...
... ... @@ -44,6 +44,10 @@
&:before {
content: '赠品';
display: block;
font-size: 12px;
line-height: 25rem / $pxConvertRem;
transform: scale(0.833);
}
}
... ... @@ -52,6 +56,7 @@
}
.name {
width: 440rem / $pxConvertRem;
font-size: 28rem / $pxConvertRem;
}
... ... @@ -74,8 +79,14 @@
}
.price {
margin-left: 10rem / $pxConvertRem;
font-size: 24rem / $pxConvertRem;
color: #000;
color: #f1545b;
&.market-price {
color: #999;
text-decoration: line-through;
}
}
.count {
... ... @@ -96,9 +107,9 @@
}
.title {
height: 50rem / $pxConvertRem;
line-height: 50rem / $pxConvertRem;
padding-left: 20rem / $pxConvertRem;
height: 60rem / $pxConvertRem;
line-height: 60rem / $pxConvertRem;
padding: 0 20rem / $pxConvertRem;
font-size: 24rem / $pxConvertRem;
background: #f8f8f8;
}
... ...
... ... @@ -7,6 +7,7 @@
position: absolute;
top: 50%;
margin-top: -14rem / $pxConvertRem;
margin-left: 20rem / $pxConvertRem;
font-size: 28rem / $pxConvertRem;
color: #f0f0f0;
... ... @@ -15,9 +16,40 @@
}
}
.few-tag{
width: 132rem / $pxConvertRem;
position: absolute;
left: 100rem / $pxConvertRem;
text-align: center;
top: 75%;
color: #fff;
}
.gift-tag {
background-color: #88BE51;
}
.plus-tag {
background-color: #FC1264;
}
.few-tag-expire {
position: absolute;
top: 40%;
left: 20rem / $pxConvertRem;
background-color: #7f7f7f;
display: inline-block;
color: #fff;
border-radius: 12rem / $pxConvertRem;
padding: 4rem / $pxConvertRem;
font-size: 20rem / $pxConvertRem;
width: 48rem / $pxConvertRem;
text-align: center;
}
.info {
float: left;
margin-left: 30rem / $pxConvertRem;
margin-left: 60rem / $pxConvertRem;
padding: 16rem / $pxConvertRem 0;
padding-right: 20rem / $pxConvertRem;
}
... ... @@ -32,13 +64,18 @@
.deps {
margin-left: 173rem / $pxConvertRem;
padding-bottom: 60rem / $pxConvertRem;
padding-bottom: 72rem / $pxConvertRem;
border-bottom: 1px solid #e0e0e0;
width: 380rem / $pxConvertRem;
position: relative;
min-height: 140rem / $pxConvertRem;
}
.name {
font-size: 28rem / $pxConvertRem;
color: #5a5a5a;
width: 80%;
display: inline-block;
}
.row:nth-child(2) {
... ... @@ -71,9 +108,13 @@
}
.count {
font-size: 20rem / $pxConvertRem;
font-size: 32rem / $pxConvertRem;
color: #999;
margin-left: 22rem / $pxConvertRem;
//margin-left: 22rem / $pxConvertRem;
display: inline-block;
width: 19%;
position: absolute;
text-align: center;
}
.sold-out, .low-stocks {
... ... @@ -205,7 +246,6 @@
top: 20rem / $pxConvertRem;;
font-size: 52em / $pxConvertRem;
}
}
}
... ...
... ... @@ -158,5 +158,5 @@ a {
@import "category/index";
@import "product/index";
@import "index/index";
@import "shopping-cart/index";
@import "cart/index";
@import "me/index"; //个人中心
... ...
{{> layout/header}}
<div class="gift-advance-page yoho-page">
{{# shoppingCart}}
{{#if gift}}
{{# gift}}
{{> shopping-cart/gift-advance-good}}
{{/ gift}}
{{^}}
{{# advance}}
{{#if advanceBuyPage}}
{{# advanceBuy}}
<div class="advance-block">
<p class="title">{{title}}</p>
{{# goods}}
{{> shopping-cart/gift-advance-good}}
{{/ goods}}
{{#goods}}
{{> cart/gift-advance-good}}
{{/goods}}
</div>
{{/ advance}}
{{/ advanceBuy}}
{{else}}
{{# gift}}
{{> cart/gift-advance-good}}
{{/ gift}}
{{/if}}
{{/ shoppingCart}}
</div>
{{> layout/footer}}
... ...
... ... @@ -27,7 +27,7 @@
{{# commonCart}}
<div class="cart-content common">
{{> shopping-cart/cart-content}}
{{> cart/cart-content}}
</div>
{{/ commonCart}}
... ... @@ -38,7 +38,7 @@
<span class="txt">预售商品全场包邮,到货后立即发货</span>
<span class="txt">预售商品不参加活动,不可使用优惠券</span>
</p>
{{> shopping-cart/cart-content}}
{{> cart/cart-content}}
</div>
{{/ preSellCart}}
{{/ shoppingCart}}
... ... @@ -52,5 +52,5 @@
</div>
{{> product/recommend-for-you}}
</div>
{{> shopping-cart/chose-panel}}
{{> cart/chose-panel}}
{{> layout/footer}}
... ...
<div class="cart-goods">
{{# goods}}
{{> shopping-cart/good}}
{{> cart/good}}
{{/ goods}}
{{# $notValidGoods}}
{{> shopping-cart/good}}
{{> cart/good}}
{{/ $notValidGoods}}
</div>
... ...
... ... @@ -22,8 +22,8 @@
<span class="price">
¥{{price}}
</span>
<span class="price">
¥{{salePrice}}
<span class="price market-price">
¥{{marketPrice}}
</span>
<span class="count">
×{{count}}
... ...
<div class="shopping-cart-good clearfix" data-id={{id}}>
<span class="checkbox icon-cb-checked iconfont"></span>
<!-- {{#if isSoldOut}}
<p class="">失效</p>
{{^}}
{{#if isGift}}
{{#if isSoldOut}}
<span class="few-tag-expire">失效</span>
{{^}}
<span class="checkbox icon-cb-checked iconfont"></span>
<span class="checkbox icon-cb-checked iconfont"></span>
{{/if}}
{{/if}}-->
<div class="info">
<img class="thumb lazy" data-original={{thumb}}>
<!--
<a class="" href="{{url}}">
<img class="thumb lazy" data-original="{{thumb}}">
</a>
{{#if isAdvanceBuy}}
<p class="few-tag">加价购</p>
<p class="few-tag plus-tag">加价购</p>
{{^}}
{{#if isGift}}
<p class="few-tag">赠品</p>
{{/if}}
<p class="few-tag gift-tag">赠品</p>
{{/if}}
{{#if isSoldOut}}
<p class="few-tag">失效</p>
{{/if}}
-->
</a>
<div class="deps show">
<p class="name row">{{name}}</p>
<span class="count">
×{{count}}
</span>
<p class="row">
{{#if color}}
<span class="color">
... ... @@ -48,9 +39,7 @@
<span class="price">
¥{{price}}
</span>
<span class="count">
×{{count}}
</span>
{{#if soldOut}}
<span class="sold-out">
已售罄
... ...
... ... @@ -221,29 +221,34 @@
{{!-- 购物车 --}}
{{#if shoppingCartPage}}
<script>
seajs.use('js/shopping-cart/cart');
seajs.use('js/cart/cart');
seajs.use('js/product/recommend-for-you');
</script>
{{/if}}
{{#if giftAdvancePage}}
{{#if giftPage}}
<script>
seajs.use('js/shopping-cart/gift-advance');
seajs.use('js/cart/gift-advance');
</script>
{{/if}}
{{#if advanceBuyPage}}
<script>
seajs.use('js/cart/gift-advance');
</script>
{{/if}}
{{#if orderEnsurePage}}
<script>
seajs.use('js/shopping-cart/order-ensure');
seajs.use('js/cart/order-ensure');
</script>
{{/if}}
{{#if selectAddressPage}}
<script>
seajs.use('js/me/address');
seajs.use('js/shopping-cart/select-address');
seajs.use('js/cart/select-address');
</script>
{{/if}}
{{#if selectCouponPage}}
<script>
seajs.use('js/shopping-cart/select-coupon');
seajs.use('js/cart/select-coupon');
</script>
{{/if}}
{{!-- 个人中心 --}}
... ...
... ... @@ -674,12 +674,12 @@ class CartModel
break;
}
if ($onlyAdvanceBuy) {
if ($onlyGift) {
// 赠品
$result['freebie'] = Helpers::formatAdvanceGoods($data['gift_list']);
break;
}
if ($onlyGift) {
if ($onlyAdvanceBuy) {
// 加价购
$result['advanceBuy'] = Helpers::formatAdvanceGoods($data['price_gift']);
break;
... ...
... ... @@ -143,11 +143,11 @@ class IndexController extends AbstractAction
$shoppingKey = Helpers::getShoppingKeyByCookie();
$uid = $this->getUid(true);
$cartType = $this->get('cartType', 'ordinary');
$data = array('shoppingCartPage' => true);
$data = array('giftPage' => true);
$data += CartModel::getCartData($uid, $shoppingKey, $cartType, true);
// 渲染模板
$this->_view->display('gift-advance-good', $data);
$this->_view->display('gift-advance', $data);
}
/*
... ... @@ -161,11 +161,11 @@ class IndexController extends AbstractAction
$shoppingKey = Helpers::getShoppingKeyByCookie();
$uid = $this->getUid(true);
$cartType = $this->get('cartType', 'ordinary');
$data = array('shoppingCartPage' => true);
$data = array('advanceBuyPage' => true);
$data += CartModel::getCartData($uid, $shoppingKey, $cartType, false, true);
// 渲染模板
$this->_view->display('gift-advance-good', $data);
$this->_view->display('gift-advance', $data);
}
/*
... ...