...
|
...
|
@@ -2376,6 +2376,8 @@ var tip = require("js/plugin/tip"); |
|
|
var trim = $.trim;
|
|
|
var showErrTip = tip.show;
|
|
|
|
|
|
var requested = false;
|
|
|
|
|
|
api.selectCssHack($('#country-select'));
|
|
|
|
|
|
api.bindClearEvt();
|
...
|
...
|
@@ -2400,7 +2402,15 @@ $btnNext.on('touchstart', function() { |
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (requested) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (api.phoneRegx[areaCode].test(pn)) {
|
|
|
|
|
|
requested = true;
|
|
|
|
|
|
$.ajax({
|
|
|
url: '/passport/reg/verifymobile',
|
|
|
type: 'POST',
|
...
|
...
|
@@ -2413,13 +2423,19 @@ $btnNext.on('touchstart', function() { |
|
|
location.href = data.data;
|
|
|
} else {
|
|
|
showErrTip(data.message);
|
|
|
requested = false;
|
|
|
}
|
|
|
},
|
|
|
error: function(err) {
|
|
|
showErrTip('出错了,请重试');
|
|
|
requested = false;
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
showErrTip('手机号格式不正确,请重新输入');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
});
|
|
|
define("js/passport/api", ["jquery"], function(require, exports, module){
|
|
|
/**
|
...
|
...
|
@@ -3340,14 +3356,14 @@ var api = require("js/passport/api"), |
|
|
var trim = $.trim;
|
|
|
var showErrTip = tip.show;
|
|
|
|
|
|
var requesting = false;
|
|
|
var requested = false;
|
|
|
|
|
|
function nextStep(url, mobileNo, areaCode) {
|
|
|
if (requesting) {
|
|
|
if (requested) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
requesting = true;
|
|
|
requested = true;
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
...
|
...
|
@@ -3359,13 +3375,10 @@ function nextStep(url, mobileNo, areaCode) { |
|
|
success: function(res) {
|
|
|
console.log(res.data);
|
|
|
location.href = url;
|
|
|
|
|
|
requesting = false;
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('出错了,请重试!');
|
|
|
|
|
|
requesting = false;
|
|
|
requested = false;
|
|
|
}
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -5152,6 +5165,9 @@ function showFooter() { |
|
|
}, 200);
|
|
|
}
|
|
|
|
|
|
if ($('#goodsDiscount h1').length < 1) {
|
|
|
$('.dropdown').remove();
|
|
|
}
|
|
|
showFooter();
|
|
|
|
|
|
lazyLoad($('img.lazy'));
|
...
|
...
|
@@ -5703,7 +5719,7 @@ function resetColorZeroStock($siblingBlock) { |
|
|
|
|
|
// 选择了颜色切换商品图片
|
|
|
function changeGoodImgWhenClickColor() {
|
|
|
if (hasChooseColor && curColorIndex) {
|
|
|
if (hasChooseColor && curColorIndex >= 0) {
|
|
|
$imgsThumb.addClass('hide').eq(curColorIndex).removeClass('hide');
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -5790,6 +5806,7 @@ $yohoPage.on('touchstart', '.color-list .block', function() { |
|
|
// 当前颜色块 切换勾选样式
|
|
|
$this.toggleClass('chosed');
|
|
|
curColorIndex = index;
|
|
|
$('#good-num').val(1);
|
|
|
|
|
|
// 设置按钮的样式和文字
|
|
|
updateConformButtonClassAndText();
|
...
|
...
|
@@ -5841,6 +5858,7 @@ $yohoPage.on('touchstart', '.color-list .block', function() { |
|
|
$this.toggleClass('chosed');
|
|
|
curSizeIndex = index;
|
|
|
$curSizeBlock = $this;
|
|
|
$('#good-num').val(1);
|
|
|
|
|
|
// 设置按钮的样式和文字
|
|
|
updateConformButtonClassAndText();
|
...
|
...
|
@@ -5859,6 +5877,11 @@ $yohoPage.on('touchstart', '.btn-minus', function() { |
|
|
}
|
|
|
|
|
|
if (num === 1 || 0 === leftNum - 0) {
|
|
|
tip.show('您选择的数量不能为零~');
|
|
|
return;
|
|
|
}
|
|
|
if (num < 0) {
|
|
|
tip.show('您选择的数量不能为零~');
|
|
|
return;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -5878,8 +5901,8 @@ $yohoPage.on('touchstart', '.btn-minus', function() { |
|
|
}
|
|
|
|
|
|
//TODO:库存数验证
|
|
|
if (num > leftNum) {
|
|
|
$num.val(leftNum);
|
|
|
if (num > leftNum - 1) {
|
|
|
tip.show('您选择的数量超过了最大库存量~');
|
|
|
return;
|
|
|
}
|
|
|
$num.val(num + 1);
|
...
|
...
|
@@ -5890,17 +5913,12 @@ $yohoPage.on('touchstart', '.btn-minus', function() { |
|
|
|
|
|
promotionId,
|
|
|
isEdit = 0,
|
|
|
numInCart = $('.num-tag').html() - 0,
|
|
|
num = parseInt($num.val(), 10);
|
|
|
|
|
|
//颜色尺码没有选择
|
|
|
if (!checkColorSizeNum()) {
|
|
|
return;
|
|
|
}
|
|
|
if (isNaN(num)) {
|
|
|
tip.show('您选择的数量不是一个数字~');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
//TODO status change
|
|
|
if ($('#chose-btn-sure').html() === '已售罄') {
|
...
|
...
|
@@ -5913,7 +5931,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) {
|
...
|
...
|
@@ -5936,9 +5957,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) {
|
...
|
...
|
@@ -6448,13 +6475,10 @@ optHammer.on('tap', function(e) { |
|
|
}).then(function(res) {
|
|
|
$('#dialog-wrapper').hide();
|
|
|
if (!res) {
|
|
|
tip.show('网络错误');
|
|
|
return;
|
|
|
}
|
|
|
if (res.code === 200) {
|
|
|
tip.show('删除成功');
|
|
|
} else {
|
|
|
tip.show(res.message || '网络错误');
|
|
|
if (res.message) {
|
|
|
tip.show(res.message);
|
|
|
}
|
|
|
window.location.href = '/home/orders';
|
|
|
}).fail(function() {
|
...
|
...
|
@@ -6480,13 +6504,10 @@ optHammer.on('tap', function(e) { |
|
|
}).then(function(res) {
|
|
|
$('#dialog-wrapper').hide();
|
|
|
if (!res) {
|
|
|
tip.show('网络错误');
|
|
|
return;
|
|
|
}
|
|
|
if (res.code === 200) {
|
|
|
tip.show('取消成功');
|
|
|
} else {
|
|
|
tip.show(res.message || '网络错误');
|
|
|
if (res.message) {
|
|
|
tip.show(res.message);
|
|
|
}
|
|
|
window.location.href = '/home/orders';
|
|
|
}).fail(function() {
|
...
|
...
|
@@ -8615,7 +8636,7 @@ var $cartContent = $('.cart-content'); |
|
|
var navHammer,
|
|
|
cartType = $('#cartType').val();
|
|
|
|
|
|
var hasChecked = $('.cart-goods .icon-cb-checked').length > 0 ? true : false; //是否有选中商品
|
|
|
var hasChecked = $('.cart-content:not(.hide) .icon-cb-checked').length > 0 ? true : false; //是否有选中商品
|
|
|
|
|
|
require("js/cart/good");
|
|
|
|
...
|
...
|
@@ -8664,6 +8685,11 @@ $('.freebie').on('touchend', function() { |
|
|
});
|
|
|
|
|
|
$('.btn-balance').on('touchend', function() {
|
|
|
if ($('.low-stocks').length > 0) {
|
|
|
tip.show('库存不足无法结算');
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
if (hasChecked) {
|
|
|
window.location.href = '/cart/index/orderEnsure?cartType=' + cartType;
|
|
|
} else {
|
...
|
...
|
@@ -8726,6 +8752,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),
|
...
|
...
|
@@ -8733,30 +8766,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;
|
|
|
}
|
|
|
|
|
|
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 = {};
|
|
|
|
|
|
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',
|
...
|
...
|
@@ -8789,8 +8806,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',
|
...
|
...
|
@@ -8816,7 +8833,6 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { |
|
|
tip.show('网络异常');
|
|
|
});
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) {
|
...
|
...
|
@@ -8837,7 +8853,7 @@ function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) { |
|
|
tip.show(res.message);
|
|
|
}
|
|
|
},
|
|
|
error: function(err) {
|
|
|
error: function() {
|
|
|
tip.show('网络异常');
|
|
|
},
|
|
|
complete: function() {
|
...
|
...
|
@@ -8873,17 +8889,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';
|
...
|
...
|
@@ -8900,26 +8909,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() {
|
...
|
...
|
@@ -8973,7 +8965,7 @@ exports.orderInfo = function(key, value) { |
|
|
};
|
|
|
|
|
|
});
|
|
|
define("js/cart/gift-advance", ["jquery","lazyload"], function(require, exports, module){
|
|
|
define("js/cart/gift-advance", ["jquery","lazyload","hammer"], function(require, exports, module){
|
|
|
/**
|
|
|
* 赠品/加价购
|
|
|
* @author: xuqi<qi.xu@yoho.cn>
|
...
|
...
|
@@ -8982,6 +8974,7 @@ define("js/cart/gift-advance", ["jquery","lazyload"], function(require, exports, |
|
|
|
|
|
var $ = require("jquery"),
|
|
|
lazyLoad = require("lazyload"),
|
|
|
Hammer = require("hammer"),
|
|
|
tip = require("js/plugin/tip"),
|
|
|
loading = require("js/plugin/loading"),
|
|
|
chosePanel = require("js/cart/chose-panel");
|
...
|
...
|
@@ -9011,14 +9004,26 @@ 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);
|
|
|
// });
|
|
|
|
|
|
});
|
|
|
define("js/cart/order-ensure", ["jquery","lazyload","hammer","handlebars","source-map"], function(require, exports, module){
|
|
|
/**
|
...
|
...
|
@@ -9116,8 +9121,7 @@ function orderCompute() { |
|
|
}).then(function(res) {
|
|
|
var priceHtml;
|
|
|
|
|
|
if (!res) {
|
|
|
tip.show('网络出错');
|
|
|
if ($.type(res) !== 'object') {
|
|
|
window.location.reload();
|
|
|
} else {
|
|
|
/*if (res.order_amount) {
|
...
|
...
|
@@ -9129,8 +9133,12 @@ function orderCompute() { |
|
|
if (res.last_order_amount) {
|
|
|
res.last_order_amount = (+res.last_order_amount).toFixed(2);
|
|
|
}
|
|
|
$coinCheck.find('em').html('- ¥ ' + res.use_yoho_coin);
|
|
|
$coinUsed.html('已抵¥' + res.use_yoho_coin);
|
|
|
if (res.use_yoho_coin) {
|
|
|
$coinCheck.find('em').html('- ¥ ' + res.use_yoho_coin);
|
|
|
$coinUsed.html('已抵¥' + res.use_yoho_coin);
|
|
|
$coinCheck.find('em').show();
|
|
|
$coinUsed.show();
|
|
|
}
|
|
|
priceHtml = priceTmpl({
|
|
|
cartPayData: res.promotion_formula_list,
|
|
|
price: res.last_order_amount
|
...
|
...
|
@@ -9139,7 +9147,6 @@ function orderCompute() { |
|
|
$price.html(priceHtml);
|
|
|
}
|
|
|
}).fail(function() {
|
|
|
tip.show('网络出错');
|
|
|
window.location.reload();
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -9186,7 +9193,6 @@ function submitOrder() { |
|
|
var url;
|
|
|
|
|
|
if (!res) {
|
|
|
loading.hideLoadingMask();
|
|
|
tip.show('网络出错');
|
|
|
return;
|
|
|
}
|
...
|
...
|
@@ -9200,13 +9206,13 @@ function submitOrder() { |
|
|
}
|
|
|
window.setCookie('order-info', '');
|
|
|
window.location.href = url;
|
|
|
} else {
|
|
|
loading.hideLoadingMask();
|
|
|
tip.show(res.message || '网络出错');
|
|
|
} else if (res.message) {
|
|
|
tip.show(res.message);
|
|
|
}
|
|
|
}).fail(function() {
|
|
|
loading.hideLoadingMask();
|
|
|
tip.show('网络出错');
|
|
|
}).always(function() {
|
|
|
loading.hideLoadingMask();
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
@@ -9238,9 +9244,7 @@ $('.coin').on('touchend', function() { |
|
|
|
|
|
if ($this.find('.checkbox').hasClass('icon-cb-checked')) {
|
|
|
orderInfo('yohoCoin', $this.data('yoho-coin'));
|
|
|
$this.find('.coin-check em').show();
|
|
|
$this.find('.can-use').hide();
|
|
|
$this.find('.used').show();
|
|
|
} else {
|
|
|
orderInfo('yohoCoin', 0);
|
|
|
$this.find('.coin-check em').hide();
|
...
|
...
|
@@ -9349,6 +9353,16 @@ $('#coupon-list').on('touchend', '.employ-main', function() { |
|
|
|
|
|
orderInfo('couponCode', $this.data('coupon-code'));
|
|
|
orderInfo('couponName', $this.data('coupon-name'));
|
|
|
}).on('touchstart', '.employ-main', function() {
|
|
|
var $this = $(this);
|
|
|
|
|
|
$this.siblings().removeClass('focus');
|
|
|
$this.addClass('focus');
|
|
|
}).on('touchend touchcancel', '.employ-main', function() {
|
|
|
var $this = $(this);
|
|
|
|
|
|
$this.siblings().removeClass('focus');
|
|
|
$this.removeClass('focus');
|
|
|
});
|
|
|
|
|
|
$('body').on('touchend', '.not-use', function() {
|
...
|
...
|
|