...
|
...
|
@@ -237,9 +237,9 @@ $yohoPage.on('touchstart', '.tap-hightlight', function() { |
|
|
$(this).removeClass('highlight');
|
|
|
});
|
|
|
|
|
|
// $('.nav-home').on('touchstart', function() {
|
|
|
// $('.homebuttom').toggleClass('none');
|
|
|
// });
|
|
|
$('.nav-home').on('touchstart', function() {
|
|
|
$('.homebuttom').toggleClass('none');
|
|
|
});
|
|
|
|
|
|
(function() {
|
|
|
var lastTime = 0,
|
...
|
...
|
@@ -755,7 +755,7 @@ $('#nav-tab').on('touchstart', function(e) { |
|
|
$navs.removeClass('bytouch');
|
|
|
});
|
|
|
});
|
|
|
define("js/guang/plus-star/detail", ["jquery","hammer","mlellipsis","lazyload"], function(require, exports, module){
|
|
|
define("js/guang/plus-star/detail", ["jquery","hammer","mlellipsis","lazyload","swiper","index"], function(require, exports, module){
|
|
|
/**
|
|
|
* PLUS+STAR详情页
|
|
|
* @author: xuqi<qi.xu@yoho.cn>
|
...
|
...
|
@@ -865,7 +865,7 @@ likeHammer.on('tap', function(e) { |
|
|
});
|
|
|
});
|
|
|
});
|
|
|
define("js/guang/info", ["jquery","hammer","mlellipsis","lazyload"], function(require, exports, module){
|
|
|
define("js/guang/info", ["jquery","hammer","mlellipsis","lazyload","swiper","index"], function(require, exports, module){
|
|
|
/**
|
|
|
* 资讯相关API
|
|
|
* @author: xuqi<qi.xu@yoho.cn>
|
...
|
...
|
@@ -875,16 +875,19 @@ define("js/guang/info", ["jquery","hammer","mlellipsis","lazyload"], function(re |
|
|
var $ = require("jquery"),
|
|
|
Hammer = require("hammer"),
|
|
|
ellipsis = require("mlellipsis"),
|
|
|
lazyLoad = require("lazyload");
|
|
|
lazyLoad = require("lazyload"),
|
|
|
Swiper = require("swiper");
|
|
|
|
|
|
var tip = require("js/plugin/tip");
|
|
|
var loading = require("js/plugin/loading");
|
|
|
|
|
|
var $loadMoreInfo = $('#load-more-info');
|
|
|
var $loading = $(''),
|
|
|
$noMore = $('');
|
|
|
$noMore = $(''),
|
|
|
$swiper = $('');
|
|
|
|
|
|
var searching = false;
|
|
|
var mySwiper = {};
|
|
|
|
|
|
ellipsis.init();
|
|
|
|
...
|
...
|
@@ -893,6 +896,19 @@ if ($loadMoreInfo.length > 0) { |
|
|
$noMore = $loadMoreInfo.children('.no-more');
|
|
|
}
|
|
|
|
|
|
//初始化swiper
|
|
|
function initSwiper(typeId) {
|
|
|
if (typeof typeId === undefined) {
|
|
|
return;
|
|
|
}
|
|
|
mySwiper[typeId] = new Swiper('.swiper-cont-' + typeId, {
|
|
|
lazyLoading: true,
|
|
|
wrapperClass: 'swiper-wrap-' + typeId,
|
|
|
pagination: '.swiper-pagi-' + typeId,
|
|
|
autoplay: 3000
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 设置指定资讯项的Lazyload和文字截取
|
|
|
* @params $infos 资讯项
|
...
|
...
|
@@ -1043,6 +1059,14 @@ function loadMore($container, opt, url) { |
|
|
|
|
|
$container.append(data);
|
|
|
|
|
|
$swiper = $container.find('.swiper-container');
|
|
|
if ($swiper.length) {
|
|
|
$swiper.addClass('swiper-cont-' + opt.type);
|
|
|
$swiper.children('.swiper-wrapper').addClass('swiper-wrap-' + opt.type);
|
|
|
$swiper.children('.swiper-pagination').addClass('swiper-pagi-' + opt.type);
|
|
|
initSwiper(opt.type);
|
|
|
}
|
|
|
|
|
|
if (num > 0) {
|
|
|
$newItems = $container.find('.guang-info:gt(' + (num - 1) + ')');
|
|
|
} else {
|
...
|
...
|
@@ -1062,14 +1086,19 @@ function loadMore($container, opt, url) { |
|
|
opt.page++;
|
|
|
|
|
|
searching = false;
|
|
|
delete opt.isTab;
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('网络断开连接了~');
|
|
|
searching = false;
|
|
|
delete opt.isTab;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
exports.mySwiper = mySwiper;
|
|
|
exports.initSwiper = initSwiper;
|
|
|
exports.initInfosEvt = initInfosEvt;
|
|
|
exports.setLazyLoadAndMellipsis = setLazyLoadAndMellipsis;
|
|
|
exports.loadMore = loadMore;
|
...
|
...
|
@@ -1213,15 +1242,14 @@ module.exports = function() { |
|
|
});
|
|
|
};
|
|
|
});
|
|
|
define("js/guang/home", ["jquery","swiper","hammer","mlellipsis","lazyload","index"], function(require, exports, module){
|
|
|
define("js/guang/home", ["jquery","hammer","mlellipsis","lazyload","swiper","index"], function(require, exports, module){
|
|
|
/**
|
|
|
* 逛首页
|
|
|
* @author: xuqi<qi.xu@yoho.cn>
|
|
|
* @date: 2015/10/10
|
|
|
*/
|
|
|
|
|
|
var $ = require("jquery"),
|
|
|
Swiper = require("swiper");
|
|
|
var $ = require("jquery");
|
|
|
|
|
|
var info = require("js/guang/info"),
|
|
|
loadMore = info.loadMore;
|
...
|
...
|
@@ -1240,18 +1268,12 @@ var $infoList = $('#info-list'), |
|
|
|
|
|
var state = {};
|
|
|
|
|
|
var mySwiper;
|
|
|
|
|
|
if ($loadMoreInfo.length > 0) {
|
|
|
$loading = $loadMoreInfo.children('.loading');
|
|
|
$noMore = $loadMoreInfo.children('.no-more');
|
|
|
}
|
|
|
|
|
|
mySwiper = new Swiper('.swiper-container', {
|
|
|
lazyLoading: true,
|
|
|
pagination: '.swiper-pagination',
|
|
|
autoplay: 3000
|
|
|
});
|
|
|
info.initSwiper(curType);
|
|
|
|
|
|
info.initInfosEvt($infoList);
|
|
|
|
...
|
...
|
@@ -1302,6 +1324,7 @@ $nav.on('touchend touchcancel', function(e) { |
|
|
$loading.addClass('hide');
|
|
|
$noMore.addClass('hide');
|
|
|
|
|
|
state[curType].isTab = true;
|
|
|
loadMore($content, state[curType]);
|
|
|
} else {
|
|
|
|
...
|
...
|
@@ -1344,7 +1367,7 @@ $nav.on('touchstart', function(e) { |
|
|
$nav.find('li').removeClass('bytouch');
|
|
|
});
|
|
|
});
|
|
|
define("js/guang/list", ["jquery","hammer","mlellipsis","lazyload"], function(require, exports, module){
|
|
|
define("js/guang/list", ["jquery","hammer","mlellipsis","lazyload","swiper","index"], function(require, exports, module){
|
|
|
/**
|
|
|
* 列表页,编辑页
|
|
|
* @author: xuqi<qi.xu@yoho.cn>
|
...
|
...
|
@@ -1903,11 +1926,6 @@ module.exports = function(specificGender) { |
|
|
url = '/product/recom/maylike?gender=' + gender;
|
|
|
}
|
|
|
|
|
|
//以防cookie异常,强制加载男首
|
|
|
if (specificGender === 'boys') {
|
|
|
url = '/product/recom/maylike?gender=1,3';
|
|
|
}
|
|
|
|
|
|
$curNav = $navList.children('.focus');
|
|
|
|
|
|
if (lifestyleType) {
|
...
|
...
|
@@ -5432,6 +5450,11 @@ var $chosePanel = $('#chose-panel'), |
|
|
$soonSoldOut = $('.soonSoldOut-tag'),
|
|
|
$yohoPage = $('.yoho-page');
|
|
|
|
|
|
//购物车编辑标相关变量
|
|
|
var isEdit,
|
|
|
isSelected,
|
|
|
oldSknId;
|
|
|
|
|
|
//初始化购物车面板显示
|
|
|
function init() {
|
|
|
hasChooseColor = false;
|
...
|
...
|
@@ -5445,6 +5468,37 @@ function init() { |
|
|
$leftNum = $('#left-num');
|
|
|
curColorIndex = 0;
|
|
|
curSizeIndex = 0;
|
|
|
isEdit = 0;
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 设置当前面板为编辑模式
|
|
|
*
|
|
|
* @param {String} sknId. 当前编辑商品的sknId
|
|
|
*
|
|
|
* @param {Bool} isThisGoodSelected. 当前编辑商品的在购物车中是否被选中
|
|
|
*
|
|
|
* @return {undefined}
|
|
|
*/
|
|
|
function setEditModeWithSknId(sknId, isThisGoodSelected) {
|
|
|
$('#chose-btn-sure').html('确认');
|
|
|
isEdit = 1;
|
|
|
oldSknId = sknId;
|
|
|
isSelected = isThisGoodSelected;
|
|
|
}
|
|
|
|
|
|
//删除面板
|
|
|
function removePannel() {
|
|
|
var $pannel = $('.chose-panel'),
|
|
|
$promotionId = $('#promotionId');
|
|
|
|
|
|
if ($pannel) {
|
|
|
$pannel.remove();
|
|
|
}
|
|
|
|
|
|
if ($promotionId) {
|
|
|
$promotionId.remove();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function checkColorSizeNum() {
|
...
|
...
|
@@ -5506,7 +5560,7 @@ function updateConformButtonClassAndText() { |
|
|
if (2 === $chosed.closest('.zero-stock').length) {
|
|
|
$('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄');
|
|
|
} else {
|
|
|
$('#chose-btn-sure').css('background-color', '#eb0313').html('加入购物车');
|
|
|
$('#chose-btn-sure').css('background-color', '#eb0313').html(isEdit ? '确认' : '加入购物车');
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -5753,7 +5807,8 @@ $yohoPage.on('touchstart', '.btn-minus', function() { |
|
|
buyNumber = $('#good-num').val() - 0,
|
|
|
|
|
|
promotionId,
|
|
|
isEdit = 0,
|
|
|
cartGoodData,
|
|
|
url,
|
|
|
num = parseInt($num.val(), 10);
|
|
|
|
|
|
//颜色尺码没有选择
|
...
|
...
|
@@ -5787,21 +5842,39 @@ $yohoPage.on('touchstart', '.btn-minus', function() { |
|
|
|
|
|
confirming = true;
|
|
|
loading.showLoadingMask();
|
|
|
$.ajax({
|
|
|
method: 'POST',
|
|
|
url: '/cart/index/add',
|
|
|
data: {
|
|
|
|
|
|
//针对是否处于编辑模式设置不同的url和需要post的数据
|
|
|
if (isEdit) {
|
|
|
cartGoodData = {
|
|
|
new_product_sku: productSku,
|
|
|
old_product_sku: oldSknId,
|
|
|
buy_number: buyNumber,
|
|
|
selected: isSelected
|
|
|
};
|
|
|
|
|
|
url = '/cart/index/modify';
|
|
|
|
|
|
} else {
|
|
|
cartGoodData = {
|
|
|
productSku: productSku,
|
|
|
buyNumber: buyNumber,
|
|
|
promotionId: promotionId,
|
|
|
isEdit: isEdit,
|
|
|
cartType: queryString.cartType
|
|
|
}
|
|
|
};
|
|
|
|
|
|
url = '/cart/index/add';
|
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
|
method: 'POST',
|
|
|
url: url,
|
|
|
data: cartGoodData
|
|
|
}).done(function(res) {
|
|
|
var cartNum;
|
|
|
|
|
|
loading.hideLoadingMask();
|
|
|
if (res.code === 200) {
|
|
|
if (res.code === 200 && !isEdit) {
|
|
|
cartNum = res.data.goods_count;
|
|
|
if (cartNum > 99) {
|
|
|
cartNum = '99+';
|
...
|
...
|
@@ -5813,11 +5886,20 @@ $yohoPage.on('touchstart', '.btn-minus', function() { |
|
|
cbFn();
|
|
|
}
|
|
|
}
|
|
|
if (res.message) {
|
|
|
if (res.message && !isEdit) {
|
|
|
tip.show(res.message);
|
|
|
}
|
|
|
|
|
|
hide();
|
|
|
|
|
|
if (isEdit) {
|
|
|
loading.showLoadingMask();
|
|
|
|
|
|
//延迟刷新,否则面板可能无法隐藏
|
|
|
setTimeout(function() {
|
|
|
window.location.reload();
|
|
|
}, 1);
|
|
|
}
|
|
|
}).fail(function() {
|
|
|
tip.show('网络出了点问题~');
|
|
|
}).always(function() {
|
...
|
...
|
@@ -5829,6 +5911,10 @@ $yohoPage.on('touchstart', '.btn-minus', function() { |
|
|
|
|
|
exports.init = init;
|
|
|
exports.show = show;
|
|
|
exports.remove = removePannel;
|
|
|
exports.setEditModeWithSknId = setEditModeWithSknId;
|
|
|
|
|
|
|
|
|
});
|
|
|
define("js/product/detail/desc", ["jquery","lazyload","swiper","index"], function(require, exports, module){
|
|
|
/**
|
...
|
...
|
@@ -8608,7 +8694,7 @@ if (chinaAddressList) { |
|
|
}
|
|
|
|
|
|
});
|
|
|
define("js/me/logistic", ["jquery"], function(require, exports, module){
|
|
|
define("js/me/logistic", ["jquery","hammer","lazyload"], function(require, exports, module){
|
|
|
/**
|
|
|
* 物流信息页面
|
|
|
* @author: 赵彪<bill.zhao@yoho.cn>
|
...
|
...
|
@@ -8632,7 +8718,7 @@ function addFooterTopBorder() { |
|
|
|
|
|
$(document).ready(addFooterTopBorder);
|
|
|
|
|
|
|
|
|
require("js/home/maybe-like")();
|
|
|
|
|
|
|
|
|
|
...
|
...
|
@@ -8786,6 +8872,16 @@ function showPage() { |
|
|
$pageList.css('visibility', 'visible');
|
|
|
}
|
|
|
|
|
|
function bindTouchedEvent() {
|
|
|
var $boxs = $('.box');
|
|
|
|
|
|
$boxs.on('touchstart', function(e) {
|
|
|
$(this).addClass('bytouch');
|
|
|
}).on('touchend touchcancel', function() {
|
|
|
$boxs.removeClass('bytouch');
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if (wxHammer) {
|
|
|
wxHammer.on('tap', function() {
|
|
|
callpay(theOrderCode);
|
...
|
...
|
@@ -8797,6 +8893,7 @@ function main() { |
|
|
loading.hideLoadingMask();
|
|
|
showPage();
|
|
|
loadIcon();
|
|
|
bindTouchedEvent();
|
|
|
}
|
|
|
|
|
|
loading.showLoadingMask();
|
...
|
...
|
@@ -8804,6 +8901,7 @@ loading.showLoadingMask(); |
|
|
$(document).ready(main);
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
define("js/me/personal-details", ["jquery"], function(require, exports, module){
|
|
|
/**
|
...
|
...
|
@@ -9135,6 +9233,7 @@ define("js/cart/good", ["jquery","mlellipsis","lazyload","handlebars","source-ma |
|
|
var $ = require("jquery"),
|
|
|
ellipsis = require("mlellipsis"),
|
|
|
chosePanel = require("js/cart/chose-panel"),
|
|
|
loading = require("js/plugin/loading"),
|
|
|
lazyLoad = require("lazyload");
|
|
|
|
|
|
var dialog = require("js/me/dialog"),
|
...
|
...
|
@@ -9204,6 +9303,69 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { |
|
|
});
|
|
|
});
|
|
|
|
|
|
/*
|
|
|
* 显示购物车编辑面板。
|
|
|
*
|
|
|
* @param {String} html. chose-pannel模板,由服务端返回
|
|
|
*
|
|
|
* @param {String} id. 商品skuid
|
|
|
*
|
|
|
* @param {Bool} isSelected. 所要编辑的商品是否被选中
|
|
|
*
|
|
|
* @return false;
|
|
|
*
|
|
|
*/
|
|
|
function showEditPannelWithSku(html, id, isSelected) {
|
|
|
|
|
|
if (html.length < 2) {
|
|
|
tip.show('出错啦!');
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
//删掉页面上原有的pannel
|
|
|
chosePanel.remove();
|
|
|
|
|
|
$(html).appendTo('#mainCart');
|
|
|
chosePanel.init();
|
|
|
chosePanel.setEditModeWithSknId(id, isSelected);
|
|
|
chosePanel.show();
|
|
|
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
$('.icon-edit').on('touchstart', function(e) {
|
|
|
var $this = $(this),
|
|
|
$checkBox = $this.closest('.info').siblings('.checkbox');
|
|
|
|
|
|
var skn = $this.closest('.shopping-cart-good').data('skn'),
|
|
|
id = $this.closest('.shopping-cart-good').data('id'),
|
|
|
count = $this.data('count');
|
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
|
loading.showLoadingMask();
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
url: '/cart/index/goodinfo',
|
|
|
data: {
|
|
|
skn: skn,
|
|
|
buy_num: count
|
|
|
},
|
|
|
success: function(res) {
|
|
|
showEditPannelWithSku(res, id, $checkBox.hasClass('icon-cb-checked'));
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('网络异常');
|
|
|
window.location.reload();
|
|
|
},
|
|
|
complete: function() {
|
|
|
loading.hideLoadingMask();
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
$('.icon-del').on('touchstart', function(e) {
|
|
|
var $this = $(this);
|
|
|
|
...
|
...
|
@@ -9502,6 +9664,7 @@ $invoice.on('touchend', '.checkbox', function() { |
|
|
function orderCompute() {
|
|
|
var yohoCoin = orderInfo('yohoCoin');
|
|
|
|
|
|
loading.showLoadingMask();
|
|
|
$.ajax({
|
|
|
method: 'POST',
|
|
|
url: '/cart/index/orderCompute',
|
...
|
...
|
@@ -9536,6 +9699,8 @@ function orderCompute() { |
|
|
}
|
|
|
}).fail(function() {
|
|
|
window.location.reload();
|
|
|
}).always(function() {
|
|
|
loading.hideLoadingMask();
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
|