Authored by zhangxiaoru

首页

... ... @@ -355,7 +355,6 @@ var $nav = $('.category-nav'),
var $curContent = $contents.not('.hide');
//初始化container高度
(function() {
var $header = $('.yoho-header'),
$search = $('#search-input');
... ... @@ -5386,7 +5385,7 @@ define("js/passport/bind/relate", ["jquery"], function(require, exports, module)
require("js/passport/code")(true, false, true);
});
define("js/product/entry", ["jquery","swiper","lazyload","hammer","handlebars","source-map","index"], function(require, exports, module){
define("js/product/entry", ["jquery","swiper","lazyload","hammer","handlebars","source-map","iscroll-probe","index"], function(require, exports, module){
/**
* 产品打包入口
* @author: liangzhifeng<zhifeng.liang@yoho.cn>
... ... @@ -5399,8 +5398,8 @@ require("js/product/list");
require("js/product/detail/detail");
require("js/product/detail/consultform");
require("js/product/newsale/hot-rank");
require("js/product/product-category");
require("js/product/shop");
});
define("js/product/newsale/newarrival", ["jquery","swiper","lazyload","hammer","index"], function(require, exports, module){
/**
... ... @@ -6897,7 +6896,8 @@ var $ = require("jquery"),
var goodsSwiper,
$discountFolder = $('.goodsDiscount .discount-folder'),
$discountArrow = $('.goodsDiscount .first-item span');
$downArea = $('.goodsDiscount .pull-down');
$upArea = $('.goodsDiscount .pull-up');
var goodsDiscountEl = document.getElementById('goodsDiscount'),
goodsDiscountHammer = goodsDiscountEl && new Hammer(goodsDiscountEl),
... ... @@ -6949,7 +6949,7 @@ goodsSwiper = new Swiper('.banner-swiper', {
//初始化goods-discount
if (0 === $discountFolder.children().length) {
$discountFolder.css('display', 'none');
$discountArrow.html('');
$downArea.hide();
}
//goods-discount下拉按钮点击事件
... ... @@ -6957,12 +6957,14 @@ if (goodsDiscountHammer && $discountFolder.children().length > 0) {
goodsDiscountHammer.on('tap', function(e) {
if ($discountFolder.is(':hidden')) {
$discountFirstItem.removeClass('short-text');
$discountArrow.removeClass('icon-down').addClass('icon-up').html('&#xe608;');
$downArea.hide();
$discountFolder.slideDown();
$upArea.show();
} else {
$discountFirstItem.addClass('short-text');
$discountArrow.removeClass('icon-up').addClass('icon-down').html('&#xe609;');
$upArea.hide();
$discountFolder.slideUp();
$downArea.show();
}
});
}
... ... @@ -8376,169 +8378,1041 @@ $('#hotRank').on('touchstart', function(e) {
});
define("js/me/entry", ["jquery","hammer","lazyload","handlebars","source-map","swiper","mlellipsis","index"], function(require, exports, module){
define("js/product/product-category", ["jquery"], function(require, exports, module){
/**
* 个人中心js打包入口文件
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/11/10
* 分类
* @author: berry<lixia.zhang@yoho.cn>
* @date: 2016/4/25
*/
var $ = require("jquery");
require("js/me/order");
require("js/me/order-detail");
require("js/me/fav");
require("js/me/suggest");
require("js/me/index");
require("js/me/coupons");
require("js/me/online-service");
require("js/me/address");
require("js/me/suggest");
require("js/me/browse-record");
require("js/me/address-act");
require("js/me/logistic");
require("js/me/pay");
require("js/me/personal-details");
require("js/me/currency");
require("js/me/currency-new");
require("js/me/message");
require("js/me/message-detail");
var $allProductCell = $('.allproduct'),
$categoryContainer = $('.category-container'),
$contents = $categoryContainer.children('.content'),
$subLevelItem = $categoryContainer.find('.sub-level li'),
$trilangle = $categoryContainer.find('.primary-level-trilangle');
//初始化container高度
(function() {
var $header = $('.yoho-header');
var h = $(window).height() - $header.outerHeight() - $allProductCell.outerHeight();
var trilangleRightMargin = $(window).width() * 0.55;
$categoryContainer.css('min-height', h);
$trilangle.css('margin-right', trilangleRightMargin);
$contents.height(h);
}());
$categoryContainer.on('touchend', function(e) {
var $this = $(e.target),
$subLevel,
$cur, index,
$subLevelContainer, $trilangleItem;
$cur = $this.closest('.p-level-item');
$subLevelContainer = $this.closest('.content').find('.sub-level-container');
$subLevelContainer.removeClass('hide');
if ($cur.length > 0) {
index = $cur.index();
$subLevel = $this.closest('.content').find('.sub-level');
$trilangleItem = $this.closest('.content').find('.primary-level-trilangle');
if ($this.hasClass('focus')) {
return;
}
$subLevel.not('.hide').addClass('hide');
$subLevel.eq(index).removeClass('hide');
$trilangleItem.not('.hide').addClass('hide');
$trilangleItem.eq(index).removeClass('hide');
}
});
define("js/me/order", ["jquery","hammer","lazyload","handlebars","source-map"], function(require, exports, module){
$categoryContainer.find('.sub-level').on('touchstart', 'li', function() {
$subLevelItem.removeClass('highlight');
$(this).addClass('highlight');
}).on('touchend touchcancel', 'li', function() {
$(this).removeClass('highlight');
});
$allProductCell.on('touchstart', function() {
$(this).addClass('highlight');
}).on('touchend touchcancel', function() {
$(this).removeClass('highlight');
});
});
define("js/product/shop", ["jquery","iscroll-probe","lazyload","swiper","hammer","index"], function(require, exports, module){
/**
* 个人中心--我的订单
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/11/10
* 品牌店铺首页
*/
var $ = require("jquery"),
Hammer = require("hammer"),
IScroll = require("iscroll-probe"),
lazyLoad = require("lazyload"),
tip = require("js/plugin/tip");
var $navLi = $('#order-nav > li'),
$orderContainer = $('#order-container');
var $curContainer = $orderContainer.children('.orders:not(.hide)');//保存当前显示的order-container
Swiper = require("swiper"),
bannerSwiper,
multiSwiper,
myScroll,
imgH,
nav1H,
main1H,
main1oH,
nav2H,
main2oH,
scH,
$nav1 = $('#pos-nav'),
$nav2 = $('#pos-list'),
sTop,
isIphone = navigator.userAgent.indexOf('iPhone') > 0 ? true : false;//判断浏览器类型
var winH = $(window).height();
var tip = require("js/plugin/tip"),
filter = require("js/plugin/filter"),
loading = require("js/plugin/loading");
var activeType = $navLi.filter('.active').data('type'); //当前active的项的index
var $subNav = $('.home-sub-nav'),
$goodsContainer = $('#goods-container'),
$goodsChildren = $goodsContainer.children(),
$ngc = $($goodsChildren.get(0)),
$pgc = $($goodsChildren.get(1)),
$dgc = $($goodsChildren.get(2)),
$shopId = $('input[name="shop_id"]').val(),
$appVersion = $('input[name="app_version"]').val();
var order = {
page: 0,
end: false
};
var winH = $(window).height(),
noResult = '<p class="no-result">未找到相关搜索结果</p>';
var inAjax = false;
//默认筛选条件
var defaultOpt = require("js/product/query-param");
var loading = require("js/plugin/loading");
var $listNav = $('#list-nav'),
$posList = $('#pos-list'),
var dialog = require("js/me/dialog");
//导航数据信息
navInfo = {
new: {
order: 1,
reload: true,
page: 0,
end: false
},
hot: {
order: 1,
reload: true,
page: 0,
end: false
},
newest: {
order: 1,
reload: true,
page: 0,
end: false
},
price: {
order: 1,
reload: true,
page: 0,
end: false
},
discount: {
order: 1,
reload: true,
page: 0,
end: false
}
},
$pre = $listNav.find('.active'), //纪录进入筛选前的active项,初始为选中项
searching;
var orderHammer;
var viewType = 1; // 1-首页,2-上新,3-人气
//加载订单
function getOrders(option) {
var opt = {
type: activeType,
page: order.page + 1
};
//焦点效果
if ($('.banner-swiper').find('li').size() > 1) {
bannerSwiper = new Swiper('.banner-swiper', {
lazyLoading: true,
lazyLoadingInPrevNext: true,
loop: true,
autoplay: 3000,
autoplayDisableOnInteraction: false,
paginationClickable: true,
slideElement: 'li',
pagination: '.banner-top .pagination-inner'
});
}
var show = option && !option.noLoadingMask;
if ($('.multi-browse').find('li').size() > 1) {
multiSwiper = new Swiper('.multi-browse', {
lazyLoading: true,
lazyLoadingInPrevNext: true,
lazyLoadingOnTransitionStart: true,
grabCursor: true,
slidesPerView: 'auto',
slideElement: 'li',
watchSlidesVisibility: true
});
}
if (inAjax) {
function getPageGoods(info) {
if (searching) {
return;
}
inAjax = true;
show && loading.showLoadingMask();
searching = true;
$.ajax({
type: 'GET',
url: '/home/getOrders',
data: opt,
url: info.url,
data: info.data,
success: function(data) {
var num;
info.callBack(data);
},
error: function() {
alert('网络断开连接了~');
searching = false;
}
});
}
if (data !== ' ') {
order.page = opt.page;
function newData(callback) {
var req = {};
if (opt.page === 1) {
$curContainer.html(data);
lazyLoad($curContainer.find('.lazy'), {
try_again_css: 'order-failure'
});
} else {
num = $curContainer.children('.order').length;
$curContainer.append(data);
req.url = '/index/search/search';
req.data = {
type: 'newest',
order: '1',
page: '1',
shop_id: $shopId
//lazyload
lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ')').find('.lazy'), {
try_again_css: 'order-failure'
});
}
};
req.callBack = function(data) {
$('#new-arrival').append(data);
navInfo.new.page++;
myScroll.refresh();
lazyLoad($('img.lazy'));
$("#scroller").trigger('scroll');
scH = $('#scroller').outerHeight();
searching = false;
callback && $.isFunction(callback) && callback();
}
getPageGoods(req);
}
function hotData(callback) {
var req = {};
req.url = '/index/search/search';
req.data = {
type: 'sales',
order: '1',
page: '1',
shop_id: $shopId
};
req.callBack = function(data) {
$('#popularity').append(data);
navInfo.hot.page++;
myScroll.refresh();
lazyLoad($('img.lazy'));
$("#scroller").trigger('scroll');
scH = $('#scroller').outerHeight();
searching = false;
callback && $.isFunction(callback) && callback();
}
getPageGoods(req);
}
window.rePosFooter(); //重新计算底部位置
} else {
order.end = true;
}
function tabChange(dom, index) {
var li = dom.eq(index);
inAjax = false;
show && loading.hideLoadingMask();
}
});
dom.removeClass('active');
li.addClass('active');
dom.removeClass('color');
li.addClass('color');
}
lazyLoad({
try_again_css: 'order-failure'
});
//首页导航
$.jqtab = function(nav, posNav, main) {
//初始化导航
(function() {
var liCount = $navLi.length;
$(nav + ' li, ' + posNav + ' li').not('li.all-goods').on('touchstart', function() {
//默认4个导航项
if (liCount === 4) {
return;
}
var index = $(this).index(),
activeTab = $(this).attr('tab');
$navLi.width(100 / liCount + '%');
}());
$nav1.removeClass('fixed-top');
tabChange($(nav + ' li'), index);
tabChange($(posNav + ' li'), index);
loading.init($('body')); //满屏loading
$(main).hide();
$('#' + activeTab).fadeIn();
//点击订单区域跳转订单详情页
orderHammer = new Hammer(document.getElementById('order-container'));
orderHammer.on('tap', function(e) {
var $cur = $(e.target),
$order,
id,
url;
if(activeTab === 'new-arrival'){
newData();
viewType = 2;
} else if(activeTab === 'popularity'){
hotData();
viewType = 2;
} else if (activeTab === 'home-page') {
myScroll && myScroll.refresh();
scH = $('#scroller').outerHeight();
$nav1.removeClass('fixed-top');
$nav1.removeClass('absolute');
if ($cur.closest('.locHref').length > 0) {
return;
}
$nav2.removeClass('fixed-top');
$nav2.removeClass('absolute');
}
$order = $cur.closest('.order');
id = $order.data('id');
myScroll.scrollTo(0,0);
$nav1.addClass('hide');
if ($cur.closest('.del').length > 0) {
return false;
});
};
$.jqtab('#nav','#pos-nav','.main');
$('#wrapper').addClass('scroll-wrapper');
lazyLoad($('img.lazy'));
//Order delete
dialog.showDialog({
dialogText: '确定删除订单吗?',
hasFooter: {
leftBtnText: '取消',
rightBtnText: '确定'
}
}, function() {
$.ajax({
type: 'GET',
url: '/home/delOrder',
data: {
id: id
},
success: function(data) {
myScroll = new IScroll('#wrapper', {
probeType: 3,
mouseWheel: true,
click: true
});
myScroll.on('scroll', function() {
sTop = -this.y;
if (sTop + winH * 2 > scH) {
switch(viewType) {
case 2:
var scrollCall = function() {
$nav1.css({
transform: 'translate(0, ' + (- scH) + 'px)'
});
}
newData(scrollCall);
break;
case 3:
var scrollCall = function() {
$nav1.css({
transform: 'translate(0, ' + (- scH) + 'px)'
});
}
hotData(scrollCall);
break;
}
}
if (sTop < imgH) {
if (!$nav1.hasClass('hide')) {
$nav1.addClass('hide');
}
if (!$nav2.hasClass('hide')) {
$nav2.addClass('hide');
} //滑动距离不到导航1
} else if (sTop < imgH + nav1H + main1oH) {
if ($nav1.hasClass('hide')) {
$nav1.removeClass('hide');
}
if (!$nav2.hasClass('hide')) {
$nav2.addClass('hide');
}//滑动距离不到导航2
if (sTop < imgH + main1H) {
if (!$nav1.hasClass('fixed-top')) {
$nav1.addClass('fixed-top')
.removeClass('absolute')
.css({
transform: 'translate(0, ' + (- scH) + 'px)'
});
}
} else if (sTop < imgH + nav1H + main1H) {
if ($('#home-page').is(':hidden')) {
return false;
}
if (!$nav1.hasClass('absolute')) {
$nav1.addClass('absolute')
.removeClass('fixed-top');
}
$nav1.css({
transform: 'translate(0, ' + (imgH + main1H - sTop - scH) + 'px)'
});
}
} else {
if ($('#home-page').is(':hidden')) {
return false;
}
if (!$nav1.hasClass('hide')) {
$nav1.addClass('hide');
}
if ($nav2.hasClass('hide')) {
$nav2.removeClass('hide');
}
if (sTop < scH) {
if (!$nav2.hasClass('fixed-top')) {
$nav2.addClass('fixed-top')
.removeClass('absolute')
.css({
transform: 'translate(0, ' + (- scH) + 'px)'
});
}
}
}
$("#scroller").trigger('scroll');
});
document.addEventListener('touchmove', function(e) {
e.preventDefault();
}, false);
if (!isIphone) {
return;
}
//window onload 后重新refresh iscroll
$(window).load(function() {
myScroll && myScroll.refresh();
imgH = $('#nav-top').outerHeight();
nav1H = $('#nav').outerHeight();
main1H = $('#nav-main').height();
main1oH = $('#nav-main').outerHeight();
nav2H = $('#list-nav').outerHeight();
main2oH = $('#goods-container').outerHeight();
setTimeout(function(){
scH = $('#scroller').outerHeight();
},1000);
});
function search(opt) {
var setting = {},
ext,
att,
nav, navType,
page;
if (searching) {
return;
}
if (opt) {
//筛选项变更则重置reload为true
for (att in navInfo) {
if (navInfo.hasOwnProperty(att)) {
navInfo[att].reload = true;
}
}
switch (opt.type) {
case 'shop_id':
ext = {
shop_id: opt.id
};
break;
case 'gender':
ext = {
gender: opt.id
};
break;
case 'brand':
ext = {
brand: opt.id
};
break;
case 'sort':
ext = {
sort: opt.id
};
break;
case 'color':
ext = {
color: opt.id
};
break;
case 'size':
ext = {
size: opt.id
};
break;
case 'price':
ext = {
price: opt.id
};
break;
case 'discount':
ext = {
discount: opt.id
};
break;
}
$.extend(defaultOpt, ext); //扩展筛选项
}
//导航类别
if ($pre.hasClass('new')) {
navType = 'newest';
} else if ($pre.hasClass('price')) {
navType = 'price';
} else if ($pre.hasClass('discount')) {
navType = 'discount';
}
nav = navInfo[navType];
page = nav.page + 1;
if (nav.reload) {
page = 1;
} else if (nav.end) {
//不需要重新加载并且数据请求结束
return;
}
$.extend(setting, defaultOpt, {
type: navType,
order: nav.order,
page: page
});
searching = true;
loading.showLoadingMask();
$.ajax({
type: 'GET',
url: opt.url ? opt.url : '',
data: setting,
success: function(data) {
var $container,
num;
switch (navType) {
case 'newest':
$container = $ngc;
break;
case 'price':
$container = $pgc;
break;
case 'discount':
$container = $dgc;
break;
}
if (data === ' ') {
nav.end = true;
if (nav.reload) {
$container.html(noResult);
}
} else {
if (nav.reload) {
$container.html(data);
lazyLoad($container.find('.lazy'));
} else {
num = $container.find('.good-info').length;
$container.append(data);
//lazy good-infos who append in
lazyLoad($container.find('.good-info:gt(' + (num - 1) + ') .lazy'));
}
}
nav.reload = false;
nav.page = page;
searching = false;
loading.hideLoadingMask();
window.rePosFooter();
setTimeout(function () {
myScroll.refresh();
scH = $('#scroller').outerHeight();
}, 1000);
},
error: function() {
tip.show('网络断开连接了~');
searching = false;
loading.hideLoadingMask();
}
});
}
$.ajax({
type: 'GET',
url: '/product/newsale/filter',
data: defaultOpt,
success: function(data) {
$goodsContainer.append(data);
setTimeout(function () {
myScroll.refresh();
scH = $('#scroller').outerHeight();
}, 1000);
//初始化filter&注册filter回调
filter.initFilter({
fCbFn: search,
hCbFn: function() {
//切换active状态到$pre上
$pre.addClass('active');
$pre.siblings('.filter').removeClass('active');
},
missStatus: true
});
}
});
$listNav.bind('contextmenu', function(e) {
return false;
});
$posList.bind('contextmenu', function(e) {
return false;
});
$subNav.on('touchend touchcancel', function(e) {
var $this = $(e.target).closest('li'),
cname,
nav,
navType,
$active;
e.preventDefault();
if (typeof $this === 'undefined' || $this.length === 0) {
return;
}
if ($this.hasClass('filter')) {
//筛选面板切换状态
if ($this.hasClass('active')) {
filter.hideFilter();
//点击筛选钱的active项回复active
$pre.addClass('active');
$this.removeClass('active');
} else {
$pre = $this.siblings('.active');
$pre.removeClass('active');
$this.addClass('active');
filter.showFilter();
}
} else {
if ($this.hasClass('new')) {
cname = '.new';
navType = 'newest';
} else if ($this.hasClass('price')) {
cname = '.price';
navType = 'price';
} else if ($this.hasClass('discount')) {
cname = '.discount';
navType = 'discount';
}
nav = navInfo[navType];
if ($this.hasClass('active')) {
//最新无排序切换
if ($this.hasClass('new')) {
return;
}
if ($this.hasClass('price') || $this.hasClass('discount')) {
$this = $subNav.find(cname);
// 价格/折扣切换排序状态
$this.find('.icon > .iconfont').toggleClass('cur');
$pre = $this; //更新pre为当前项
nav.reload = true; //重置reload,HTML会被替换为逆序的HTML
nav.order = nav.order === 0 ? 1 : 0; //切换排序
}
} else {
$active = $subNav.find('.active');
$pre = $this; //$pre为除筛选导航的其他导航项,若当前active的为筛选,则把$pre置为当前点击项
if ($active.hasClass('filter')) {
//若之前active项为筛选,则隐藏筛选面板
filter.hideFilter();
} else {
//切换container显示
$goodsContainer.children('.container:not(.hide)').addClass('hide');
switch (navType) {
case 'newest':
$ngc.removeClass('hide');
break;
case 'price':
$pgc.removeClass('hide');
break;
case 'discount':
$dgc.removeClass('hide');
break;
}
}
$subNav.children().removeClass('active');
$subNav.find(cname).addClass('active');
}
if (nav.reload) {
search({
type: 'shop_id',
id: $shopId,
url: '/index/search/search'
});
}
}
e.stopPropagation();
});
function scrollHandler() {
//当scroll到1/4$goodsContainer高度后继续请求下一页数据
myScroll && myScroll.refresh();
if (sTop + winH > $('#scroller').height() - 0.25 * $goodsContainer.height() - 50){
if ($pre !== undefined) {
search({
type: 'shop_id',
id: $shopId,
url: '/index/search/search'
});
}
}
}
//srcoll to load more
$(window).scroll(function() {
window.requestAnimationFrame(scrollHandler);
});
//初始请求最新第一页数据
search({
type: 'shop_id',
id: $shopId,
url: '/index/search/search'
}
);
$listNav.on('touchstart', 'li', function(e) {
$(this).addClass('bytouch');
}).on('touchend touchcancel', function() {
$listNav.find('li').removeClass('bytouch');
myScroll.refresh();
if (sTop > imgH + nav1H + main1oH) {
myScroll.scrollTo(0,-(imgH + nav1H + main1oH + 10));
}
});
$posList.on('touchstart', 'li', function(e) {
$(this).addClass('bytouch');
}).on('touchend touchcancel', function() {
$posList.find('li').removeClass('bytouch');
myScroll.refresh();
if (sTop > imgH + nav1H + main1oH) {
myScroll.scrollTo(0,-(imgH + nav1H + main1oH + 10));
}
});
//底部导航点击
function fotterClick(group) {
$(group + ' li').on('touchstart', function() {
$('.sub-group').addClass('hide');
if ($(this).find('.sub-group').length > 0){
$(this).find('.sub-group').removeClass('hide');
}
});
};
fotterClick('.shop-foot-wrapper');
function stopPropagation(e) {
if (e.stopPropagation){
e.stopPropagation();
}else {
e.cancelBubble = true; }
}
$(document).bind('touchstart', function(){
$('.sub-group').addClass('hide');
});
$('.shop-foot-wrapper').bind('touchstart',function(e){
stopPropagation(e);
});
//收藏
function postCollect(info) {
var url = '';
if (searching) {
return;
}
searching = true;
$.ajax({
method: 'post',
url: info.url,
data: info.data,
success: function(data) {
if (data.code === 200){
if ($('#collect').hasClass('alreadyCollect')) {
$('#collect').attr('class', 'notCollect');
}else{
$('#collect').attr('class', 'alreadyCollect');
}
}
if (data.code === 401) {
url = data.url;
$('body').append('<a href=\'' + url + '\'><span class="jump-login"><span></a>');
$('.jump-login').click();
}
setTimeout(function () {
myScroll.refresh();
scH = $('#scroller').outerHeight();
}, 1000);
searching = false;
},
error: function() {
alert('网络断开连接了~');
searching = false;
}
});
}
function collectShop() {
var qew = {};
qew.url = '/product/index/shopFav';
qew.data = {
shop_id: $shopId,
app_version: $appVersion
};
postCollect(qew);
}
function cancelShop() {
var qew = {};
qew.url = '/product/index/cancelShopFav';
qew.data = {
shop_id: $shopId,
app_version: $appVersion
};
postCollect(qew);
}
$('#collect').bind('touchstart', function() {
if ($('#collect').hasClass('alreadyCollect')) {
cancelShop();
}else{
collectShop();
}
});
});
define("js/me/entry", ["jquery","hammer","lazyload","handlebars","source-map","swiper","mlellipsis","index"], function(require, exports, module){
/**
* 个人中心js打包入口文件
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/11/10
*/
require("js/me/order");
require("js/me/order-detail");
require("js/me/fav");
require("js/me/suggest");
require("js/me/index");
require("js/me/coupons");
require("js/me/online-service");
require("js/me/address");
require("js/me/suggest");
require("js/me/browse-record");
require("js/me/address-act");
require("js/me/logistic");
require("js/me/pay");
require("js/me/personal-details");
require("js/me/currency");
require("js/me/currency-new");
require("js/me/message");
require("js/me/message-detail");
});
define("js/me/order", ["jquery","hammer","lazyload","handlebars","source-map"], function(require, exports, module){
/**
* 个人中心--我的订单
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/11/10
*/
var $ = require("jquery"),
Hammer = require("hammer"),
lazyLoad = require("lazyload"),
tip = require("js/plugin/tip");
var $navLi = $('#order-nav > li'),
$orderContainer = $('#order-container');
var $curContainer = $orderContainer.children('.orders:not(.hide)');//保存当前显示的order-container
var winH = $(window).height();
var activeType = $navLi.filter('.active').data('type'); //当前active的项的index
var order = {
page: 0,
end: false
};
var inAjax = false;
var loading = require("js/plugin/loading");
var dialog = require("js/me/dialog");
var orderHammer;
//加载订单
function getOrders(option) {
var opt = {
type: activeType,
page: order.page + 1
};
var show = option && !option.noLoadingMask;
if (inAjax) {
return;
}
inAjax = true;
show && loading.showLoadingMask();
$.ajax({
type: 'GET',
url: '/home/getOrders',
data: opt,
success: function(data) {
var num;
if (data !== ' ') {
order.page = opt.page;
if (opt.page === 1) {
$curContainer.html(data);
lazyLoad($curContainer.find('.lazy'), {
try_again_css: 'order-failure'
});
} else {
num = $curContainer.children('.order').length;
$curContainer.append(data);
//lazyload
lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ')').find('.lazy'), {
try_again_css: 'order-failure'
});
}
window.rePosFooter(); //重新计算底部位置
} else {
order.end = true;
}
inAjax = false;
show && loading.hideLoadingMask();
}
});
}
lazyLoad({
try_again_css: 'order-failure'
});
//初始化导航
(function() {
var liCount = $navLi.length;
//默认4个导航项
if (liCount === 4) {
return;
}
$navLi.width(100 / liCount + '%');
}());
loading.init($('body')); //满屏loading
//点击订单区域跳转订单详情页
orderHammer = new Hammer(document.getElementById('order-container'));
orderHammer.on('tap', function(e) {
var $cur = $(e.target),
$order,
id,
url;
if ($cur.closest('.locHref').length > 0) {
return;
}
$order = $cur.closest('.order');
id = $order.data('id');
if ($cur.closest('.del').length > 0) {
//Order delete
dialog.showDialog({
dialogText: '确定删除订单吗?',
hasFooter: {
leftBtnText: '取消',
rightBtnText: '确定'
}
}, function() {
$.ajax({
type: 'GET',
url: '/home/delOrder',
data: {
id: id
},
success: function(data) {
dialog.hideDialog();
if (data.message) {
tip.show(data.message);
... ... @@ -8705,7 +9579,9 @@ optHammer.on('tap', function(e) {
});
}
});
$(".owner-info").on('touchend',function(){
location.href='/home/address';
})
});
define("js/me/fav", ["jquery","hammer","swiper","handlebars","source-map","index"], function(require, exports, module){
/**
... ... @@ -10839,6 +11715,24 @@ loading.showLoadingMask();
$(document).ready(main);
$('.box').on('click', function() {
var url = $('.payapp-list a').attr('href'),
theRequest = [],
orderCode,
payment;
if (url.indexOf("?") != -1) {
theRequest = url.split('?')[1].split("&");
orderCode=theRequest[0].split('=')[1];
payment=theRequest[1].split('=')[1];
}
$.ajax({
url:'/shopping/pay/addPaymentInterval?orderCode=' + orderCode + '&payment=' + payment,
method:'get'
});
});
});
define("js/me/personal-details", ["jquery"], function(require, exports, module){
... ... @@ -11060,6 +11954,7 @@ require("js/cart/gift-advance");
require("js/cart/order-ensure");
require("js/cart/select-coupon");
require("js/cart/select-address");
require("js/cart/jit-detail");
});
define("js/cart/cart", ["jquery","mlellipsis","hammer","handlebars","source-map","swiper","lazyload","index"], function(require, exports, module){
... ... @@ -12037,7 +12932,7 @@ function phoneHidden(phone) {
$('.info-phone').html(phoneHidden($('.info-phone').html()));
if (orderInfo('address').is_support === 'N') {
if (orderInfo('address') && orderInfo('address').is_support === 'N') {
orderInfo('deliveryId', $('.delivery-id .icon-cb-radio').data('id'));
orderCompute();
}
... ... @@ -12321,3 +13216,37 @@ $confim.on('touchend', '.confim', function() {
});
});
define("js/cart/jit-detail", ["swiper","jquery","index"], function(require, exports, module){
/**
* jit拆单配送信息页面
* @author: zhaobiao<bill.zhao@yoho.cn>
* @date: 2016/04/26
*/
var Swiper = require("swiper"),
$ = require("jquery");
var height = $(window).height() - $('#yoho-header').height();
// 为了展示页面背景色,需要把页面根据窗口大小撑开
$('.jit-detail-page').css('height', height);
$('.jit-detail-page>div').show();
// 内容展示之后,再根据document高度,调整一次容器高度
height = $(document).height() - $('#yoho-header').height();
$('.jit-detail-page').css('height', height);
(function() {
return new Swiper('.swiper-container', {
slidesPerView: 'auto',
grabCursor: true,
slideElement: 'a',
lazyLoading: true,
watchSlidesVisibility: true
});
})();
});
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
... ... @@ -2,7 +2,7 @@
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>
Created by FontForge 20120731 at Fri Apr 15 10:26:51 2016
Created by FontForge 20120731 at Wed Apr 27 17:15:53 2016
By admin
</metadata>
<defs>
... ... @@ -19,7 +19,7 @@ Created by FontForge 20120731 at Fri Apr 15 10:26:51 2016
bbox="-0.75 -224 3943 896"
underline-thickness="50"
underline-position="-100"
unicode-range="U+0078-E648"
unicode-range="U+0078-E649"
/>
<missing-glyph horiz-adv-x="374"
d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" />
... ... @@ -263,5 +263,8 @@ t94.5 -142t142 -94.5t172.5 -35t172.5 35t142 94.5t94.5 142t35 172.5t-35 172.5t-94
<glyph glyph-name="uniE648" unicode="&#xe648;"
d="M512 798q-101 0 -193.5 -39.5t-159 -106t-106 -159t-39.5 -193.5t39.5 -193.5t106 -159t159 -106t193.5 -39.5t193.5 39.5t159 106t106 159t39.5 193.5t-39.5 193.5t-106 159t-159 106t-193.5 39.5zM512 -166q-95 0 -181 37t-148.5 99.5t-99.5 148.5t-37 181t37 181
t99.5 148.5t148.5 99.5t181 37t181 -37t148.5 -99.5t99.5 -148.5t37 -181t-37 -181t-99.5 -148.5t-148.5 -99.5t-181 -37zM420 133l-156 155l-22 -22l178 -179l361 361l-23 23z" />
<glyph glyph-name="uniE649" unicode="&#xe649;"
d="M875 126l-363 -164l-363 164v610q247 75 363 75t363 -75v-610zM930 808q-34 11 -84.5 26t-159.5 38.5t-174 23.5t-174 -23.5t-159.5 -38.5t-84.5 -26q-14 -4 -22 -15.5t-8 -25.5v-669q0 -27 25 -39l405 -183q9 -3 18 -3t18 3l405 183q25 12 25 39v669q0 14 -8 25.5
t-22 15.5zM751 552v83h-473v-83h206v-298h-72v237h-87v-237h-66v-84h506v84h-193v119h151v83h-151v96h179z" />
</font>
</defs></svg>
... ...