Showing
7 changed files
with
1066 additions
and
134 deletions
@@ -355,7 +355,6 @@ var $nav = $('.category-nav'), | @@ -355,7 +355,6 @@ var $nav = $('.category-nav'), | ||
355 | 355 | ||
356 | var $curContent = $contents.not('.hide'); | 356 | var $curContent = $contents.not('.hide'); |
357 | 357 | ||
358 | -//初始化container高度 | ||
359 | (function() { | 358 | (function() { |
360 | var $header = $('.yoho-header'), | 359 | var $header = $('.yoho-header'), |
361 | $search = $('#search-input'); | 360 | $search = $('#search-input'); |
@@ -5386,7 +5385,7 @@ define("js/passport/bind/relate", ["jquery"], function(require, exports, module) | @@ -5386,7 +5385,7 @@ define("js/passport/bind/relate", ["jquery"], function(require, exports, module) | ||
5386 | require("js/passport/code")(true, false, true); | 5385 | require("js/passport/code")(true, false, true); |
5387 | 5386 | ||
5388 | }); | 5387 | }); |
5389 | -define("js/product/entry", ["jquery","swiper","lazyload","hammer","handlebars","source-map","index"], function(require, exports, module){ | 5388 | +define("js/product/entry", ["jquery","swiper","lazyload","hammer","handlebars","source-map","iscroll-probe","index"], function(require, exports, module){ |
5390 | /** | 5389 | /** |
5391 | * 产品打包入口 | 5390 | * 产品打包入口 |
5392 | * @author: liangzhifeng<zhifeng.liang@yoho.cn> | 5391 | * @author: liangzhifeng<zhifeng.liang@yoho.cn> |
@@ -5399,8 +5398,8 @@ require("js/product/list"); | @@ -5399,8 +5398,8 @@ require("js/product/list"); | ||
5399 | require("js/product/detail/detail"); | 5398 | require("js/product/detail/detail"); |
5400 | require("js/product/detail/consultform"); | 5399 | require("js/product/detail/consultform"); |
5401 | require("js/product/newsale/hot-rank"); | 5400 | require("js/product/newsale/hot-rank"); |
5402 | - | ||
5403 | - | 5401 | +require("js/product/product-category"); |
5402 | +require("js/product/shop"); | ||
5404 | }); | 5403 | }); |
5405 | define("js/product/newsale/newarrival", ["jquery","swiper","lazyload","hammer","index"], function(require, exports, module){ | 5404 | define("js/product/newsale/newarrival", ["jquery","swiper","lazyload","hammer","index"], function(require, exports, module){ |
5406 | /** | 5405 | /** |
@@ -6897,7 +6896,8 @@ var $ = require("jquery"), | @@ -6897,7 +6896,8 @@ var $ = require("jquery"), | ||
6897 | 6896 | ||
6898 | var goodsSwiper, | 6897 | var goodsSwiper, |
6899 | $discountFolder = $('.goodsDiscount .discount-folder'), | 6898 | $discountFolder = $('.goodsDiscount .discount-folder'), |
6900 | - $discountArrow = $('.goodsDiscount .first-item span'); | 6899 | + $downArea = $('.goodsDiscount .pull-down'); |
6900 | +$upArea = $('.goodsDiscount .pull-up'); | ||
6901 | 6901 | ||
6902 | var goodsDiscountEl = document.getElementById('goodsDiscount'), | 6902 | var goodsDiscountEl = document.getElementById('goodsDiscount'), |
6903 | goodsDiscountHammer = goodsDiscountEl && new Hammer(goodsDiscountEl), | 6903 | goodsDiscountHammer = goodsDiscountEl && new Hammer(goodsDiscountEl), |
@@ -6949,7 +6949,7 @@ goodsSwiper = new Swiper('.banner-swiper', { | @@ -6949,7 +6949,7 @@ goodsSwiper = new Swiper('.banner-swiper', { | ||
6949 | //初始化goods-discount | 6949 | //初始化goods-discount |
6950 | if (0 === $discountFolder.children().length) { | 6950 | if (0 === $discountFolder.children().length) { |
6951 | $discountFolder.css('display', 'none'); | 6951 | $discountFolder.css('display', 'none'); |
6952 | - $discountArrow.html(''); | 6952 | + $downArea.hide(); |
6953 | } | 6953 | } |
6954 | 6954 | ||
6955 | //goods-discount下拉按钮点击事件 | 6955 | //goods-discount下拉按钮点击事件 |
@@ -6957,12 +6957,14 @@ if (goodsDiscountHammer && $discountFolder.children().length > 0) { | @@ -6957,12 +6957,14 @@ if (goodsDiscountHammer && $discountFolder.children().length > 0) { | ||
6957 | goodsDiscountHammer.on('tap', function(e) { | 6957 | goodsDiscountHammer.on('tap', function(e) { |
6958 | if ($discountFolder.is(':hidden')) { | 6958 | if ($discountFolder.is(':hidden')) { |
6959 | $discountFirstItem.removeClass('short-text'); | 6959 | $discountFirstItem.removeClass('short-text'); |
6960 | - $discountArrow.removeClass('icon-down').addClass('icon-up').html(''); | 6960 | + $downArea.hide(); |
6961 | $discountFolder.slideDown(); | 6961 | $discountFolder.slideDown(); |
6962 | + $upArea.show(); | ||
6962 | } else { | 6963 | } else { |
6963 | $discountFirstItem.addClass('short-text'); | 6964 | $discountFirstItem.addClass('short-text'); |
6964 | - $discountArrow.removeClass('icon-up').addClass('icon-down').html(''); | 6965 | + $upArea.hide(); |
6965 | $discountFolder.slideUp(); | 6966 | $discountFolder.slideUp(); |
6967 | + $downArea.show(); | ||
6966 | } | 6968 | } |
6967 | }); | 6969 | }); |
6968 | } | 6970 | } |
@@ -8376,169 +8378,1041 @@ $('#hotRank').on('touchstart', function(e) { | @@ -8376,169 +8378,1041 @@ $('#hotRank').on('touchstart', function(e) { | ||
8376 | 8378 | ||
8377 | 8379 | ||
8378 | }); | 8380 | }); |
8379 | -define("js/me/entry", ["jquery","hammer","lazyload","handlebars","source-map","swiper","mlellipsis","index"], function(require, exports, module){ | 8381 | +define("js/product/product-category", ["jquery"], function(require, exports, module){ |
8380 | /** | 8382 | /** |
8381 | - * 个人中心js打包入口文件 | ||
8382 | - * @author: xuqi<qi.xu@yoho.cn> | ||
8383 | - * @date: 2015/11/10 | 8383 | + * 分类 |
8384 | + * @author: berry<lixia.zhang@yoho.cn> | ||
8385 | + * @date: 2016/4/25 | ||
8384 | */ | 8386 | */ |
8387 | +var $ = require("jquery"); | ||
8385 | 8388 | ||
8386 | -require("js/me/order"); | ||
8387 | -require("js/me/order-detail"); | ||
8388 | -require("js/me/fav"); | ||
8389 | -require("js/me/suggest"); | ||
8390 | -require("js/me/index"); | ||
8391 | -require("js/me/coupons"); | ||
8392 | -require("js/me/online-service"); | ||
8393 | -require("js/me/address"); | ||
8394 | -require("js/me/suggest"); | ||
8395 | -require("js/me/browse-record"); | ||
8396 | -require("js/me/address-act"); | ||
8397 | -require("js/me/logistic"); | ||
8398 | -require("js/me/pay"); | ||
8399 | -require("js/me/personal-details"); | ||
8400 | -require("js/me/currency"); | ||
8401 | -require("js/me/currency-new"); | ||
8402 | -require("js/me/message"); | ||
8403 | -require("js/me/message-detail"); | 8389 | +var $allProductCell = $('.allproduct'), |
8390 | + $categoryContainer = $('.category-container'), | ||
8391 | + $contents = $categoryContainer.children('.content'), | ||
8392 | + $subLevelItem = $categoryContainer.find('.sub-level li'), | ||
8393 | + $trilangle = $categoryContainer.find('.primary-level-trilangle'); | ||
8394 | + | ||
8395 | +//初始化container高度 | ||
8396 | +(function() { | ||
8397 | + var $header = $('.yoho-header'); | ||
8398 | + var h = $(window).height() - $header.outerHeight() - $allProductCell.outerHeight(); | ||
8399 | + var trilangleRightMargin = $(window).width() * 0.55; | ||
8400 | + | ||
8401 | + $categoryContainer.css('min-height', h); | ||
8402 | + $trilangle.css('margin-right', trilangleRightMargin); | ||
8403 | + $contents.height(h); | ||
8404 | + | ||
8405 | +}()); | ||
8406 | + | ||
8407 | + | ||
8408 | +$categoryContainer.on('touchend', function(e) { | ||
8409 | + var $this = $(e.target), | ||
8410 | + $subLevel, | ||
8411 | + $cur, index, | ||
8412 | + $subLevelContainer, $trilangleItem; | ||
8413 | + | ||
8414 | + $cur = $this.closest('.p-level-item'); | ||
8415 | + | ||
8416 | + $subLevelContainer = $this.closest('.content').find('.sub-level-container'); | ||
8417 | + $subLevelContainer.removeClass('hide'); | ||
8418 | + | ||
8419 | + if ($cur.length > 0) { | ||
8420 | + index = $cur.index(); | ||
8421 | + $subLevel = $this.closest('.content').find('.sub-level'); | ||
8422 | + $trilangleItem = $this.closest('.content').find('.primary-level-trilangle'); | ||
8423 | + | ||
8424 | + if ($this.hasClass('focus')) { | ||
8425 | + return; | ||
8426 | + } | ||
8427 | + | ||
8428 | + $subLevel.not('.hide').addClass('hide'); | ||
8429 | + $subLevel.eq(index).removeClass('hide'); | ||
8404 | 8430 | ||
8431 | + $trilangleItem.not('.hide').addClass('hide'); | ||
8432 | + $trilangleItem.eq(index).removeClass('hide'); | ||
8433 | + } | ||
8405 | }); | 8434 | }); |
8406 | -define("js/me/order", ["jquery","hammer","lazyload","handlebars","source-map"], function(require, exports, module){ | 8435 | + |
8436 | +$categoryContainer.find('.sub-level').on('touchstart', 'li', function() { | ||
8437 | + $subLevelItem.removeClass('highlight'); | ||
8438 | + $(this).addClass('highlight'); | ||
8439 | +}).on('touchend touchcancel', 'li', function() { | ||
8440 | + $(this).removeClass('highlight'); | ||
8441 | +}); | ||
8442 | + | ||
8443 | +$allProductCell.on('touchstart', function() { | ||
8444 | + $(this).addClass('highlight'); | ||
8445 | +}).on('touchend touchcancel', function() { | ||
8446 | + $(this).removeClass('highlight'); | ||
8447 | +}); | ||
8448 | +}); | ||
8449 | +define("js/product/shop", ["jquery","iscroll-probe","lazyload","swiper","hammer","index"], function(require, exports, module){ | ||
8407 | /** | 8450 | /** |
8408 | - * 个人中心--我的订单 | ||
8409 | - * @author: xuqi<qi.xu@yoho.cn> | ||
8410 | - * @date: 2015/11/10 | 8451 | + * 品牌店铺首页 |
8411 | */ | 8452 | */ |
8412 | 8453 | ||
8413 | var $ = require("jquery"), | 8454 | var $ = require("jquery"), |
8414 | - Hammer = require("hammer"), | 8455 | + IScroll = require("iscroll-probe"), |
8415 | lazyLoad = require("lazyload"), | 8456 | lazyLoad = require("lazyload"), |
8416 | - tip = require("js/plugin/tip"); | ||
8417 | - | ||
8418 | -var $navLi = $('#order-nav > li'), | ||
8419 | - $orderContainer = $('#order-container'); | ||
8420 | - | ||
8421 | -var $curContainer = $orderContainer.children('.orders:not(.hide)');//保存当前显示的order-container | 8457 | + Swiper = require("swiper"), |
8458 | + bannerSwiper, | ||
8459 | + multiSwiper, | ||
8460 | + myScroll, | ||
8461 | + imgH, | ||
8462 | + nav1H, | ||
8463 | + main1H, | ||
8464 | + main1oH, | ||
8465 | + nav2H, | ||
8466 | + main2oH, | ||
8467 | + scH, | ||
8468 | + $nav1 = $('#pos-nav'), | ||
8469 | + $nav2 = $('#pos-list'), | ||
8470 | + sTop, | ||
8471 | + isIphone = navigator.userAgent.indexOf('iPhone') > 0 ? true : false;//判断浏览器类型 | ||
8422 | 8472 | ||
8423 | -var winH = $(window).height(); | 8473 | +var tip = require("js/plugin/tip"), |
8474 | + filter = require("js/plugin/filter"), | ||
8475 | + loading = require("js/plugin/loading"); | ||
8424 | 8476 | ||
8425 | -var activeType = $navLi.filter('.active').data('type'); //当前active的项的index | 8477 | +var $subNav = $('.home-sub-nav'), |
8478 | + $goodsContainer = $('#goods-container'), | ||
8479 | + $goodsChildren = $goodsContainer.children(), | ||
8480 | + $ngc = $($goodsChildren.get(0)), | ||
8481 | + $pgc = $($goodsChildren.get(1)), | ||
8482 | + $dgc = $($goodsChildren.get(2)), | ||
8483 | + $shopId = $('input[name="shop_id"]').val(), | ||
8484 | + $appVersion = $('input[name="app_version"]').val(); | ||
8426 | 8485 | ||
8427 | -var order = { | ||
8428 | - page: 0, | ||
8429 | - end: false | ||
8430 | -}; | 8486 | +var winH = $(window).height(), |
8487 | + noResult = '<p class="no-result">未找到相关搜索结果</p>'; | ||
8431 | 8488 | ||
8432 | -var inAjax = false; | 8489 | +//默认筛选条件 |
8490 | +var defaultOpt = require("js/product/query-param"); | ||
8433 | 8491 | ||
8434 | -var loading = require("js/plugin/loading"); | 8492 | +var $listNav = $('#list-nav'), |
8493 | + $posList = $('#pos-list'), | ||
8435 | 8494 | ||
8436 | -var dialog = require("js/me/dialog"); | 8495 | + //导航数据信息 |
8496 | + navInfo = { | ||
8497 | + new: { | ||
8498 | + order: 1, | ||
8499 | + reload: true, | ||
8500 | + page: 0, | ||
8501 | + end: false | ||
8502 | + }, | ||
8503 | + hot: { | ||
8504 | + order: 1, | ||
8505 | + reload: true, | ||
8506 | + page: 0, | ||
8507 | + end: false | ||
8508 | + }, | ||
8509 | + newest: { | ||
8510 | + order: 1, | ||
8511 | + reload: true, | ||
8512 | + page: 0, | ||
8513 | + end: false | ||
8514 | + }, | ||
8515 | + price: { | ||
8516 | + order: 1, | ||
8517 | + reload: true, | ||
8518 | + page: 0, | ||
8519 | + end: false | ||
8520 | + }, | ||
8521 | + discount: { | ||
8522 | + order: 1, | ||
8523 | + reload: true, | ||
8524 | + page: 0, | ||
8525 | + end: false | ||
8526 | + } | ||
8527 | + }, | ||
8528 | + $pre = $listNav.find('.active'), //纪录进入筛选前的active项,初始为选中项 | ||
8529 | + searching; | ||
8437 | 8530 | ||
8438 | -var orderHammer; | 8531 | +var viewType = 1; // 1-首页,2-上新,3-人气 |
8439 | 8532 | ||
8440 | -//加载订单 | ||
8441 | -function getOrders(option) { | ||
8442 | - var opt = { | ||
8443 | - type: activeType, | ||
8444 | - page: order.page + 1 | ||
8445 | - }; | 8533 | +//焦点效果 |
8534 | +if ($('.banner-swiper').find('li').size() > 1) { | ||
8535 | + bannerSwiper = new Swiper('.banner-swiper', { | ||
8536 | + lazyLoading: true, | ||
8537 | + lazyLoadingInPrevNext: true, | ||
8538 | + loop: true, | ||
8539 | + autoplay: 3000, | ||
8540 | + autoplayDisableOnInteraction: false, | ||
8541 | + paginationClickable: true, | ||
8542 | + slideElement: 'li', | ||
8543 | + pagination: '.banner-top .pagination-inner' | ||
8544 | + }); | ||
8545 | +} | ||
8446 | 8546 | ||
8447 | - var show = option && !option.noLoadingMask; | 8547 | +if ($('.multi-browse').find('li').size() > 1) { |
8548 | + multiSwiper = new Swiper('.multi-browse', { | ||
8549 | + lazyLoading: true, | ||
8550 | + lazyLoadingInPrevNext: true, | ||
8551 | + lazyLoadingOnTransitionStart: true, | ||
8552 | + grabCursor: true, | ||
8553 | + slidesPerView: 'auto', | ||
8554 | + slideElement: 'li', | ||
8555 | + watchSlidesVisibility: true | ||
8556 | + }); | ||
8557 | +} | ||
8448 | 8558 | ||
8449 | - if (inAjax) { | 8559 | +function getPageGoods(info) { |
8560 | + if (searching) { | ||
8450 | return; | 8561 | return; |
8451 | } | 8562 | } |
8452 | - | ||
8453 | - inAjax = true; | ||
8454 | - show && loading.showLoadingMask(); | ||
8455 | - | 8563 | + searching = true; |
8456 | $.ajax({ | 8564 | $.ajax({ |
8457 | type: 'GET', | 8565 | type: 'GET', |
8458 | - url: '/home/getOrders', | ||
8459 | - data: opt, | 8566 | + url: info.url, |
8567 | + data: info.data, | ||
8460 | success: function(data) { | 8568 | success: function(data) { |
8461 | - var num; | 8569 | + info.callBack(data); |
8570 | + }, | ||
8571 | + error: function() { | ||
8572 | + alert('网络断开连接了~'); | ||
8573 | + searching = false; | ||
8574 | + } | ||
8575 | + }); | ||
8576 | +} | ||
8462 | 8577 | ||
8463 | - if (data !== ' ') { | ||
8464 | - order.page = opt.page; | 8578 | +function newData(callback) { |
8579 | + var req = {}; | ||
8465 | 8580 | ||
8466 | - if (opt.page === 1) { | ||
8467 | - $curContainer.html(data); | ||
8468 | - lazyLoad($curContainer.find('.lazy'), { | ||
8469 | - try_again_css: 'order-failure' | ||
8470 | - }); | ||
8471 | - } else { | ||
8472 | - num = $curContainer.children('.order').length; | ||
8473 | - $curContainer.append(data); | 8581 | + req.url = '/index/search/search'; |
8582 | + req.data = { | ||
8583 | + type: 'newest', | ||
8584 | + order: '1', | ||
8585 | + page: '1', | ||
8586 | + shop_id: $shopId | ||
8474 | 8587 | ||
8475 | - //lazyload | ||
8476 | - lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ')').find('.lazy'), { | ||
8477 | - try_again_css: 'order-failure' | ||
8478 | - }); | ||
8479 | - } | 8588 | + }; |
8589 | + req.callBack = function(data) { | ||
8590 | + $('#new-arrival').append(data); | ||
8591 | + navInfo.new.page++; | ||
8592 | + myScroll.refresh(); | ||
8593 | + lazyLoad($('img.lazy')); | ||
8594 | + $("#scroller").trigger('scroll'); | ||
8595 | + scH = $('#scroller').outerHeight(); | ||
8596 | + searching = false; | ||
8597 | + callback && $.isFunction(callback) && callback(); | ||
8598 | + } | ||
8599 | + getPageGoods(req); | ||
8600 | +} | ||
8601 | + | ||
8602 | +function hotData(callback) { | ||
8603 | + var req = {}; | ||
8604 | + | ||
8605 | + req.url = '/index/search/search'; | ||
8606 | + req.data = { | ||
8607 | + type: 'sales', | ||
8608 | + order: '1', | ||
8609 | + page: '1', | ||
8610 | + shop_id: $shopId | ||
8611 | + }; | ||
8612 | + req.callBack = function(data) { | ||
8613 | + $('#popularity').append(data); | ||
8614 | + navInfo.hot.page++; | ||
8615 | + myScroll.refresh(); | ||
8616 | + lazyLoad($('img.lazy')); | ||
8617 | + $("#scroller").trigger('scroll'); | ||
8618 | + scH = $('#scroller').outerHeight(); | ||
8619 | + searching = false; | ||
8620 | + callback && $.isFunction(callback) && callback(); | ||
8621 | + } | ||
8622 | + getPageGoods(req); | ||
8623 | +} | ||
8480 | 8624 | ||
8481 | - window.rePosFooter(); //重新计算底部位置 | ||
8482 | - } else { | ||
8483 | - order.end = true; | ||
8484 | - } | 8625 | +function tabChange(dom, index) { |
8626 | + var li = dom.eq(index); | ||
8485 | 8627 | ||
8486 | - inAjax = false; | ||
8487 | - show && loading.hideLoadingMask(); | ||
8488 | - } | ||
8489 | - }); | 8628 | + dom.removeClass('active'); |
8629 | + li.addClass('active'); | ||
8630 | + | ||
8631 | + dom.removeClass('color'); | ||
8632 | + li.addClass('color'); | ||
8490 | } | 8633 | } |
8491 | 8634 | ||
8492 | -lazyLoad({ | ||
8493 | - try_again_css: 'order-failure' | ||
8494 | -}); | 8635 | +//首页导航 |
8636 | +$.jqtab = function(nav, posNav, main) { | ||
8495 | 8637 | ||
8496 | -//初始化导航 | ||
8497 | -(function() { | ||
8498 | - var liCount = $navLi.length; | 8638 | + $(nav + ' li, ' + posNav + ' li').not('li.all-goods').on('touchstart', function() { |
8499 | 8639 | ||
8500 | - //默认4个导航项 | ||
8501 | - if (liCount === 4) { | ||
8502 | - return; | ||
8503 | - } | 8640 | + var index = $(this).index(), |
8641 | + activeTab = $(this).attr('tab'); | ||
8504 | 8642 | ||
8505 | - $navLi.width(100 / liCount + '%'); | ||
8506 | -}()); | 8643 | + $nav1.removeClass('fixed-top'); |
8644 | + | ||
8645 | + tabChange($(nav + ' li'), index); | ||
8646 | + tabChange($(posNav + ' li'), index); | ||
8507 | 8647 | ||
8508 | -loading.init($('body')); //满屏loading | 8648 | + $(main).hide(); |
8649 | + $('#' + activeTab).fadeIn(); | ||
8509 | 8650 | ||
8510 | -//点击订单区域跳转订单详情页 | ||
8511 | -orderHammer = new Hammer(document.getElementById('order-container')); | ||
8512 | -orderHammer.on('tap', function(e) { | ||
8513 | - var $cur = $(e.target), | ||
8514 | - $order, | ||
8515 | - id, | ||
8516 | - url; | 8651 | + if(activeTab === 'new-arrival'){ |
8652 | + newData(); | ||
8653 | + viewType = 2; | ||
8654 | + } else if(activeTab === 'popularity'){ | ||
8655 | + hotData(); | ||
8656 | + viewType = 2; | ||
8657 | + } else if (activeTab === 'home-page') { | ||
8658 | + myScroll && myScroll.refresh(); | ||
8659 | + scH = $('#scroller').outerHeight(); | ||
8660 | + $nav1.removeClass('fixed-top'); | ||
8661 | + $nav1.removeClass('absolute'); | ||
8517 | 8662 | ||
8518 | - if ($cur.closest('.locHref').length > 0) { | ||
8519 | - return; | ||
8520 | - } | 8663 | + $nav2.removeClass('fixed-top'); |
8664 | + $nav2.removeClass('absolute'); | ||
8665 | + } | ||
8521 | 8666 | ||
8522 | - $order = $cur.closest('.order'); | ||
8523 | - id = $order.data('id'); | 8667 | + myScroll.scrollTo(0,0); |
8668 | + $nav1.addClass('hide'); | ||
8524 | 8669 | ||
8525 | - if ($cur.closest('.del').length > 0) { | 8670 | + return false; |
8671 | + }); | ||
8672 | +}; | ||
8673 | +$.jqtab('#nav','#pos-nav','.main'); | ||
8674 | + | ||
8675 | +$('#wrapper').addClass('scroll-wrapper'); | ||
8676 | +lazyLoad($('img.lazy')); | ||
8526 | 8677 | ||
8527 | - //Order delete | ||
8528 | - dialog.showDialog({ | ||
8529 | - dialogText: '确定删除订单吗?', | ||
8530 | - hasFooter: { | ||
8531 | - leftBtnText: '取消', | ||
8532 | - rightBtnText: '确定' | ||
8533 | - } | ||
8534 | - }, function() { | ||
8535 | - $.ajax({ | ||
8536 | - type: 'GET', | ||
8537 | - url: '/home/delOrder', | ||
8538 | - data: { | ||
8539 | - id: id | ||
8540 | - }, | ||
8541 | - success: function(data) { | 8678 | + |
8679 | +myScroll = new IScroll('#wrapper', { | ||
8680 | + probeType: 3, | ||
8681 | + mouseWheel: true, | ||
8682 | + click: true | ||
8683 | +}); | ||
8684 | + | ||
8685 | +myScroll.on('scroll', function() { | ||
8686 | + sTop = -this.y; | ||
8687 | + | ||
8688 | + if (sTop + winH * 2 > scH) { | ||
8689 | + switch(viewType) { | ||
8690 | + case 2: | ||
8691 | + var scrollCall = function() { | ||
8692 | + $nav1.css({ | ||
8693 | + transform: 'translate(0, ' + (- scH) + 'px)' | ||
8694 | + }); | ||
8695 | + } | ||
8696 | + newData(scrollCall); | ||
8697 | + break; | ||
8698 | + case 3: | ||
8699 | + var scrollCall = function() { | ||
8700 | + $nav1.css({ | ||
8701 | + transform: 'translate(0, ' + (- scH) + 'px)' | ||
8702 | + }); | ||
8703 | + } | ||
8704 | + hotData(scrollCall); | ||
8705 | + break; | ||
8706 | + } | ||
8707 | + } | ||
8708 | + | ||
8709 | + if (sTop < imgH) { | ||
8710 | + if (!$nav1.hasClass('hide')) { | ||
8711 | + $nav1.addClass('hide'); | ||
8712 | + } | ||
8713 | + if (!$nav2.hasClass('hide')) { | ||
8714 | + $nav2.addClass('hide'); | ||
8715 | + } //滑动距离不到导航1 | ||
8716 | + } else if (sTop < imgH + nav1H + main1oH) { | ||
8717 | + if ($nav1.hasClass('hide')) { | ||
8718 | + $nav1.removeClass('hide'); | ||
8719 | + } | ||
8720 | + if (!$nav2.hasClass('hide')) { | ||
8721 | + $nav2.addClass('hide'); | ||
8722 | + }//滑动距离不到导航2 | ||
8723 | + | ||
8724 | + if (sTop < imgH + main1H) { | ||
8725 | + if (!$nav1.hasClass('fixed-top')) { | ||
8726 | + $nav1.addClass('fixed-top') | ||
8727 | + .removeClass('absolute') | ||
8728 | + .css({ | ||
8729 | + transform: 'translate(0, ' + (- scH) + 'px)' | ||
8730 | + }); | ||
8731 | + } | ||
8732 | + } else if (sTop < imgH + nav1H + main1H) { | ||
8733 | + if ($('#home-page').is(':hidden')) { | ||
8734 | + return false; | ||
8735 | + } | ||
8736 | + | ||
8737 | + if (!$nav1.hasClass('absolute')) { | ||
8738 | + $nav1.addClass('absolute') | ||
8739 | + .removeClass('fixed-top'); | ||
8740 | + } | ||
8741 | + $nav1.css({ | ||
8742 | + transform: 'translate(0, ' + (imgH + main1H - sTop - scH) + 'px)' | ||
8743 | + }); | ||
8744 | + } | ||
8745 | + } else { | ||
8746 | + if ($('#home-page').is(':hidden')) { | ||
8747 | + return false; | ||
8748 | + } | ||
8749 | + | ||
8750 | + if (!$nav1.hasClass('hide')) { | ||
8751 | + $nav1.addClass('hide'); | ||
8752 | + } | ||
8753 | + if ($nav2.hasClass('hide')) { | ||
8754 | + $nav2.removeClass('hide'); | ||
8755 | + } | ||
8756 | + | ||
8757 | + if (sTop < scH) { | ||
8758 | + if (!$nav2.hasClass('fixed-top')) { | ||
8759 | + $nav2.addClass('fixed-top') | ||
8760 | + .removeClass('absolute') | ||
8761 | + .css({ | ||
8762 | + transform: 'translate(0, ' + (- scH) + 'px)' | ||
8763 | + }); | ||
8764 | + } | ||
8765 | + } | ||
8766 | + } | ||
8767 | + $("#scroller").trigger('scroll'); | ||
8768 | +}); | ||
8769 | + | ||
8770 | + | ||
8771 | + | ||
8772 | +document.addEventListener('touchmove', function(e) { | ||
8773 | + e.preventDefault(); | ||
8774 | +}, false); | ||
8775 | + | ||
8776 | +if (!isIphone) { | ||
8777 | + return; | ||
8778 | +} | ||
8779 | + | ||
8780 | + | ||
8781 | +//window onload 后重新refresh iscroll | ||
8782 | +$(window).load(function() { | ||
8783 | + myScroll && myScroll.refresh(); | ||
8784 | + imgH = $('#nav-top').outerHeight(); | ||
8785 | + nav1H = $('#nav').outerHeight(); | ||
8786 | + main1H = $('#nav-main').height(); | ||
8787 | + main1oH = $('#nav-main').outerHeight(); | ||
8788 | + nav2H = $('#list-nav').outerHeight(); | ||
8789 | + main2oH = $('#goods-container').outerHeight(); | ||
8790 | + setTimeout(function(){ | ||
8791 | + scH = $('#scroller').outerHeight(); | ||
8792 | + },1000); | ||
8793 | +}); | ||
8794 | + | ||
8795 | + | ||
8796 | +function search(opt) { | ||
8797 | + var setting = {}, | ||
8798 | + ext, | ||
8799 | + att, | ||
8800 | + nav, navType, | ||
8801 | + page; | ||
8802 | + | ||
8803 | + if (searching) { | ||
8804 | + return; | ||
8805 | + } | ||
8806 | + | ||
8807 | + if (opt) { | ||
8808 | + | ||
8809 | + //筛选项变更则重置reload为true | ||
8810 | + for (att in navInfo) { | ||
8811 | + if (navInfo.hasOwnProperty(att)) { | ||
8812 | + navInfo[att].reload = true; | ||
8813 | + } | ||
8814 | + } | ||
8815 | + | ||
8816 | + switch (opt.type) { | ||
8817 | + case 'shop_id': | ||
8818 | + ext = { | ||
8819 | + shop_id: opt.id | ||
8820 | + }; | ||
8821 | + break; | ||
8822 | + case 'gender': | ||
8823 | + ext = { | ||
8824 | + gender: opt.id | ||
8825 | + }; | ||
8826 | + break; | ||
8827 | + case 'brand': | ||
8828 | + ext = { | ||
8829 | + brand: opt.id | ||
8830 | + }; | ||
8831 | + break; | ||
8832 | + case 'sort': | ||
8833 | + ext = { | ||
8834 | + sort: opt.id | ||
8835 | + }; | ||
8836 | + break; | ||
8837 | + case 'color': | ||
8838 | + ext = { | ||
8839 | + color: opt.id | ||
8840 | + }; | ||
8841 | + break; | ||
8842 | + case 'size': | ||
8843 | + ext = { | ||
8844 | + size: opt.id | ||
8845 | + }; | ||
8846 | + break; | ||
8847 | + case 'price': | ||
8848 | + ext = { | ||
8849 | + price: opt.id | ||
8850 | + }; | ||
8851 | + break; | ||
8852 | + case 'discount': | ||
8853 | + ext = { | ||
8854 | + discount: opt.id | ||
8855 | + }; | ||
8856 | + break; | ||
8857 | + } | ||
8858 | + | ||
8859 | + $.extend(defaultOpt, ext); //扩展筛选项 | ||
8860 | + } | ||
8861 | + | ||
8862 | + | ||
8863 | + //导航类别 | ||
8864 | + if ($pre.hasClass('new')) { | ||
8865 | + navType = 'newest'; | ||
8866 | + } else if ($pre.hasClass('price')) { | ||
8867 | + navType = 'price'; | ||
8868 | + } else if ($pre.hasClass('discount')) { | ||
8869 | + navType = 'discount'; | ||
8870 | + } | ||
8871 | + | ||
8872 | + nav = navInfo[navType]; | ||
8873 | + | ||
8874 | + page = nav.page + 1; | ||
8875 | + if (nav.reload) { | ||
8876 | + page = 1; | ||
8877 | + } else if (nav.end) { | ||
8878 | + | ||
8879 | + //不需要重新加载并且数据请求结束 | ||
8880 | + return; | ||
8881 | + } | ||
8882 | + | ||
8883 | + $.extend(setting, defaultOpt, { | ||
8884 | + type: navType, | ||
8885 | + order: nav.order, | ||
8886 | + page: page | ||
8887 | + }); | ||
8888 | + | ||
8889 | + searching = true; | ||
8890 | + loading.showLoadingMask(); | ||
8891 | + | ||
8892 | + $.ajax({ | ||
8893 | + type: 'GET', | ||
8894 | + url: opt.url ? opt.url : '', | ||
8895 | + data: setting, | ||
8896 | + success: function(data) { | ||
8897 | + var $container, | ||
8898 | + num; | ||
8899 | + | ||
8900 | + switch (navType) { | ||
8901 | + case 'newest': | ||
8902 | + $container = $ngc; | ||
8903 | + break; | ||
8904 | + case 'price': | ||
8905 | + $container = $pgc; | ||
8906 | + break; | ||
8907 | + case 'discount': | ||
8908 | + $container = $dgc; | ||
8909 | + break; | ||
8910 | + } | ||
8911 | + | ||
8912 | + if (data === ' ') { | ||
8913 | + nav.end = true; | ||
8914 | + | ||
8915 | + if (nav.reload) { | ||
8916 | + $container.html(noResult); | ||
8917 | + } | ||
8918 | + } else { | ||
8919 | + if (nav.reload) { | ||
8920 | + $container.html(data); | ||
8921 | + lazyLoad($container.find('.lazy')); | ||
8922 | + } else { | ||
8923 | + num = $container.find('.good-info').length; | ||
8924 | + $container.append(data); | ||
8925 | + | ||
8926 | + //lazy good-infos who append in | ||
8927 | + lazyLoad($container.find('.good-info:gt(' + (num - 1) + ') .lazy')); | ||
8928 | + } | ||
8929 | + } | ||
8930 | + | ||
8931 | + nav.reload = false; | ||
8932 | + nav.page = page; | ||
8933 | + | ||
8934 | + searching = false; | ||
8935 | + loading.hideLoadingMask(); | ||
8936 | + | ||
8937 | + window.rePosFooter(); | ||
8938 | + | ||
8939 | + setTimeout(function () { | ||
8940 | + myScroll.refresh(); | ||
8941 | + scH = $('#scroller').outerHeight(); | ||
8942 | + }, 1000); | ||
8943 | + | ||
8944 | + | ||
8945 | + }, | ||
8946 | + error: function() { | ||
8947 | + tip.show('网络断开连接了~'); | ||
8948 | + searching = false; | ||
8949 | + loading.hideLoadingMask(); | ||
8950 | + } | ||
8951 | + }); | ||
8952 | +} | ||
8953 | + | ||
8954 | +$.ajax({ | ||
8955 | + type: 'GET', | ||
8956 | + url: '/product/newsale/filter', | ||
8957 | + data: defaultOpt, | ||
8958 | + success: function(data) { | ||
8959 | + $goodsContainer.append(data); | ||
8960 | + | ||
8961 | + setTimeout(function () { | ||
8962 | + myScroll.refresh(); | ||
8963 | + scH = $('#scroller').outerHeight(); | ||
8964 | + }, 1000); | ||
8965 | + | ||
8966 | + | ||
8967 | + | ||
8968 | + //初始化filter&注册filter回调 | ||
8969 | + filter.initFilter({ | ||
8970 | + fCbFn: search, | ||
8971 | + hCbFn: function() { | ||
8972 | + | ||
8973 | + //切换active状态到$pre上 | ||
8974 | + $pre.addClass('active'); | ||
8975 | + $pre.siblings('.filter').removeClass('active'); | ||
8976 | + }, | ||
8977 | + missStatus: true | ||
8978 | + }); | ||
8979 | + } | ||
8980 | +}); | ||
8981 | + | ||
8982 | +$listNav.bind('contextmenu', function(e) { | ||
8983 | + return false; | ||
8984 | +}); | ||
8985 | + | ||
8986 | +$posList.bind('contextmenu', function(e) { | ||
8987 | + return false; | ||
8988 | +}); | ||
8989 | + | ||
8990 | +$subNav.on('touchend touchcancel', function(e) { | ||
8991 | + var $this = $(e.target).closest('li'), | ||
8992 | + cname, | ||
8993 | + nav, | ||
8994 | + navType, | ||
8995 | + $active; | ||
8996 | + | ||
8997 | + e.preventDefault(); | ||
8998 | + | ||
8999 | + if (typeof $this === 'undefined' || $this.length === 0) { | ||
9000 | + return; | ||
9001 | + } | ||
9002 | + | ||
9003 | + if ($this.hasClass('filter')) { | ||
9004 | + | ||
9005 | + //筛选面板切换状态 | ||
9006 | + if ($this.hasClass('active')) { | ||
9007 | + filter.hideFilter(); | ||
9008 | + | ||
9009 | + //点击筛选钱的active项回复active | ||
9010 | + $pre.addClass('active'); | ||
9011 | + $this.removeClass('active'); | ||
9012 | + } else { | ||
9013 | + $pre = $this.siblings('.active'); | ||
9014 | + | ||
9015 | + $pre.removeClass('active'); | ||
9016 | + $this.addClass('active'); | ||
9017 | + | ||
9018 | + filter.showFilter(); | ||
9019 | + } | ||
9020 | + } else { | ||
9021 | + if ($this.hasClass('new')) { | ||
9022 | + cname = '.new'; | ||
9023 | + navType = 'newest'; | ||
9024 | + } else if ($this.hasClass('price')) { | ||
9025 | + cname = '.price'; | ||
9026 | + navType = 'price'; | ||
9027 | + } else if ($this.hasClass('discount')) { | ||
9028 | + cname = '.discount'; | ||
9029 | + navType = 'discount'; | ||
9030 | + } | ||
9031 | + | ||
9032 | + nav = navInfo[navType]; | ||
9033 | + | ||
9034 | + if ($this.hasClass('active')) { | ||
9035 | + | ||
9036 | + //最新无排序切换 | ||
9037 | + if ($this.hasClass('new')) { | ||
9038 | + return; | ||
9039 | + } | ||
9040 | + | ||
9041 | + if ($this.hasClass('price') || $this.hasClass('discount')) { | ||
9042 | + $this = $subNav.find(cname); | ||
9043 | + | ||
9044 | + // 价格/折扣切换排序状态 | ||
9045 | + $this.find('.icon > .iconfont').toggleClass('cur'); | ||
9046 | + $pre = $this; //更新pre为当前项 | ||
9047 | + nav.reload = true; //重置reload,HTML会被替换为逆序的HTML | ||
9048 | + nav.order = nav.order === 0 ? 1 : 0; //切换排序 | ||
9049 | + } | ||
9050 | + } else { | ||
9051 | + $active = $subNav.find('.active'); | ||
9052 | + | ||
9053 | + $pre = $this; //$pre为除筛选导航的其他导航项,若当前active的为筛选,则把$pre置为当前点击项 | ||
9054 | + | ||
9055 | + if ($active.hasClass('filter')) { | ||
9056 | + | ||
9057 | + //若之前active项为筛选,则隐藏筛选面板 | ||
9058 | + filter.hideFilter(); | ||
9059 | + } else { | ||
9060 | + | ||
9061 | + //切换container显示 | ||
9062 | + $goodsContainer.children('.container:not(.hide)').addClass('hide'); | ||
9063 | + | ||
9064 | + switch (navType) { | ||
9065 | + case 'newest': | ||
9066 | + $ngc.removeClass('hide'); | ||
9067 | + break; | ||
9068 | + | ||
9069 | + case 'price': | ||
9070 | + $pgc.removeClass('hide'); | ||
9071 | + break; | ||
9072 | + | ||
9073 | + case 'discount': | ||
9074 | + $dgc.removeClass('hide'); | ||
9075 | + break; | ||
9076 | + } | ||
9077 | + } | ||
9078 | + | ||
9079 | + $subNav.children().removeClass('active'); | ||
9080 | + $subNav.find(cname).addClass('active'); | ||
9081 | + } | ||
9082 | + | ||
9083 | + if (nav.reload) { | ||
9084 | + search({ | ||
9085 | + type: 'shop_id', | ||
9086 | + id: $shopId, | ||
9087 | + url: '/index/search/search' | ||
9088 | + }); | ||
9089 | + } | ||
9090 | + } | ||
9091 | + e.stopPropagation(); | ||
9092 | +}); | ||
9093 | + | ||
9094 | + | ||
9095 | +function scrollHandler() { | ||
9096 | + | ||
9097 | + //当scroll到1/4$goodsContainer高度后继续请求下一页数据 | ||
9098 | + myScroll && myScroll.refresh(); | ||
9099 | + | ||
9100 | + if (sTop + winH > $('#scroller').height() - 0.25 * $goodsContainer.height() - 50){ | ||
9101 | + if ($pre !== undefined) { | ||
9102 | + search({ | ||
9103 | + type: 'shop_id', | ||
9104 | + id: $shopId, | ||
9105 | + url: '/index/search/search' | ||
9106 | + }); | ||
9107 | + } | ||
9108 | + } | ||
9109 | +} | ||
9110 | + | ||
9111 | +//srcoll to load more | ||
9112 | +$(window).scroll(function() { | ||
9113 | + window.requestAnimationFrame(scrollHandler); | ||
9114 | +}); | ||
9115 | + | ||
9116 | +//初始请求最新第一页数据 | ||
9117 | +search({ | ||
9118 | + type: 'shop_id', | ||
9119 | + id: $shopId, | ||
9120 | + url: '/index/search/search' | ||
9121 | + } | ||
9122 | +); | ||
9123 | + | ||
9124 | +$listNav.on('touchstart', 'li', function(e) { | ||
9125 | + $(this).addClass('bytouch'); | ||
9126 | +}).on('touchend touchcancel', function() { | ||
9127 | + $listNav.find('li').removeClass('bytouch'); | ||
9128 | + myScroll.refresh(); | ||
9129 | + | ||
9130 | + if (sTop > imgH + nav1H + main1oH) { | ||
9131 | + myScroll.scrollTo(0,-(imgH + nav1H + main1oH + 10)); | ||
9132 | + } | ||
9133 | +}); | ||
9134 | + | ||
9135 | +$posList.on('touchstart', 'li', function(e) { | ||
9136 | + $(this).addClass('bytouch'); | ||
9137 | +}).on('touchend touchcancel', function() { | ||
9138 | + $posList.find('li').removeClass('bytouch'); | ||
9139 | + myScroll.refresh(); | ||
9140 | + | ||
9141 | + if (sTop > imgH + nav1H + main1oH) { | ||
9142 | + myScroll.scrollTo(0,-(imgH + nav1H + main1oH + 10)); | ||
9143 | + } | ||
9144 | +}); | ||
9145 | + | ||
9146 | + | ||
9147 | + | ||
9148 | +//底部导航点击 | ||
9149 | +function fotterClick(group) { | ||
9150 | + $(group + ' li').on('touchstart', function() { | ||
9151 | + $('.sub-group').addClass('hide'); | ||
9152 | + if ($(this).find('.sub-group').length > 0){ | ||
9153 | + $(this).find('.sub-group').removeClass('hide'); | ||
9154 | + } | ||
9155 | + }); | ||
9156 | +}; | ||
9157 | + | ||
9158 | +fotterClick('.shop-foot-wrapper'); | ||
9159 | + | ||
9160 | +function stopPropagation(e) { | ||
9161 | + if (e.stopPropagation){ | ||
9162 | + e.stopPropagation(); | ||
9163 | + }else { | ||
9164 | + e.cancelBubble = true; } | ||
9165 | +} | ||
9166 | + | ||
9167 | +$(document).bind('touchstart', function(){ | ||
9168 | + $('.sub-group').addClass('hide'); | ||
9169 | +}); | ||
9170 | + | ||
9171 | +$('.shop-foot-wrapper').bind('touchstart',function(e){ | ||
9172 | + stopPropagation(e); | ||
9173 | +}); | ||
9174 | + | ||
9175 | +//收藏 | ||
9176 | +function postCollect(info) { | ||
9177 | + var url = ''; | ||
9178 | + | ||
9179 | + if (searching) { | ||
9180 | + return; | ||
9181 | + } | ||
9182 | + searching = true; | ||
9183 | + | ||
9184 | + $.ajax({ | ||
9185 | + method: 'post', | ||
9186 | + url: info.url, | ||
9187 | + data: info.data, | ||
9188 | + | ||
9189 | + success: function(data) { | ||
9190 | + | ||
9191 | + if (data.code === 200){ | ||
9192 | + if ($('#collect').hasClass('alreadyCollect')) { | ||
9193 | + $('#collect').attr('class', 'notCollect'); | ||
9194 | + }else{ | ||
9195 | + $('#collect').attr('class', 'alreadyCollect'); | ||
9196 | + } | ||
9197 | + } | ||
9198 | + | ||
9199 | + if (data.code === 401) { | ||
9200 | + url = data.url; | ||
9201 | + $('body').append('<a href=\'' + url + '\'><span class="jump-login"><span></a>'); | ||
9202 | + | ||
9203 | + $('.jump-login').click(); | ||
9204 | + } | ||
9205 | + | ||
9206 | + setTimeout(function () { | ||
9207 | + myScroll.refresh(); | ||
9208 | + scH = $('#scroller').outerHeight(); | ||
9209 | + }, 1000); | ||
9210 | + | ||
9211 | + searching = false; | ||
9212 | + }, | ||
9213 | + error: function() { | ||
9214 | + alert('网络断开连接了~'); | ||
9215 | + searching = false; | ||
9216 | + } | ||
9217 | + }); | ||
9218 | +} | ||
9219 | + | ||
9220 | +function collectShop() { | ||
9221 | + var qew = {}; | ||
9222 | + | ||
9223 | + qew.url = '/product/index/shopFav'; | ||
9224 | + qew.data = { | ||
9225 | + shop_id: $shopId, | ||
9226 | + app_version: $appVersion | ||
9227 | + }; | ||
9228 | + postCollect(qew); | ||
9229 | +} | ||
9230 | + | ||
9231 | +function cancelShop() { | ||
9232 | + var qew = {}; | ||
9233 | + | ||
9234 | + qew.url = '/product/index/cancelShopFav'; | ||
9235 | + qew.data = { | ||
9236 | + shop_id: $shopId, | ||
9237 | + app_version: $appVersion | ||
9238 | + }; | ||
9239 | + postCollect(qew); | ||
9240 | +} | ||
9241 | + | ||
9242 | +$('#collect').bind('touchstart', function() { | ||
9243 | + if ($('#collect').hasClass('alreadyCollect')) { | ||
9244 | + cancelShop(); | ||
9245 | + }else{ | ||
9246 | + collectShop(); | ||
9247 | + } | ||
9248 | + }); | ||
9249 | + | ||
9250 | + | ||
9251 | + | ||
9252 | +}); | ||
9253 | +define("js/me/entry", ["jquery","hammer","lazyload","handlebars","source-map","swiper","mlellipsis","index"], function(require, exports, module){ | ||
9254 | +/** | ||
9255 | + * 个人中心js打包入口文件 | ||
9256 | + * @author: xuqi<qi.xu@yoho.cn> | ||
9257 | + * @date: 2015/11/10 | ||
9258 | + */ | ||
9259 | + | ||
9260 | +require("js/me/order"); | ||
9261 | +require("js/me/order-detail"); | ||
9262 | +require("js/me/fav"); | ||
9263 | +require("js/me/suggest"); | ||
9264 | +require("js/me/index"); | ||
9265 | +require("js/me/coupons"); | ||
9266 | +require("js/me/online-service"); | ||
9267 | +require("js/me/address"); | ||
9268 | +require("js/me/suggest"); | ||
9269 | +require("js/me/browse-record"); | ||
9270 | +require("js/me/address-act"); | ||
9271 | +require("js/me/logistic"); | ||
9272 | +require("js/me/pay"); | ||
9273 | +require("js/me/personal-details"); | ||
9274 | +require("js/me/currency"); | ||
9275 | +require("js/me/currency-new"); | ||
9276 | +require("js/me/message"); | ||
9277 | +require("js/me/message-detail"); | ||
9278 | + | ||
9279 | +}); | ||
9280 | +define("js/me/order", ["jquery","hammer","lazyload","handlebars","source-map"], function(require, exports, module){ | ||
9281 | +/** | ||
9282 | + * 个人中心--我的订单 | ||
9283 | + * @author: xuqi<qi.xu@yoho.cn> | ||
9284 | + * @date: 2015/11/10 | ||
9285 | + */ | ||
9286 | + | ||
9287 | +var $ = require("jquery"), | ||
9288 | + Hammer = require("hammer"), | ||
9289 | + lazyLoad = require("lazyload"), | ||
9290 | + tip = require("js/plugin/tip"); | ||
9291 | + | ||
9292 | +var $navLi = $('#order-nav > li'), | ||
9293 | + $orderContainer = $('#order-container'); | ||
9294 | + | ||
9295 | +var $curContainer = $orderContainer.children('.orders:not(.hide)');//保存当前显示的order-container | ||
9296 | + | ||
9297 | +var winH = $(window).height(); | ||
9298 | + | ||
9299 | +var activeType = $navLi.filter('.active').data('type'); //当前active的项的index | ||
9300 | + | ||
9301 | +var order = { | ||
9302 | + page: 0, | ||
9303 | + end: false | ||
9304 | +}; | ||
9305 | + | ||
9306 | +var inAjax = false; | ||
9307 | + | ||
9308 | +var loading = require("js/plugin/loading"); | ||
9309 | + | ||
9310 | +var dialog = require("js/me/dialog"); | ||
9311 | + | ||
9312 | +var orderHammer; | ||
9313 | + | ||
9314 | +//加载订单 | ||
9315 | +function getOrders(option) { | ||
9316 | + var opt = { | ||
9317 | + type: activeType, | ||
9318 | + page: order.page + 1 | ||
9319 | + }; | ||
9320 | + | ||
9321 | + var show = option && !option.noLoadingMask; | ||
9322 | + | ||
9323 | + if (inAjax) { | ||
9324 | + return; | ||
9325 | + } | ||
9326 | + | ||
9327 | + inAjax = true; | ||
9328 | + show && loading.showLoadingMask(); | ||
9329 | + | ||
9330 | + $.ajax({ | ||
9331 | + type: 'GET', | ||
9332 | + url: '/home/getOrders', | ||
9333 | + data: opt, | ||
9334 | + success: function(data) { | ||
9335 | + var num; | ||
9336 | + | ||
9337 | + if (data !== ' ') { | ||
9338 | + order.page = opt.page; | ||
9339 | + | ||
9340 | + if (opt.page === 1) { | ||
9341 | + $curContainer.html(data); | ||
9342 | + lazyLoad($curContainer.find('.lazy'), { | ||
9343 | + try_again_css: 'order-failure' | ||
9344 | + }); | ||
9345 | + } else { | ||
9346 | + num = $curContainer.children('.order').length; | ||
9347 | + $curContainer.append(data); | ||
9348 | + | ||
9349 | + //lazyload | ||
9350 | + lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ')').find('.lazy'), { | ||
9351 | + try_again_css: 'order-failure' | ||
9352 | + }); | ||
9353 | + } | ||
9354 | + | ||
9355 | + window.rePosFooter(); //重新计算底部位置 | ||
9356 | + } else { | ||
9357 | + order.end = true; | ||
9358 | + } | ||
9359 | + | ||
9360 | + inAjax = false; | ||
9361 | + show && loading.hideLoadingMask(); | ||
9362 | + } | ||
9363 | + }); | ||
9364 | +} | ||
9365 | + | ||
9366 | +lazyLoad({ | ||
9367 | + try_again_css: 'order-failure' | ||
9368 | +}); | ||
9369 | + | ||
9370 | +//初始化导航 | ||
9371 | +(function() { | ||
9372 | + var liCount = $navLi.length; | ||
9373 | + | ||
9374 | + //默认4个导航项 | ||
9375 | + if (liCount === 4) { | ||
9376 | + return; | ||
9377 | + } | ||
9378 | + | ||
9379 | + $navLi.width(100 / liCount + '%'); | ||
9380 | +}()); | ||
9381 | + | ||
9382 | +loading.init($('body')); //满屏loading | ||
9383 | + | ||
9384 | +//点击订单区域跳转订单详情页 | ||
9385 | +orderHammer = new Hammer(document.getElementById('order-container')); | ||
9386 | +orderHammer.on('tap', function(e) { | ||
9387 | + var $cur = $(e.target), | ||
9388 | + $order, | ||
9389 | + id, | ||
9390 | + url; | ||
9391 | + | ||
9392 | + if ($cur.closest('.locHref').length > 0) { | ||
9393 | + return; | ||
9394 | + } | ||
9395 | + | ||
9396 | + $order = $cur.closest('.order'); | ||
9397 | + id = $order.data('id'); | ||
9398 | + | ||
9399 | + if ($cur.closest('.del').length > 0) { | ||
9400 | + | ||
9401 | + //Order delete | ||
9402 | + dialog.showDialog({ | ||
9403 | + dialogText: '确定删除订单吗?', | ||
9404 | + hasFooter: { | ||
9405 | + leftBtnText: '取消', | ||
9406 | + rightBtnText: '确定' | ||
9407 | + } | ||
9408 | + }, function() { | ||
9409 | + $.ajax({ | ||
9410 | + type: 'GET', | ||
9411 | + url: '/home/delOrder', | ||
9412 | + data: { | ||
9413 | + id: id | ||
9414 | + }, | ||
9415 | + success: function(data) { | ||
8542 | dialog.hideDialog(); | 9416 | dialog.hideDialog(); |
8543 | if (data.message) { | 9417 | if (data.message) { |
8544 | tip.show(data.message); | 9418 | tip.show(data.message); |
@@ -8705,7 +9579,9 @@ optHammer.on('tap', function(e) { | @@ -8705,7 +9579,9 @@ optHammer.on('tap', function(e) { | ||
8705 | }); | 9579 | }); |
8706 | } | 9580 | } |
8707 | }); | 9581 | }); |
8708 | - | 9582 | +$(".owner-info").on('touchend',function(){ |
9583 | + location.href='/home/address'; | ||
9584 | +}) | ||
8709 | }); | 9585 | }); |
8710 | define("js/me/fav", ["jquery","hammer","swiper","handlebars","source-map","index"], function(require, exports, module){ | 9586 | define("js/me/fav", ["jquery","hammer","swiper","handlebars","source-map","index"], function(require, exports, module){ |
8711 | /** | 9587 | /** |
@@ -10839,6 +11715,24 @@ loading.showLoadingMask(); | @@ -10839,6 +11715,24 @@ loading.showLoadingMask(); | ||
10839 | 11715 | ||
10840 | $(document).ready(main); | 11716 | $(document).ready(main); |
10841 | 11717 | ||
11718 | +$('.box').on('click', function() { | ||
11719 | + var url = $('.payapp-list a').attr('href'), | ||
11720 | + theRequest = [], | ||
11721 | + orderCode, | ||
11722 | + payment; | ||
11723 | + | ||
11724 | + if (url.indexOf("?") != -1) { | ||
11725 | + theRequest = url.split('?')[1].split("&"); | ||
11726 | + orderCode=theRequest[0].split('=')[1]; | ||
11727 | + payment=theRequest[1].split('=')[1]; | ||
11728 | + } | ||
11729 | + | ||
11730 | + $.ajax({ | ||
11731 | + url:'/shopping/pay/addPaymentInterval?orderCode=' + orderCode + '&payment=' + payment, | ||
11732 | + method:'get' | ||
11733 | + }); | ||
11734 | +}); | ||
11735 | + | ||
10842 | 11736 | ||
10843 | }); | 11737 | }); |
10844 | define("js/me/personal-details", ["jquery"], function(require, exports, module){ | 11738 | define("js/me/personal-details", ["jquery"], function(require, exports, module){ |
@@ -11060,6 +11954,7 @@ require("js/cart/gift-advance"); | @@ -11060,6 +11954,7 @@ require("js/cart/gift-advance"); | ||
11060 | require("js/cart/order-ensure"); | 11954 | require("js/cart/order-ensure"); |
11061 | require("js/cart/select-coupon"); | 11955 | require("js/cart/select-coupon"); |
11062 | require("js/cart/select-address"); | 11956 | require("js/cart/select-address"); |
11957 | +require("js/cart/jit-detail"); | ||
11063 | 11958 | ||
11064 | }); | 11959 | }); |
11065 | define("js/cart/cart", ["jquery","mlellipsis","hammer","handlebars","source-map","swiper","lazyload","index"], function(require, exports, module){ | 11960 | define("js/cart/cart", ["jquery","mlellipsis","hammer","handlebars","source-map","swiper","lazyload","index"], function(require, exports, module){ |
@@ -12037,7 +12932,7 @@ function phoneHidden(phone) { | @@ -12037,7 +12932,7 @@ function phoneHidden(phone) { | ||
12037 | 12932 | ||
12038 | $('.info-phone').html(phoneHidden($('.info-phone').html())); | 12933 | $('.info-phone').html(phoneHidden($('.info-phone').html())); |
12039 | 12934 | ||
12040 | -if (orderInfo('address').is_support === 'N') { | 12935 | +if (orderInfo('address') && orderInfo('address').is_support === 'N') { |
12041 | orderInfo('deliveryId', $('.delivery-id .icon-cb-radio').data('id')); | 12936 | orderInfo('deliveryId', $('.delivery-id .icon-cb-radio').data('id')); |
12042 | orderCompute(); | 12937 | orderCompute(); |
12043 | } | 12938 | } |
@@ -12321,3 +13216,37 @@ $confim.on('touchend', '.confim', function() { | @@ -12321,3 +13216,37 @@ $confim.on('touchend', '.confim', function() { | ||
12321 | }); | 13216 | }); |
12322 | 13217 | ||
12323 | }); | 13218 | }); |
13219 | +define("js/cart/jit-detail", ["swiper","jquery","index"], function(require, exports, module){ | ||
13220 | +/** | ||
13221 | + * jit拆单配送信息页面 | ||
13222 | + * @author: zhaobiao<bill.zhao@yoho.cn> | ||
13223 | + * @date: 2016/04/26 | ||
13224 | + */ | ||
13225 | + | ||
13226 | +var Swiper = require("swiper"), | ||
13227 | + $ = require("jquery"); | ||
13228 | + | ||
13229 | +var height = $(window).height() - $('#yoho-header').height(); | ||
13230 | + | ||
13231 | +// 为了展示页面背景色,需要把页面根据窗口大小撑开 | ||
13232 | +$('.jit-detail-page').css('height', height); | ||
13233 | + | ||
13234 | +$('.jit-detail-page>div').show(); | ||
13235 | + | ||
13236 | +// 内容展示之后,再根据document高度,调整一次容器高度 | ||
13237 | +height = $(document).height() - $('#yoho-header').height(); | ||
13238 | +$('.jit-detail-page').css('height', height); | ||
13239 | + | ||
13240 | + | ||
13241 | +(function() { | ||
13242 | + return new Swiper('.swiper-container', { | ||
13243 | + slidesPerView: 'auto', | ||
13244 | + grabCursor: true, | ||
13245 | + slideElement: 'a', | ||
13246 | + lazyLoading: true, | ||
13247 | + watchSlidesVisibility: true | ||
13248 | + }); | ||
13249 | +})(); | ||
13250 | + | ||
13251 | + | ||
13252 | +}); |
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
No preview for this file type
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > | 2 | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > |
3 | <svg xmlns="http://www.w3.org/2000/svg"> | 3 | <svg xmlns="http://www.w3.org/2000/svg"> |
4 | <metadata> | 4 | <metadata> |
5 | -Created by FontForge 20120731 at Fri Apr 15 10:26:51 2016 | 5 | +Created by FontForge 20120731 at Wed Apr 27 17:15:53 2016 |
6 | By admin | 6 | By admin |
7 | </metadata> | 7 | </metadata> |
8 | <defs> | 8 | <defs> |
@@ -19,7 +19,7 @@ Created by FontForge 20120731 at Fri Apr 15 10:26:51 2016 | @@ -19,7 +19,7 @@ Created by FontForge 20120731 at Fri Apr 15 10:26:51 2016 | ||
19 | bbox="-0.75 -224 3943 896" | 19 | bbox="-0.75 -224 3943 896" |
20 | underline-thickness="50" | 20 | underline-thickness="50" |
21 | underline-position="-100" | 21 | underline-position="-100" |
22 | - unicode-range="U+0078-E648" | 22 | + unicode-range="U+0078-E649" |
23 | /> | 23 | /> |
24 | <missing-glyph horiz-adv-x="374" | 24 | <missing-glyph horiz-adv-x="374" |
25 | d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" /> | 25 | 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 | @@ -263,5 +263,8 @@ t94.5 -142t142 -94.5t172.5 -35t172.5 35t142 94.5t94.5 142t35 172.5t-35 172.5t-94 | ||
263 | <glyph glyph-name="uniE648" unicode="" | 263 | <glyph glyph-name="uniE648" unicode="" |
264 | 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 | 264 | 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 |
265 | 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" /> | 265 | 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" /> |
266 | + <glyph glyph-name="uniE649" unicode="" | ||
267 | +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 | ||
268 | +t-22 15.5zM751 552v83h-473v-83h206v-298h-72v237h-87v-237h-66v-84h506v84h-193v119h151v83h-151v96h179z" /> | ||
266 | </font> | 269 | </font> |
267 | </defs></svg> | 270 | </defs></svg> |
No preview for this file type
No preview for this file type
-
Please register or login to post a comment