...
|
...
|
@@ -1101,6 +1101,7 @@ function loadComment() { |
|
|
commentPage[type] = commentPage[type] || 1;
|
|
|
|
|
|
loadingComments = true;
|
|
|
|
|
|
return $.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/product/detail/comment',
|
...
|
...
|
@@ -1115,7 +1116,7 @@ function loadComment() { |
|
|
|
|
|
// 购买评价
|
|
|
function loadAllComments(type, nowPage) {
|
|
|
loadComments(type, nowPage).then(function(data) {
|
|
|
return loadComments(type, nowPage).then(function(data) {
|
|
|
var res, filter, $ul, totalnum = 0, baseUrl;
|
|
|
|
|
|
if (data.code === 200) {
|
...
|
...
|
@@ -1203,7 +1204,7 @@ function loadComment() { |
|
|
}
|
|
|
});
|
|
|
|
|
|
loadAllComments(currentType);
|
|
|
return loadAllComments(currentType);
|
|
|
}
|
|
|
|
|
|
// 购买评价的相关事件
|
...
|
...
|
@@ -1265,7 +1266,7 @@ function loadConsult() { |
|
|
|
|
|
loadingConsults = true;
|
|
|
|
|
|
$.ajax({
|
|
|
return $.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/product/detail/consult',
|
|
|
data: {
|
...
|
...
|
@@ -1426,7 +1427,7 @@ function loadConsult() { |
|
|
});
|
|
|
});
|
|
|
|
|
|
loadConsults(1);
|
|
|
return loadConsults(1);
|
|
|
}
|
|
|
|
|
|
window.fetchConsult = window.once(loadConsult);
|
...
|
...
|
@@ -1465,7 +1466,7 @@ function initPageYas() { |
|
|
|
|
|
// 店铺推荐
|
|
|
function loadRecommend() {
|
|
|
$.ajax({
|
|
|
return $.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/product/detail/recommend',
|
|
|
data: {
|
...
|
...
|
@@ -1769,6 +1770,19 @@ function loadReturn() { |
|
|
|
|
|
window.fetchReturn = window.once(loadReturn);
|
|
|
|
|
|
function _scrollTo($ele) {
|
|
|
var top = 0;
|
|
|
|
|
|
if ($ele) {
|
|
|
top = $ele.offset().top - 20;
|
|
|
}
|
|
|
|
|
|
$('html,body').animate({
|
|
|
scrollTop: top
|
|
|
}, 500);
|
|
|
}
|
|
|
|
|
|
|
|
|
// 首屏加载后,对比数据是否变化,如果变化,重新渲染,重新绑定事件
|
|
|
bindEvent.fire();
|
|
|
|
...
|
...
|
@@ -1796,6 +1810,10 @@ bindEvent.fire(); |
|
|
favorite.statusFav(shopId, brandId).then(function() {
|
|
|
$('#brand-favour').addClass('coled');
|
|
|
});
|
|
|
|
|
|
// 数据懒加载
|
|
|
var dataLoad = dataLazyLoad.init({cls: '.datalazyload', threshold: 0}); //eslint-disable-line
|
|
|
dataLoad.fn && dataLoad.fn();
|
|
|
}());
|
|
|
|
|
|
$(window).scroll(function() {
|
...
|
...
|
@@ -1840,6 +1858,8 @@ $(window).scroll(function() { |
|
|
});
|
|
|
|
|
|
$('.shoppingCar').on('click', '.option', function(e) {
|
|
|
e.stopPropagation();
|
|
|
|
|
|
var $this = $(this);
|
|
|
|
|
|
if ($this.hasClass('fixed')) {
|
...
|
...
|
@@ -1849,15 +1869,15 @@ $('.shoppingCar').on('click', '.option', function(e) { |
|
|
$this.closest('li').siblings().find('.option').removeClass('fixed');
|
|
|
$this.addClass('fixed');
|
|
|
|
|
|
if ($this.hasClass('comment')) {
|
|
|
window.fetchComment();
|
|
|
window.fetchRecommend();
|
|
|
} else if ($this.hasClass('consult')) {
|
|
|
window.fetchConsult();
|
|
|
window.fetchRecommend();
|
|
|
if ($this.hasClass('comment') || $this.hasClass('consult')) {
|
|
|
$.when(window.fetchComment(), window.fetchConsult(), window.fetchRecommend()).always(function() {
|
|
|
_scrollTo($($this.data('el')));
|
|
|
});
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
e.stopPropagation();
|
|
|
_scrollTo($($this.data('el')));
|
|
|
});
|
|
|
|
|
|
$('.shoppingCar-btn').on('click', function() {
|
...
|
...
|
@@ -1873,9 +1893,8 @@ $('.shoppingCar-btn').on('click', function() { |
|
|
}
|
|
|
|
|
|
var $addToCart = $('#add-to-cart');
|
|
|
var sc = $(document);
|
|
|
|
|
|
sc.scrollTop(200);
|
|
|
_scrollTo();
|
|
|
|
|
|
if (maxStock === -1) {
|
|
|
$('#sizes').children('.size-warn').removeClass('hide');
|
...
|
...
|
@@ -1911,5 +1930,4 @@ $(function() { |
|
|
yasAtBottom.yasBottom();
|
|
|
|
|
|
|
|
|
// 数据懒加载
|
|
|
dataLazyLoad.init({cls: '.datalazyload', threshold: 0}); |
|
|
|
...
|
...
|
|