Authored by biao

Merge branch 'feature/limitsale' into develop/wap

... ... @@ -38,12 +38,19 @@ var $chosePanel = $('#chose-panel'),
$soonSoldOut = $('.soonSoldOut-tag'),
$yohoPage = $('.yoho-page');
//购物车编辑标相关变量
// 购物车编辑标相关变量
var isEdit,
isSelected,
oldSknId;
//初始化购物车面板显示
// 限购商品的商品码。只有限购商品时才会设置。
var limitProductCode,
// 限购商品的skn。只有限购商品时才会设置。
skn;
// 初始化购物车面板显示
function init() {
hasChooseColor = false;
hasChooseSize = false;
... ... @@ -77,6 +84,21 @@ function setEditModeWithSknId(sknId, isThisGoodSelected) {
isSelected = isThisGoodSelected;
}
/*
* 设置当前面板为限购商品模式
*
* @param {String} code 当前限购商品的商品码
*
* @param {String} sknId. 当前限购商品的sknId
*
* @return {undefined}
*/
function setLimitGoodModeWithSknId(code, sknId) {
$('#chose-btn-sure').html('结算');
limitProductCode = code;
skn = sknId;
}
//删除面板
function removePannel() {
var $pannel = $('.chose-panel'),
... ... @@ -149,6 +171,8 @@ function updateConformButtonClassAndText() {
$chosed = $allChoseItems.find('.chosed');
if (2 === $chosed.closest('.zero-stock').length) {
$('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄');
} else if (limitProductCode) {
$('#chose-btn-sure').css('background-color', '#eb0313').html('结算');
} else {
$('#chose-btn-sure').css('background-color', '#eb0313').html(isEdit ? '确认' : '加入购物车');
}
... ... @@ -446,6 +470,16 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
url = '/cart/index/modify';
} else if (limitProductCode) {
// 当前面板选择的是限购商品
url = 'http://m.yohobuy.com/cart/index/orderEnsure?code=' + limitProductCode + '&&sku=' +
productSku + '&&skn=' + skn + '&&buy_num=' + buyNumber;
//打开结算页面,结束函数执行。
window.location.href = url;
return false;
} else {
cartGoodData = {
productSku: productSku,
... ... @@ -508,4 +542,4 @@ exports.show = show;
exports.remove = removePannel;
exports.setEditModeWithSknId = setEditModeWithSknId;
exports.disableNumEdit = disableNumEdit;
exports.setLimitGoodModeWithSknId = setLimitGoodModeWithSknId;
... ...
... ... @@ -18,11 +18,13 @@ var goodsDiscountEl = document.getElementById('goodsDiscount'),
var $cart = $('.cart-bar');
var limitSaleBtn = document.getElementById('limit-sale'),
limitSaleHammer = limitSaleBtn && new Hammer(limitSaleBtn);
var limitSaleHammer = (limitSaleHammer = document.getElementById('limit-sale')) && new Hammer(limitSaleHammer);
var appUrl = $('input[name="limitCodeUrl"]').val();
var dialog = require('../../me/dialog');
//add extra marign-bottom for footer to show the yoho copyright
function showFooter() {
var $cartBar = $('.cart-bar');
... ... @@ -80,15 +82,15 @@ if (goodsDiscountHammer && $discountFolder.children().length > 0) {
});
}
limitSaleHammer ? limitSaleHammer.on('tap', function(e) {
limitSaleHammer && limitSaleHammer.on('tap', function(e) {
e.srcEvent.stopPropagation();
dialog.showDialog({
dialogText: '进入有货APP尖货频道分享\n以获取限购码',
dialogText: '打开有货APP限定发售频道\n获取限购码',
hasFooter: {
rightBtnText: '打开Yoho!Buy有货APP'
}
}, function() {
console.log('111');
window.location.href = appUrl;
}, undefined, true);
$('.dialog-wrapper').off('touchstart').on('touchstart', function(e) {
... ... @@ -97,7 +99,7 @@ limitSaleHammer ? limitSaleHammer.on('tap', function(e) {
dialog.hideDialog();
}
});
}) : null;
});
require('./desc');
require('./comments-consults');
... ...
... ... @@ -11,6 +11,9 @@ var $ = require('jquery'),
var productId = $('#productId').val();
var skn = $('#preferenceUrl').val().split('?')[1].split('&')[0].split('=')[1],
productCode = $('#limitProductCode').val();
$('#likeBtn').on('touchstart', function() {
var opt,
favorite;
... ... @@ -65,6 +68,7 @@ $('#likeBtn').on('touchstart', function() {
$('#addtoCart').on('touchstart', function() {
$('.cart-bar').hide();
chosePanel.setLimitGoodModeWithSknId(productCode, skn);
chosePanel.show();
//统计代码:用于统计用户加入购物车的动作
... ... @@ -76,4 +80,4 @@ $('#addtoCart').on('touchstart', function() {
}
return false;
});
\ No newline at end of file
});
... ...
... ... @@ -63,15 +63,24 @@
.goodDesc {
margin-top: 1rem;
padding: 0.5rem;
border-top: 1px solid #e6e6e6;
background-color: #fff;
p {
font-size: 0.6rem;
line-height: 1rem;
}
img {
margin: 0.3rem 0;
}
}
.bottom {
background-color: #fff;
border-top: 1px solid #e6e6e6;
padding: 0.5rem 2rem 2rem 2rem;
height: 3rem;
position: absolute;
bottom: 0;
width: 12rem;
margin: 0 auto;
... ...
... ... @@ -56,9 +56,6 @@
<button class="got-limit-sale">已获限购码</button>
{{/if}}
{{/noLimitGoodsBtn}}
{{!--
<button class="got-limit-sale">已获限购码</button>
}}
{{#if periodOfMarket}}
<div class="periodOfMarket">
... ...
... ... @@ -22,7 +22,28 @@
</div>
</div>
<div class="goodDesc"></div>
<div class="goodDesc">
{{#mainImg}}
<img class="lazy" src="{{mainImg}}" alt="">
{{/mainImg}}
{{#goodDescription}}
<p class="desc">{{goodDescription}}</p>
{{/goodDescription}}
{{#imgList}}
<img class="lazy" src="{{img}}" alt="">
{{/imgList}}
{{#vedio}}
<video poster="{{img}}" controls="controls" controls="controls" preload="metadata" loop="loop" width="100%" name="media">
{{#list}}
<source src="{{src}}" type="video/ogg;codecs=" theora,vorbis"" media="screen" />
<source src="{{src}}"/>
{{/list}}
</video>
{{/vedio}}
</div>
<div class="bottom">
<div class="logo"></div>
... ...
... ... @@ -5,14 +5,14 @@ use Plugin\Helpers;
/**
* 商品列表相关的控制器
*
*
*/
class IndexController extends AbstractAction
{
/**
* 品类商品列表页
*
*
* @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param integer $brand 品牌Id
* @param integer $sort 品类查询sort参数
... ... @@ -108,7 +108,7 @@ class IndexController extends AbstractAction
/**
* 品牌商品列表页
*
*
* @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param integer $sort 品类查询sort参数
* @param integer $color 颜色Id
... ... @@ -244,7 +244,34 @@ class IndexController extends AbstractAction
'name' => '潮流尖端商品啊啊啊啊',
'price' => '1999',
'releaseDate' => '2016年12月发售',
'appSrc' => './'
'appSrc' => './',
'mainImg' => 'http://img11.static.yhbimg.com/yhb-img01/2016/02/25/02/016ed5a17fb9d9bc7542174c22dccb4acf.jpg?imageView/2/w/640/h/240',
'goodDescription' => '独独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤',
'imgList' => array(
array(
'img' => 'http://img11.static.yhbimg.com/yhb-img01/2016/02/25/02/016ed5a17fb9d9bc7542174c22dccb4acf.jpg?imageView/2/w/640/h/240'
),
array(
'img' => 'http://img11.static.yhbimg.com/yhb-img01/2016/02/25/02/016ed5a17fb9d9bc7542174c22dccb4acf.jpg?imageView/2/w/640/h/240'
),
array(
'img' => 'http://img11.static.yhbimg.com/yhb-img01/2016/02/25/02/016ed5a17fb9d9bc7542174c22dccb4acf.jpg?imageView/2/w/640/h/240'
)
),
'vedio' => array(
'img' => './',
'list' => array(
array(
'src' => 'http://video.yohoboys.com/xuanchuan/wuyifan_mobile.mp4'
),
array(
'src' => 'http://video.yohoboys.com/xuanchuan/wuyifan_mobile.webm'
),
array(
'src' => 'http://video.yohoboys.com/xuanchuan/wuyifan_mobile.ogv'
)
)
)
);
... ...