Authored by Rock Zhang

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

... ... @@ -78,6 +78,10 @@ function search(opt) {
}
}
//处理active状态
$listNav.children('.active').removeClass('active');
$pre.addClass('active');
switch (opt.type) {
case 'gender':
ext = {
... ...
/**
* 购物车Logic
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/20
*/
var $ = require('yoho.zepto');
var $cartContent = $('.cart-content');
require('./good');
$('.cart-nav').delegate('li', 'touchstart', function() {
var $this = $(this);
if ($this.hasClass('active')) {
return;
}
$this.siblings('.active').removeClass('active');
$this.addClass('active');
//切换普通商品和预售商品购物车显示
$cartContent.toggleClass('hide');
//trigger lazyload
$(window).trigger('scroll');
});
\ No newline at end of file
... ...
/**
* 赠品/加价购
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/23
*/
var $ = require('yoho.zepto'),
lazyLoad = require('yoho.zeptolazyload');
var chosePanel = require('./chose-panel');
lazyLoad($('.lazy'));
$('.gift-advance-page').delegate('.chose', 'touchstart', function() {
var id = $(this).closest('.gift-advance-good').data('id');
$.ajax({
type: 'GET',
url: '/shoppingCart/goodinfo',
data: {
id: id
},
success: function(data) {
if (data.code === 200) {
chosePanel.show(data.data);
}
}
});
});
\ No newline at end of file
... ...
... ... @@ -55,9 +55,36 @@ $('.cart-goods').delegate('.checkbox', 'touchstart', function() {
}
}
});
}).delegate('.icon-del', 'touchstart', function() {
}).delegate('.icon-del', 'touchstart', function(e) {
e.stopPropagation();
$(this).closest('.shopping-cart-good').children('.opt-panel').removeClass('hide');
$(document).bind('touchstart', docTouchEvt);
}).delegate('.opt-panel', 'touchstart', function() {
var $this = $(this),
id = $this.closest('.shopping-cart-good').data('id');
if ($this.closest('.put-in-favorite')) {
//移入收藏夹
$.ajax({
type: 'POST',
url: '/shoppingCart/col',
data: {
id: id
}
});
} else {
//删除
$.ajax({
type: 'POST',
url: '/shoppingCart/del',
data: {
id: id
}
});
}
});
... ...
/**
* 购物车Logic
* 购物车打包入口
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/20
* @date: 2015/10/23
*/
var $ = require('yoho.zepto');
var $cartContent = $('.cart-content');
require('./good');
$('.cart-nav').delegate('li', 'touchstart', function() {
var $this = $(this);
if ($this.hasClass('active')) {
return;
}
$this.siblings('.active').removeClass('active');
$this.addClass('active');
//切换普通商品和预售商品购物车显示
$cartContent.toggleClass('hide');
//trigger lazyload
$(window).trigger('scroll');
});
\ No newline at end of file
require('./cart');
require('./gift-advance');
\ No newline at end of file
... ...
.gift-advance-page {
.gift-advance-good {
position: relative;
padding: 20rem / $pxConvertRem 0;
margin-left: 34rem / $pxConvertRem;
height: 160rem / $pxConvertRem;
border-bottom: 1px solid #e0e0e0;
&:last-child {
border-bottom: none;
}
}
.advance-block .gift-advance-good:last-child {
border-bottom: none;
}
.advance-block:last-child .gift-advance-good:last-child {
border-bottom: 1px solid #e0e0e0;
}
.thumb-wrap {
position: relative;
float: left;
width: 120rem / $pxConvertRem;
height: 160rem / $pxConvertRem;
.thumb {
width: 100%;
height: 100%;
}
}
.tag {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 25rem / $pxConvertRem;
color: #fff;
text-align: center;
background: #a1ce4e;
&:before {
content: '赠品';
}
}
.deps {
margin-left: 135rem / $pxConvertRem;
}
.name {
font-size: 28rem / $pxConvertRem;
}
.row:nth-child(2) {
font-size: 22rem / $pxConvertRem;
height: 45rem / $pxConvertRem;
line-height: 45rem / $pxConvertRem;
> span {
margin-right: 15rem / $pxConvertRem;
}
}
.row:nth-child(3) {
position: relative;
}
.color, .size {
color: #b6b6b6;
}
.price {
font-size: 24rem / $pxConvertRem;
color: #000;
}
.count {
font-size: 20rem / $pxConvertRem;
color: #999;
margin-left: 22rem / $pxConvertRem;
}
.chose {
position: absolute;
width: 88rem / $pxConvertRem;
height: 58rem / $pxConvertRem;
background: #f8f8f8;
border: 1px solid #ccc;
right: 20rem / $pxConvertRem;
top: 71rem / $pxConvertRem;
font-size: 26rem / $pxConvertRem;
}
.title {
height: 50rem / $pxConvertRem;
line-height: 50rem / $pxConvertRem;
padding-left: 20rem / $pxConvertRem;
font-size: 24rem / $pxConvertRem;
background: #f8f8f8;
}
.advance-block .tag {
background: #eb76aa;
&:before {
content: '加价购';
}
}
}
\ No newline at end of file
... ...
@import "good", "chose-panel";
@import "good", "chose-panel", "gift-advance-good";
.icon-checkbox:before { content: "\e61c"; }
... ...
{{> layout/header}}
<div class="gift-advance-page yoho-page">
{{# shoppingCart}}
{{#if gift}}
{{# gift}}
{{> shopping-cart/gift-advance-good}}
{{/ gift}}
{{^}}
{{# advance}}
<div class="advance-block">
<p class="title">{{title}}</p>
{{# goods}}
{{> shopping-cart/gift-advance-good}}
{{/ goods}}
</div>
{{/ advance}}
{{/if}}
{{/ shoppingCart}}
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
<script>
seajs.use('js/common');
</script>
{{!-- 逛(PLUS+STAR) --}}
{{#if psList}}
<script>
... ... @@ -27,6 +28,7 @@
seajs.use('js/guang/detail');
</script>
{{/if}}
{{!-- 注册 --}}
{{#if regIndex}}
<script>
... ... @@ -43,6 +45,7 @@
seajs.use('js/passport/register/password');
</script>
{{/if}}
{{!-- 登陆 --}}
{{#if loginIndex}}
<script>
... ... @@ -54,6 +57,7 @@
seajs.use('js/passport/login/international');
</script>
{{/if}}
{{!-- 密码找回 --}}
{{#if backEmail}}
<script>
... ... @@ -80,6 +84,7 @@
seajs.use('js/passport/back/new-password');
</script>
{{/if}}
{{!-- 首页 --}}
{{#if grilsHomePage}}
<script>
... ... @@ -101,51 +106,64 @@
seajs.use('js/home/home');
</script>
{{/if}}
{{!-- 新品到着 --}}
{{#if newArrival}}
<script>
seajs.use('js/product/newsale/newarrival');
</script>
{{/if}}
{{!-- 折扣专区 --}}
{{#if discount}}
<script>
seajs.use('js/product/newsale/discount');
</script>
{{/if}}
{{!-- 商品列表 --}}
{{#if goodListPage}}
<script>
seajs.use('js/product/list');
</script>
{{/if}}
{{!-- 商品详情 --}}
{{#if goodDetail}}
<script>
seajs.use('js/product/detail/detail');
</script>
{{/if}}
{{!-- 品类 --}}
{{#if categoryPage}}
<script>
seajs.use('js/category/index');
</script>
{{/if}}
{{!-- 品牌 --}}
{{#if brandPage}}
<script>
seajs.use('js/category/brand');
</script>
{{/if}}
{{!-- 搜索 --}}
{{#if searchPage}}
<script>
seajs.use('js/index/search');
</script>
{{/if}}
{{!-- 购物车 --}}
{{#if shoppingCartPage}}
<script>
seajs.use('js/shopping-cart/index');
seajs.use('js/shopping-cart/cart');
</script>
{{/if}}
{{#if giftAdvancePage}}
<script>
seajs.use('js/shopping-cart/gift-advance');
</script>
{{/if}}
\ No newline at end of file
... ...
<div class="gift-advance-good" data-id={{id}}>
<div class="thumb-wrap">
<img class="thumb lazy" data-original={{thumb}}>
<p class="tag"></p>
</div>
<div class="deps">
<p class="name row">{{name}}</p>
<p class="row">
{{#if color}}
<span class="color">
颜色:{{color}}
</span>
{{/if}}
{{#if size}}
<span class="size">
尺码:{{size}}
</span>
{{/if}}
</p>
<p class="row">
<span class="price">
¥{{price}}
</span>
<span class="count">
×{{count}}
</span>
</p>
<button class="chose">选择</button>
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -85,6 +85,49 @@ class ShoppingCartController extends AbstractAction
'navBack' => 'http://m.yohobuy.com', 'navTitle' => '购物车'), 'shoppingCart' => $data));
}
public function giftAdvanceAction()
{
$data = array(
'advance' => array(
array(
'title' => '【izzue】加¥19购袜子',
'goods' => array(
'id' => 1,
'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/09/17/03/014cacfa5c458b9732c68adf1af15d7a45.jpg?imageMogr2/thumbnail/120x120/extent/120x120/background/d2hpdGU=/position/center/quality/90',
'name' => 'Life.After.Life纯棉短袜',
'salePrice' => 19,
'price' => 99
)
),
array(
'title' => '【银鳞堂】加¥9购手绳',
'goods' => array(
'id' => 1,
'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/10/03/10/01bc1878f9154e77ac4f7a6003c954f1b8.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => '银鳞堂民族风牛皮手绳',
'salePrice' => 9,
'price' => 19
)
)
)
);
// $data = array(
// 'gift' => array(
// 'id' => 1,
// 'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/09/17/03/014cacfa5c458b9732c68adf1af15d7a45.jpg?imageMogr2/thumbnail/120x120/extent/120x120/background/d2hpdGU=/position/center/quality/90',
// 'name' => 'Life.After.Life纯棉短袜',
// 'color' => '黄色',
// 'size' => 'L',
// 'price' => 0,
// 'count' => 1
// )
// );
$this->_view->display('gift-advance', array('giftAdvancePage' => true, 'pageHeader' => array(
'navBack' => true, 'navTitle' => '加价购'), 'shoppingCart' => $data));
}
/**
* 读取chose-panel内容
*/
... ...