Authored by xuqi

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

... ... @@ -23,16 +23,17 @@ class Yohobuy
// const SERVICE_URL = 'http://service.api.yohobuy.com/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_URL = 'http://apih5.yoho.cn/';
// const API_URL = 'http://apih5.yoho.cn/';
// const API_URL2 = 'http://apih5.yoho.cn/';
// const SERVICE_URL = 'http://serviceh5.yoho.cn/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
/* 测试环境 */
const API_URL = 'http://testapi.yoho.cn:28078/';
const API_URL = 'http://testapi.yoho.cn:28078/';
const SERVICE_URL = 'http://testservice.yoho.cn:28077/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
/**
* 私钥列表
*
... ...
... ... @@ -124,6 +124,11 @@ function changeGoodImgWhenClickColor() {
}
}
//function resetHasSelectedNum() {
// $allChoseItems.find('.num .left-num').html('剩余' + 1 + '件');
// $leftNum.val(1);
//}
init();
$yohoPage.on('touchstart', '.chose-panel', function(e) {
... ... @@ -212,6 +217,9 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
// 修改颜色时修改商品图片
changeGoodImgWhenClickColor();
// 颜色切换时, 重置已经选择的商品数量
//resetHasSelectedNum();
}).on('touchstart', '.size-list .block', function() {
var $this = $(this),
index,
... ... @@ -263,6 +271,9 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
// 重置颜色块的样式
resetColorZeroStock($siblingBlock);
// 颜色尺码时, 重置已经选择的商品数量
//resetHasSelectedNum();
});
$yohoPage.on('touchstart', '.btn-minus', function() {
... ... @@ -275,10 +286,11 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
}
if (num === 1 || 0 === leftNum - 0) {
tip.show('您选择的数量不能为零~');
return;
}
if (num < 1) {
$num.val(1);
if (num < 0) {
tip.show('您选择的数量不能为零~');
return;
}
... ... @@ -299,7 +311,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
//TODO:库存数验证
if (num > leftNum - 1) {
$num.val(leftNum);
tip.show('您选择的数量超过了最大库存量~');
return;
}
$num.val(num + 1);
... ... @@ -316,10 +328,6 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
if (!checkColorSizeNum()) {
return;
}
if (isNaN(num)) {
tip.show('您选择的数量不是一个数字~');
return;
}
//TODO status change
if ($('#chose-btn-sure').html() === '已售罄') {
... ...
... ... @@ -41,25 +41,14 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
id = $good.data('id');
var goodsList = [],
goodInfo = {},
isSelected = true;
if ($this.hasClass('icon-cb-checked')) {
isSelected = true;
} else {
isSelected = false;
}
goodInfo = {};
goodInfo.goods_type = cartType;
goodInfo.selected = isSelected ? 'N' : 'Y';
goodInfo.selected = $this.hasClass('icon-cb-checked') ? 'N' : 'Y';
goodInfo.product_sku = id;
goodInfo.buy_number = $good.find('.count').eq(0).text().trim().replace('×', '');
goodsList.push(new GoodInfo(goodInfo));
$.ajax({
type: 'post',
url: 'select',
... ... @@ -92,8 +81,8 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
rightBtnText: '确定'
}
}, function() {
var id = $this.closest('.shopping-cart-good').data('id');
var count = $this.data('count');
var id = $this.closest('.shopping-cart-good').data('id'),
count = $this.data('count');
$.ajax({
method: 'post',
... ... @@ -119,7 +108,6 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
tip.show('网络异常');
});
});
});
function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) {
... ... @@ -140,7 +128,7 @@ function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) {
tip.show(res.message);
}
},
error: function(err) {
error: function() {
tip.show('网络异常');
},
complete: function() {
... ... @@ -196,26 +184,9 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) {
requestUpdateAllGoodsCheckStatus(goodsList, handlerAfterTouch);
}
//是否要全选
function willBeSelected($this) {
var isSelected = true;
if ($this.hasClass('icon-cb-checked')) {
isSelected = true;
} else {
isSelected = false;
}
return isSelected;
}
//全选按钮点击事件
$selectAllBtn.on('touchend', function() {
var $this = $(this);
bottomCheckBoxHandeler(willBeSelected($this), cartType, didUpdateAllGoodsCheckStatus);
bottomCheckBoxHandeler($(this).hasClass('icon-cb-checked'), cartType, didUpdateAllGoodsCheckStatus);
});
$('.down').on('touchend', function() {
... ...
... ... @@ -139,7 +139,6 @@
height: 90rem / $pxConvertRem;
line-height: 90rem / $pxConvertRem;
margin-bottom: 10rem / $pxConvertRem;
background: #f8f8f8;
padding: 0 20rem / $pxConvertRem;
&:last-child {
... ...
... ... @@ -52,7 +52,7 @@
<a class="btn btn-minus" href="javascript:void(0);">
<span class="iconfont {{#if promotionId}}disabled{{/if}}">&#xe625;</span>
</a>
<input id="good-num" class="good-num {{#if promotionId}}disabled{{/if}}" type="text" value="1" {{#if promotionId}}disabled="true"{{/if}}>
<input id="good-num" class="good-num disabled" type="text" value="1" disabled="true">
<a class="btn btn-plus" href="javascript:void(0);">
<span class="iconfont {{#if promotionId}}disabled{{/if}}">&#xe624;</span>
</a>
... ...