...
|
...
|
@@ -916,7 +916,7 @@ $('.after-service-switch').click(function() { |
|
|
});
|
|
|
|
|
|
// 商品详情区的热点
|
|
|
function fetchHotArea() {
|
|
|
function loadHotArea() {
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/product/detail/hotarea',
|
...
|
...
|
@@ -940,13 +940,13 @@ function fetchHotArea() { |
|
|
});
|
|
|
}
|
|
|
|
|
|
window.fetchHotArea = fetchHotArea;
|
|
|
window.fetchHotArea = window.once(loadHotArea);
|
|
|
|
|
|
// 商品详情图片懒加载
|
|
|
lazyLoad($('#details-html img'));
|
|
|
|
|
|
// 咨询和评价
|
|
|
function fetchComment() {
|
|
|
function loadComment() {
|
|
|
var commentPage = {}, // 每个类型的分页页码
|
|
|
currentType = '7', // 当前评论展示的类型
|
|
|
cNumReady = false; // 只第一次请求后更新数量
|
...
|
...
|
@@ -954,8 +954,6 @@ function fetchComment() { |
|
|
var commentsTpl = require('hbs/product/comment-item.hbs'),
|
|
|
loadingComments;
|
|
|
|
|
|
|
|
|
|
|
|
function loadComments(type, nowPage) {
|
|
|
if (loadingComments) {
|
|
|
return;
|
...
|
...
|
@@ -1111,9 +1109,9 @@ $('.comments').on('click', '.img-preview [data-role="preview-right"]', function( |
|
|
$img.css('transform', 'rotate(' + rotate + 'deg)');
|
|
|
});
|
|
|
|
|
|
window.fetchComment = fetchComment;
|
|
|
window.fetchComment = window.once(loadComment);
|
|
|
|
|
|
function fetchConsult() {
|
|
|
function loadConsult() {
|
|
|
var consultsTpl = require('hbs/product/consult-item.hbs'),
|
|
|
$consultsUl = $('#consults-ul'),
|
|
|
$consultNum = $('.consult-num'),
|
...
|
...
|
@@ -1292,7 +1290,7 @@ function fetchConsult() { |
|
|
loadConsults(1);
|
|
|
}
|
|
|
|
|
|
window.fetchConsult = fetchConsult;
|
|
|
window.fetchConsult = window.once(loadConsult);
|
|
|
|
|
|
function randomString(len) {
|
|
|
var $chars = 'ABCDEFGHJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-';
|
...
|
...
|
@@ -1327,7 +1325,7 @@ function initPageYas() { |
|
|
}
|
|
|
|
|
|
// 店铺推荐
|
|
|
function fetchRecommend() {
|
|
|
function loadRecommend() {
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/product/detail/recommend',
|
...
|
...
|
@@ -1387,7 +1385,7 @@ $('.recommend-slider').on('click', '.img-item', function() { |
|
|
yas.givePoint('YB_CHOOSE_FOR_YOU_Y', loadYas);
|
|
|
});
|
|
|
|
|
|
window.fetchRecommend = fetchRecommend;
|
|
|
window.fetchRecommend = window.once(loadRecommend);
|
|
|
|
|
|
// 加载套餐默认信息
|
|
|
$(function() {
|
...
|
...
|
@@ -1545,7 +1543,7 @@ $('.recommend-content').find('.iconfont').mouseenter(function() { |
|
|
});
|
|
|
|
|
|
// 特殊商品退换货
|
|
|
function fetchReturn() {
|
|
|
function loadReturn() {
|
|
|
return $.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/product/detail/return',
|
...
|
...
|
@@ -1561,7 +1559,7 @@ function fetchReturn() { |
|
|
});
|
|
|
}
|
|
|
|
|
|
window.fetchReturn = fetchReturn;
|
|
|
window.fetchReturn = window.once(loadReturn);
|
|
|
|
|
|
// 首屏加载后,对比数据是否变化,如果变化,重新渲染,重新绑定事件
|
|
|
bindEvent.fire();
|
...
|
...
|
@@ -1627,7 +1625,6 @@ $(window).scroll(function() { |
|
|
});
|
|
|
|
|
|
$('.shoppingCar').on('click', '.option', function(e) {
|
|
|
e.stopPropagation();
|
|
|
var $this = $(this);
|
|
|
|
|
|
if ($this.hasClass('fixed')) {
|
...
|
...
|
@@ -1636,6 +1633,14 @@ $('.shoppingCar').on('click', '.option', function(e) { |
|
|
|
|
|
$this.closest('li').siblings().find('.option').removeClass('fixed');
|
|
|
$this.addClass('fixed');
|
|
|
|
|
|
if ($this.hasClass('comment')) {
|
|
|
window.fetchComment();
|
|
|
} else if ($this.hasClass('consult')) {
|
|
|
window.fetchConsult();
|
|
|
}
|
|
|
|
|
|
e.stopPropagation();
|
|
|
});
|
|
|
|
|
|
$('.shoppingCar-btn').on('click', function() {
|
...
|
...
|
@@ -1666,7 +1671,6 @@ $(function() { |
|
|
});
|
|
|
|
|
|
font.each(function(i, ele) {
|
|
|
|
|
|
if ((i + 1) % 4 === 0) {
|
|
|
$(this).find('.justpostion').css({display: 'inline-block', float: 'right'});
|
|
|
} else if ((i + 1) % 4 === 1) {
|
...
|
...
|
@@ -1674,8 +1678,6 @@ $(function() { |
|
|
} else {
|
|
|
$(this).css('text-align', 'center');
|
|
|
}
|
|
|
|
|
|
|
|
|
});
|
|
|
});
|
|
|
|
...
|
...
|
|