Authored by xuqi

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

... ... @@ -583,8 +583,11 @@ class Helpers
$oneGoods['isVipPrice'] = $value['sales_price'] !== $value['last_vip_price'];
$oneGoods['count'] = $value['buy_number'];
if ($isValid) { // 库存不足
if ($isValid) {
// 库存不足
$oneGoods['lowStocks'] = ($value['buy_number'] > $value['storage_number']);
} else { // 失效商品
$oneGoods['inValid'] = true;
}
//gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品;
... ...
... ... @@ -66,7 +66,7 @@ $('.freebie').on('touchend', function() {
$('.btn-balance').on('touchend', function() {
if ($('.low-stocks').length > 0) {
tip.show('请先删除库存不足商品');
tip.show('库存不足无法结算');
return false;
}
... ...
... ... @@ -277,6 +277,10 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
if (num === 1 || 0 === leftNum - 0) {
return;
}
if (num < 1) {
$num.val(1);
return;
}
$num.val(num - 1);
}).on('touchstart', '.btn-plus', function() {
... ... @@ -294,7 +298,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
}
//TODO:库存数验证
if (num > leftNum) {
if (num > leftNum - 1) {
$num.val(leftNum);
return;
}
... ... @@ -306,7 +310,6 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
promotionId,
isEdit = 0,
numInCart = $('.num-tag').html() - 0,
num = parseInt($num.val(), 10);
//颜色尺码没有选择
... ... @@ -329,7 +332,10 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
tip.show('您选择的数量超过了最大库存量~');
return;
}
if (num < 0) {
tip.show('您选择的数量小于一件~');
return;
}
$chosed = $('.block-list>ul>li.chosed');
if (2 === $chosed.length && 0 === $chosed.closest('.zero-stock').length) {
... ... @@ -352,9 +358,15 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
cartType: queryString.cartType
}
}).done(function(res) {
var cartNum;
loading.hideLoadingMask();
if (res.code === 200) {
$('.num-tag').html(numInCart + buyNumber).removeClass('hide');
cartNum = res.data.goods_count;
if (cartNum > 99) {
cartNum = '99+';
}
$('.num-tag').html(cartNum).removeClass('hide');
confirming = false;
if (cbFn) {
... ...
... ... @@ -6,6 +6,7 @@
var $ = require('jquery'),
lazyLoad = require('yoho.lazyload'),
Hammer = require('yoho.hammer'),
tip = require('../plugin/tip'),
loading = require('../plugin/loading'),
chosePanel = require('./chose-panel');
... ... @@ -35,10 +36,22 @@ function getProductInfo(skn, promotionId) {
});
}
$page.on('touchend', '.chose', function() {
var $this = $(this),
id = $this.closest('.gift-advance-good').data('id'),
promotionId = $this.closest('.advance-block').data('promotion-id');
$page.find('.chose').each(function(i, elem) {
var choseHammer = new Hammer(elem);
getProductInfo(id, promotionId);
choseHammer.on('tap', function(e) {
var $this = $(e.target),
id = $this.closest('.gift-advance-good').data('id'),
promotionId = $this.closest('.advance-block').data('promotion-id');
getProductInfo(id, promotionId);
});
});
// $page.on('touchend', '.chose', function() {
// var $this = $(this),
// id = $this.closest('.gift-advance-good').data('id'),
// promotionId = $this.closest('.advance-block').data('promotion-id');
//
// getProductInfo(id, promotionId);
// });
... ...
... ... @@ -27,6 +27,13 @@ $('.shopping-cart-good .name').each(function() {
this.mlellipsis(2);
});
function GoodInfo(properties) {
this.goods_type = properties.goods_type;
this.buy_number = properties.buy_number;
this.product_sku = properties.product_sku;
this.selected = properties.selected;
}
//TIP:事件委托在.cart-goods,商品列表的容器统一需要有.cart-goods
$('.cart-goods').on('touchstart', '.checkbox', function() {
var $this = $(this),
... ... @@ -43,12 +50,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
isSelected = false;
}
function GoodInfo(properties) {
this.goods_type = properties.goods_type;
this.buy_number = properties.buy_number;
this.product_sku = properties.product_sku;
this.selected = properties.selected;
}
goodInfo.goods_type = cartType;
goodInfo.selected = isSelected ? 'N' : 'Y';
... ... @@ -174,17 +176,10 @@ function didUpdateAllGoodsCheckStatus() {
}
function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) {
var goodInfo = {};
var $goods = $('.cart-content:not(.hide) .shopping-cart-good');
var $good = null;
var goodsList = [];
function GoodInfo(properties) {
this.goods_type = properties.goods_type;
this.buy_number = properties.buy_number;
this.product_sku = properties.product_sku;
this.selected = properties.selected;
}
var goodInfo = {},
$goods = $('.cart-content:not(.hide) .shopping-cart-good'),
$good = null,
goodsList = [];
goodInfo.goods_type = type;
goodInfo.selected = isSelected ? 'N' : 'Y';
... ...
... ... @@ -39,17 +39,18 @@
.thumb {
float: left;
width: 80rem / $pxConvertRem;
width: 100rem / $pxConvertRem;
}
.text-info {
position: absolute;
height: auto;
left: pxToRem(95px);
top:50%;
transform: translateY(-50%);
.name {
font-size: 28rem / $pxConvertRem;
height: 74rem / $pxConvertRem;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.price{
... ...
... ... @@ -119,7 +119,10 @@
}
.coupon-use {
box-sizing: border-box;
position: relative;
float: right;
padding-right: 30rem / $pxConvertRem;
color: #999;
text-align: right;
width: 360rem / $pxConvertRem;
... ... @@ -128,6 +131,9 @@
overflow: hidden;
.iconfont {
position: absolute;
top:0;
right: 0;
color: #999;
}
}
... ...
... ... @@ -11,7 +11,7 @@
{{/if}}
{{#if isEmptyCart}}
<div class="cart-zero">
<i class="iconfont">&#xe62c</i>
<i class="iconfont">&#xe640;</i>
<p>您的购物车暂无商品</p>
<a href="/product/new">随便逛逛</a>
</div>
... ...
... ... @@ -118,8 +118,7 @@
{{#cartInfo}}
<div class="cart-bar">
<span class="num-tag hide"></span>
<a href="{{cartUrl}}" class="num-incart iconfont">&#xe62c;</a>
<a href="{{cartUrl}}" class="num-incart iconfont"><span class="num-tag hide"></span>&#xe62c;</a>
{{#if addToCartUrl}}
<!-- <a id="addtoCart" href="{{addToCartUrl}}" class="addto-cart">加入购物车</a> -->
... ...
... ... @@ -19,8 +19,8 @@
<a href="/cart/index/gift?cartType={{cartType}}">
<span class="iconfont">&#xe620;</span>
赠品
<span class="count">{{count}}</span>
<span class="iconfont icon-right-arrow">&#xe614;</span>
<span class="count">{{count}}</span>
</a>
</li>
{{/ freebie}}
... ... @@ -29,8 +29,8 @@
<a href="/cart/index/advanceBuy?cartType={{cartType}}">
<span class="iconfont">&#xe61b;</span>
加价购
<span class="count">{{advanceBuyCount}}</span>
<span class="iconfont icon-right-arrow">&#xe614;</span>
<span class="count">{{advanceBuyCount}}</span>
</a>
</li>
{{/if}}
... ...
... ... @@ -10,9 +10,6 @@
{{#if price}}
<span class="price market-price">&yen;{{marketPrice}}</span>
{{/if}}
<span class="count">
×{{count}}
</span>
</p>
<button class="chose">选择</button>
</div>
... ...