...
|
...
|
@@ -14,12 +14,13 @@ var $ = require('yoho-jquery'); |
|
|
var lazyLoad = require('yoho-jquery-lazyload');
|
|
|
var yas = require('../common/data-yas');
|
|
|
var dataLazyLoad = require('../plugins/lazy-load')(document);
|
|
|
var handlebars = require('yoho-handlebars');
|
|
|
var setPager = require('./detail/pager');
|
|
|
|
|
|
var bindEvent = $.Callbacks(); // eslint-disable-line
|
|
|
var clickAcquireCouponEvent = $.Callbacks('unique'); // eslint-disable-line
|
|
|
|
|
|
var Dialog = require('../common/dialog').Dialog;
|
|
|
|
|
|
var $main = $('.main'),
|
|
|
id = $main.data('id'),
|
|
|
md5 = $main.data('md5'),
|
...
|
...
|
@@ -50,6 +51,9 @@ var $saleReturn = $('#saleReturn'); |
|
|
|
|
|
var dialogTpl = require('hbs/product/coupon-dialog.hbs');
|
|
|
|
|
|
var $goodsIdArr = [];
|
|
|
|
|
|
var pkgData;// 套餐数据
|
|
|
var notifyTpl = require('hbs/product/notify.hbs');
|
|
|
|
|
|
var $goodsIdArr = [],
|
...
|
...
|
@@ -66,9 +70,6 @@ function isEmpty(el) { |
|
|
require('../plugins/slider');
|
|
|
require('../common/center-slider');
|
|
|
|
|
|
// handlebars模板
|
|
|
pkgFn = handlebars.compile($('#packageDialog').html() || '');
|
|
|
|
|
|
bindEvent.add(function() {
|
|
|
var $imgShow = $('#img-show'),
|
|
|
$thumbs = $('#thumbs > .thumb-wrap');
|
...
|
...
|
@@ -225,7 +226,7 @@ bindEvent.add(function() { |
|
|
move(e);
|
|
|
});
|
|
|
|
|
|
//促销弹出框
|
|
|
// 促销弹出框
|
|
|
var icon = {
|
|
|
unfold: '',
|
|
|
fold: ''
|
...
|
...
|
@@ -631,17 +632,6 @@ bindEvent.add(function() { |
|
|
}
|
|
|
});
|
|
|
|
|
|
// 套餐
|
|
|
$('#buy-detail').click(function() {
|
|
|
var opt = {
|
|
|
className: 'pkg-dialog',
|
|
|
closeIcon: false,
|
|
|
content: pkgFn({msg: '测试信息!'})
|
|
|
};
|
|
|
|
|
|
new Dialog(opt).show();
|
|
|
});
|
|
|
|
|
|
// 继续购物
|
|
|
$('#keep-shopping').click(function() {
|
|
|
$('#type-chose').slideDown(SLIDETIME);
|
...
|
...
|
@@ -872,10 +862,6 @@ $('#brand-favour').click(function() { |
|
|
// $modelContent.slideDown(SLIDETIME);
|
|
|
// }
|
|
|
// });
|
|
|
// 详情页套餐区
|
|
|
$('.good-info .good-detail-text > a').dotdotdot({
|
|
|
wrap: 'letter'
|
|
|
});
|
|
|
|
|
|
// 售后服务
|
|
|
$('.after-service-switch').click(function() {
|
...
|
...
|
@@ -1027,7 +1013,7 @@ function fetchComment() { |
|
|
});
|
|
|
|
|
|
// 顾客咨询
|
|
|
function loadConsults() {
|
|
|
function loadConsults(nowPage) {
|
|
|
if (loadingConsults) {
|
|
|
return;
|
|
|
}
|
...
|
...
|
@@ -1039,11 +1025,11 @@ function fetchComment() { |
|
|
url: '/product/detail/consult',
|
|
|
data: {
|
|
|
productId: id,
|
|
|
page: consultPage
|
|
|
page: nowPage
|
|
|
}
|
|
|
}).then(function(data) {
|
|
|
var res;
|
|
|
|
|
|
var totalnum;
|
|
|
if (data.code === 200) {
|
|
|
res = data.data;
|
|
|
|
...
|
...
|
@@ -1055,16 +1041,35 @@ function fetchComment() { |
|
|
// 更新总数显示
|
|
|
$consultNum.text(res[0].total);
|
|
|
|
|
|
$consultsUl.append(consultsTpl({
|
|
|
totalnum = Math.ceil(res[0].total / 10) * 20;
|
|
|
|
|
|
$consultsUl.empty().append(consultsTpl({
|
|
|
consults: res
|
|
|
}));
|
|
|
consultPage++;
|
|
|
|
|
|
baseUrl = '/product/detail/consult?productId=' + id + '&filterId=7';
|
|
|
|
|
|
$('.consults-devide').empty().append(
|
|
|
setPager({baseUrl: baseUrl, totalRecords: totalnum, page: nowPage, type: 'ellipsis', theme: 'msg-pager'})
|
|
|
);
|
|
|
}
|
|
|
}).always(function() {
|
|
|
loadingConsults = false;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
$('.consults-devide').on('click', 'a', function() {
|
|
|
var $this = $(this);
|
|
|
var href = $this.data('page');
|
|
|
var data = href.split('?')[1].split('&');
|
|
|
var result = data.map(function(i) {
|
|
|
return i.split('=')[1];
|
|
|
});
|
|
|
loadConsults(result[2]);
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$('.consult-comment').on('click', '.load-more', function() {
|
|
|
var $this = $(this);
|
|
|
|
...
|
...
|
@@ -1305,6 +1310,118 @@ $('.recommend-slider').on('click', '.img-item', function() { |
|
|
|
|
|
window.loadRecommend = loadRecommend;
|
|
|
|
|
|
// 加载套餐默认信息
|
|
|
$(function() {
|
|
|
return $.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/product/detail/getPacakge',
|
|
|
data: {
|
|
|
skn: '51127118'
|
|
|
}
|
|
|
}).then(function(result) {
|
|
|
if (result.code === 200) {
|
|
|
var packageTpl = require('hbs/product/package.hbs');
|
|
|
|
|
|
pkgData = result.data;
|
|
|
$('#package').html(packageTpl(pkgData));
|
|
|
|
|
|
// 详情页套餐区
|
|
|
$('.good-info .good-detail-text > a').dotdotdot({
|
|
|
wrap: 'letter'
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
// 套餐点击事件
|
|
|
$('.package-box').on('click', '#buy-detail', function() {
|
|
|
var pkgDetailTpl = require('hbs/product/package-dialog.hbs');
|
|
|
var opt = {
|
|
|
className: 'pkg-dialog',
|
|
|
closeIcon: false,
|
|
|
content: pkgDetailTpl(pkgData)
|
|
|
};
|
|
|
new Dialog(opt).show();
|
|
|
|
|
|
var $pkSizes = $('.pkg-sizes'),
|
|
|
$pkColors = $('.pkg-colors');
|
|
|
|
|
|
// 选择颜色
|
|
|
$pkColors.on('click', 'li', function() {
|
|
|
var $this = $(this);
|
|
|
var index = $this.index();
|
|
|
var $colorName = $this.find('.color-name');
|
|
|
var $pkType = $this.closest('.type-chose');
|
|
|
var $pkSizesUl = $pkType.find('.pkg-sizes ul');
|
|
|
var $pkgColor = $pkType.find('.chose-done .pkg-color');
|
|
|
var $pkgSize = $pkType.find('.chose-done .pkg-size');
|
|
|
|
|
|
if ($this.hasClass('focus') || $this.hasClass('disable')) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$this.addClass('focus').siblings('.focus').removeClass('focus');
|
|
|
|
|
|
// 取消尺码的选择
|
|
|
$pkSizesUl.find('li').removeClass('focus');
|
|
|
$pkgColor.html('"' + $colorName.html() + '"');
|
|
|
$pkgSize.html('');
|
|
|
|
|
|
$pkSizesUl.addClass('hide').eq(index).removeClass('hide');
|
|
|
});
|
|
|
|
|
|
// 选择尺码
|
|
|
$pkSizes.on('click', 'li', function() {
|
|
|
var $this = $(this);
|
|
|
var $pkType = $this.closest('.type-chose');
|
|
|
var $pkgSize = $pkType.find('.chose-done .pkg-size');
|
|
|
var $pkgSizeWarn = $pkType.find('.pkg-sizes .size-warn');
|
|
|
|
|
|
if ($this.hasClass('focus') || $this.hasClass('disable')) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$this.addClass('focus').siblings('.focus').removeClass('focus');
|
|
|
|
|
|
$pkgSize.html('"' + $this.html() + '码"');
|
|
|
|
|
|
$pkgSizeWarn.addClass('hide');
|
|
|
});
|
|
|
|
|
|
// 立即购买跳转
|
|
|
$('#pay-pkg').on('click', function() {
|
|
|
window.location.href = '//www.yohobuy.com/cart/easypay?bundle=1124&sku=809291,789239';
|
|
|
});
|
|
|
});
|
|
|
|
|
|
// 推荐和浏览切换
|
|
|
// $('.individual-comment').on('click', '.title', function() {
|
|
|
// var $this = $(this),
|
|
|
// index = $this.index();
|
|
|
//
|
|
|
// var $latestWalk = $('.latest-walk'),
|
|
|
// $recommendComment = $('#recommend-shop');
|
|
|
//
|
|
|
// if ($this.hasClass('cur')) {
|
|
|
// return;
|
|
|
// }
|
|
|
//
|
|
|
// $this.addClass('cur');
|
|
|
// $this.siblings('.cur').removeClass('cur');
|
|
|
//
|
|
|
// if (index === 0) {
|
|
|
// // 店铺推荐
|
|
|
// $recommendComment.slideDown(SLIDETIME);
|
|
|
// $latestWalk.slideUp(SLIDETIME);
|
|
|
// } else {
|
|
|
// // 最近游览
|
|
|
// fetchLatestWalk(); // eslint-disable-line
|
|
|
// $recommendComment.slideUp(SLIDETIME);
|
|
|
// $latestWalk.slideDown(SLIDETIME);
|
|
|
// }
|
|
|
// });
|
|
|
|
|
|
$('.bottom-tab').on('click', '.bottom-title', function() {
|
|
|
var $this = $(this),
|
|
|
index = $this.index();
|
...
|
...
|
|