Merge branch 'develop' of git.yoho.cn:fe/yohoblk-wap into develop
Showing
20 changed files
with
325 additions
and
299 deletions
@@ -4,6 +4,6 @@ | @@ -4,6 +4,6 @@ | ||
4 | |首页| /| | 4 | |首页| /| |
5 | |侧边栏| /sidebar| 只有 app 使用| | 5 | |侧边栏| /sidebar| 只有 app 使用| |
6 | |品牌列表| /brand-list| | | 6 | |品牌列表| /brand-list| | |
7 | -|品牌店铺| /brand?domain=colormad| | | ||
8 | -|品牌店铺分享页面| /brand-share?domain=colormad| | | 7 | +|品牌店铺| /product/brand?domain=colormad| | |
8 | +|品牌店铺分享页面| /product/brand-share?domain=colormad| | | ||
9 | |商品详情| /product/{productId}| | | 9 | |商品详情| /product/{productId}| | |
@@ -6,8 +6,6 @@ | @@ -6,8 +6,6 @@ | ||
6 | */ | 6 | */ |
7 | 'use strict'; | 7 | 'use strict'; |
8 | 8 | ||
9 | -// const _ = require('lodash'); | ||
10 | -// const helpers = global.yoho.helpers; | ||
11 | const mRoot = '../models'; | 9 | const mRoot = '../models'; |
12 | const brandModel = require(`${mRoot}/brand`); | 10 | const brandModel = require(`${mRoot}/brand`); |
13 | 11 | ||
@@ -16,46 +14,6 @@ const brandModel = require(`${mRoot}/brand`); | @@ -16,46 +14,6 @@ const brandModel = require(`${mRoot}/brand`); | ||
16 | */ | 14 | */ |
17 | module.exports = { | 15 | module.exports = { |
18 | 16 | ||
19 | - /* 品牌店铺页面 */ | ||
20 | - index: (req, res) => { | ||
21 | - res.render('brand/index', { | ||
22 | - module: 'channel', | ||
23 | - page: 'brand', | ||
24 | - domain: req.domain | ||
25 | - }); | ||
26 | - }, | ||
27 | - | ||
28 | - /* 获取品牌店铺介绍 */ | ||
29 | - getShopInfo: (req, res) => { | ||
30 | - brandModel.getBrandData({ | ||
31 | - domain: req.query.domain, | ||
32 | - uid: req.user.uid | ||
33 | - }).then(result => { | ||
34 | - res.json(result); | ||
35 | - }); | ||
36 | - }, | ||
37 | - | ||
38 | - /* 获取商品列表 */ | ||
39 | - getBrandShopGoods: (req, res) => { | ||
40 | - brandModel.getBrandShopGoodsData({ | ||
41 | - sort: req.body.sort, | ||
42 | - page: req.body.page, | ||
43 | - channel: req.body.filter.channel || 'men', | ||
44 | - gender: req.body.filter.gender || '1,2,3', | ||
45 | - brand: req.body.filter.brand, | ||
46 | - shopId: req.body.filter.shopId, | ||
47 | - order: req.body.filter.order || 's_t_desc', | ||
48 | - limit: req.body.filter.limit || '60', | ||
49 | - color: req.body.filter.color, | ||
50 | - price: req.body.filter.price, | ||
51 | - size: req.body.filter.size, | ||
52 | - pd: req.body.filter.pd, | ||
53 | - tagsFilter: req.body.filter.tagsFilter | ||
54 | - }).then(result => { | ||
55 | - res.json(result); | ||
56 | - }); | ||
57 | - }, | ||
58 | - | ||
59 | /* 品牌列表页 */ | 17 | /* 品牌列表页 */ |
60 | brandList: (req, res) => { | 18 | brandList: (req, res) => { |
61 | 19 | ||
@@ -75,26 +33,6 @@ module.exports = { | @@ -75,26 +33,6 @@ module.exports = { | ||
75 | }); | 33 | }); |
76 | }, | 34 | }, |
77 | 35 | ||
78 | - /* 品牌店铺分享页面 */ | ||
79 | - brandShare: (req, res) => { | ||
80 | - res.render('brand/brand-share', { | ||
81 | - module: 'channel', | ||
82 | - page: 'brand-share' | ||
83 | - }); | ||
84 | - }, | ||
85 | - | ||
86 | - /* 收藏店铺 */ | ||
87 | - collectShop: (req, res) => { | ||
88 | - brandModel.collectShopData({ | ||
89 | - shopId: req.body.shopId, | ||
90 | - favId: req.body.favId, | ||
91 | - uid: req.user.uid, | ||
92 | - type: 'shop' | ||
93 | - }).then(result => { | ||
94 | - res.json(result); | ||
95 | - }); | ||
96 | - }, | ||
97 | - | ||
98 | /* 全部分类 */ | 36 | /* 全部分类 */ |
99 | cate: (req, res) => { | 37 | cate: (req, res) => { |
100 | res.render('brand/cate', { | 38 | res.render('brand/cate', { |
@@ -22,92 +22,6 @@ const yhChannel = { | @@ -22,92 +22,6 @@ const yhChannel = { | ||
22 | module.exports = { | 22 | module.exports = { |
23 | 23 | ||
24 | /** | 24 | /** |
25 | - * 从接口获取品牌店铺数据 | ||
26 | - * @returns {*} | ||
27 | - */ | ||
28 | - getShopInfoData(params) { | ||
29 | - let finalParams = { | ||
30 | - method: 'app.shops.getIntro', | ||
31 | - shop_id: params.shopId | ||
32 | - }; | ||
33 | - | ||
34 | - if (params.uid) { | ||
35 | - Object.assign(finalParams, { | ||
36 | - uid: params.uid | ||
37 | - }); | ||
38 | - } | ||
39 | - | ||
40 | - return api.get('', finalParams); | ||
41 | - }, | ||
42 | - | ||
43 | - /** | ||
44 | - * 通过品牌域名获取品牌信息 | ||
45 | - * @param params | ||
46 | - */ | ||
47 | - getBrandInfoByDomain(params) { | ||
48 | - return api.get('', { | ||
49 | - method: 'web.brand.byDomain', | ||
50 | - domain: params.domain | ||
51 | - }); | ||
52 | - }, | ||
53 | - | ||
54 | - | ||
55 | - getShopsDecoratorList(params) { | ||
56 | - return api.get('', { | ||
57 | - method: 'app.shopsdecorator.getList', | ||
58 | - | ||
59 | - }); | ||
60 | - }, | ||
61 | - | ||
62 | - /** | ||
63 | - * 从接口获取品牌店铺商品数据 | ||
64 | - * @returns {*} | ||
65 | - */ | ||
66 | - getBrandShopGoodsOriginData(params) { | ||
67 | - return api.get('', { | ||
68 | - method: 'app.search.brand', | ||
69 | - yh_channel: params.channel ? yhChannel[params.channel].channel : '1', | ||
70 | - brand: params.brand, | ||
71 | - shop_id: params.shopId, | ||
72 | - order: params.order, | ||
73 | - limit: params.limit, | ||
74 | - page: params.page, | ||
75 | - gender: params.gender, | ||
76 | - color: params.color, | ||
77 | - price: params.price, | ||
78 | - size: params.size, | ||
79 | - p_d: params.pd, | ||
80 | - sort: params.sort, | ||
81 | - tags_filter: params.tagsFilter | ||
82 | - }); | ||
83 | - }, | ||
84 | - | ||
85 | - /** | ||
86 | - * 收藏取消收藏店铺 | ||
87 | - * @param params | ||
88 | - * @returns {*} | ||
89 | - */ | ||
90 | - collectShopOriginData(params) { | ||
91 | - let finalParams = { | ||
92 | - id: params.shopId, | ||
93 | - fav_id: params.shopId, | ||
94 | - uid: params.uid, | ||
95 | - type: params.type | ||
96 | - }; | ||
97 | - | ||
98 | - if (params.isFav) { | ||
99 | - Object.assign(finalParams, { | ||
100 | - method: 'app.favorite.add' | ||
101 | - }); | ||
102 | - } else { | ||
103 | - Object.assign(finalParams, { | ||
104 | - method: 'app.favorite.cancel' | ||
105 | - }); | ||
106 | - } | ||
107 | - return api.get('', finalParams); | ||
108 | - }, | ||
109 | - | ||
110 | - /** | ||
111 | * 从接口获取品牌列表页数据 | 25 | * 从接口获取品牌列表页数据 |
112 | * @returns {*} | 26 | * @returns {*} |
113 | */ | 27 | */ |
@@ -127,16 +41,5 @@ module.exports = { | @@ -127,16 +41,5 @@ module.exports = { | ||
127 | method: 'app.sort.get' | 41 | method: 'app.sort.get' |
128 | }) | 42 | }) |
129 | ); | 43 | ); |
130 | - }, | ||
131 | - | ||
132 | - /** | ||
133 | - * 从接口获取品类资源位数据 | ||
134 | - * @returns {*} | ||
135 | - */ | ||
136 | - getCateResource(params) { | ||
137 | - return api.get('', Object.assign(params, { | ||
138 | - method: 'app.sort.get' | ||
139 | - }) | ||
140 | - ); | ||
141 | } | 44 | } |
142 | }; | 45 | }; |
@@ -5,14 +5,12 @@ | @@ -5,14 +5,12 @@ | ||
5 | * Time: 13:51 | 5 | * Time: 13:51 |
6 | */ | 6 | */ |
7 | 'use strict'; | 7 | 'use strict'; |
8 | -const path = require('path'); | 8 | + |
9 | const api = global.yoho.API; | 9 | const api = global.yoho.API; |
10 | const helpers = global.yoho.helpers; | 10 | const helpers = global.yoho.helpers; |
11 | const brandApi = require('./brand-api'); | 11 | const brandApi = require('./brand-api'); |
12 | const logger = global.yoho.logger; | 12 | const logger = global.yoho.logger; |
13 | const _ = require('lodash'); | 13 | const _ = require('lodash'); |
14 | -const processProductList = require(path.join(global.utils, '/beautify/product')).processProductList; | ||
15 | -const camelCase = global.yoho.camelCase; | ||
16 | 14 | ||
17 | /** | 15 | /** |
18 | * 处理品牌一览品牌列表数据 | 16 | * 处理品牌一览品牌列表数据 |
@@ -53,94 +51,6 @@ const handleBrandList = origin => { | @@ -53,94 +51,6 @@ const handleBrandList = origin => { | ||
53 | }; | 51 | }; |
54 | 52 | ||
55 | /** | 53 | /** |
56 | - * 获取品牌店铺数据 | ||
57 | - * @param params | ||
58 | - * @returns {*|Promise.<TResult>} | ||
59 | - */ | ||
60 | -const getBrandData = params => { | ||
61 | - let finalResult = {}; | ||
62 | - | ||
63 | - return api.all([ | ||
64 | - brandApi.getBrandInfoByDomain({domain: params.domain}) | ||
65 | - ]).then(result => { | ||
66 | - | ||
67 | - if (result[0].code === 200) { | ||
68 | - | ||
69 | - /* 品牌有店铺 */ | ||
70 | - if (result[0].data.shop_id) { | ||
71 | - return api.all([ | ||
72 | - brandApi.getShopInfoData({ | ||
73 | - shopId: result[0].data.shop_id, | ||
74 | - uid: params.uid | ||
75 | - }) | ||
76 | - ]).then(subResult => { | ||
77 | - if (subResult[0].code === 200) { | ||
78 | - | ||
79 | - /* TODO 判断是否是使用 BLK 模板,不使用 BLK 模板的就直接返回 */ | ||
80 | - if (subResult[0].data.shop_template_type === '2') { | ||
81 | - Object.assign(finalResult, { | ||
82 | - | ||
83 | - /* TODO 背景图取资源位,接口未开发 */ | ||
84 | - brandBg: 'http://7xwj52.com1.z0.glb.clouddn.com/brandbg.jpg', | ||
85 | - | ||
86 | - /* TODO 是否显示店铺 LOGO,接口未开发 */ | ||
87 | - showBrandLogo: false, | ||
88 | - brandLogo: subResult[0].data.shop_logo, | ||
89 | - brandName: subResult[0].data.shop_name, | ||
90 | - brandIntro: subResult[0].data.shop_intro | ||
91 | - }); | ||
92 | - return finalResult; | ||
93 | - } else { | ||
94 | - logger.info('no BLK template'); | ||
95 | - } | ||
96 | - } else { | ||
97 | - logger.error('getShopInfoData api code no 200'); | ||
98 | - } | ||
99 | - }); | ||
100 | - } else { | ||
101 | - logger.info('brand has no shop'); | ||
102 | - } | ||
103 | - } else { | ||
104 | - logger.error('getBrandOriginData api code no 200'); | ||
105 | - } | ||
106 | - }); | ||
107 | -}; | ||
108 | - | ||
109 | -/** | ||
110 | - * 获取品牌店铺商品数据 | ||
111 | - * @param params | ||
112 | - * @returns {*|Promise.<TResult>} | ||
113 | - */ | ||
114 | -const getBrandShopGoodsData = params => { | ||
115 | - let finalResult = {}; | ||
116 | - | ||
117 | - return api.all([brandApi.getBrandShopGoodsOriginData(params)]).then(result => { | ||
118 | - if (result[0].code === 200) { | ||
119 | - Object.assign(finalResult, { | ||
120 | - data: { | ||
121 | - productList: processProductList(result[0].data.productList) | ||
122 | - } | ||
123 | - }); | ||
124 | - } else { | ||
125 | - logger.error('getBrandShopGoodsOriginData api code no 200'); | ||
126 | - } | ||
127 | - | ||
128 | - return camelCase(finalResult); | ||
129 | - }); | ||
130 | -}; | ||
131 | - | ||
132 | -/** | ||
133 | - * 收藏店铺 | ||
134 | - * @param params | ||
135 | - * @returns {*|Promise.<TResult>} | ||
136 | - */ | ||
137 | -const collectShopData = params => { | ||
138 | - return api.all([brandApi.collectShopOriginData(params)]).then(result => { | ||
139 | - return result[0]; | ||
140 | - }); | ||
141 | -}; | ||
142 | - | ||
143 | -/** | ||
144 | * 获取品牌列表页数据 | 54 | * 获取品牌列表页数据 |
145 | * @param params | 55 | * @param params |
146 | */ | 56 | */ |
@@ -234,24 +144,7 @@ const getCateListData = params => { | @@ -234,24 +144,7 @@ const getCateListData = params => { | ||
234 | }); | 144 | }); |
235 | }; | 145 | }; |
236 | 146 | ||
237 | -/** | ||
238 | - * 获取品类资源位数据 | ||
239 | - * @param params | ||
240 | - * @returns {*|Promise.<TResult>} | ||
241 | - */ | ||
242 | -const getCateResource = params => { | ||
243 | - let finalResult = {}; | ||
244 | - | ||
245 | - return brandApi.getCateResource(params).then(result => { | ||
246 | - return finalResult; | ||
247 | - }); | ||
248 | -}; | ||
249 | - | ||
250 | module.exports = { | 147 | module.exports = { |
251 | - getBrandData, | ||
252 | - getBrandShopGoodsData, | ||
253 | getBrandListData, | 148 | getBrandListData, |
254 | - getCateListData, | ||
255 | - getCateResource, | ||
256 | - collectShopData | 149 | + getCateListData |
257 | }; | 150 | }; |
@@ -17,15 +17,10 @@ router.get('/', channel.index); // 首页 | @@ -17,15 +17,10 @@ router.get('/', channel.index); // 首页 | ||
17 | router.get('/channel/channel.json', channel.channel); // 查询所有频道 | 17 | router.get('/channel/channel.json', channel.channel); // 查询所有频道 |
18 | router.get('/channel/resources.json', channel.resources); // 资源位接口 | 18 | router.get('/channel/resources.json', channel.resources); // 资源位接口 |
19 | router.get('/channel/goods.json', channel.goods); // 首页查询商品列表 | 19 | router.get('/channel/goods.json', channel.goods); // 首页查询商品列表 |
20 | -router.get('/brand', brand.index); // 店铺首页 | ||
21 | -router.get('/get-shop-info', brand.getShopInfo); // 店铺介绍 | ||
22 | -router.post('/get-brand-shop-goods', brand.getBrandShopGoods); // 店铺介绍 | ||
23 | router.get('/brand-list', brand.brandList); // 品牌列表页 | 20 | router.get('/brand-list', brand.brandList); // 品牌列表页 |
24 | router.get('/get-brand-list', brand.getBrandList); // 获取品牌列表数据 | 21 | router.get('/get-brand-list', brand.getBrandList); // 获取品牌列表数据 |
25 | -router.get('/brand-share', brand.brandShare); // 获取品牌列表数据 | ||
26 | 22 | ||
27 | router.get('/cate-resource', brand.cateResource); // 品类资源位页面 | 23 | router.get('/cate-resource', brand.cateResource); // 品类资源位页面 |
28 | -router.post('/collect-shop', brand.collectShop); // 收藏品牌店铺 | ||
29 | router.get('/cate', brand.cate); // 全部分类 | 24 | router.get('/cate', brand.cate); // 全部分类 |
30 | router.get('/get-cate-list', brand.getCateList); // 全部分类数据列表 | 25 | router.get('/get-cate-list', brand.getCateList); // 全部分类数据列表 |
31 | 26 |
apps/product/controllers/shop.js
0 → 100644
1 | +/** | ||
2 | + * Created by PhpStorm. | ||
3 | + * User: Targaryen | ||
4 | + * Date: 2016/7/26 | ||
5 | + * Time: 10:34 | ||
6 | + */ | ||
7 | +'use strict'; | ||
8 | + | ||
9 | +const mRoot = '../models'; | ||
10 | +const shopModel = require(`${mRoot}/shop`); | ||
11 | + | ||
12 | +module.exports = { | ||
13 | + | ||
14 | + /* 品牌店铺页面 */ | ||
15 | + index: (req, res) => { | ||
16 | + res.render('shop/index', { | ||
17 | + module: 'product', | ||
18 | + page: 'shop' | ||
19 | + }); | ||
20 | + }, | ||
21 | + | ||
22 | + /* 获取品牌店铺介绍 */ | ||
23 | + getShopInfo: (req, res) => { | ||
24 | + shopModel.getShopData({ | ||
25 | + domain: req.query.domain, | ||
26 | + uid: req.user.uid | ||
27 | + }).then(result => { | ||
28 | + res.json(result); | ||
29 | + }); | ||
30 | + }, | ||
31 | + | ||
32 | + /* 获取商品列表 */ | ||
33 | + getBrandShopGoods: (req, res) => { | ||
34 | + shopModel.getBrandShopGoodsData({ | ||
35 | + sort: req.body.sort, | ||
36 | + page: req.body.page, | ||
37 | + channel: req.body.filter.channel || 'men', | ||
38 | + gender: req.body.filter.gender || '1,2,3', | ||
39 | + brand: req.body.filter.brand, | ||
40 | + shopId: req.body.filter.shopId, | ||
41 | + order: req.body.filter.order || 's_t_desc', | ||
42 | + limit: req.body.filter.limit || '60', | ||
43 | + color: req.body.filter.color, | ||
44 | + price: req.body.filter.price, | ||
45 | + size: req.body.filter.size, | ||
46 | + pd: req.body.filter.pd, | ||
47 | + tagsFilter: req.body.filter.tagsFilter | ||
48 | + }).then(result => { | ||
49 | + res.json(result); | ||
50 | + }); | ||
51 | + }, | ||
52 | + | ||
53 | + /* 收藏店铺 */ | ||
54 | + collectShop: (req, res) => { | ||
55 | + shopModel.collectShopData({ | ||
56 | + shopId: req.body.shopId, | ||
57 | + favId: req.body.favId, | ||
58 | + uid: req.user.uid, | ||
59 | + type: 'shop' | ||
60 | + }).then(result => { | ||
61 | + res.json(result); | ||
62 | + }); | ||
63 | + }, | ||
64 | + | ||
65 | + /* 品牌店铺分享页面 */ | ||
66 | + shopShare: (req, res) => { | ||
67 | + res.render('shop/share', { | ||
68 | + module: 'product', | ||
69 | + page: 'shop-share' | ||
70 | + }); | ||
71 | + } | ||
72 | +}; |
apps/product/models/shop-api.js
0 → 100644
1 | +/** | ||
2 | + * Created by PhpStorm. | ||
3 | + * User: Targaryen | ||
4 | + * Date: 2016/7/26 | ||
5 | + * Time: 10:35 | ||
6 | + */ | ||
7 | +'use strict'; | ||
8 | +const api = global.yoho.API; | ||
9 | +const yhChannel = { | ||
10 | + men: { | ||
11 | + channel: '1' | ||
12 | + }, | ||
13 | + women: { | ||
14 | + channel: '2' | ||
15 | + }, | ||
16 | + lifestyle: { | ||
17 | + channel: '4' | ||
18 | + } | ||
19 | +}; | ||
20 | + | ||
21 | +exports.module = { | ||
22 | + /** | ||
23 | + * 通过品牌域名获取品牌信息 | ||
24 | + * @param params | ||
25 | + */ | ||
26 | + getBrandInfoByDomain(params) { | ||
27 | + return api.get('', { | ||
28 | + method: 'web.brand.byDomain', | ||
29 | + domain: params.domain | ||
30 | + }); | ||
31 | + }, | ||
32 | + | ||
33 | + /** | ||
34 | + * 从接口获取品牌店铺数据 | ||
35 | + * @returns {*} | ||
36 | + */ | ||
37 | + getShopInfoData(params) { | ||
38 | + let finalParams = { | ||
39 | + method: 'app.shops.getIntro', | ||
40 | + shop_id: params.shopId | ||
41 | + }; | ||
42 | + | ||
43 | + if (params.uid) { | ||
44 | + Object.assign(finalParams, { | ||
45 | + uid: params.uid | ||
46 | + }); | ||
47 | + } | ||
48 | + | ||
49 | + return api.get('', finalParams); | ||
50 | + }, | ||
51 | + | ||
52 | + /** | ||
53 | + * TODO 从接口获得店铺装修资源 | ||
54 | + * @param params | ||
55 | + * @returns {*} | ||
56 | + */ | ||
57 | + getShopsDecoratorList(params) { | ||
58 | + return api.get('', { | ||
59 | + method: 'app.shopsdecorator.getList', | ||
60 | + shop_id: params.shopId | ||
61 | + }); | ||
62 | + }, | ||
63 | + | ||
64 | + /** | ||
65 | + * 从接口获取品牌店铺商品数据 | ||
66 | + * @returns {*} | ||
67 | + */ | ||
68 | + getBrandShopGoodsOriginData(params) { | ||
69 | + return api.get('', { | ||
70 | + method: 'app.search.brand', | ||
71 | + yh_channel: params.channel ? yhChannel[params.channel].channel : '1', | ||
72 | + brand: params.brand, | ||
73 | + shop_id: params.shopId, | ||
74 | + order: params.order, | ||
75 | + limit: params.limit, | ||
76 | + page: params.page, | ||
77 | + gender: params.gender, | ||
78 | + color: params.color, | ||
79 | + price: params.price, | ||
80 | + size: params.size, | ||
81 | + p_d: params.pd, | ||
82 | + sort: params.sort, | ||
83 | + tags_filter: params.tagsFilter | ||
84 | + }); | ||
85 | + }, | ||
86 | + | ||
87 | + /** | ||
88 | + * 收藏取消收藏店铺 | ||
89 | + * @param params | ||
90 | + * @returns {*} | ||
91 | + */ | ||
92 | + collectShopOriginData(params) { | ||
93 | + let finalParams = { | ||
94 | + id: params.shopId, | ||
95 | + fav_id: params.shopId, | ||
96 | + uid: params.uid, | ||
97 | + type: params.type | ||
98 | + }; | ||
99 | + | ||
100 | + if (params.isFav) { | ||
101 | + Object.assign(finalParams, { | ||
102 | + method: 'app.favorite.add' | ||
103 | + }); | ||
104 | + } else { | ||
105 | + Object.assign(finalParams, { | ||
106 | + method: 'app.favorite.cancel' | ||
107 | + }); | ||
108 | + } | ||
109 | + return api.get('', finalParams); | ||
110 | + } | ||
111 | +}; |
apps/product/models/shop.js
0 → 100644
1 | +/** | ||
2 | + * Created by PhpStorm. | ||
3 | + * User: Targaryen | ||
4 | + * Date: 2016/7/26 | ||
5 | + * Time: 10:34 | ||
6 | + */ | ||
7 | +'use strict'; | ||
8 | +const logger = global.yoho.logger; | ||
9 | +const api = global.yoho.API; | ||
10 | +const shopApi = require('./shop-api'); | ||
11 | +const path = require('path'); | ||
12 | +const processProductList = require(path.join(global.utils, '/beautify/product')).processProductList; | ||
13 | +const camelCase = global.yoho.camelCase; | ||
14 | + | ||
15 | +/** | ||
16 | + * 获取品牌店铺数据 | ||
17 | + * @param params | ||
18 | + * @returns {*|Promise.<TResult>} | ||
19 | + */ | ||
20 | +const getShopData = params => { | ||
21 | + let finalResult = {}; | ||
22 | + | ||
23 | + return api.all([ | ||
24 | + shopApi.getBrandInfoByDomain({domain: params.domain}) | ||
25 | + ]).then(result => { | ||
26 | + | ||
27 | + if (result[0].code === 200) { | ||
28 | + | ||
29 | + /* 品牌有店铺 */ | ||
30 | + if (result[0].data.shop_id) { | ||
31 | + return api.all([ | ||
32 | + shopApi.getShopInfoData({ | ||
33 | + shopId: result[0].data.shop_id, | ||
34 | + uid: params.uid | ||
35 | + }) | ||
36 | + ]).then(subResult => { | ||
37 | + if (subResult[0].code === 200) { | ||
38 | + | ||
39 | + /* TODO 判断是否是使用 BLK 模板,不使用 BLK 模板的就直接返回 */ | ||
40 | + if (subResult[0].data.shop_template_type === '2') { | ||
41 | + Object.assign(finalResult, { | ||
42 | + | ||
43 | + /* TODO 背景图取资源位,接口未开发 */ | ||
44 | + brandBg: 'http://7xwj52.com1.z0.glb.clouddn.com/brandbg.jpg', | ||
45 | + | ||
46 | + /* TODO 是否显示店铺 LOGO,接口未开发 */ | ||
47 | + showBrandLogo: false, | ||
48 | + brandLogo: subResult[0].data.shop_logo, | ||
49 | + brandName: subResult[0].data.shop_name, | ||
50 | + brandIntro: subResult[0].data.shop_intro | ||
51 | + }); | ||
52 | + return finalResult; | ||
53 | + } else { | ||
54 | + logger.info('no BLK template'); | ||
55 | + } | ||
56 | + } else { | ||
57 | + logger.error('getShopInfoData api code no 200'); | ||
58 | + } | ||
59 | + }); | ||
60 | + } else { | ||
61 | + logger.info('brand has no shop'); | ||
62 | + } | ||
63 | + } else { | ||
64 | + logger.error('getBrandOriginData api code no 200'); | ||
65 | + } | ||
66 | + }); | ||
67 | +}; | ||
68 | + | ||
69 | +/** | ||
70 | + * 获取品牌店铺商品数据 | ||
71 | + * @param params | ||
72 | + * @returns {*|Promise.<TResult>} | ||
73 | + */ | ||
74 | +const getBrandShopGoodsData = params => { | ||
75 | + let finalResult = {}; | ||
76 | + | ||
77 | + return api.all([shopApi.getBrandShopGoodsOriginData(params)]).then(result => { | ||
78 | + if (result[0].code === 200) { | ||
79 | + Object.assign(finalResult, { | ||
80 | + data: { | ||
81 | + productList: processProductList(result[0].data.productList) | ||
82 | + } | ||
83 | + }); | ||
84 | + } else { | ||
85 | + logger.error('getBrandShopGoodsOriginData api code no 200'); | ||
86 | + } | ||
87 | + | ||
88 | + return camelCase(finalResult); | ||
89 | + }); | ||
90 | +}; | ||
91 | + | ||
92 | +/** | ||
93 | + * 收藏店铺 | ||
94 | + * @param params | ||
95 | + * @returns {*|Promise.<TResult>} | ||
96 | + */ | ||
97 | +const collectShopData = params => { | ||
98 | + return api.all([shopApi.collectShopOriginData(params)]).then(result => { | ||
99 | + return result[0]; | ||
100 | + }); | ||
101 | +}; | ||
102 | + | ||
103 | +exports.module = { | ||
104 | + getShopData, | ||
105 | + getBrandShopGoodsData, | ||
106 | + collectShopData | ||
107 | +}; |
@@ -19,6 +19,15 @@ router.post('/search', search.fetchProducts); | @@ -19,6 +19,15 @@ router.post('/search', search.fetchProducts); | ||
19 | router.get('/filter', search.subFilter); | 19 | router.get('/filter', search.subFilter); |
20 | router.get('/filters.json', search.fetchFilters); | 20 | router.get('/filters.json', search.fetchFilters); |
21 | 21 | ||
22 | +// 品牌店铺页面 | ||
23 | +const shop = require(`${cRoot}/shop`); | ||
24 | + | ||
25 | +router.get('/shop', shop.index); // 店铺首页 | ||
26 | +router.get('/get-shop-info', shop.getShopInfo); // 店铺介绍 | ||
27 | +router.post('/get-brand-shop-goods', shop.getBrandShopGoods); // 店铺商品列表 | ||
28 | +router.post('/collect-shop', shop.collectShop); // 收藏品牌店铺 | ||
29 | +router.get('/shop-share', shop.shopShare); // 品牌店铺分享页面 | ||
30 | + | ||
22 | // 商品详情controller | 31 | // 商品详情controller |
23 | const detail = require(`${cRoot}/detail`); | 32 | const detail = require(`${cRoot}/detail`); |
24 | 33 |
apps/product/views/action/shop/index.hbs
0 → 100644
apps/product/views/action/shop/share.hbs
0 → 100644
@@ -7,15 +7,15 @@ | @@ -7,15 +7,15 @@ | ||
7 | 7 | ||
8 | const Vue = require('yoho-vue'); | 8 | const Vue = require('yoho-vue'); |
9 | const lazyload = require('yoho-vue-lazyload'); | 9 | const lazyload = require('yoho-vue-lazyload'); |
10 | -const brandShareBox = require('channel/brand-share-box.vue'); | 10 | +const shareBox = require('product/shop/share-box.vue'); |
11 | 11 | ||
12 | require('common/vue-filter'); | 12 | require('common/vue-filter'); |
13 | 13 | ||
14 | Vue.use(lazyload); | 14 | Vue.use(lazyload); |
15 | 15 | ||
16 | new Vue({ | 16 | new Vue({ |
17 | - el: '#brand-share', | 17 | + el: '#share', |
18 | components: { | 18 | components: { |
19 | - brandShareBox | 19 | + shareBox |
20 | } | 20 | } |
21 | }); | 21 | }); |
@@ -8,14 +8,14 @@ const Vue = require('yoho-vue'); | @@ -8,14 +8,14 @@ const Vue = require('yoho-vue'); | ||
8 | const lazyload = require('yoho-vue-lazyload'); | 8 | const lazyload = require('yoho-vue-lazyload'); |
9 | const infinitScroll = require('yoho-vue-infinite-scroll'); | 9 | const infinitScroll = require('yoho-vue-infinite-scroll'); |
10 | 10 | ||
11 | -const brandBox = require('channel/brand-box.vue'); | 11 | +const shopBox = require('product/shop/shop-box.vue'); |
12 | 12 | ||
13 | Vue.use(lazyload); | 13 | Vue.use(lazyload); |
14 | Vue.use(infinitScroll); | 14 | Vue.use(infinitScroll); |
15 | 15 | ||
16 | new Vue({ | 16 | new Vue({ |
17 | - el: '#brand', | 17 | + el: '#shop', |
18 | components: { | 18 | components: { |
19 | - brandBox | 19 | + shopBox |
20 | } | 20 | } |
21 | }); | 21 | }); |
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | </div> | 9 | </div> |
10 | </template> | 10 | </template> |
11 | <style> | 11 | <style> |
12 | - .share-bottom { | 12 | + .share-bottom { |
13 | width: 100%; | 13 | width: 100%; |
14 | padding: 20px 10px; | 14 | padding: 20px 10px; |
15 | background: #fff; | 15 | background: #fff; |
@@ -37,7 +37,7 @@ | @@ -37,7 +37,7 @@ | ||
37 | } | 37 | } |
38 | 38 | ||
39 | .new-user { | 39 | .new-user { |
40 | - float: left;] | 40 | + float: left; |
41 | border: #fff solid 2px; | 41 | border: #fff solid 2px; |
42 | } | 42 | } |
43 | 43 | ||
@@ -64,4 +64,4 @@ | @@ -64,4 +64,4 @@ | ||
64 | } | 64 | } |
65 | } | 65 | } |
66 | }; | 66 | }; |
67 | -</script> | ||
67 | +</script> |
@@ -53,8 +53,7 @@ | @@ -53,8 +53,7 @@ | ||
53 | } | 53 | } |
54 | </style> | 54 | </style> |
55 | <script> | 55 | <script> |
56 | - const brandShopTop = require('channel/brand-shop-top.vue'); | ||
57 | - const shareBottom = require('channel/share-bottom.vue'); | 56 | + const shareBottom = require('product/shop/share-bottom.vue'); |
58 | 57 | ||
59 | module.exports = { | 58 | module.exports = { |
60 | 59 | ||
@@ -68,7 +67,6 @@ | @@ -68,7 +67,6 @@ | ||
68 | }; | 67 | }; |
69 | }, | 68 | }, |
70 | components: { | 69 | components: { |
71 | - brandShopTop, | ||
72 | shareBottom | 70 | shareBottom |
73 | } | 71 | } |
74 | }; | 72 | }; |
1 | <template> | 1 | <template> |
2 | - <brand-top-bar v-bind:share-data="shareData"></brand-top-bar> | ||
3 | - <brand-shop-top v-bind:shop-info="shopInfo"></brand-shop-top> | 2 | + <top-bar v-bind:share-data="shareData"></top-bar> |
3 | + <shop-top v-bind:shop-info="shopInfo"></shop-top> | ||
4 | <goods-list v-bind:data="productList"></goods-list> | 4 | <goods-list v-bind:data="productList"></goods-list> |
5 | <drawer v-ref:drawer> | 5 | <drawer v-ref:drawer> |
6 | <filter :config.once="filterConfig"></filter> | 6 | <filter :config.once="filterConfig"></filter> |
@@ -12,8 +12,8 @@ | @@ -12,8 +12,8 @@ | ||
12 | const qs = require('yoho-qs'); | 12 | const qs = require('yoho-qs'); |
13 | const bus = require('common/vue-bus'); | 13 | const bus = require('common/vue-bus'); |
14 | const tip = require('common/tip'); | 14 | const tip = require('common/tip'); |
15 | - const brandTopBar = require('channel/brand-top-bar.vue'); // 顶部栏,包括返回、收藏店铺、分享,打开筛选页面 | ||
16 | - const brandShopTop = require('channel/brand-shop-top.vue'); // 店铺头部信息 | 15 | + const topBar = require('product/shop/top-bar.vue'); // 顶部栏,包括返回、收藏店铺、分享,打开筛选页面 |
16 | + const shopTop = require('product/shop/shop-top.vue'); // 店铺头部信息 | ||
17 | const goodsList = require('product/list.vue'); | 17 | const goodsList = require('product/list.vue'); |
18 | const drawer = require('product/drawer.vue'); | 18 | const drawer = require('product/drawer.vue'); |
19 | const filter = require('product/filter.vue'); | 19 | const filter = require('product/filter.vue'); |
@@ -132,8 +132,8 @@ | @@ -132,8 +132,8 @@ | ||
132 | } | 132 | } |
133 | }, | 133 | }, |
134 | components: { | 134 | components: { |
135 | - brandTopBar, | ||
136 | - brandShopTop, | 135 | + topBar, |
136 | + shopTop, | ||
137 | goodsList, | 137 | goodsList, |
138 | drawer, | 138 | drawer, |
139 | filter | 139 | filter |
-
Please register or login to post a comment