Authored by lijing

分割page.js

... ... @@ -62,27 +62,7 @@ $(
// 风格详情页图片点击放大
$('.pull-pic-list').on('click', function() {
var w_height = $(window).height();
$('.big-pic').show();
$('.swiper-slide img').each(
function() {
var newTop = 0;
if ($(this).height() > w_height) {
$(this).css('height', '90%');
$(this).css('width', 'auto');
newTop = (w_height - $(this).height()) / 2;
$(this).css('margin-top', newTop + 'px');
} else {
newTop = (w_height - $(this).height()) / 2;
$(this).css('margin-top', newTop + 'px');
}
}
);
$('.swiper-slide').on('click', function() {
$('.big-pic').hide();
});
indexAct.pullPicBig();
});
// 瀑布流
... ... @@ -357,25 +337,7 @@ $(
});
// 默认选中菜单
if ($('.class-detail').length > 0) {
window.setCookie('chosenClass', $('.class-detail').find('.name').text());
window.setCookie('packageId', $('.class-detail').find('.name').attr('id'));
}
if ($('.adviser-info').find('.name').length > 0) {
window.setCookie('chosenCutter', $('.adviser-info').find('.name').text());
window.setCookie('chosenAdviser', $('.adviser-info').find('.name').text());
window.setCookie('cutterId', $('.cutter-id').val());
}
if ($('.style-detail').length > 0) {
window.setCookie('styleId', window.queryString.id);
window.setCookie('chosenStyle', ' ' + decodeURI(window.queryString.styleName) + ' ');
}
if ($('.package-detail').length > 0) {
window.setCookie('chosenPackage', $('.package-detail').find('.name').text());
window.setCookie('packageLimit', $('.package-detail').find('.limit').val());
window.setCookie('packageStyle', $('.package-detail').find('.styleid').val());
window.setCookie('packageId', window.queryString.id);
}
indexAct.chosenDefault();
// 立即预约按钮
$('.chosen-btn').on('click', function() {
... ... @@ -443,35 +405,7 @@ $(
// 取消订单
$('.order-btn a').on('click', function() {
diaLog.showDialog({
dialogText: '确认取消预约吗?',
hasFooter: {
leftBtnText: '我再想想',
rightBtnText: '确认取消'
}
}, function() {
$.ajax({
url: '/activity/trend/delOrder',
data: {
id: $('.order-btn a').attr('id')
},
success: function(result) {
if (result.code === 200) {
document.location.href = '//m.yohobuy.com/activity/trend/order-list?storeId=' +
window.queryString.storeId;
} else {
tip.show(result.message);
}
},
error: function() {
tip.show('网络断开了~~~');
}
});
});
// 修改弹框样式
$('.dialog-left-btn').css('color', '#999');
$('.dialog-right-btn').css('color', '#007aff');
indexAct.cancelOrder();
});
// 加减人数按钮
... ...
... ... @@ -415,6 +415,82 @@ function _formatDay(day) {
return moment(day).format('MM月DD日 HH:mm');
}
function pullPicBig(){
var w_height = $(window).height();
$('.big-pic').show();
$('.swiper-slide img').each(
function() {
var newTop = (w_height - $(this).height()) / 2;
if ($(this).height() > w_height) {
$(this).css('height', '90%');
$(this).css('width', 'auto');
$(this).css('margin-top', newTop + 'px');
} else {
$(this).css('margin-top', newTop + 'px');
}
}
);
$('.swiper-slide').on('click', function() {
$('.big-pic').hide();
});
}
function cancelOrder(){
diaLog.showDialog({
dialogText: '确认取消预约吗?',
hasFooter: {
leftBtnText: '我再想想',
rightBtnText: '确认取消'
}
}, function() {
$.ajax({
url: '/activity/trend/delOrder',
data: {
id: $('.order-btn a').attr('id')
},
success: function(result) {
if (result.code === 200) {
document.location.href = '//m.yohobuy.com/activity/trend/order-list?storeId=' +
window.queryString.storeId;
} else {
tip.show(result.message);
}
},
error: function() {
tip.show('网络断开了~~~');
}
});
});
// 修改弹框样式
$('.dialog-left-btn').css('color', '#999');
$('.dialog-right-btn').css('color', '#007aff');
}
function chosenDefault() {
if ($('.class-detail').length > 0) {
window.setCookie('chosenClass', $('.class-detail').find('.name').text());
window.setCookie('packageId', $('.class-detail').find('.name').attr('id'));
}
if ($('.adviser-info').find('.name').length > 0) {
window.setCookie('chosenCutter', $('.adviser-info').find('.name').text());
window.setCookie('chosenAdviser', $('.adviser-info').find('.name').text());
window.setCookie('cutterId', $('.cutter-id').val());
}
if ($('.style-detail').length > 0) {
window.setCookie('styleId', window.queryString.id);
window.setCookie('chosenStyle', ' ' + decodeURI(window.queryString.styleName) + ' ');
}
if ($('.package-detail').length > 0) {
window.setCookie('chosenPackage', $('.package-detail').find('.name').text());
window.setCookie('packageLimit', $('.package-detail').find('.limit').val());
window.setCookie('packageStyle', $('.package-detail').find('.styleid').val());
window.setCookie('packageId', window.queryString.id);
}
}
module.exports = {
getTimeList: getTimeList,
clearCookieArr: clearCookieArr,
... ... @@ -427,5 +503,8 @@ module.exports = {
removeByValue: removeByValue,
limitInp: limitInp,
pullPic: pullPic,
pullPicBig: pullPicBig,
cancelOrder: cancelOrder,
chosenDefault: chosenDefault,
_formatDay: _formatDay
};
... ...