shop-reds.page.js
1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
require('scss/layout/swiper.scss');
require('scss/product/search/list.page.scss');
require('scss/product/shop/redshop.page.scss');
const $ = require('yoho-jquery');
const shopId = $('#shopId').val();
const ProductListWithFilter = require('js/product/list/product-list-with-filter');
let Tab = require('../plugin/tab');
let $filterBox = $('.filter-box');
let $shopCategory = $('#shop-category');
let $listNav = $('#list-nav'); // 筛选项列表
/**
* 初始化全部商品 TAB 页
*/
let productListWithFilter = new ProductListWithFilter({
shop_id: shopId
}, 'product/search/shop/goods');
productListWithFilter.scrollActived = false;
Tab.prototype.home = function() { // 隐藏筛选 TAB
$filterBox.css('display', 'none');
$('.filter-mask').addClass('hide');
productListWithFilter.scrollActived = false;
};
Tab.prototype.getallgoods = function() { // 显示筛选 TAB
$listNav.find('li').removeClass('active');
$listNav.find('.default').addClass('active');
$filterBox.css('display', 'block');
$('.filter-mask').addClass('hide');
productListWithFilter.reset();
productListWithFilter.getGoodsList({type: 'default', page: 1});
productListWithFilter.scrollActived = true;
};
Tab.prototype.getnewgoods = function() {
$filterBox.css('display', 'none');
$('.filter-mask').addClass('hide');
productListWithFilter.reset();
productListWithFilter.getGoodsList({type: 'new', page: 1});
productListWithFilter.scrollActived = true;
};
/**
* 商品分类展示隐藏
*/
if ($shopCategory.length > 0) {
$shopCategory.on('click', function() {
$('.sub-group').toggleClass('hide');
});
}
// 页面打开直接加载筛选项
// productListWithFilter.getFilter();
require('../plugin/sticky');
require('./shop/coupon');
require('./shop/red-shop');
require('js/common/invite-share');