...
|
...
|
@@ -7,6 +7,7 @@ var $ = require('yoho-jquery'), |
|
|
RConfirm = rDialog.RConfirm,
|
|
|
RAlert = rDialog.RAlert,
|
|
|
capi = require('./cart-api'),
|
|
|
yas = require('../common/data-yas'),
|
|
|
Cart;
|
|
|
|
|
|
var $cartnewTips = $('.cartnew-tips'),
|
...
|
...
|
@@ -29,6 +30,32 @@ function toastNoStore(parent, info) { |
|
|
}, 2000);
|
|
|
}
|
|
|
|
|
|
function submitPoint(type) {
|
|
|
|
|
|
// 添加埋点
|
|
|
var productId = [];
|
|
|
var $wrap = $('#Y_CartListWrap');
|
|
|
|
|
|
if (type === 'A') {
|
|
|
$wrap = $wrap.find('[data-role=advance]');
|
|
|
} else if (type === 'O') {
|
|
|
$wrap = $wrap.find('[data-role=ordinary]');
|
|
|
}
|
|
|
|
|
|
$wrap.find('.cart-item-check.cart-item-checked').each(function() {
|
|
|
var $this = $(this);
|
|
|
var $t = $this.closest('li[data-role=pitem]');
|
|
|
var pid = $t.data('pid');
|
|
|
|
|
|
if (pid) {
|
|
|
productId.push(pid);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 结算点击埋点
|
|
|
yas.givePoint('YB_SC_TOBUY_CLICK', {PRD_ID: productId.join(',')});
|
|
|
}
|
|
|
|
|
|
Cart = {
|
|
|
|
|
|
toggleSelectOne: function() { // 单选
|
...
|
...
|
@@ -310,6 +337,9 @@ Cart = { |
|
|
if ($t.data('mix')) {
|
|
|
return capi.showMDialog('#Y_CartSelectDialog');
|
|
|
}
|
|
|
|
|
|
submitPoint();
|
|
|
|
|
|
window.location = $t.data('ensureurl') || '//www.yohobuy.com/cart/ensure';
|
|
|
},
|
|
|
submit: function() {
|
...
|
...
|
@@ -334,50 +364,14 @@ Cart = { |
|
|
}, '去选择', '不要赠品');
|
|
|
} else {
|
|
|
Cart._submit($this);
|
|
|
|
|
|
// window.location = '//www.yohobuy.com';
|
|
|
}
|
|
|
},
|
|
|
submitSingle: function() {
|
|
|
var $t = $(this);
|
|
|
var type = $t.data('type');
|
|
|
|
|
|
// $('.cart-preSell-dialog').show();
|
|
|
|
|
|
// $('.cart-togetherGoods').show();
|
|
|
|
|
|
/* understock = '';
|
|
|
if ($('.pay-wapper input:checked').parents('tr').find('.tipNoStore').length > 0) {
|
|
|
shopName = $('.pay-wapper input:checked').parents('tr').find('.tipNoStore');
|
|
|
$.each(shopName.parents('tr').find('.pay-pro-info a'), function() {
|
|
|
understock += $(this).html();
|
|
|
});
|
|
|
new Alert(understock + '库存不足').show();
|
|
|
} else {
|
|
|
if ($('.zp').length > 0 && !$(this).attr('title')) {
|
|
|
$(this).attr('title', '1');
|
|
|
new Alert('您有赠品没有选择,请选择完再结算!').show();
|
|
|
} else {
|
|
|
if ($('input:checked').length > 0) {
|
|
|
|
|
|
// 添加埋点
|
|
|
var productId = [];
|
|
|
$('.pay-wapper input:checked').parents('tr').each(function() {
|
|
|
if ($(this).attr('data-pid')) {
|
|
|
productId.push($(this).attr('data-pid'));
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 结算点击埋点
|
|
|
window.addPoint('YB_SC_TOBUY_CLICK', {PRD_ID: productId.join(',')});
|
|
|
|
|
|
|
|
|
if ($('.pre-sell-box input:checked').length > 0) {
|
|
|
window.location.href = '/cart/index/orderEnsure?type=2';
|
|
|
} else {
|
|
|
window.location.href = '/cart/index/orderEnsure?type=1';
|
|
|
}
|
|
|
} else {
|
|
|
new Alert('请至少选择一件商品').show();
|
|
|
}
|
|
|
}
|
|
|
}*/
|
|
|
submitPoint(type);
|
|
|
window.location = $t.data('url');
|
|
|
}
|
|
|
};
|
|
|
|
...
|
...
|
@@ -391,6 +385,7 @@ $cartListWrap.on('click', '.cartnew-sum .delete-all-sel', Cart.delAll); // |
|
|
$cartListWrap.on('click', '.cartnew-sum .remove-all-2fav', Cart.toFavAll); // 批量移入收藏夹商品
|
|
|
$cartListWrap.on('click', '.cartnew-sum .clean-all-disable', Cart.cleanAllDisable);
|
|
|
$cartListWrap.on('click', '#Y_SubmitBtn', Cart.submit); // 结算
|
|
|
$cartListWrap.on('click', '#Y_CartSelectDialog .btn-account', Cart.submitSingle);
|
|
|
|
|
|
// 重新加入购物车
|
|
|
$cartListWrap.on('click', '#Y_delReselWrap [data-role=readd2cart]', Cart.reAdd2Cart);
|
...
|
...
|
|