...
|
...
|
@@ -2,9 +2,9 @@ |
|
|
* Created by yoho on 2017-01-05.
|
|
|
*/
|
|
|
|
|
|
var $ = require('yoho-jquery');
|
|
|
var dialog = require('../common/dialog');
|
|
|
var Confirm = dialog.Confirm;
|
|
|
var $ = require('yoho-jquery'),
|
|
|
capi = require('./cart-api');
|
|
|
|
|
|
var rDialog = require('./rdialog');
|
|
|
var RConfirm = rDialog.RConfirm;
|
|
|
var RAlert = rDialog.RAlert;
|
...
|
...
|
@@ -13,8 +13,7 @@ var Cart; |
|
|
|
|
|
var $cartnewTips = $('.cartnew-tips'),
|
|
|
$payWapper = $('.pay-wapper'),
|
|
|
$cartnewSum = $('.cartnew-sum'),
|
|
|
capi = require('./cart-api');
|
|
|
$cartnewSum = $('.cartnew-sum');
|
|
|
|
|
|
// 关闭温馨提示
|
|
|
$cartnewTips.find('.btn_close').click(function() {
|
...
|
...
|
@@ -78,6 +77,7 @@ Cart = { |
|
|
var $this = $(this);
|
|
|
var selected;
|
|
|
var selectArray = [];
|
|
|
var $noStores = $payWapper.find('[data-role=cart-item-check][data-tipnostore]');
|
|
|
|
|
|
$this.toggleClass('cart-item-checked');
|
|
|
selected = $this.hasClass('cart-item-checked') ? 'Y' : 'N';
|
...
|
...
|
@@ -96,17 +96,15 @@ Cart = { |
|
|
}
|
|
|
});
|
|
|
|
|
|
var $noStores = $payWapper.find('[data-role=cart-item-check][data-tipnostore]');
|
|
|
|
|
|
if (selected === 'Y' && $noStores && $noStores.length > 0) { // 无库存提示
|
|
|
|
|
|
$('html,body').animate({scrollTop: $noStores.eq(0).offset().top - 50 + 'px'}, 500);
|
|
|
|
|
|
$noStores.each(function(){
|
|
|
$noStores.each(function() {
|
|
|
toastNoStore($(this).closest('li[data-role=pitem]'), '您全选的商品中存在库存不足商品,已帮您自动取消勾选');
|
|
|
});
|
|
|
|
|
|
setTimeout(function(){
|
|
|
setTimeout(function() {
|
|
|
capi.choiceOut(selectArray);
|
|
|
}, 2000);
|
|
|
} else {
|
...
|
...
|
@@ -153,7 +151,7 @@ Cart = { |
|
|
|
|
|
var selectArray = [];
|
|
|
var PromotionArray = [];
|
|
|
var content = '<div><i class="iconfont"></i>删除商品</div><p>确定从购物车中删除所有选中商品?</p>';
|
|
|
var content = '<div><i class="iconfont"></i>删除商品</div><p>确定从购物车中删除所有选中商品?</p>'; //eslint-disable-line
|
|
|
|
|
|
$payWapper.find('[data-role=cart-item-check]').each(function() {
|
|
|
|
...
|
...
|
@@ -184,12 +182,12 @@ Cart = { |
|
|
|
|
|
if (!$.isEmptyObject(selectArray)) {
|
|
|
|
|
|
new RConfirm(content, function() {
|
|
|
new RConfirm(content, function() { // eslint-disable-line
|
|
|
capi.cartItemDel(selectArray, true, PromotionArray);
|
|
|
});
|
|
|
} else {
|
|
|
var content = '<div class="alert-main"><i class="iconfont"></i>请至少选中一件商品!</div>';
|
|
|
new RAlert(content);
|
|
|
var content = '<div class="alert-main"><i class="iconfont"></i>请至少选中一件商品!</div>'; // eslint-disable-line
|
|
|
new RAlert(content); // eslint-disable-line
|
|
|
}
|
|
|
},
|
|
|
cleanAllDisable: function() {
|
...
|
...
|
@@ -221,13 +219,13 @@ Cart = { |
|
|
});
|
|
|
|
|
|
if (!$.isEmptyObject(selectArray)) {
|
|
|
var content = '<div><i class="iconfont"></i>清除失效商品</div><p>确定要清除失效商品吗?</p>';
|
|
|
new RConfirm(content, function() {
|
|
|
var content = '<div><i class="iconfont"></i>清除失效商品</div><p>确定要清除失效商品吗?</p>'; // eslint-disable-line
|
|
|
new RConfirm(content, function() { // eslint-disable-line
|
|
|
capi.cartItemDel(selectArray, true, PromotionArray);
|
|
|
}).show();
|
|
|
} else {
|
|
|
var content = '<div class="alert-main"><i class="iconfont"></i>购物车中没有失效商品!</div>';
|
|
|
new RAlert(content);
|
|
|
var content = '<div class="alert-main"><i class="iconfont"></i>购物车中没有失效商品!</div>'; // eslint-disable-line
|
|
|
new RAlert(content); // eslint-disable-line
|
|
|
}
|
|
|
},
|
|
|
toFav: function() {
|
...
|
...
|
@@ -253,7 +251,6 @@ Cart = { |
|
|
toFavAll: function() {
|
|
|
|
|
|
var selectArray = [];
|
|
|
var content = '<div><i class="iconfont"></i>移入收藏</div><p>确定要将已选中的商品从购物车中移入收藏夹吗?<br/>移入收藏后已选中的商品将不在购物车中显示</p>';
|
|
|
|
|
|
$payWapper.find('[data-role=cart-item-check]').each(function() {
|
|
|
|
...
|
...
|
@@ -274,13 +271,14 @@ Cart = { |
|
|
|
|
|
if (!$.isEmptyObject(selectArray)) {
|
|
|
|
|
|
new RConfirm(content, function() {
|
|
|
var content = '<div><i class="iconfont"></i>移入收藏</div><p>确定要将已选中的商品从购物车中移入收藏夹吗?<br/>移入收藏后已选中的商品将不在购物车中显示</p>'; // eslint-disable-line
|
|
|
new RConfirm(content, function() { // eslint-disable-line
|
|
|
capi.cartItemDel(selectArray);
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
var content = '<div class="alert-main"><i class="iconfont"></i>请至少选中一件商品!</div>';
|
|
|
new RAlert(content);
|
|
|
var content = '<div class="alert-main"><i class="iconfont"></i>请至少选中一件商品!</div>'; // eslint-disable-line
|
|
|
new RAlert(content); // eslint-disable-line
|
|
|
}
|
|
|
},
|
|
|
modNum: function() {
|
...
|
...
|
|