...
|
...
|
@@ -3340,7 +3340,15 @@ var api = require("js/passport/api"), |
|
|
var trim = $.trim;
|
|
|
var showErrTip = tip.show;
|
|
|
|
|
|
var requesting = false;
|
|
|
|
|
|
function nextStep(url, mobileNo, areaCode) {
|
|
|
if (requesting) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
requesting = true;
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: '/passport/bind/sendBindMsg',
|
...
|
...
|
@@ -3351,9 +3359,13 @@ function nextStep(url, mobileNo, areaCode) { |
|
|
success: function(res) {
|
|
|
console.log(res.data);
|
|
|
location.href = url;
|
|
|
|
|
|
requesting = false;
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('出错了,请重试!');
|
|
|
|
|
|
requesting = false;
|
|
|
}
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -5402,7 +5414,7 @@ if (navtabHammer) { |
|
|
|
|
|
if (gotoConsultHammer) {
|
|
|
gotoConsultHammer.on('tap', function() {
|
|
|
location.href = $(gotoConsultEle).data('href');
|
|
|
location.href = $(gotoConsultEle).find('a').attr('href');
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
@@ -5585,8 +5597,8 @@ var $ = require("jquery"), |
|
|
var $chosePanel = $('#chose-panel'),
|
|
|
$num,
|
|
|
$chosed,
|
|
|
|
|
|
// re = /\d+/,
|
|
|
$imgsThumb,
|
|
|
$leftNum,
|
|
|
leftNum,
|
|
|
confirming,
|
|
|
curColorIndex,
|
...
|
...
|
@@ -5595,7 +5607,11 @@ var $chosePanel = $('#chose-panel'), |
|
|
hasChooseColor,
|
|
|
hasChooseSize,
|
|
|
$curSizeBlock,
|
|
|
$sizeRowList;
|
|
|
$sizeRowList,
|
|
|
cbFn,
|
|
|
$allChoseItems,
|
|
|
queryString,
|
|
|
$yohoPage = $('.yoho-page');
|
|
|
|
|
|
//初始化购物车面板显示
|
|
|
function init() {
|
...
|
...
|
@@ -5604,12 +5620,15 @@ function init() { |
|
|
hasChooseColor = false;
|
|
|
hasChooseSize = false;
|
|
|
$curSizeBlock = null;
|
|
|
queryString = $.queryString();
|
|
|
$imgsThumb = $('.chose-panel').find('.thumb');
|
|
|
$allChoseItems = $('.chose-items');
|
|
|
$sizeRowList = $('.size-list ul');
|
|
|
$leftNum = $('#left-num');
|
|
|
$firstRow = $sizeRowList.eq(0);
|
|
|
$firstRow.toggleClass('hide');
|
|
|
$curSizeRow = $firstRow;
|
|
|
}
|
|
|
init();
|
|
|
|
|
|
function checkColorSizeNum() {
|
|
|
if (!hasChooseColor && !hasChooseSize) {
|
...
|
...
|
@@ -5625,32 +5644,28 @@ function checkColorSizeNum() { |
|
|
return true;
|
|
|
}
|
|
|
|
|
|
function show(html) {
|
|
|
function show(html, cb) {
|
|
|
if (html) {
|
|
|
$chosePanel.html(html);
|
|
|
init();
|
|
|
}
|
|
|
$('.chose-panel').show();
|
|
|
|
|
|
$('body').css('overflow', 'hidden');
|
|
|
$num = $('#good-num');
|
|
|
cbFn = cb;
|
|
|
}
|
|
|
|
|
|
//隐藏当前Panel
|
|
|
function hide() {
|
|
|
$('.chose-panel').hide();
|
|
|
$('body').css('overflow', 'auto');
|
|
|
}
|
|
|
|
|
|
//修改加入购物车的文字和背景
|
|
|
function updateConformButtonClassAndText() {
|
|
|
$chosed = $('.chose-items').find('.chosed');
|
|
|
$chosed = $allChoseItems.find('.chosed');
|
|
|
if (2 === $chosed.closest('.zero-stock').length) {
|
|
|
$('#chose-btn-sure').css('background-color', '#c0c0c0');
|
|
|
$('#chose-btn-sure').html('已售罄');
|
|
|
$('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄');
|
|
|
} else {
|
|
|
$('#chose-btn-sure').css('background-color', '#eb0313');
|
|
|
$('#chose-btn-sure').html('确定');
|
|
|
$('#chose-btn-sure').css('background-color', '#eb0313').html('确定');
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -5679,13 +5694,13 @@ function resetColorZeroStock($siblingBlock) { |
|
|
// 选择了颜色切换商品图片
|
|
|
function changeGoodImgWhenClickColor() {
|
|
|
if (hasChooseColor && curColorIndex) {
|
|
|
$('.chose-panel').find('.thumb').addClass('hide').eq(curColorIndex).removeClass('hide');
|
|
|
$imgsThumb.addClass('hide').eq(curColorIndex).removeClass('hide');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
init();
|
|
|
|
|
|
$('.yoho-page').on('touchstart', '.chose-panel', function(e) {
|
|
|
$yohoPage.on('touchstart', '.chose-panel', function(e) {
|
|
|
var $cur = $(e.target);
|
|
|
|
|
|
if ($cur.closest('.main').length > 0) {
|
...
|
...
|
@@ -5696,12 +5711,11 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { |
|
|
hide();
|
|
|
});
|
|
|
|
|
|
$('.color-list').on('touchstart', '.block', function(e) {
|
|
|
$yohoPage.on('touchstart', '.color-list .block', function(e) {
|
|
|
var $this = $(this),
|
|
|
$that = $(e.target).closest('.chose-items'),
|
|
|
index,
|
|
|
curSelectedSizeBlock,
|
|
|
$sizeChosed,
|
|
|
curSizeBlock,
|
|
|
$preSiblingBlock,
|
|
|
scindex,
|
|
|
curGoodNum;
|
|
|
|
...
|
...
|
@@ -5710,16 +5724,16 @@ $('.color-list').on('touchstart', '.block', function(e) { |
|
|
$this.siblings('.chosed').removeClass('chosed');
|
|
|
index = $this.index();
|
|
|
|
|
|
$sizeChosed = $siblingBlock.find('.chosed');
|
|
|
scindex = $sizeChosed.index();
|
|
|
$preSiblingBlock = $siblingBlock.find('.chosed');
|
|
|
scindex = $preSiblingBlock.index();
|
|
|
$curSizeRow = $sizeRowList.eq(index);
|
|
|
|
|
|
// 当前颜色已经是选中状态,再点击时
|
|
|
if ($this.hasClass('chosed')) {
|
|
|
|
|
|
//颜色原来已经是勾选时,要清空剩余件数的提示
|
|
|
$that.find('.num .left-num').html('');
|
|
|
$('#left-num').val(0);
|
|
|
$allChoseItems.find('.num .left-num').html('');
|
|
|
$leftNum.val(0);
|
|
|
hasChooseColor = false;
|
|
|
|
|
|
// 当前颜色不是选中状态,选中时
|
...
|
...
|
@@ -5731,24 +5745,23 @@ $('.color-list').on('touchstart', '.block', function(e) { |
|
|
$curSizeRow.removeClass('hide').addClass('show');
|
|
|
|
|
|
// 之前选中的尺码去掉勾选样式
|
|
|
if ($sizeChosed.length > 0) {
|
|
|
$sizeChosed.removeClass('chosed');
|
|
|
curSelectedSizeBlock = $curSizeRow.children().get(scindex);
|
|
|
if ($preSiblingBlock.length > 0) {
|
|
|
$preSiblingBlock.removeClass('chosed');
|
|
|
curSizeBlock = $curSizeRow.children().get(scindex);
|
|
|
}
|
|
|
|
|
|
// 当前选中颜色对应的尺码行,其对应的尺码加上勾选样式 (前提是要判断下这个尺码是否存在)
|
|
|
if (curSelectedSizeBlock) {
|
|
|
curGoodNum = $(curSelectedSizeBlock).data('num');
|
|
|
$(curSelectedSizeBlock).addClass('chosed');
|
|
|
if (curSizeBlock) {
|
|
|
curGoodNum = $(curSizeBlock).data('num');
|
|
|
$(curSizeBlock).addClass('chosed');
|
|
|
|
|
|
//如果当前有尺码被选中,且数量等于0,则颜色块添加数量为0的样式
|
|
|
if (curGoodNum > 0) {
|
|
|
$that.find('.num .left-num').html('剩余' + curGoodNum + '件');
|
|
|
$('#left-num').val(curGoodNum);
|
|
|
$allChoseItems.find('.num .left-num').html('剩余' + curGoodNum + '件');
|
|
|
$leftNum.val(curGoodNum);
|
|
|
} else {
|
|
|
$(curSelectedSizeBlock).removeClass('zero-stock').addClass('zero-stock');
|
|
|
$that.find('.num .left-num').html('');
|
|
|
$('#left-num').val(0);
|
|
|
$allChoseItems.find('.num .left-num').html('');
|
|
|
$leftNum.val(0);
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -5764,9 +5777,8 @@ $('.color-list').on('touchstart', '.block', function(e) { |
|
|
changeGoodImgWhenClickColor();
|
|
|
});
|
|
|
|
|
|
$('.size-list').on('touchstart', '.block', function(e) {
|
|
|
$yohoPage.on('touchstart', '.size-list .block', function(e) {
|
|
|
var $this = $(this),
|
|
|
$that = $(e.target).closest('.chose-items'),
|
|
|
index,
|
|
|
curGoodNum;
|
|
|
|
...
|
...
|
@@ -5780,7 +5792,7 @@ $('.size-list').on('touchstart', '.block', function(e) { |
|
|
if ($this.hasClass('chosed')) {
|
|
|
|
|
|
//尺码原来已经是勾选时,要清空剩余件数的提示
|
|
|
$that.find('.num .left-num').html('');
|
|
|
$allChoseItems.find('.num .left-num').html('');
|
|
|
$('#left-num').val(0);
|
|
|
hasChooseSize = false;
|
|
|
|
...
|
...
|
@@ -5795,12 +5807,12 @@ $('.size-list').on('touchstart', '.block', function(e) { |
|
|
$curSizeBlock.removeClass('chosed');
|
|
|
}
|
|
|
|
|
|
// 如果当前有尺码被选中,且数量等于0,则颜色块添加数量为0的样式, 否则显示剩余件数
|
|
|
// 如果当前有尺码被选中,且数量等于0, 否则显示剩余件数
|
|
|
if (curGoodNum > 0 && hasChooseColor) {
|
|
|
$that.find('.num .left-num').html('剩余' + curGoodNum + '件');
|
|
|
$allChoseItems.find('.num .left-num').html('剩余' + curGoodNum + '件');
|
|
|
$('#left-num').val(curGoodNum);
|
|
|
} else {
|
|
|
$that.find('.num .left-num').html('');
|
|
|
$allChoseItems.find('.num .left-num').html('');
|
|
|
$('#left-num').val(0);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -5818,8 +5830,8 @@ $('.size-list').on('touchstart', '.block', function(e) { |
|
|
|
|
|
});
|
|
|
|
|
|
$('.btn-minus').on('touchstart', function() {
|
|
|
var num = $num.val();
|
|
|
$yohoPage.on('touchstart', '.btn-minus', function() {
|
|
|
var num = parseInt($num.val(), 10);
|
|
|
|
|
|
leftNum = $('#left-num').val();
|
|
|
|
...
|
...
|
@@ -5832,10 +5844,8 @@ $('.btn-minus').on('touchstart', function() { |
|
|
}
|
|
|
|
|
|
$num.val(num - 1);
|
|
|
});
|
|
|
|
|
|
$('.btn-plus').on('touchstart', function() {
|
|
|
var num = $num.val();
|
|
|
}).on('touchstart', '.btn-plus', function() {
|
|
|
var num = parseInt($num.val(), 10);
|
|
|
|
|
|
leftNum = $('#left-num').val();
|
|
|
|
...
|
...
|
@@ -5850,9 +5860,7 @@ $('.btn-plus').on('touchstart', function() { |
|
|
|
|
|
//TODO:库存数验证
|
|
|
$num.val(num + 1);
|
|
|
});
|
|
|
|
|
|
$('#chose-btn-sure').on('touchstart', function() {
|
|
|
}).on('touchstart', '#chose-btn-sure', function() {
|
|
|
|
|
|
var productSku,
|
|
|
buyNumber = $('#good-num').val() - 0,
|
...
|
...
|
@@ -5867,6 +5875,7 @@ $('#chose-btn-sure').on('touchstart', function() { |
|
|
return;
|
|
|
}
|
|
|
|
|
|
//TODO status change
|
|
|
if ($('#chose-btn-sure').html() === '已售罄') {
|
|
|
return;
|
|
|
}
|
...
|
...
|
@@ -5896,15 +5905,19 @@ $('#chose-btn-sure').on('touchstart', function() { |
|
|
productSku: productSku,
|
|
|
buyNumber: buyNumber,
|
|
|
promotionId: promotionId,
|
|
|
isEdit: isEdit
|
|
|
isEdit: isEdit,
|
|
|
cartType: queryString.cartType
|
|
|
}
|
|
|
}).done(function(res) {
|
|
|
loading.hideLoadingMask();
|
|
|
if (res.code === 200) {
|
|
|
$('.num-tag').html(numInCart + buyNumber);
|
|
|
$('.num-tag').removeClass('hide');
|
|
|
$('.num-tag').html(numInCart + buyNumber).removeClass('hide');
|
|
|
confirming = false;
|
|
|
hide();
|
|
|
|
|
|
if (cbFn) {
|
|
|
cbFn();
|
|
|
}
|
|
|
}
|
|
|
if (res.message) {
|
|
|
tip.show(res.message);
|
...
|
...
|
@@ -8614,6 +8627,10 @@ if ($('.cart-nav').length > 0) { |
|
|
}, 3000);
|
|
|
}
|
|
|
|
|
|
$('.advance-buy').on('touchend', function() {
|
|
|
window.location.href = '/cart/index/advanceBuy?cartType=' + cartType;
|
|
|
});
|
|
|
|
|
|
$('.btn-balance').on('touchend', function() {
|
|
|
if (hasChecked) {
|
|
|
window.location.href = '/cart/index/orderEnsure?cartType=' + cartType;
|
...
|
...
|
@@ -8644,7 +8661,8 @@ var $ = require("jquery"), |
|
|
lazyLoad = require("lazyload");
|
|
|
|
|
|
var dialog = require("js/me/dialog"),
|
|
|
tip = require("js/plugin/tip");
|
|
|
tip = require("js/plugin/tip"),
|
|
|
orderInfo = require("js/cart/order-info").orderInfo;
|
|
|
|
|
|
var $selectAllBtn = $('.balance .checkbox'),
|
|
|
cartType = $('#cartType').val(),
|
...
|
...
|
@@ -8740,6 +8758,8 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { |
|
|
autoHide: true,
|
|
|
fast: true
|
|
|
});
|
|
|
orderInfo('couponCode', null);
|
|
|
orderInfo('couponName', null);
|
|
|
history.go(0);
|
|
|
} else {
|
|
|
tip.show(data.message);
|
...
|
...
|
@@ -8858,7 +8878,51 @@ $('.down').on('touchend', function() { |
|
|
chosePanel.show();
|
|
|
});
|
|
|
|
|
|
});
|
|
|
define("js/cart/order-info", ["jquery"], function(require, exports, module){
|
|
|
/**
|
|
|
* 订单信息读取
|
|
|
* @author: bikai<kai.bi@yoho.cn>
|
|
|
* @date: 2015/12/14
|
|
|
*/
|
|
|
var $ = require("jquery");
|
|
|
var info = window.cookie('order-info');
|
|
|
|
|
|
function init() {
|
|
|
info = {
|
|
|
uid: window.getUid(),
|
|
|
deliveryId: 1,
|
|
|
deliveryTimeId: 1,
|
|
|
paymentTypeId: 1,
|
|
|
yohoCoin: $('.coin').data('yoho-coin') || 0,
|
|
|
addressId: null,
|
|
|
couponCode: null,
|
|
|
couponName: null,
|
|
|
invoice: null,
|
|
|
invoiceText: null,
|
|
|
invoiceType: null,
|
|
|
msg: null,
|
|
|
cartType: 'ordinary'
|
|
|
};
|
|
|
window.setCookie('order-info', JSON.stringify(info));
|
|
|
}
|
|
|
|
|
|
// info 必须是 JSON 字符串
|
|
|
try {
|
|
|
info = JSON.parse(info);
|
|
|
} catch (e) {
|
|
|
init();
|
|
|
}
|
|
|
|
|
|
exports.init = init;
|
|
|
|
|
|
exports.orderInfo = function(key, value) {
|
|
|
if (value === undefined) {
|
|
|
return info[key];
|
|
|
}
|
|
|
info[key] = value;
|
|
|
window.setCookie('order-info', JSON.stringify(info));
|
|
|
};
|
|
|
|
|
|
});
|
|
|
define("js/cart/gift-advance", ["jquery","lazyload"], function(require, exports, module){
|
...
|
...
|
@@ -8874,7 +8938,8 @@ var $ = require("jquery"), |
|
|
loading = require("js/plugin/loading"),
|
|
|
chosePanel = require("js/cart/chose-panel");
|
|
|
|
|
|
var $page = $('.gift-advance-page');
|
|
|
var $page = $('.gift-advance-page'),
|
|
|
queryString = $.queryString();
|
|
|
|
|
|
lazyLoad($('.lazy'));
|
|
|
|
...
|
...
|
@@ -8888,7 +8953,9 @@ function getProductInfo(skn, promotionId) { |
|
|
tip.show('网络错误');
|
|
|
return;
|
|
|
}
|
|
|
chosePanel.show(html);
|
|
|
chosePanel.show(html, function() {
|
|
|
window.location.href = '/cart/index/index?cartType=' + queryString.cartType;
|
|
|
});
|
|
|
}, function() {
|
|
|
tip.show('网络错误');
|
|
|
}).always(function() {
|
...
|
...
|
@@ -8936,11 +9003,13 @@ if (window.getUid() !== orderInfo('uid')) { |
|
|
order.init();
|
|
|
}
|
|
|
|
|
|
if ($couponUse.data('value') !== orderInfo('couponValue')) {
|
|
|
if ($couponUse.data('name') !== orderInfo('couponName')) {
|
|
|
orderInfo('couponCode', null);
|
|
|
orderInfo('couponValue', null);
|
|
|
orderInfo('couponName', null);
|
|
|
}
|
|
|
|
|
|
orderInfo('cartType', queryString.cartType || queryString.carttype || 'ordinary');
|
|
|
|
|
|
function dispacthTapEvt(e) {
|
|
|
var $cur = $(e.target).closest('li');
|
|
|
|
...
|
...
|
@@ -8986,7 +9055,7 @@ function orderCompute() { |
|
|
method: 'POST',
|
|
|
url: '/cart/index/orderCompute',
|
|
|
data: {
|
|
|
cartType: queryString.cartType || queryString.carttype || 'ordinary',
|
|
|
cartType: orderInfo('cartType') || 'ordinary',
|
|
|
deliveryId: orderInfo('deliveryId'),
|
|
|
paymentTypeId: orderInfo('paymentTypeId'),
|
|
|
couponCode: orderInfo('couponCode'),
|
...
|
...
|
@@ -9047,11 +9116,12 @@ function submitOrder() { |
|
|
url: '/cart/index/orderSub',
|
|
|
data: {
|
|
|
addressId: orderInfo('addressId'),
|
|
|
cartType: queryString.cartType || queryString.carttype || 'ordinary',
|
|
|
cartType: orderInfo('cartType') || 'ordinary',
|
|
|
deliveryId: orderInfo('deliveryId'),
|
|
|
deliveryTimeId: orderInfo('deliveryTimeId'),
|
|
|
invoiceText: invoiceText,
|
|
|
invoiceType: $invoice.find('.invoice-type').val() || orderInfo('invoiceType'),
|
|
|
invoiceText: orderInfo('invoice') ? invoiceText : null,
|
|
|
invoiceType: orderInfo('invoice') ? ($invoice.find('.invoice-type').val() ||
|
|
|
orderInfo('invoiceType')) : null,
|
|
|
msg: msg,
|
|
|
paymentTypeId: orderInfo('paymentTypeId'),
|
|
|
paymentType: orderInfo('paymentType'), //支付方式
|
...
|
...
|
@@ -9139,51 +9209,6 @@ $('.pay-mode').on('click', 'li', function() { |
|
|
});
|
|
|
|
|
|
});
|
|
|
define("js/cart/order-info", ["jquery"], function(require, exports, module){
|
|
|
/**
|
|
|
* 订单信息读取
|
|
|
* @author: bikai<kai.bi@yoho.cn>
|
|
|
* @date: 2015/12/14
|
|
|
*/
|
|
|
var $ = require("jquery");
|
|
|
var info = window.cookie('order-info');
|
|
|
|
|
|
function init() {
|
|
|
info = {
|
|
|
uid: window.getUid(),
|
|
|
deliveryId: 1,
|
|
|
deliveryTimeId: 1,
|
|
|
paymentTypeId: 1,
|
|
|
yohoCoin: $('.coin').data('yoho-coin') || 0,
|
|
|
addressId: null,
|
|
|
couponCode: null,
|
|
|
couponValue: null,
|
|
|
invoice: null,
|
|
|
invoiceText: null,
|
|
|
invoiceType: null,
|
|
|
msg: null
|
|
|
};
|
|
|
window.setCookie('order-info', JSON.stringify(info));
|
|
|
}
|
|
|
|
|
|
// info 必须是 JSON 字符串
|
|
|
try {
|
|
|
info = JSON.parse(info);
|
|
|
} catch (e) {
|
|
|
init();
|
|
|
}
|
|
|
|
|
|
exports.init = init;
|
|
|
|
|
|
exports.orderInfo = function(key, value) {
|
|
|
if (value === undefined) {
|
|
|
return info[key];
|
|
|
}
|
|
|
info[key] = value;
|
|
|
window.setCookie('order-info', JSON.stringify(info));
|
|
|
};
|
|
|
|
|
|
});
|
|
|
define("js/cart/select-coupon", ["jquery","handlebars","source-map","mlellipsis"], function(require, exports, module){
|
|
|
/**
|
|
|
* 优惠券选择
|
...
|
...
|
@@ -9224,7 +9249,7 @@ $newCoupon.on('submit', function() { |
|
|
if (res.code === 200) {
|
|
|
tip.show('优惠券可用');
|
|
|
orderInfo('couponCode', res.data.coupon_code);
|
|
|
orderInfo('couponValue', res.data.coupon_value);
|
|
|
orderInfo('couponName', res.data.coupon_title);
|
|
|
window.location.href = '/cart/index/orderEnsure';
|
|
|
} else {
|
|
|
tip.show(res.message || '网络错误');
|
...
|
...
|
@@ -9239,12 +9264,12 @@ $('#coupon-list').on('touchend', '.employ-main', function() { |
|
|
var $this = $(this);
|
|
|
|
|
|
orderInfo('couponCode', $this.data('coupon-code'));
|
|
|
orderInfo('couponValue', $this.data('coupon-value'));
|
|
|
orderInfo('couponName', $this.data('coupon-name'));
|
|
|
});
|
|
|
|
|
|
$('body').on('touchend', '.not-use', function() {
|
|
|
orderInfo('couponCode', null);
|
|
|
orderInfo('couponValue', null);
|
|
|
orderInfo('couponName', null);
|
|
|
});
|
|
|
|
|
|
|
...
|
...
|
|