...
|
...
|
@@ -47,7 +47,7 @@ var Alert = require('../common/dialog').Alert; |
|
|
|
|
|
require('./detail/latest-walk');
|
|
|
|
|
|
require('../common/share');
|
|
|
require('../plugins/share');
|
|
|
|
|
|
function imgShow(src) {
|
|
|
$imgShow.attr('src', src);
|
...
|
...
|
@@ -103,7 +103,7 @@ function showSizeWarn() { |
|
|
}
|
|
|
|
|
|
// size title
|
|
|
(function () {
|
|
|
(function() {
|
|
|
var $sizeTitleJson = $('#size-title-json'),
|
|
|
jsonHtml = $sizeTitleJson.html(),
|
|
|
sizeTitle;
|
...
|
...
|
@@ -117,7 +117,7 @@ function showSizeWarn() { |
|
|
// 数据获取后删除
|
|
|
$sizeTitleJson.remove();
|
|
|
|
|
|
$sizes.children('li').each(function () {
|
|
|
$sizes.children('li').each(function() {
|
|
|
var $this = $(this),
|
|
|
key = $this.data('name');
|
|
|
|
...
|
...
|
@@ -129,7 +129,7 @@ function showSizeWarn() { |
|
|
thumbsLoaded[$('.colors .focus').index()] = true;
|
|
|
|
|
|
// 品牌收藏
|
|
|
$('#brand-favour').click(function () {
|
|
|
$('#brand-favour').click(function() {
|
|
|
var $this = $(this);
|
|
|
|
|
|
$.ajax({
|
...
|
...
|
@@ -138,7 +138,7 @@ $('#brand-favour').click(function () { |
|
|
data: {
|
|
|
brandId: $this.data('id')
|
|
|
}
|
|
|
}).then(function (data) {
|
|
|
}).then(function(data) {
|
|
|
if (data.code === 200) {
|
|
|
$this.toggleClass('coled');
|
|
|
} else if (data.code === 403) {
|
...
|
...
|
@@ -148,7 +148,7 @@ $('#brand-favour').click(function () { |
|
|
});
|
|
|
|
|
|
// 颜色
|
|
|
$('.colors').on('click', 'li', function () {
|
|
|
$('.colors').on('click', 'li', function() {
|
|
|
var $this = $(this),
|
|
|
index = $this.index();
|
|
|
|
...
|
...
|
@@ -203,12 +203,12 @@ $('.colors').on('click', 'li', function () { |
|
|
});
|
|
|
|
|
|
// 缩略图鼠标移入显示
|
|
|
$('#thumbs').on('mouseenter', '.thumb', function () {
|
|
|
$('#thumbs').on('mouseenter', '.thumb', function() {
|
|
|
imgShow($(this).data('shower'));
|
|
|
});
|
|
|
|
|
|
// 尺码
|
|
|
$size.on('click', 'li', function () {
|
|
|
$size.on('click', 'li', function() {
|
|
|
var $this = $(this);
|
|
|
|
|
|
if ($this.hasClass('focus')) {
|
...
|
...
|
@@ -227,7 +227,7 @@ $size.on('click', 'li', function () { |
|
|
switchBtnStatus();
|
|
|
|
|
|
resetNum();
|
|
|
}).on('click', '.size-ruler', function () {
|
|
|
}).on('click', '.size-ruler', function() {
|
|
|
|
|
|
// 尺码帮助
|
|
|
|
...
|
...
|
@@ -237,7 +237,7 @@ $size.on('click', 'li', function () { |
|
|
});
|
|
|
|
|
|
// 数量
|
|
|
$plusNum.click(function () {
|
|
|
$plusNum.click(function() {
|
|
|
var num = getNum();
|
|
|
|
|
|
if ($(this).hasClass('dis')) {
|
...
|
...
|
@@ -266,11 +266,11 @@ $plusNum.click(function () { |
|
|
}
|
|
|
|
|
|
$num.text(num + 1 > maxStock ? maxStock : num + 1);
|
|
|
}).on('selectstart', function () {
|
|
|
}).on('selectstart', function() {
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
$minusNum.click(function () {
|
|
|
$minusNum.click(function() {
|
|
|
var num = getNum();
|
|
|
|
|
|
if ($(this).hasClass('dis')) {
|
...
|
...
|
@@ -288,19 +288,19 @@ $minusNum.click(function () { |
|
|
}
|
|
|
|
|
|
$num.text(num - 1 < 0 ? 0 : num - 1);
|
|
|
}).on('selectstart', function () {
|
|
|
}).on('selectstart', function() {
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
// 限购码
|
|
|
$('.get-lc:not(.dis)').hover(function () {
|
|
|
$('.get-lc:not(.dis)').hover(function() {
|
|
|
$lcContainer.removeClass('hide');
|
|
|
}, function () {
|
|
|
}, function() {
|
|
|
$lcContainer.addClass('hide');
|
|
|
});
|
|
|
|
|
|
// 加入购物车
|
|
|
$addToCart.click(function () {
|
|
|
$addToCart.click(function() {
|
|
|
if (maxStock === -1) {
|
|
|
showSizeWarn();
|
|
|
return;
|
...
|
...
|
@@ -313,7 +313,7 @@ $addToCart.click(function () { |
|
|
productSku: $('.size:not(.hide) li.focus').data('sku'),
|
|
|
buyNumber: getNum()
|
|
|
}
|
|
|
}).then(function (data) {
|
|
|
}).then(function(data) {
|
|
|
var code = data.code;
|
|
|
|
|
|
if (code === 200) {
|
...
|
...
|
@@ -326,7 +326,7 @@ $addToCart.click(function () { |
|
|
});
|
|
|
|
|
|
// 收藏
|
|
|
$('#collect-product').click(function () {
|
|
|
$('#collect-product').click(function() {
|
|
|
var $this = $(this),
|
|
|
cancel;
|
|
|
|
...
|
...
|
@@ -341,7 +341,7 @@ $('#collect-product').click(function () { |
|
|
productId: id,
|
|
|
type: cancel ? 'cancel' : 'add'
|
|
|
}
|
|
|
}).then(function (data) {
|
|
|
}).then(function(data) {
|
|
|
var code = data.code;
|
|
|
|
|
|
if (code === 200) {
|
...
|
...
|
@@ -357,13 +357,13 @@ $('#collect-product').click(function () { |
|
|
location.href = data.data.url;
|
|
|
}
|
|
|
});
|
|
|
}).hover(function () {
|
|
|
}).hover(function() {
|
|
|
var $this = $(this);
|
|
|
|
|
|
if ($this.hasClass('coled')) {
|
|
|
$this.find('em').text(colTxt.hover);
|
|
|
}
|
|
|
}, function () {
|
|
|
}, function() {
|
|
|
var $this = $(this);
|
|
|
|
|
|
if ($this.hasClass('coled')) {
|
...
|
...
|
@@ -372,13 +372,13 @@ $('#collect-product').click(function () { |
|
|
});
|
|
|
|
|
|
// 继续购物
|
|
|
$('#keep-shopping').click(function () {
|
|
|
$('#keep-shopping').click(function() {
|
|
|
$('#type-chose').slideDown(SLIDETIME);
|
|
|
$('#balance').slideUp(SLIDETIME);
|
|
|
});
|
|
|
|
|
|
// 立即购买
|
|
|
$('#buy-now').click(function () {
|
|
|
$('#buy-now').click(function() {
|
|
|
var sku,
|
|
|
base,
|
|
|
myAlert;
|
...
|
...
|
@@ -409,18 +409,18 @@ $('#buy-now').click(function () { |
|
|
});
|
|
|
|
|
|
// 按钮鼠标移入效果【dis状态的按钮状态不变】
|
|
|
$('.buy-btn').mouseover(function () {
|
|
|
$('.buy-btn').mouseover(function() {
|
|
|
if ($(this).hasClass('dis')) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$(this).addClass('hover');
|
|
|
}).mouseleave(function () {
|
|
|
}).mouseleave(function() {
|
|
|
$(this).removeClass('hover');
|
|
|
});
|
|
|
|
|
|
// 商品详情/材质洗涤切换
|
|
|
$('.description-material').on('click', '.title', function () {
|
|
|
$('.description-material').on('click', '.title', function() {
|
|
|
var $this = $(this),
|
|
|
index = $this.index();
|
|
|
|
...
|
...
|
@@ -446,13 +446,13 @@ $('.description-material').on('click', '.title', function () { |
|
|
});
|
|
|
|
|
|
// 售后服务
|
|
|
$('.after-service-switch').click(function () {
|
|
|
$('.after-service-switch').click(function() {
|
|
|
var $this = $(this),
|
|
|
$content = $this.next('.after-service-content');
|
|
|
|
|
|
var html = {
|
|
|
def: '',
|
|
|
spread: ''
|
|
|
def: '',
|
|
|
spread: ''
|
|
|
};
|
|
|
|
|
|
if ($content.css('display') === 'none') {
|
...
|
...
|
@@ -474,18 +474,18 @@ $.ajax({ |
|
|
data: {
|
|
|
productId: id
|
|
|
}
|
|
|
}).then(function (html) {
|
|
|
}).then(function(html) {
|
|
|
$('#details-html').prepend(html);
|
|
|
|
|
|
// 修正热区尺寸使居中
|
|
|
$('.hot-point-wrap > img').load(function () {
|
|
|
$('.hot-point-wrap > img').load(function() {
|
|
|
$(this).parent('.hot-point-wrap').width($(this).width());
|
|
|
});
|
|
|
|
|
|
// Bind Hover event
|
|
|
$('.hot-point').hover(function () {
|
|
|
$('.hot-point').hover(function() {
|
|
|
$(this).addClass('hover');
|
|
|
}, function () {
|
|
|
}, function() {
|
|
|
$(this).removeClass('hover');
|
|
|
});
|
|
|
});
|
...
|
...
|
@@ -494,7 +494,7 @@ $.ajax({ |
|
|
lazyLoad($('#details-html img'));
|
|
|
|
|
|
// 只有一个尺码(多个或一个颜色)时默认选中第一个未售罄的颜色的第一个尺码
|
|
|
(function () {
|
|
|
(function() {
|
|
|
var hasOnlyOneSize = true,
|
|
|
i;
|
|
|
|
...
|
...
|
@@ -511,7 +511,7 @@ lazyLoad($('#details-html img')); |
|
|
}());
|
|
|
|
|
|
// 咨询和评价
|
|
|
(function () {
|
|
|
(function() {
|
|
|
var commentPage = 1,
|
|
|
consultPage = 1;
|
|
|
|
...
|
...
|
@@ -541,7 +541,7 @@ lazyLoad($('#details-html img')); |
|
|
productId: id,
|
|
|
page: commentPage
|
|
|
}
|
|
|
}).then(function (data) {
|
|
|
}).then(function(data) {
|
|
|
var res;
|
|
|
|
|
|
if (data.code === 200) {
|
...
|
...
|
@@ -560,7 +560,7 @@ lazyLoad($('#details-html img')); |
|
|
}));
|
|
|
commentPage++;
|
|
|
}
|
|
|
}).always(function () {
|
|
|
}).always(function() {
|
|
|
loadingComments = false;
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -580,7 +580,7 @@ lazyLoad($('#details-html img')); |
|
|
productId: id,
|
|
|
page: consultPage
|
|
|
}
|
|
|
}).then(function (data) {
|
|
|
}).then(function(data) {
|
|
|
var res;
|
|
|
|
|
|
if (data.code === 200) {
|
...
|
...
|
@@ -599,13 +599,13 @@ lazyLoad($('#details-html img')); |
|
|
}));
|
|
|
consultPage++;
|
|
|
}
|
|
|
}).always(function () {
|
|
|
}).always(function() {
|
|
|
loadingConsults = false;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 评价和咨询切换
|
|
|
$('.consult-comment').on('click', '.title', function () {
|
|
|
$('.consult-comment').on('click', '.title', function() {
|
|
|
var $this = $(this),
|
|
|
index = $this.index();
|
|
|
|
...
|
...
|
@@ -628,7 +628,7 @@ lazyLoad($('#details-html img')); |
|
|
$consults.slideUp(SLIDETIME);
|
|
|
$comments.slideDown(SLIDETIME);
|
|
|
}
|
|
|
}).on('click', '.load-more', function () {
|
|
|
}).on('click', '.load-more', function() {
|
|
|
var $this = $(this);
|
|
|
|
|
|
if ($this.hasClass('load-more-comments')) {
|
...
|
...
|
@@ -639,7 +639,7 @@ lazyLoad($('#details-html img')); |
|
|
});
|
|
|
|
|
|
// 我要咨询
|
|
|
$('#consults-btn').click(function () {
|
|
|
$('#consults-btn').click(function() {
|
|
|
|
|
|
// TODO:点击我要资讯的时候更新验证码显示
|
|
|
$('.new-consult').removeClass('hide');
|
...
|
...
|
@@ -647,7 +647,7 @@ lazyLoad($('#details-html img')); |
|
|
});
|
|
|
|
|
|
// 提交咨询
|
|
|
$('#submit-consult').click(function () {
|
|
|
$('#submit-consult').click(function() {
|
|
|
var $this = $(this),
|
|
|
$parent = $this.closest('.new-consult'),
|
|
|
$textarea = $parent.find('.my-consult'),
|
...
|
...
|
@@ -678,7 +678,7 @@ lazyLoad($('#details-html img')); |
|
|
productId: id,
|
|
|
content: content
|
|
|
}
|
|
|
}).then(function (data) {
|
|
|
}).then(function(data) {
|
|
|
var code = data.code;
|
|
|
|
|
|
if (code === 200) {
|
...
|
...
|
|