Authored by 郭成尧

Merge branch 'feature/cart' of git.yoho.cn:fe/yohobuywap-node into feature/cart

... ... @@ -17,12 +17,12 @@ module.exports = {
assetUrl: '//127.0.0.1:5001',
testCode: 'yoho4946abcdef#$%&!@',
domains: {
// api: 'http://api-test2.yohops.com:9999/',
api: 'http://api-test3.yohops.com:9999/',
// service: 'http://service-test3.yohops.com:9999/',
// liveApi: 'http://testapi.live.yohops.com:9999/',
// singleApi: 'http://api-test3.yohops.com:9999/',
api: 'http://dev-api.yohops.com:9999/',
// api: 'http://dev-api.yohops.com:9999/',
service: 'http://service.yoho.cn/',
liveApi: 'http://api.live.yoho.cn/',
singleApi: 'http://single.yoho.cn/',
... ...
... ... @@ -47,20 +47,20 @@
<div class="num">
<span class="name">数量</span>
<div class="clearfix">
<a class="btn btn-minus {{#if @root.discountBuy}}discount-gray{{/if}}" href="javascript:void(0);">
<span class="iconfont {{#if promotionId}}disabled{{/if}}">&#xe625;</span>
<a class="btn btn-minus {{#if discountBuy}}discount-gray{{/if}}" href="javascript:void(0);">
<span class="iconfont {{#if ../promotionId}}disabled{{/if}}">&#xe625;</span>
</a>
<input id="good-num" class="good-num disabled" type="text" {{#if @root.discountBuy}}value="{{@root.discountBuy.num}}" {{^}} value="1"{{/if}} disabled="true">
<input id="good-num" class="good-num disabled" type="text" {{#if discountBuy}}value="{{discountBuy.num}}" {{^}} value="1"{{/if}} disabled="true">
<a class="btn btn-plus" href="javascript:void(0);">
<span class="iconfont {{#if promotionId}}disabled{{/if}}">&#xe624;</span>
<span class="iconfont {{#if ../promotionId}}disabled{{/if}}">&#xe624;</span>
</a>
</div>
{{#if @root.discountBuy}}
<input id="mnum" type="hidden" value="{{@root.discountBuy.num}}">
{{#if @root.discountBuy.discount}}
<span class="left-num-discount" style="color: #e10;position: absolute;top: 0.5rem;left: 9.5rem;overflow: hidden;white-space: nowrap;width: 5.2rem;-o-text-overflow: ellipsis;text-overflow: ellipsis;">{{@root.discountBuy.num}}件起购享{{@root.discountBuy.discount}}</span>
{{#if discountBuy}}
<input id="mnum" type="hidden" value="{{discountBuy.num}}">
{{#if discountBuy.discount}}
<span class="left-num-discount" style="color: #e10;position: absolute;top: 0.5rem;left: 9.5rem;overflow: hidden;white-space: nowrap;width: 5.2rem;-o-text-overflow: ellipsis;text-overflow: ellipsis;">{{discountBuy.num}}件起购享{{discountBuy.discount}}</span>
{{^}}
<span class="left-num-discount" style="color: #e10;position: absolute;top: 0.5rem;left: 9.5rem;overflow: hidden;white-space: nowrap;width: 5.2rem;-o-text-overflow: ellipsis;text-overflow: ellipsis;">{{@root.discountBuy.num}}件起购</span>
<span class="left-num-discount" style="color: #e10;position: absolute;top: 0.5rem;left: 9.5rem;overflow: hidden;white-space: nowrap;width: 5.2rem;-o-text-overflow: ellipsis;text-overflow: ellipsis;">{{discountBuy.num}}件起购</span>
{{/if}}
{{^}}
<span class="left-num"></span>
... ... @@ -77,4 +77,4 @@
</div>
{{/ cartInfo}}
<input id="promotionId" type="hidden" value="{{promotionId}}">
<input id="single" type="hidden" value="{{@root.single}}">
\ No newline at end of file
<input id="single" type="hidden" value="{{@root.single}}">
... ...
... ... @@ -83,6 +83,7 @@ function disableNumEdit() {
// 初始化购物车面板显示
function init() {
discountNum = $('#mnum').val() - 0;
hasChooseColor = false;
hasChooseSize = false;
$curSizeBlock = null;
... ...
... ... @@ -17,14 +17,6 @@ let indexObj = {
init() {
let self = this;
$('.nav-btn').on('click', () => {
$('.main-wrap').toggleClass('edit');
if ($('.main-wrap').hasClass('edit')) {
self.editMode = true;
} else {
self.editMode = false;
}
});
self.refreshPage();
require('./index/recommend-for-you').init(self);
},
... ...
... ... @@ -16,8 +16,8 @@ let cartObj = {
self.handle = handle;
$('.cart-nav').on('click', 'li', function() {
self.cartNavClick();
$('.cart-nav').on('click', 'li', function(e) {
self.cartNavClick(e);
});
$('.more-box>.down-arrow').on('click', function(e) {
self.arrowClick(e);
... ... @@ -31,14 +31,28 @@ let cartObj = {
$('.all-gift-box').on('click', '.gift-item', (e) => {
self.allGiftBoxClick(e);
});
$('.nav-btn').on('click', () => {
self.navClick();
});
self.initPresellTip();
},
navClick() {
let self = this;
$('.main-wrap').toggleClass('edit');
if ($('.main-wrap').hasClass('edit')) {
self.handle.editMode = true;
$('.chk.edit').removeClass('checked');
} else {
self.handle.editMode = false;
}
},
arrowClick(e) {
$(e.currentTarget).parent().toggleClass('down');
},
cartNavClick() {
cartNavClick(e) {
let self = this;
let type = $(this).data('type');
let type = $(e.currentTarget).data('type');
window.setCookie('cartType', type);
self.handle.refreshPage('');
... ... @@ -130,7 +144,7 @@ let cartObj = {
tip.show('请先勾选商品');
return false;
}
window.location.href = '/cart/index/orderEnsure?cartType=' + cartType;
window.location.href = '/cart/index/new/orderEnsure?cartType=' + cartType;
}
};
... ...
... ... @@ -35,8 +35,8 @@ let goodObj = {
$('.good-item').on('click', '.name,.color-size-row,.img', function(e) {
self.goodClick(e);
});
$('.check-all').on('click', function() {
self.checkedAllClick();
$('.check-all').on('click', function(e) {
self.checkedAllClick(e);
});
$('.btn-del').on('click', function() {
self.delClick();
... ... @@ -50,6 +50,8 @@ let goodObj = {
$(e.currentTarget).toggleClass('checked');
},
removeInvalidClick() {
let self = this;
dialog.showDialog({
dialogText: '您确定要清空失效商品吗?',
hasFooter: {
... ... @@ -143,17 +145,19 @@ let goodObj = {
dialog.hideDialog();
});
},
checkedAllClick() {
checkedAllClick(e) {
let self = this;
if (self.handle.editMode) {
$(this).find('.chk.edit').toggleClass('checked');
if ($(this).find('.chk.edit').hasClass('checked')) {
$(e.currentTarget).find('.chk.edit').toggleClass('checked');
if ($(e.currentTarget).find('.chk.edit').hasClass('checked')) {
$('.good-item .chk.edit').addClass('checked');
} else {
$('.good-item .chk.edit').removeClass('checked');
}
} else {
$(this).find('.chk.select').toggleClass('checked');
let checked = $(this).find('.chk.select').hasClass('checked');
$(e.currentTarget).find('.chk.select').toggleClass('checked');
let checked = $(e.currentTarget).find('.chk.select').hasClass('checked');
if (checked) {
let promise = self.clearLowStock();
... ... @@ -406,16 +410,12 @@ let goodObj = {
},
openChosepanel(e, isGift) {
let self = this;
let skn = $(e.delegateTarget).data('skn');
let id,
count,
canEditNum,
minNum,
promotionId;
let isSelected = $(e.delegateTarget).find('.chk.select').hasClass('checked');
id = $(e.delegateTarget).data('id');
... ...
... ... @@ -99,7 +99,7 @@ const formatCartGoods = (goodData, isAdvanceCart, isValid = true, inValidLow = f
promotion_id: _.toNumber(goodData.promotion_id) === 0 ? '' : goodData.promotion_id
};
if (goodData.min_buy_number && goodData.min_buy_number > 0) {
if (goodData.min_buy_number && goodData.min_buy_number > 1) {
result.minNumber = parseInt(goodData.min_buy_number, 10);
}
result.maxNumber = parseInt(goodData.storage_number, 10);
... ...