Showing
1 changed file
with
18 additions
and
39 deletions
@@ -833,24 +833,8 @@ $subNav.on('touchend touchcancel', function(e) { | @@ -833,24 +833,8 @@ $subNav.on('touchend touchcancel', function(e) { | ||
833 | } | 833 | } |
834 | 834 | ||
835 | nav = navInfo[navType]; | 835 | nav = navInfo[navType]; |
836 | - | ||
837 | - if ($this.hasClass('active')) { | ||
838 | - | ||
839 | - // 最新无排序切换 | ||
840 | - if ($this.hasClass('new')) { | ||
841 | - return; | ||
842 | - } | ||
843 | - | ||
844 | - if ($this.hasClass('price') || $this.hasClass('discount')) { | ||
845 | - $this = $subNav.find(cname); | ||
846 | - | ||
847 | - // 价格/折扣切换排序状态 | ||
848 | - $this.find('.icon > .iconfont').toggleClass('cur'); | ||
849 | - nav.reload = true; // 重置reload,HTML会被替换为逆序的HTML | ||
850 | - nav.order = nav.order === 0 ? 1 : 0; // 切换排序 | ||
851 | - | 836 | + var reloadCb = function() { |
852 | $goodsContainer.children('.container:not(.hide)').addClass('hide'); | 837 | $goodsContainer.children('.container:not(.hide)').addClass('hide'); |
853 | - | ||
854 | switch (navType) { | 838 | switch (navType) { |
855 | case 'newest': | 839 | case 'newest': |
856 | $ngc.removeClass('hide'); | 840 | $ngc.removeClass('hide'); |
@@ -869,6 +853,21 @@ $subNav.on('touchend touchcancel', function(e) { | @@ -869,6 +853,21 @@ $subNav.on('touchend touchcancel', function(e) { | ||
869 | default: | 853 | default: |
870 | break; | 854 | break; |
871 | } | 855 | } |
856 | + } | ||
857 | + if ($this.hasClass('active')) { | ||
858 | + | ||
859 | + // 最新无排序切换 | ||
860 | + if ($this.hasClass('new')) { | ||
861 | + return; | ||
862 | + } | ||
863 | + | ||
864 | + if ($this.hasClass('price') || $this.hasClass('discount')) { | ||
865 | + $this = $subNav.find(cname); | ||
866 | + | ||
867 | + // 价格/折扣切换排序状态 | ||
868 | + $this.find('.icon > .iconfont').toggleClass('cur'); | ||
869 | + nav.reload = true; // 重置reload,HTML会被替换为逆序的HTML | ||
870 | + nav.order = nav.order === 0 ? 1 : 0; // 切换排序 | ||
872 | 871 | ||
873 | } | 872 | } |
874 | } else { | 873 | } else { |
@@ -881,26 +880,7 @@ $subNav.on('touchend touchcancel', function(e) { | @@ -881,26 +880,7 @@ $subNav.on('touchend touchcancel', function(e) { | ||
881 | } else { | 880 | } else { |
882 | 881 | ||
883 | // 切换container显示 | 882 | // 切换container显示 |
884 | - $goodsContainer.children('.container:not(.hide)').addClass('hide'); | ||
885 | - | ||
886 | - switch (navType) { | ||
887 | - case 'newest': | ||
888 | - $ngc.removeClass('hide'); | ||
889 | - break; | ||
890 | - | ||
891 | - case 'price': | ||
892 | - $pgc.removeClass('hide'); | ||
893 | - break; | ||
894 | - | ||
895 | - case 'discount': | ||
896 | - $dgc.removeClass('hide'); | ||
897 | - break; | ||
898 | - case 'default': | ||
899 | - $defaultgc.removeClass('hide'); | ||
900 | - break; | ||
901 | - default: | ||
902 | - break; | ||
903 | - } | 883 | + reloadCb(); |
904 | } | 884 | } |
905 | 885 | ||
906 | $subNav.children().removeClass('active'); | 886 | $subNav.children().removeClass('active'); |
@@ -915,8 +895,7 @@ $subNav.on('touchend touchcancel', function(e) { | @@ -915,8 +895,7 @@ $subNav.on('touchend touchcancel', function(e) { | ||
915 | appVersion: appVersion, | 895 | appVersion: appVersion, |
916 | url: '/product/search/search', | 896 | url: '/product/search/search', |
917 | nextPage: false | 897 | nextPage: false |
918 | - }, function() { | ||
919 | - }); | 898 | + }, reloadCb); |
920 | } | 899 | } |
921 | } | 900 | } |
922 | e.stopPropagation(); | 901 | e.stopPropagation(); |
-
Please register or login to post a comment