Showing
10 changed files
with
1698 additions
and
23 deletions
@@ -23,28 +23,28 @@ const _getShopData = (shopId, uid, isApp) => { | @@ -23,28 +23,28 @@ const _getShopData = (shopId, uid, isApp) => { | ||
23 | let channel = req.yoho.channel; | 23 | let channel = req.yoho.channel; |
24 | isApp = isApp || ''; | 24 | isApp = isApp || ''; |
25 | 25 | ||
26 | - //Promise.all([searchModel.getShopDecorator(shopId),searchModel.getShopInfo(shopId, uid)]).then((result) => { | ||
27 | - // data = { | ||
28 | - // decorator: result[0], // 店铺装修资源数据 | ||
29 | - // shopInfo: result[1] // 店铺信息 | ||
30 | - // }; | ||
31 | - // | ||
32 | - // // 店铺使用基础模板,返回品牌页面 | ||
33 | - // if (data.shopInfo.data.shopTemplateType && data.shopInfo.data.shopTemplateType ===1) { | ||
34 | - // return { | ||
35 | - // goBrand: data.shopInfo.data | ||
36 | - // } | ||
37 | - // } | ||
38 | - // | ||
39 | - // // 店铺分类 | ||
40 | - // return searchModel.getShopCategory(shopId, channel); | ||
41 | - //}).then(shopCategory => { | ||
42 | - // _.assign({ | ||
43 | - // shopCategory: shopCategory | ||
44 | - // }, data); | ||
45 | - // | ||
46 | - // return searchModel.formShopData(data, shopId, isApp); // 组织楼层数据 | ||
47 | - //}); | 26 | + Promise.all([searchModel.getShopDecorator(shopId),searchModel.getShopInfo(shopId, uid)]).then((result) => { |
27 | + data = { | ||
28 | + decorator: result[0], // 店铺装修资源数据 | ||
29 | + shopInfo: result[1] // 店铺信息 | ||
30 | + }; | ||
31 | + | ||
32 | + // 店铺使用基础模板,返回品牌页面 | ||
33 | + if (data.shopInfo.data.shopTemplateType && data.shopInfo.data.shopTemplateType ===1) { | ||
34 | + return { | ||
35 | + goBrand: data.shopInfo.data | ||
36 | + } | ||
37 | + } | ||
38 | + | ||
39 | + // 店铺分类 | ||
40 | + return searchModel.getShopCategory(shopId, channel); | ||
41 | + }).then(shopCategory => { | ||
42 | + _.assign({ | ||
43 | + shopCategory: shopCategory | ||
44 | + }, data); | ||
45 | + | ||
46 | + return searchModel.formShopData(data, shopId, isApp); // 组织楼层数据 | ||
47 | + }); | ||
48 | }; | 48 | }; |
49 | 49 | ||
50 | /** | 50 | /** |
@@ -421,7 +421,7 @@ const getShopCategory = (shopId, channel) => { | @@ -421,7 +421,7 @@ const getShopCategory = (shopId, channel) => { | ||
421 | * 组织店铺页面数据 | 421 | * 组织店铺页面数据 |
422 | * @param {array} data 接口返回的店铺页所需数据 | 422 | * @param {array} data 接口返回的店铺页所需数据 |
423 | * @param {int} shopId 店铺id | 423 | * @param {int} shopId 店铺id |
424 | - * @param {int} isAap app版本 | 424 | + * @param {int} isApp app版本 |
425 | * @return array | 425 | * @return array |
426 | */ | 426 | */ |
427 | const formShopData = (data, shopId, isApp) => { | 427 | const formShopData = (data, shopId, isApp) => { |
@@ -61,5 +61,6 @@ router.get('/search/search', search.search); | @@ -61,5 +61,6 @@ router.get('/search/search', search.search); | ||
61 | router.get('/index/index', search.category); | 61 | router.get('/index/index', search.category); |
62 | router.get('/index/brand', search.brand); | 62 | router.get('/index/brand', search.brand); |
63 | router.post('/opt/favoriteBrand', search.favoriteBrand); | 63 | router.post('/opt/favoriteBrand', search.favoriteBrand); |
64 | +router.get('/opt/favoriteBrand', search.favoriteBrand); | ||
64 | 65 | ||
65 | module.exports = router; | 66 | module.exports = router; |
apps/product/views/action/shop/index.hbs
0 → 100644
1 | +{{# shopIndex}} | ||
2 | + <div class="shop-index yoho-page" id="wrapper"> | ||
3 | + <div id="scroller"> | ||
4 | + <div id="nav-top"> | ||
5 | + {{!--{{# headerBanner}} | ||
6 | + {{> resources/banner-top}} | ||
7 | + {{/ headerBanner}}--}} | ||
8 | + <div class="search-area"> | ||
9 | + <div id="search-input" class="search-input"> | ||
10 | + <form id="search-form" action={{url}} method="get"> | ||
11 | + <i class="search-icon iconfont"></i> | ||
12 | + <input type="text" placeholder="搜索店铺内潮品" name="query" class="buriedpoint" data-bp-id="shop_search_input_1"> | ||
13 | + <input type="hidden" name="from" value="search"> | ||
14 | + <i class="clear-input iconfont hide"></i> | ||
15 | + <span id="search" class="search buriedpoint" type="submit" data-bp-id="shop_search_btn_0">搜索</span> | ||
16 | + </form> | ||
17 | + </div> | ||
18 | + </div> | ||
19 | + <div class="branner-top"> | ||
20 | + <img src="{{branerImg}}"> | ||
21 | + <img class="logo" src=""></div> | ||
22 | + <p class="name">Vans专营店</p> | ||
23 | + <div class="collect"></div> | ||
24 | + </div> | ||
25 | + </div> | ||
26 | + | ||
27 | + <ul id="nav" class="nav"> | ||
28 | + <li class="active color buriedpoint" tab="home-page" data-bp-id="shop_nav_index_1">首页</li> | ||
29 | + <li tab="new-arrival" class="buriedpoint" data-bp-id="shop_nav_new_1">上新</li> | ||
30 | + <li tab="popularity" class="buriedpoint" data-bp-id="shop_nav_populary_1">人气</li> | ||
31 | + <li class="buriedpoint" data-bp-id="shop_nav_all_1"> | ||
32 | + <a href="#" target="_blank">全部商品</a> | ||
33 | + </li> | ||
34 | + </ul> | ||
35 | + | ||
36 | + <div id="home-page"> | ||
37 | + <div id="nav-main" class="main"> | ||
38 | + {{#unless brands}} | ||
39 | + <div class="multi-brands"> | ||
40 | + <h2>品牌一览</h2> | ||
41 | + <div class="multi-browse"> | ||
42 | + <ul class="swiper-wrapper"> | ||
43 | + {{#each multiList}} | ||
44 | + <li class="swiper-slide brand-img buriedpoint" data-bp-id="shop_brand_{{img}}_0"> | ||
45 | + <a href="{{url}}"> | ||
46 | + <img src="{{img}}"> | ||
47 | + </a> | ||
48 | + <p>{{brandName}}</p> | ||
49 | + </li> | ||
50 | + {{/each}} | ||
51 | + </ul> | ||
52 | + </div> | ||
53 | + </div> | ||
54 | + {{/unless}} | ||
55 | + | ||
56 | + <div class="banner-area"> | ||
57 | + {{# bannerTop}} | ||
58 | + {{> home/banner_top}} | ||
59 | + {{/ bannerTop}} | ||
60 | + </div> | ||
61 | + | ||
62 | + <ul class="spring"> | ||
63 | + {{#each spring}} | ||
64 | + <li class="buriedpoint" data-bp-id="shop_spring_{{img}}_0" > | ||
65 | + <a href="{{url}}"> | ||
66 | + <img src="{{springType}}"> | ||
67 | + </a> | ||
68 | + </li> | ||
69 | + {{/each}} | ||
70 | + </ul> | ||
71 | + | ||
72 | + {{! 热门品类}} | ||
73 | + {{# hotCategory}} | ||
74 | + {{> resources/hot-category}} | ||
75 | + {{/ hotCategory}} | ||
76 | + | ||
77 | + <div class="popularity-title"> | ||
78 | + 人气单品 | ||
79 | + <a class="more" href="{{more_url}}"></a> | ||
80 | + </div> | ||
81 | + | ||
82 | + <ul class="product-list"> | ||
83 | + {{#each hotList}} | ||
84 | + <li class="buriedpoint" data-bp-id="shop_hotcategory_{{listUrl}}_0"> | ||
85 | + <a href="{{url}}"> | ||
86 | + <img src="{{listUrl}}"> | ||
87 | + </a> | ||
88 | + <div class="list-price"> | ||
89 | + <p>VANS AP M BERZE</p> | ||
90 | + <p><span class="red">{{originalPrice}}</span> | ||
91 | + <span>{{presentPrice}}</span> | ||
92 | + </p> | ||
93 | + </div> | ||
94 | + </li> | ||
95 | + {{/each}} | ||
96 | + </ul> | ||
97 | + </div> | ||
98 | + | ||
99 | + <div class="discount-area"> | ||
100 | + {{> shop/goods-nav-top}} | ||
101 | + </div> | ||
102 | + </div> | ||
103 | + <div id="new-arrival" class=""></div> | ||
104 | + <div id="popularity" class=""></div> | ||
105 | + </div> | ||
106 | + {{> shop/shop-footer}} | ||
107 | + <ul id="pos-nav" class="nav hide"> | ||
108 | + <li class="active color buriedpoint" data-bp-id="shop_nav_index_1">首页</li> | ||
109 | + <li class="buriedpoint" data-bp-id="shop_nav_new_1">上新</li> | ||
110 | + <li class="buriedpoint" data-bp-id="shop_nav_populary_1">人气</li> | ||
111 | + <li class="buriedpoint" data-bp-id="shop_nav_all_1"> | ||
112 | + <a href="#" target="_blank">全部商品</a> | ||
113 | + </li> | ||
114 | + </ul> | ||
115 | + | ||
116 | + <ul id="pos-list " class="list-nav hide"> | ||
117 | + <li class="new active buriedpoint" data-bp-id="shop_listnav_new_1"> | ||
118 | + <a href="javascript:void(0);"> | ||
119 | + <span class="spanTest">最新</span> | ||
120 | + <span class="iconfont cur"></span> | ||
121 | + </a> | ||
122 | + </li> | ||
123 | + <li class="price buriedpoint" data-bp-id="shop_listnav_price_1"> | ||
124 | + <a href="javascript:void(0);"> | ||
125 | + <span class="spanTest">价格</span> | ||
126 | + <span class="icon"> | ||
127 | + <i class="iconfont up cur"></i> | ||
128 | + <i class="iconfont down"></i> | ||
129 | + </span> | ||
130 | + </a> | ||
131 | + </li> | ||
132 | + <li class="discount buriedpoint" data-bp-id="shop_listnav_discount_true"> | ||
133 | + <a href="javascript:void(0);"> | ||
134 | + <span class="spanTest">折扣</span> | ||
135 | + <span class="icon"> | ||
136 | + <i class="iconfont up cur"></i> | ||
137 | + <i class="iconfont down"></i> | ||
138 | + </span> | ||
139 | + </a> | ||
140 | + </li> | ||
141 | + <li class="filter buriedpoint" data-bp-id="shop_listnav_filter_1"> | ||
142 | + <a href="javascript:void(0);"> | ||
143 | + <span class="spanTest">筛选</span> | ||
144 | + <span class="iconfont cur"></span> | ||
145 | + </a> | ||
146 | + </li> | ||
147 | + </ul> | ||
148 | + </div> | ||
149 | +{{/ shopIndex}} |
1 | +<ul id="list-nav" class="home-sub-nav list-nav clearfix"> | ||
2 | + <li data-bp-id="shop_listnav_new_1" class="new active buriedpoint"> | ||
3 | + <a href="javascript:void(0);"> | ||
4 | + <span class="spanTest">最新</span> | ||
5 | + <span class="iconfont cur"></span> | ||
6 | + </a> | ||
7 | + </li> | ||
8 | + <li class="price buriedpoint" data-bp-id="shop_listnav_price_1"> | ||
9 | + <a href="javascript:void(0);"> | ||
10 | + <span class="spanTest">价格</span> | ||
11 | + <span class="icon"> | ||
12 | + <i class="iconfont up cur"></i> | ||
13 | + <i class="iconfont down"></i> | ||
14 | + </span> | ||
15 | + </a> | ||
16 | + </li> | ||
17 | + <li class="discount buriedpoint" data-bp-id="shop_listnav_discount_1"> | ||
18 | + <a href="javascript:void(0);"> | ||
19 | + <span class="spanTest">折扣</span> | ||
20 | + <span class="icon"> | ||
21 | + <i class="iconfont up cur"></i> | ||
22 | + <i class="iconfont down"></i> | ||
23 | + </span> | ||
24 | + </a> | ||
25 | + </li> | ||
26 | + <li class="filter buriedpoint" data-bp-id="shop_listnav_filter_1"> | ||
27 | + <a href="javascript:void(0);"> | ||
28 | + <span class="spanTest">筛选</span> | ||
29 | + <span class="iconfont cur"></span> | ||
30 | + </a> | ||
31 | + </li> | ||
32 | +</ul> | ||
33 | + | ||
34 | +<div id="goods-container" class="goods-container"> | ||
35 | + <div class="new-goods container clearfix"> | ||
36 | + {{# goods}} | ||
37 | + {{> common/goods}} | ||
38 | + {{/ goods}} | ||
39 | + </div> | ||
40 | + <div class="price-goods container hide clearfix"></div> | ||
41 | + <div class="discount-goods container hide clearfix"></div> | ||
42 | + | ||
43 | + {{> common/filter}} | ||
44 | +</div> |
1 | +<div class="shop-foot-wrapper"> | ||
2 | + <ul{{#if brandList}} class="foot-list-3"{{/if}}> | ||
3 | + <li data-bp-id="shop_footnav_one_1" class="buriedpoint"> | ||
4 | + {{#if shopCategory.url}} | ||
5 | + <a href="{{shopCategory.url}}">商品分类</a> | ||
6 | + {{^}} | ||
7 | + 商品分类 | ||
8 | + <div class="sub-group hide"> | ||
9 | + <dl> | ||
10 | + {{# shopCategory.list}} | ||
11 | + <dd data-bp-id="shop_subgroup_{{name}}_1" class="buriedpoint"><a href="{{url}}">{{name}}</a></dd> | ||
12 | + {{/ shopCategory.list}} | ||
13 | + </dl> | ||
14 | + <div class="sharp"></div> | ||
15 | + </div> | ||
16 | + {{/if}} | ||
17 | + <div class="wall"></div> | ||
18 | + </li> | ||
19 | + {{#if brandList}} | ||
20 | + <li data-bp-id="shop_footnav_two_1" class="buriedpoint"> | ||
21 | + {{#if brandList.url}} | ||
22 | + <a href="{{brandList.url}}">品牌一览</a> | ||
23 | + {{^}} | ||
24 | + 品牌一览 | ||
25 | + <div class="sub-group hide"> | ||
26 | + <dl> | ||
27 | + {{# brandList.list}} | ||
28 | + <dd><a href="{{url}}" data-bp-id="shop_subgroup_{{brandName}}_1" class="buriedpoint">{{brandName}}</a></dd> | ||
29 | + {{/ brandList.list}} | ||
30 | + </dl> | ||
31 | + <div class="sharp"></div> | ||
32 | + </div> | ||
33 | + {{/if}} | ||
34 | + <div class="wall"></div> | ||
35 | + </li> | ||
36 | + {{/if}} | ||
37 | + <li data-bp-id="shop_footnav_three_1" class="buriedpoint"> | ||
38 | + <a href="{{shopIntroHref}}">店铺简介</a> | ||
39 | + </li> | ||
40 | + </ul> | ||
41 | +</div> |
public/js/product/shop.page.js
0 → 100644
1 | +request('../shop/shop'); |
public/js/product/shop/shop.js
0 → 100644
1 | +/** | ||
2 | + * 品牌店铺首页 | ||
3 | + */ | ||
4 | + | ||
5 | +var $ = require('jquery'), | ||
6 | + IScroll = require('iscroll/iscroll-probe'), | ||
7 | + lazyLoad = require('yoho.lazyload'), | ||
8 | + Swiper = require('yoho.iswiper'), | ||
9 | + bannerSwiper, | ||
10 | + multiSwiper, | ||
11 | + myScroll, | ||
12 | + imgH, | ||
13 | + nav1H, | ||
14 | + main1H, | ||
15 | + main1oH, | ||
16 | + nav2H, | ||
17 | + main2oH, | ||
18 | + scH, | ||
19 | + $nav1 = $('#pos-nav'), | ||
20 | + $nav2 = $('#pos-list'), | ||
21 | + sTop; | ||
22 | + | ||
23 | +var tip = require('../plugin/tip'), | ||
24 | + filter = require('../plugin/filter'), | ||
25 | + loading = require('../plugin/loading'); | ||
26 | + | ||
27 | +var $subNav = $('.home-sub-nav'), | ||
28 | + $goodsContainer = $('#goods-container'), | ||
29 | + $goodsChildren = $goodsContainer.children(), | ||
30 | + $ngc = $($goodsChildren.get(0)), | ||
31 | + $pgc = $($goodsChildren.get(1)), | ||
32 | + $dgc = $($goodsChildren.get(2)), | ||
33 | + shopId = $('input[name="shop_id"]').val(), | ||
34 | + appVersion = $('input[name="app_version"]').val(), | ||
35 | + brand = $('input[name="brand"]').val(), | ||
36 | + favId = $('input[name="favId"]').val(); | ||
37 | + | ||
38 | +var winH = $(window).height(), | ||
39 | + noResult = '<p class="no-result">未找到相关搜索结果</p>'; | ||
40 | + | ||
41 | +//默认筛选条件 | ||
42 | +var defaultOpt = require('./query-param'); | ||
43 | + | ||
44 | +var $listNav = $('#list-nav'), | ||
45 | + | ||
46 | + //导航数据信息 | ||
47 | + navInfo = { | ||
48 | + new: { | ||
49 | + order: 1, | ||
50 | + reload: true, | ||
51 | + page: 1, | ||
52 | + end: false | ||
53 | + }, | ||
54 | + hot: { | ||
55 | + order: 1, | ||
56 | + reload: true, | ||
57 | + page: 1, | ||
58 | + end: false | ||
59 | + }, | ||
60 | + newest: { | ||
61 | + order: 1, | ||
62 | + reload: true, | ||
63 | + page: 0, | ||
64 | + end: false | ||
65 | + }, | ||
66 | + price: { | ||
67 | + order: 1, | ||
68 | + reload: true, | ||
69 | + page: 0, | ||
70 | + end: false | ||
71 | + }, | ||
72 | + discount: { | ||
73 | + order: 1, | ||
74 | + reload: true, | ||
75 | + page: 0, | ||
76 | + end: false | ||
77 | + } | ||
78 | + }, | ||
79 | + $pre = $listNav.find('.active'), //纪录进入筛选前的active项,初始为选中项 | ||
80 | + searching; | ||
81 | + | ||
82 | +var viewType = 1,// 1-首页,2-上新,3-人气 | ||
83 | + listCount = $('.category-list li').length, | ||
84 | + listModValue = 4 - listCount % 4, | ||
85 | + listIndex; | ||
86 | + | ||
87 | +lazyLoad($('img.lazy')); | ||
88 | + | ||
89 | +//焦点效果 | ||
90 | +if ($('.banner-swiper').find('li').size() > 1) { | ||
91 | + bannerSwiper = new Swiper('.banner-swiper', { | ||
92 | + lazyLoading: true, | ||
93 | + lazyLoadingInPrevNext: true, | ||
94 | + loop: true, | ||
95 | + autoplay: 3000, | ||
96 | + autoplayDisableOnInteraction: false, | ||
97 | + paginationClickable: true, | ||
98 | + slideElement: 'li', | ||
99 | + pagination: '.banner-top .pagination-inner' | ||
100 | + }); | ||
101 | +} | ||
102 | + | ||
103 | +if ($('.multi-browse').find('li').size() > 1) { | ||
104 | + multiSwiper = new Swiper('.multi-browse', { | ||
105 | + lazyLoading: true, | ||
106 | + lazyLoadingInPrevNext: true, | ||
107 | + lazyLoadingOnTransitionStart: true, | ||
108 | + grabCursor: true, | ||
109 | + slidesPerView: 'auto', | ||
110 | + slideElement: 'li', | ||
111 | + watchSlidesVisibility: true | ||
112 | + }); | ||
113 | +} | ||
114 | + | ||
115 | +//根据热门品类的个数来改变样式展示 | ||
116 | +// | ||
117 | +if ($('.category-list li').length % 4 !== 0) { | ||
118 | + $('.category-list li:last-child').addClass('category-list-last-li'); | ||
119 | +} | ||
120 | + | ||
121 | +if ($('.category-list li').length < 4) { | ||
122 | + $('.category-list').addClass('category-list-top-board'); | ||
123 | + $('.category-list').find('.buriedpoint').addClass('category-list-only-one-row'); | ||
124 | +} | ||
125 | + | ||
126 | +if ($('.category-list li').length >= 5) { | ||
127 | + for (listIndex = listModValue; listIndex >= 0; listIndex--) { | ||
128 | + $('.category-list li').eq(listCount - 4 + listIndex - 1).addClass('category-list-last-full-row'); | ||
129 | + } | ||
130 | +} | ||
131 | + | ||
132 | +function getPageGoods(info) { | ||
133 | + var nav,navType; | ||
134 | + | ||
135 | + if (searching) { | ||
136 | + return; | ||
137 | + } | ||
138 | + | ||
139 | + navType = info.data.type; | ||
140 | + nav = navInfo[navType]; | ||
141 | + | ||
142 | + //不需要重新加载并且数据请求结束 | ||
143 | + if (nav.end) { | ||
144 | + | ||
145 | + return; | ||
146 | + } | ||
147 | + | ||
148 | + searching = true; | ||
149 | + $.ajax({ | ||
150 | + type: 'GET', | ||
151 | + url: info.url, | ||
152 | + data: info.data, | ||
153 | + success: function(data) { | ||
154 | + if (data === ' ') { | ||
155 | + nav.end = true; | ||
156 | + } | ||
157 | + | ||
158 | + info.callBack(data); | ||
159 | + }, | ||
160 | + error: function() { | ||
161 | + alert('网络断开连接了~'); | ||
162 | + searching = false; | ||
163 | + } | ||
164 | + }); | ||
165 | +} | ||
166 | + | ||
167 | +function getParam(req) { | ||
168 | + if (brand) { | ||
169 | + req.data.brand = brand; | ||
170 | + } | ||
171 | + | ||
172 | + if (shopId) { | ||
173 | + req.data.shop_id = shopId; | ||
174 | + } | ||
175 | +} | ||
176 | + | ||
177 | +function newData(callback) { | ||
178 | + var req = {}; | ||
179 | + | ||
180 | + req.url = '/index/search/search'; | ||
181 | + req.data = { | ||
182 | + type: 'newest', | ||
183 | + order: '1', | ||
184 | + page: navInfo.new.page, | ||
185 | + tagNew: '1' | ||
186 | + }; | ||
187 | + | ||
188 | + getParam(req); | ||
189 | + | ||
190 | + req.callBack = function(data) { | ||
191 | + $('#new-arrival').append(data); | ||
192 | + navInfo.new.page++; | ||
193 | + myScroll.refresh(); | ||
194 | + lazyLoad($('#new-arrival .lazy')); | ||
195 | + scH = $('#scroller').outerHeight(); | ||
196 | + searching = false; | ||
197 | + callback && $.isFunction(callback) && callback(); | ||
198 | + }; | ||
199 | + getPageGoods(req); | ||
200 | +} | ||
201 | + | ||
202 | +function hotData(callback) { | ||
203 | + var req = {}; | ||
204 | + | ||
205 | + req.url = '/index/search/search'; | ||
206 | + req.data = { | ||
207 | + type: 'hot', | ||
208 | + order: '1', | ||
209 | + page: navInfo.hot.page, | ||
210 | + showTag: '1' | ||
211 | + }; | ||
212 | + | ||
213 | + getParam(req); | ||
214 | + | ||
215 | + req.callBack = function(data) { | ||
216 | + $('#popularity').append(data); | ||
217 | + navInfo.hot.page++; | ||
218 | + myScroll.refresh(); | ||
219 | + lazyLoad($('#popularity .lazy')); | ||
220 | + scH = $('#scroller').outerHeight(); | ||
221 | + searching = false; | ||
222 | + callback && $.isFunction(callback) && callback(); | ||
223 | + }; | ||
224 | + getPageGoods(req); | ||
225 | +} | ||
226 | + | ||
227 | +function tabChange(dom, index) { | ||
228 | + var li = dom.eq(index); | ||
229 | + | ||
230 | + dom.removeClass('active'); | ||
231 | + li.addClass('active'); | ||
232 | + | ||
233 | + dom.removeClass('color'); | ||
234 | + li.addClass('color'); | ||
235 | +} | ||
236 | + | ||
237 | +//首页导航 | ||
238 | +$.jqtab = function(nav, posNav, main) { | ||
239 | + | ||
240 | + $(nav + ' li, ' + posNav + ' li').not('li.all-goods').on('touchstart', function() { | ||
241 | + | ||
242 | + var index = $(this).index(), | ||
243 | + activeTab = $(this).attr('tab'); | ||
244 | + | ||
245 | + $nav1.removeClass('fixed-top'); | ||
246 | + tabChange($(nav + ' li'), index); | ||
247 | + tabChange($(posNav + ' li'), index); | ||
248 | + $(main).hide(); | ||
249 | + $('#' + activeTab).fadeIn(); | ||
250 | + if (activeTab === 'new-arrival') { | ||
251 | + newData(); | ||
252 | + viewType = 2; | ||
253 | + } else if (activeTab === 'popularity') { | ||
254 | + hotData(); | ||
255 | + viewType = 3; | ||
256 | + } else if (activeTab === 'home-page') { | ||
257 | + | ||
258 | + myScroll && myScroll.refresh(); | ||
259 | + scH = $('#scroller').outerHeight(); | ||
260 | + $nav1.removeClass('fixed-top'); | ||
261 | + $nav1.removeClass('absolute'); | ||
262 | + $nav2.removeClass('fixed-top'); | ||
263 | + $nav2.removeClass('absolute'); | ||
264 | + } | ||
265 | + if (!$nav1.hasClass('hide')) { | ||
266 | + myScroll.scrollTo(0, 0 - imgH); | ||
267 | + } | ||
268 | + $nav1.addClass('hide'); | ||
269 | + }); | ||
270 | +}; | ||
271 | +$.jqtab('#nav', '#pos-nav', '.main'); | ||
272 | +$('#wrapper').addClass('scroll-wrapper'); | ||
273 | + | ||
274 | +// lazyLoad($('img.lazy')); | ||
275 | + | ||
276 | +myScroll = new IScroll('#wrapper', { | ||
277 | + probeType: 3, | ||
278 | + mouseWheel: true, | ||
279 | + click: true | ||
280 | +}); | ||
281 | +myScroll.on('scroll', function() { | ||
282 | + var scrollCall, | ||
283 | + sTop = -this.y; | ||
284 | + | ||
285 | + if (sTop + winH * 2 > scH) { | ||
286 | + switch (viewType) { | ||
287 | + case 2: | ||
288 | + scrollCall = function() { | ||
289 | + $nav1.css({ | ||
290 | + transform: 'translate(0, ' + (-scH) + 'px)' | ||
291 | + }); | ||
292 | + }; | ||
293 | + newData(scrollCall); | ||
294 | + break; | ||
295 | + case 3: | ||
296 | + scrollCall = function() { | ||
297 | + $nav1.css({ | ||
298 | + transform: 'translate(0, ' + (-scH) + 'px)' | ||
299 | + }); | ||
300 | + }; | ||
301 | + hotData(scrollCall); | ||
302 | + break; | ||
303 | + } | ||
304 | + } | ||
305 | + | ||
306 | + if (sTop < imgH) { | ||
307 | + if (!$nav1.hasClass('hide')) { | ||
308 | + $nav1.addClass('hide'); | ||
309 | + } | ||
310 | + if (!$nav2.hasClass('hide')) { | ||
311 | + $nav2.addClass('hide'); | ||
312 | + } //滑动距离不到导航1 | ||
313 | + } else if (sTop < imgH + nav1H + main1oH) { | ||
314 | + if ($nav1.hasClass('hide')) { | ||
315 | + $nav1.removeClass('hide'); | ||
316 | + } | ||
317 | + if (!$nav2.hasClass('hide')) { | ||
318 | + $nav2.addClass('hide'); | ||
319 | + }//滑动距离不到导航2 | ||
320 | + | ||
321 | + if (sTop < imgH + main1H) { | ||
322 | + if (!$nav1.hasClass('fixed-top')) { | ||
323 | + $nav1.addClass('fixed-top') | ||
324 | + .removeClass('absolute') | ||
325 | + .css({ | ||
326 | + transform: 'translate(0, ' + (-scH) + 'px)' | ||
327 | + }); | ||
328 | + } | ||
329 | + } else if (sTop < imgH + nav1H + main1H) { | ||
330 | + if ($('#home-page').is(':hidden')) { | ||
331 | + return false; | ||
332 | + } | ||
333 | + if (!$nav1.hasClass('absolute')) { | ||
334 | + $nav1.addClass('absolute') | ||
335 | + .removeClass('fixed-top'); | ||
336 | + } | ||
337 | + $nav1.css({ | ||
338 | + transform: 'translate(0, ' + (imgH + main1H - sTop - scH) + 'px)' | ||
339 | + }); | ||
340 | + } | ||
341 | + } else { | ||
342 | + if ($('#home-page').is(':hidden')) { | ||
343 | + return false; | ||
344 | + } | ||
345 | + | ||
346 | + if (!$nav1.hasClass('hide')) { | ||
347 | + $nav1.addClass('hide'); | ||
348 | + } | ||
349 | + if ($nav2.hasClass('hide')) { | ||
350 | + $nav2.removeClass('hide'); | ||
351 | + } | ||
352 | + | ||
353 | + if (sTop < scH) { | ||
354 | + if (!$nav2.hasClass('absolute')) { | ||
355 | + $nav2.addClass('absolute') | ||
356 | + .removeClass('fixed-top'); | ||
357 | + } | ||
358 | + $nav2.css({ | ||
359 | + transform: 'translate(0, ' + (-scH) + 'px)' | ||
360 | + }); | ||
361 | + } | ||
362 | + } | ||
363 | + $('#scroller').trigger('scroll'); | ||
364 | +}); | ||
365 | + | ||
366 | + | ||
367 | + | ||
368 | +document.addEventListener('touchmove', function(e) { | ||
369 | + e.preventDefault(); | ||
370 | +}, false); | ||
371 | + | ||
372 | +/*if (!isIphone) { | ||
373 | + return; | ||
374 | +}*/ | ||
375 | + | ||
376 | + | ||
377 | +//window onload 后重新refresh iscroll | ||
378 | +$(window).load(function() { | ||
379 | + myScroll && myScroll.refresh(); | ||
380 | + imgH = $('#nav-top').outerHeight(); | ||
381 | + nav1H = $('#nav').outerHeight(); | ||
382 | + main1H = $('#nav-main').height(); | ||
383 | + main1oH = $('#nav-main').outerHeight(); | ||
384 | + nav2H = $('#list-nav').outerHeight(); | ||
385 | + main2oH = $('#goods-container').outerHeight(); | ||
386 | + setTimeout(function() { | ||
387 | + scH = $('#scroller').outerHeight(); | ||
388 | + }, 1000); | ||
389 | +}); | ||
390 | + | ||
391 | +function bindGoodThumbClick() { | ||
392 | + $(document).trigger('rebindBpEvent'); | ||
393 | +} | ||
394 | + | ||
395 | +function search(opt) { | ||
396 | + var setting = {}, | ||
397 | + ext, | ||
398 | + att, | ||
399 | + nav, navType, | ||
400 | + page; | ||
401 | + | ||
402 | + if (searching) { | ||
403 | + return; | ||
404 | + } | ||
405 | + | ||
406 | + if (!opt.url) { | ||
407 | + opt.url = '/index/search/search'; | ||
408 | + } | ||
409 | + | ||
410 | + if (!opt.nextPage) { | ||
411 | + | ||
412 | + //筛选项变更则重置reload为true | ||
413 | + for (att in navInfo) { | ||
414 | + if (navInfo.hasOwnProperty(att)) { | ||
415 | + navInfo[att].reload = true; | ||
416 | + } | ||
417 | + } | ||
418 | + | ||
419 | + $listNav.children('.active').removeClass('active'); | ||
420 | + $pre.addClass('active'); | ||
421 | + if (opt.hasOwnProperty('id')) { | ||
422 | + switch (opt.type) { | ||
423 | + case 'shop_id': | ||
424 | + ext = { | ||
425 | + shop_id: opt.id | ||
426 | + }; | ||
427 | + break; | ||
428 | + case 'gender': | ||
429 | + ext = { | ||
430 | + gender: opt.id | ||
431 | + }; | ||
432 | + break; | ||
433 | + case 'brand': | ||
434 | + ext = { | ||
435 | + brand: opt.id | ||
436 | + }; | ||
437 | + break; | ||
438 | + case 'sort': | ||
439 | + ext = { | ||
440 | + sort: opt.id | ||
441 | + }; | ||
442 | + break; | ||
443 | + case 'color': | ||
444 | + ext = { | ||
445 | + color: opt.id | ||
446 | + }; | ||
447 | + break; | ||
448 | + case 'size': | ||
449 | + ext = { | ||
450 | + size: opt.id | ||
451 | + }; | ||
452 | + break; | ||
453 | + case 'price': | ||
454 | + ext = { | ||
455 | + price: opt.id | ||
456 | + }; | ||
457 | + break; | ||
458 | + case 'discount': | ||
459 | + ext = { | ||
460 | + discount: opt.id | ||
461 | + }; | ||
462 | + break; | ||
463 | + case 'ageLevel': | ||
464 | + ext = { | ||
465 | + age_level: opt.id | ||
466 | + }; | ||
467 | + break; | ||
468 | + } | ||
469 | + $.extend(defaultOpt, ext); //扩展筛选项 | ||
470 | + } | ||
471 | + } | ||
472 | + | ||
473 | + //导航类别 | ||
474 | + if ($pre.hasClass('new')) { | ||
475 | + navType = 'newest'; | ||
476 | + } else if ($pre.hasClass('price')) { | ||
477 | + navType = 'price'; | ||
478 | + } else if ($pre.hasClass('discount')) { | ||
479 | + navType = 'discount'; | ||
480 | + } | ||
481 | + nav = navInfo[navType]; | ||
482 | + | ||
483 | + page = nav.page + 1; | ||
484 | + if (nav.reload) { | ||
485 | + page = 1; | ||
486 | + } else if (nav.end) { | ||
487 | + | ||
488 | + //不需要重新加载并且数据请求结束 | ||
489 | + return; | ||
490 | + } | ||
491 | + $.extend(setting, defaultOpt, { | ||
492 | + type: navType, | ||
493 | + order: nav.order, | ||
494 | + page: page | ||
495 | + }); | ||
496 | + | ||
497 | + if (brand) { | ||
498 | + setting.brand = brand; | ||
499 | + } | ||
500 | + if (shopId) { | ||
501 | + setting.shop_id = shopId; | ||
502 | + } | ||
503 | + | ||
504 | + searching = true; | ||
505 | + loading.showLoadingMask(); | ||
506 | + | ||
507 | + $.ajax({ | ||
508 | + type: 'GET', | ||
509 | + url: opt.url ? opt.url : '', | ||
510 | + data: setting, | ||
511 | + success: function(data) { | ||
512 | + var $container, | ||
513 | + num; | ||
514 | + | ||
515 | + switch (navType) { | ||
516 | + case 'newest': | ||
517 | + $container = $ngc; | ||
518 | + break; | ||
519 | + case 'price': | ||
520 | + $container = $pgc; | ||
521 | + break; | ||
522 | + case 'discount': | ||
523 | + $container = $dgc; | ||
524 | + break; | ||
525 | + } | ||
526 | + | ||
527 | + if (data === ' ') { | ||
528 | + nav.end = true; | ||
529 | + | ||
530 | + if (nav.reload) { | ||
531 | + $container.html(noResult); | ||
532 | + } | ||
533 | + } else { | ||
534 | + if (nav.reload) { | ||
535 | + $container.html(data); | ||
536 | + lazyLoad($container.find('.lazy')); | ||
537 | + } else { | ||
538 | + num = $container.find('.good-info').length; | ||
539 | + $container.append(data); | ||
540 | + lazyLoad($container.find('.good-info:gt(' + (num - 1) + ') .lazy')); | ||
541 | + } | ||
542 | + } | ||
543 | + | ||
544 | + nav.reload = false; | ||
545 | + nav.page = page; | ||
546 | + | ||
547 | + searching = false; | ||
548 | + loading.hideLoadingMask(); | ||
549 | + | ||
550 | + window.rePosFooter(); | ||
551 | + | ||
552 | + setTimeout(function() { | ||
553 | + myScroll.refresh(); | ||
554 | + scH = $('#scroller').outerHeight(); | ||
555 | + }, 1000); | ||
556 | + bindGoodThumbClick(); | ||
557 | + }, | ||
558 | + error: function() { | ||
559 | + tip.show('网络断开连接了~'); | ||
560 | + searching = false; | ||
561 | + loading.hideLoadingMask(); | ||
562 | + } | ||
563 | + }); | ||
564 | +} | ||
565 | + | ||
566 | +/** | ||
567 | + * 获取url参数 | ||
568 | + */ | ||
569 | +function getQueryString(name) { | ||
570 | + var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i'); | ||
571 | + var r = window.location.search.substr(1).match(reg); | ||
572 | + | ||
573 | + if (r != null) { | ||
574 | + return window.unescape(r[2]); | ||
575 | + } | ||
576 | + return null; | ||
577 | +} | ||
578 | + | ||
579 | +$.ajax({ | ||
580 | + type: 'GET', | ||
581 | + url: '/search/filter', | ||
582 | + data: { | ||
583 | + shop_id: brand ? '' : shopId, | ||
584 | + brand: brand, | ||
585 | + gender: getQueryString('gender'), | ||
586 | + channel: getQueryString('channel') | ||
587 | + }, | ||
588 | + success: function(data) { | ||
589 | + $goodsContainer.append(data); | ||
590 | + | ||
591 | + //初始化filter&注册filter回调 | ||
592 | + filter.initFilter({ | ||
593 | + fCbFn: search, | ||
594 | + hCbFn: function() { | ||
595 | + | ||
596 | + //切换active状态到$pre上 | ||
597 | + $pre.addClass('active'); | ||
598 | + $pre.siblings('.filter').removeClass('active'); | ||
599 | + }, | ||
600 | + missStatus: true | ||
601 | + }); | ||
602 | + | ||
603 | + setTimeout(function() { | ||
604 | + myScroll.refresh(); | ||
605 | + scH = $('#scroller').outerHeight(); | ||
606 | + }, 1000); | ||
607 | + } | ||
608 | +}); | ||
609 | + | ||
610 | +$listNav.bind('contextmenu', function(e) { | ||
611 | + return false; | ||
612 | +}); | ||
613 | + | ||
614 | +$subNav.on('touchend touchcancel', function(e) { | ||
615 | + var $this = $(e.target).closest('li'), | ||
616 | + cname, | ||
617 | + nav, | ||
618 | + navType, | ||
619 | + $active; | ||
620 | + var bpIdData = $this.attr('data-bp-id') || ''; | ||
621 | + | ||
622 | + e.preventDefault(); | ||
623 | + $(document).trigger('shouldSendBpData', [bpIdData]); | ||
624 | + | ||
625 | + if (typeof $this === 'undefined' || $this.length === 0) { | ||
626 | + return; | ||
627 | + } | ||
628 | + | ||
629 | + if ($this.hasClass('filter')) { | ||
630 | + | ||
631 | + //筛选面板切换状态 | ||
632 | + if ($this.hasClass('active')) { | ||
633 | + filter.hideFilter(); | ||
634 | + | ||
635 | + //点击筛选钱的active项回复active | ||
636 | + $pre.addClass('active'); | ||
637 | + $this.removeClass('active'); | ||
638 | + } else { | ||
639 | + $pre = $this.siblings('.active'); | ||
640 | + | ||
641 | + $pre.removeClass('active'); | ||
642 | + $this.addClass('active'); | ||
643 | + | ||
644 | + filter.showFilter(); | ||
645 | + } | ||
646 | + } else { | ||
647 | + if ($this.hasClass('new')) { | ||
648 | + cname = '.new'; | ||
649 | + navType = 'newest'; | ||
650 | + } else if ($this.hasClass('price')) { | ||
651 | + cname = '.price'; | ||
652 | + navType = 'price'; | ||
653 | + } else if ($this.hasClass('discount')) { | ||
654 | + cname = '.discount'; | ||
655 | + navType = 'discount'; | ||
656 | + } | ||
657 | + | ||
658 | + nav = navInfo[navType]; | ||
659 | + | ||
660 | + if ($this.hasClass('active')) { | ||
661 | + | ||
662 | + //最新无排序切换 | ||
663 | + if ($this.hasClass('new')) { | ||
664 | + return; | ||
665 | + } | ||
666 | + | ||
667 | + if ($this.hasClass('price') || $this.hasClass('discount')) { | ||
668 | + $this = $subNav.find(cname); | ||
669 | + | ||
670 | + // 价格/折扣切换排序状态 | ||
671 | + $this.find('.icon > .iconfont').toggleClass('cur'); | ||
672 | + $pre = $this; //更新pre为当前项 | ||
673 | + nav.reload = true; //重置reload,HTML会被替换为逆序的HTML | ||
674 | + nav.order = nav.order === 0 ? 1 : 0; //切换排序 | ||
675 | + | ||
676 | + $goodsContainer.children('.container:not(.hide)').addClass('hide'); | ||
677 | + | ||
678 | + switch (navType) { | ||
679 | + case 'newest': | ||
680 | + $ngc.removeClass('hide'); | ||
681 | + break; | ||
682 | + | ||
683 | + case 'price': | ||
684 | + $pgc.removeClass('hide'); | ||
685 | + break; | ||
686 | + | ||
687 | + case 'discount': | ||
688 | + $dgc.removeClass('hide'); | ||
689 | + break; | ||
690 | + } | ||
691 | + | ||
692 | + } | ||
693 | + } else { | ||
694 | + $active = $subNav.find('.active'); | ||
695 | + | ||
696 | + $pre = $this; //$pre为除筛选导航的其他导航项,若当前active的为筛选,则把$pre置为当前点击项 | ||
697 | + | ||
698 | + if ($active.hasClass('filter')) { | ||
699 | + | ||
700 | + //若之前active项为筛选,则隐藏筛选面板 | ||
701 | + filter.hideFilter(); | ||
702 | + } else { | ||
703 | + | ||
704 | + //切换container显示 | ||
705 | + $goodsContainer.children('.container:not(.hide)').addClass('hide'); | ||
706 | + | ||
707 | + switch (navType) { | ||
708 | + case 'newest': | ||
709 | + $ngc.removeClass('hide'); | ||
710 | + break; | ||
711 | + | ||
712 | + case 'price': | ||
713 | + $pgc.removeClass('hide'); | ||
714 | + break; | ||
715 | + | ||
716 | + case 'discount': | ||
717 | + $dgc.removeClass('hide'); | ||
718 | + break; | ||
719 | + } | ||
720 | + } | ||
721 | + | ||
722 | + $subNav.children().removeClass('active'); | ||
723 | + $subNav.find(cname).addClass('active'); | ||
724 | + } | ||
725 | + | ||
726 | + if (nav.reload) { | ||
727 | + search({ | ||
728 | + type: 'shop_id', | ||
729 | + id: shopId, | ||
730 | + brand: brand, | ||
731 | + url: '/index/search/search', | ||
732 | + nextPage: false | ||
733 | + }); | ||
734 | + } | ||
735 | + } | ||
736 | + e.stopPropagation(); | ||
737 | +}); | ||
738 | + | ||
739 | + | ||
740 | +function scrollHandler() { | ||
741 | + | ||
742 | + sTop = -myScroll.y; | ||
743 | + | ||
744 | + //当scroll到1/4$goodsContainer高度后继续请求下一页数据 | ||
745 | + myScroll && myScroll.refresh(); | ||
746 | + if (sTop + winH > $('#scroller').height() - 0.25 * $goodsContainer.height() - 50) { | ||
747 | + if ($pre !== undefined) { | ||
748 | + search({ | ||
749 | + type: 'shop_id', | ||
750 | + id: shopId, | ||
751 | + brand: brand, | ||
752 | + url: '/index/search/search', | ||
753 | + nextPage: true | ||
754 | + }); | ||
755 | + } | ||
756 | + } | ||
757 | +} | ||
758 | + | ||
759 | +//srcoll to load more | ||
760 | +$(window).scroll(function() { | ||
761 | + window.requestAnimationFrame(scrollHandler); | ||
762 | +}); | ||
763 | + | ||
764 | + | ||
765 | +//初始请求最新第一页数据 | ||
766 | +search({ | ||
767 | + type: 'shop_id', | ||
768 | + id: shopId, | ||
769 | + brand: brand, | ||
770 | + url: '/index/search/search', | ||
771 | + nextPage: false | ||
772 | +}); | ||
773 | + | ||
774 | +$listNav.on('touchstart', 'li', function(e) { | ||
775 | + $(this).addClass('bytouch'); | ||
776 | +}).on('touchend touchcancel', function() { | ||
777 | + $listNav.find('li').removeClass('bytouch'); | ||
778 | + myScroll.refresh(); | ||
779 | +}); | ||
780 | + | ||
781 | +$nav2.on('touchstart', 'li', function(e) { | ||
782 | + $(this).addClass('bytouch'); | ||
783 | +}).on('touchend touchcancel', function() { | ||
784 | + $nav2.find('li').removeClass('bytouch'); | ||
785 | + myScroll.refresh(); | ||
786 | +}); | ||
787 | + | ||
788 | +//底部导航点击 | ||
789 | +function fotterClick(group) { | ||
790 | + $(group + ' li').on('touchstart', function() { | ||
791 | + $('.sub-group').addClass('hide'); | ||
792 | + if ($(this).find('.sub-group').length > 0) { | ||
793 | + $(this).find('.sub-group').removeClass('hide'); | ||
794 | + } | ||
795 | + }); | ||
796 | +} | ||
797 | + | ||
798 | +fotterClick('.shop-foot-wrapper'); | ||
799 | + | ||
800 | +function stopPropagation(e) { | ||
801 | + if (e.stopPropagation) { | ||
802 | + e.stopPropagation(); | ||
803 | + } else { | ||
804 | + e.cancelBubble = true; | ||
805 | + } | ||
806 | +} | ||
807 | + | ||
808 | +$(document).bind('touchstart', function() { | ||
809 | + $('.sub-group').addClass('hide'); | ||
810 | +}); | ||
811 | + | ||
812 | +$('.shop-foot-wrapper').bind('touchstart', function(e) { | ||
813 | + stopPropagation(e); | ||
814 | +}); | ||
815 | + | ||
816 | +//收藏 | ||
817 | +function postCollect(info) { | ||
818 | + var url = ''; | ||
819 | + | ||
820 | + if (searching) { | ||
821 | + return; | ||
822 | + } | ||
823 | + searching = true; | ||
824 | + | ||
825 | + $.ajax({ | ||
826 | + method: 'post', | ||
827 | + url: info.url, | ||
828 | + data: info.data, | ||
829 | + | ||
830 | + success: function(data) { | ||
831 | + | ||
832 | + if (data.code === 200) { | ||
833 | + if ($('#collect').hasClass('alreadyCollect')) { | ||
834 | + $('#collect').attr('class', 'notCollect'); | ||
835 | + } else { | ||
836 | + $('#collect').attr('class', 'alreadyCollect'); | ||
837 | + } | ||
838 | + } | ||
839 | + | ||
840 | + if (data.code === 401) { | ||
841 | + url = data.url; | ||
842 | + $('body').append('<a href=\'' + url + '\'><span class="jump-login"><span></a>'); | ||
843 | + | ||
844 | + $('.jump-login').click(); | ||
845 | + } | ||
846 | + | ||
847 | + setTimeout(function() { | ||
848 | + myScroll.refresh(); | ||
849 | + scH = $('#scroller').outerHeight(); | ||
850 | + }, 1000); | ||
851 | + searching = false; | ||
852 | + }, | ||
853 | + error: function() { | ||
854 | + alert('网络断开连接了~'); | ||
855 | + searching = false; | ||
856 | + } | ||
857 | + }); | ||
858 | +} | ||
859 | + | ||
860 | +function collectShop() { | ||
861 | + var qew = {}; | ||
862 | + | ||
863 | + qew.url = '/product/index/shopFav'; | ||
864 | + qew.data = { | ||
865 | + shop_id: favId ? favId : shopId, | ||
866 | + app_version: appVersion | ||
867 | + }; | ||
868 | + postCollect(qew); | ||
869 | +} | ||
870 | + | ||
871 | +function cancelShop() { | ||
872 | + var qew = {}; | ||
873 | + | ||
874 | + qew.url = '/product/index/cancelShopFav'; | ||
875 | + qew.data = { | ||
876 | + shop_id: favId ? favId : shopId, | ||
877 | + app_version: appVersion | ||
878 | + }; | ||
879 | + postCollect(qew); | ||
880 | +} | ||
881 | + | ||
882 | +$('#collect').on('touchstart', function(e) { | ||
883 | + if ($('#collect').hasClass('alreadyCollect')) { | ||
884 | + cancelShop(); | ||
885 | + } else { | ||
886 | + collectShop(); | ||
887 | + } | ||
888 | +}); |
public/scss/product/shop/_shop-index.css
0 → 100644
1 | +.shop-index { | ||
2 | + position: absolute; | ||
3 | + top: 0; | ||
4 | + bottom: 0; | ||
5 | + left: 0; | ||
6 | + right: 0; | ||
7 | + overflow: hidden; | ||
8 | + | ||
9 | + .branner-top { | ||
10 | + width: 100%; | ||
11 | + height: 200px; | ||
12 | + position: relative; | ||
13 | + overflow: hidden; | ||
14 | + | ||
15 | + .shop-back-img { | ||
16 | + height: 100%; | ||
17 | + width: 100%; | ||
18 | + } | ||
19 | + } | ||
20 | + | ||
21 | + .logo { | ||
22 | + position: absolute; | ||
23 | + overflow: hidden; | ||
24 | + left: 30px; | ||
25 | + bottom: 30px; | ||
26 | + width: 100px; | ||
27 | + height: 100px; | ||
28 | + } | ||
29 | + | ||
30 | + .store-name { | ||
31 | + color: #fff; | ||
32 | + font-size: 28px; | ||
33 | + position: absolute; | ||
34 | + overflow: hidden; | ||
35 | + left: 148px; | ||
36 | + bottom: 20px; | ||
37 | + } | ||
38 | + | ||
39 | + .collect { | ||
40 | + width: 128px; | ||
41 | + height: 49px; | ||
42 | + position: absolute; | ||
43 | + bottom: 30px; | ||
44 | + right: 30px; | ||
45 | + border-radius: 10px; | ||
46 | + text-align: center; | ||
47 | + background-size: contain; | ||
48 | + } | ||
49 | + | ||
50 | + .alreadyCollect{ | ||
51 | + width: 128px; | ||
52 | + height: 50px; | ||
53 | + border-radius: 10px; | ||
54 | + background-image: url('/product/already-collect.png') no-repeat; | ||
55 | + background-size: contain; | ||
56 | + } | ||
57 | + | ||
58 | + .notCollect{ | ||
59 | + width: 128px; | ||
60 | + height: 50px; | ||
61 | + border-radius: 10px; | ||
62 | + background-image: url('/product/not-collect.png') no-repeat; | ||
63 | + background-size: contain; | ||
64 | + } | ||
65 | + | ||
66 | + .nav { | ||
67 | + width: 100%; | ||
68 | + height: 88px; | ||
69 | + margin: 0; | ||
70 | + padding: 0; | ||
71 | + border: 0; | ||
72 | + font: inherit; | ||
73 | + vertical-align: baseline; | ||
74 | + list-style: none; | ||
75 | + font-size: 28px; | ||
76 | + background: #fff; | ||
77 | + overflow: hidden; | ||
78 | + border-sizing: border-box; | ||
79 | + border-bottom: 1px solid #e1e1e1; | ||
80 | + | ||
81 | + li{ | ||
82 | + color: #b1b1b1; | ||
83 | + display: block; | ||
84 | + height: 28px; | ||
85 | + float: left; | ||
86 | + line-height: 28px; | ||
87 | + width: 24.7%; | ||
88 | + text-align: center; | ||
89 | + border-left: 1px solid #e1e1e1; | ||
90 | + margin-top: 30px; | ||
91 | + border-sizing: border-box; | ||
92 | + color: #b1b1b1; | ||
93 | + | ||
94 | + &:first-child { | ||
95 | + border-left: none; | ||
96 | + } | ||
97 | + | ||
98 | + a { | ||
99 | + color: #b1b1b1; | ||
100 | + } | ||
101 | + } | ||
102 | + | ||
103 | + .color { | ||
104 | + color: #000; | ||
105 | + } | ||
106 | + } | ||
107 | + | ||
108 | + .main { | ||
109 | + background: #f0f0f0; | ||
110 | + padding-bottom: 40px; | ||
111 | + overflow: hidden; | ||
112 | + } | ||
113 | + | ||
114 | + .banner-area { | ||
115 | + @extend .banner-top; | ||
116 | + margin-bottom: 30px; | ||
117 | + } | ||
118 | + | ||
119 | + .hide { | ||
120 | + display: hidden; | ||
121 | + } | ||
122 | + | ||
123 | + .coupon { | ||
124 | + width: 100%; | ||
125 | + padding: 30px 0; | ||
126 | + overflow: hidden; | ||
127 | + | ||
128 | + img { | ||
129 | + width: 245px; | ||
130 | + height: 120px; | ||
131 | + vertical-align: top; | ||
132 | + margin-left: 30px; | ||
133 | + float: left; | ||
134 | + } | ||
135 | + } | ||
136 | + | ||
137 | + .multi-brands { | ||
138 | + width: 100%; | ||
139 | + height: 270px; | ||
140 | + background: #fff; | ||
141 | + border: 1px solid #e1e1e1; | ||
142 | + border-top: none; | ||
143 | + font-size: 20px; | ||
144 | + text-align: center; | ||
145 | + padding-top: 25px; | ||
146 | + margin-bottom: 30px; | ||
147 | + overflow: hidden; | ||
148 | + | ||
149 | + p { | ||
150 | + font-size: 30px; | ||
151 | + } | ||
152 | + } | ||
153 | + | ||
154 | + .multi-browse { | ||
155 | + margin-top: 50px; | ||
156 | + } | ||
157 | + | ||
158 | + .brand-img { | ||
159 | + margin-left: 30px; | ||
160 | + width: 30%; | ||
161 | + height: 150px; | ||
162 | + overflow: hidden; | ||
163 | + padding-bottom: 20px; | ||
164 | + float: left; | ||
165 | + | ||
166 | + p { | ||
167 | + font-size: 25px; | ||
168 | + color: #b1b1b1; | ||
169 | + padding-top: 10px; | ||
170 | + height: 30px; | ||
171 | + white-space: nowrap; | ||
172 | + overflow: hidden; | ||
173 | + text-overflow: ellipsis; | ||
174 | + } | ||
175 | + | ||
176 | + img { | ||
177 | + height: 70%; | ||
178 | + } | ||
179 | + } | ||
180 | + | ||
181 | + .spring { | ||
182 | + margin: 0; | ||
183 | + overflow: hidden; | ||
184 | + | ||
185 | + li { | ||
186 | + width: 50%; | ||
187 | + float: left; | ||
188 | + text-align: center; | ||
189 | + list-style: none; | ||
190 | + display: list-item; | ||
191 | + | ||
192 | + img { | ||
193 | + width: 90%; | ||
194 | + border-radius: 10px; | ||
195 | + vertical-align: top; | ||
196 | + } | ||
197 | + } | ||
198 | + } | ||
199 | + | ||
200 | + .popularity-title { | ||
201 | + background: #fff; | ||
202 | + border-bottom: 1px solid #e8e8e8; | ||
203 | + text-align: center; | ||
204 | + line-height: 98px; | ||
205 | + font-size: 32px; | ||
206 | + margin-top: 40px; | ||
207 | + position: relative; | ||
208 | + } | ||
209 | + | ||
210 | + .more { | ||
211 | + position: absolute; | ||
212 | + right: 30px; | ||
213 | + top: 0; | ||
214 | + bottom: 0; | ||
215 | + color: #b0b0b0; | ||
216 | + font-size: 50px; | ||
217 | + font-family: "iconfont" !important; | ||
218 | + font-style: normal; | ||
219 | + text-decoration: none; | ||
220 | + } | ||
221 | + | ||
222 | + .product-list { | ||
223 | + margin: 0; | ||
224 | + padding: 0 0 30px 30px; | ||
225 | + overflow: hidden; | ||
226 | + background: #fff; | ||
227 | + border-bottom: 30px solid #f0f0f0; | ||
228 | + | ||
229 | + li { | ||
230 | + width: 275px; | ||
231 | + height: 368px; | ||
232 | + margin-top: 50px; | ||
233 | + margin-right: 30px; | ||
234 | + float: left; | ||
235 | + text-align: center; | ||
236 | + list-style: none; | ||
237 | + | ||
238 | + img { | ||
239 | + width: 275px; | ||
240 | + height: 368px; | ||
241 | + vertical-align: top; | ||
242 | + } | ||
243 | + } | ||
244 | + } | ||
245 | + | ||
246 | + .list-price { | ||
247 | + height: 60px; | ||
248 | + background: #aaaeac; | ||
249 | + color: #FFFFFF; | ||
250 | + font-size: 22px; | ||
251 | + margin-top: -60px; | ||
252 | + position: relative; | ||
253 | + opacity: 0.90; | ||
254 | + padding-left: 15px; | ||
255 | + | ||
256 | + p { | ||
257 | + margin: 0; | ||
258 | + line-height: 32px; | ||
259 | + text-align: left; | ||
260 | + overflow: hidden; | ||
261 | + text-overflow: ellipsis; | ||
262 | + white-space: nowrap; | ||
263 | + } | ||
264 | + } | ||
265 | + | ||
266 | + .red { | ||
267 | + color: red; | ||
268 | + } | ||
269 | + | ||
270 | + .icon { | ||
271 | + position: relative; | ||
272 | + color: #b1b1b1; | ||
273 | + | ||
274 | + i { | ||
275 | + position: absolute; | ||
276 | + } | ||
277 | + | ||
278 | + .up { | ||
279 | + top: -5px; | ||
280 | + left: 8px; | ||
281 | + } | ||
282 | + | ||
283 | + .down { | ||
284 | + top: 8px; | ||
285 | + left: 8px; | ||
286 | + } | ||
287 | + } | ||
288 | + | ||
289 | + .goods-container { | ||
290 | + position: relative; | ||
291 | + min-height: 440px; | ||
292 | + padding-left: 15px; | ||
293 | + padding-top: 20px; | ||
294 | + border-bottom: 1px solid #e0e0e0; | ||
295 | + } | ||
296 | + | ||
297 | + .discount-area { | ||
298 | + @extend .discount-page; | ||
299 | + | ||
300 | + .list-nav li { | ||
301 | + display: block; | ||
302 | + height: 78px; | ||
303 | + float: left; | ||
304 | + line-height: 78px; | ||
305 | + width: 24.8%; | ||
306 | + text-align: center; | ||
307 | + border-sizing: border-box; | ||
308 | + position: relative; | ||
309 | + | ||
310 | + span { | ||
311 | + padding-top: 0; | ||
312 | + font-size: 28px; | ||
313 | + } | ||
314 | + } | ||
315 | + | ||
316 | + .new:after { | ||
317 | + height: 28px; | ||
318 | + content: ''; | ||
319 | + border-left: 1px solid #e1e1e1; | ||
320 | + position: absolute; | ||
321 | + top: 25px; | ||
322 | + left: 163px; | ||
323 | + } | ||
324 | + | ||
325 | + .price:after { | ||
326 | + height: 28px; | ||
327 | + content: ''; | ||
328 | + border-left: 1px solid #e1e1e1; | ||
329 | + position: absolute; | ||
330 | + top: 25px; | ||
331 | + left: 163px; | ||
332 | + } | ||
333 | + | ||
334 | + .discount:after { | ||
335 | + height: 28px; | ||
336 | + content: ''; | ||
337 | + border-left: 1px solid #e1e1e1; | ||
338 | + position: absolute; | ||
339 | + top: 25px; | ||
340 | + left: 163px; | ||
341 | + } | ||
342 | + | ||
343 | + .active { | ||
344 | + .cur { | ||
345 | + color: #000; | ||
346 | + } | ||
347 | + } | ||
348 | + | ||
349 | + .list-nav .icon .up { | ||
350 | + top: -28px; | ||
351 | + } | ||
352 | + | ||
353 | + .list-nav .icon .down { | ||
354 | + top: -14px; | ||
355 | + } | ||
356 | + | ||
357 | + .goods-container { | ||
358 | + padding-top: 30px; | ||
359 | + padding-bottom: 100px; | ||
360 | + } | ||
361 | + } | ||
362 | + | ||
363 | + .search-area { | ||
364 | + @extend .search-page; | ||
365 | + } | ||
366 | + | ||
367 | + .hide { | ||
368 | + display: none; | ||
369 | + } | ||
370 | + | ||
371 | + .shop-foot-wrapper { | ||
372 | + position: absolute; | ||
373 | + bottom: 0; | ||
374 | + display: table; | ||
375 | + width: 100%; | ||
376 | + height: 88px; | ||
377 | + line-height: 88px; | ||
378 | + font-size: 28px; | ||
379 | + background: #fff; | ||
380 | + border-top: 1px solid #eaeaea; | ||
381 | + | ||
382 | + | ||
383 | + ul { | ||
384 | + display: table-row; | ||
385 | + } | ||
386 | + | ||
387 | + li { | ||
388 | + display: table-cell; | ||
389 | + text-align: center; | ||
390 | + | ||
391 | + .wall { | ||
392 | + width: 0; | ||
393 | + height: 28px; | ||
394 | + margin-top: 30px; | ||
395 | + float: right; | ||
396 | + border-right: 1px solid #eaeaea; | ||
397 | + display: inline-block; | ||
398 | + } | ||
399 | + } | ||
400 | + | ||
401 | + .sub-group { | ||
402 | + position: absolute; | ||
403 | + background: #fff; | ||
404 | + border: 1px solid #eaeaea; | ||
405 | + border-radius: 12px; | ||
406 | + bottom: 104px; | ||
407 | + width: 40%; | ||
408 | + margin-left: 5%; | ||
409 | + | ||
410 | + dl { | ||
411 | + width: 80%; | ||
412 | + margin: 0 auto; | ||
413 | + } | ||
414 | + | ||
415 | + dd { | ||
416 | + line-height: 80px; | ||
417 | + text-align: center; | ||
418 | + border-top: 1px solid #eaeaea; | ||
419 | + white-space: nowrap; | ||
420 | + overflow: hidden; | ||
421 | + text-overflow: ellipsis; | ||
422 | + } | ||
423 | + | ||
424 | + dd:first-child { | ||
425 | + border-top: 0; | ||
426 | + } | ||
427 | + } | ||
428 | + | ||
429 | + .sharp { | ||
430 | + position: absolute; | ||
431 | + width: 100%; | ||
432 | + height: 14px; | ||
433 | + background: resolve('product/sharp.png') no-repeat center center; | ||
434 | + } | ||
435 | + | ||
436 | + .foot-list-3 .sub-group { | ||
437 | + width: 29%; | ||
438 | + margin-left: 2%; | ||
439 | + } | ||
440 | + } | ||
441 | + | ||
442 | + .bytouch{ | ||
443 | + background:#eee; | ||
444 | + } | ||
445 | + | ||
446 | + .new-arrival { | ||
447 | + padding-top: 30px; | ||
448 | + overflow: hidden; | ||
449 | + padding-left: 15px; | ||
450 | + background: #fff; | ||
451 | + padding-bottom: 100px; | ||
452 | + } | ||
453 | + | ||
454 | + .popularity { | ||
455 | + padding-top: 30px; | ||
456 | + overflow: hidden; | ||
457 | + padding-left: 15px; | ||
458 | + background: #fff; | ||
459 | + padding-bottom: 100px; | ||
460 | + } | ||
461 | + | ||
462 | + .pos-list { | ||
463 | + @extend .discount-page; | ||
464 | + background: #fff; | ||
465 | + width: 100%; | ||
466 | + overflow: hidden; | ||
467 | + | ||
468 | + li { | ||
469 | + display: block; | ||
470 | + height: 78px; | ||
471 | + float: left; | ||
472 | + line-height: 78px; | ||
473 | + width: 24.8%; | ||
474 | + text-align: center; | ||
475 | + border-sizing: border-box; | ||
476 | + | ||
477 | + span { | ||
478 | + font-size: 28px; | ||
479 | + } | ||
480 | + | ||
481 | + a { | ||
482 | + display: block; | ||
483 | + box-sizing: border-box; | ||
484 | + text-align: center; | ||
485 | + width: 100%; | ||
486 | + height: 100%; | ||
487 | + color: #999; | ||
488 | + | ||
489 | + b { | ||
490 | + height: 28px; | ||
491 | + border-left: 1px solid #e1e1e1; | ||
492 | + float: right; | ||
493 | + margin-top: 25px; | ||
494 | + } | ||
495 | + } | ||
496 | + } | ||
497 | + | ||
498 | + .active .cur { | ||
499 | + color: #000; | ||
500 | + } | ||
501 | + | ||
502 | + .active a { | ||
503 | + color: #000; | ||
504 | + } | ||
505 | + | ||
506 | + | ||
507 | + .new .iconfont { | ||
508 | + transform: scale(0.8); | ||
509 | + font-weight: bold; | ||
510 | + } | ||
511 | + | ||
512 | + .price .iconfont { | ||
513 | + transform: scale(0.8); | ||
514 | + font-weight: bold; | ||
515 | + } | ||
516 | + | ||
517 | + .filter .iconfont { | ||
518 | + font-size: 22px; | ||
519 | + transition: transform 0.1 ease-in; | ||
520 | + } | ||
521 | + | ||
522 | + .filter.active .iconfont { | ||
523 | + transform: rotate(-180deg); | ||
524 | + } | ||
525 | + } | ||
526 | + | ||
527 | + .pos-list .icon .up { | ||
528 | + top: -28px; | ||
529 | + } | ||
530 | + | ||
531 | + .pos-list .icon .down { | ||
532 | + top: -14px; | ||
533 | + } | ||
534 | + | ||
535 | + .category-list-top-board { | ||
536 | + border-top: 1px solid #e0e0e0; | ||
537 | + } | ||
538 | + | ||
539 | + .category-list-last-li { | ||
540 | + border-right: 1px solid #e0e0e0; | ||
541 | + } | ||
542 | + | ||
543 | + .category-list-only-one-row { | ||
544 | + border-top: none!important; | ||
545 | + } | ||
546 | + | ||
547 | + .category-list-last-full-row { | ||
548 | + border-bottom: 1px solid #e0e0e0; | ||
549 | + } | ||
550 | +} |
-
Please register or login to post a comment