brand.js
2.96 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/**
* Created by PhpStorm.
* User: Targaryen
* Date: 2016/7/19
* Time: 10:03
*/
'use strict';
// const _ = require('lodash');
// const helpers = global.yoho.helpers;
const mRoot = '../models';
const brandModel = require(`${mRoot}/brand`);
/**
* 品牌,品类,店铺相关页面
*/
module.exports = {
/* 品牌店铺页面 */
index: (req, res) => {
res.render('brand/index', {
module: 'channel',
page: 'brand',
domain: req.domain
});
},
/* 获取品牌店铺介绍 */
getShopInfo: (req, res) => {
brandModel.getBrandData({
domain: req.query.domain,
uid: req.user.uid
}).then(result => {
res.json(result);
});
},
/* 获取商品列表 */
getBrandShopGoods: (req, res) => {
brandModel.getBrandShopGoodsData({
sort: req.body.sort,
page: req.body.page,
channel: req.body.filter.channel || 'men',
gender: req.body.filter.gender || '1,2,3',
brand: req.body.filter.brand,
shopId: req.body.filter.shopId,
order: req.body.filter.order || 's_t_desc',
limit: req.body.filter.limit || '60',
color: req.body.filter.color,
price: req.body.filter.price,
size: req.body.filter.size,
pd: req.body.filter.pd,
tagsFilter: req.body.filter.tagsFilter
}).then(result => {
res.json(result);
});
},
/* 品牌列表页 */
brandList: (req, res) => {
res.render('brand/brand-list', {
module: 'channel',
page: 'brand-list'
});
},
/* 获取品牌列表数据 */
getBrandList: (req, res) => {
brandModel.getBrandListData({
channel: req.query.channel || req.cookies._Channel || 'men'
}).then(result => {
res.json(result);
});
},
/* 品牌店铺分享页面 */
brandShare: (req, res) => {
res.render('brand/brand-share', {
module: 'channel',
page: 'brand-share'
});
},
/* 收藏店铺 */
collectShop: (req, res) => {
brandModel.collectShopData({
shopId: req.body.shopId,
favId: req.body.favId,
uid: req.user.uid,
type: 'shop'
}).then(result => {
res.json(result);
});
},
/* 全部分类 */
cate: (req, res) => {
res.render('brand/cate', {
module: 'channel',
page: 'cate'
});
},
// 全部分类api
getCateList: (req, res) => {
let params = req.query;
brandModel.getCateListData(params)
.then(result => {
res.json(result);
});
},
// 品类资源位
cateResource: (req, res) => {
res.render('brand/cate-resource', {
module: 'channel',
page: 'cate-resource'
});
}
};