Showing
4 changed files
with
26 additions
and
5 deletions
@@ -52,6 +52,17 @@ const component = { | @@ -52,6 +52,17 @@ const component = { | ||
52 | res.json(result); | 52 | res.json(result); |
53 | }).catch(next); | 53 | }).catch(next); |
54 | }, | 54 | }, |
55 | + brand(req, res, next) { | ||
56 | + const brandId = req.params[0]; | ||
57 | + | ||
58 | + model.brand({ | ||
59 | + uid: req.user.uid || 0, | ||
60 | + brand_id: brandId, | ||
61 | + gender: req.query.gender || '1,2,3' | ||
62 | + }).then(result => { | ||
63 | + res.json(result); | ||
64 | + }).catch(next); | ||
65 | + }, | ||
55 | 66 | ||
56 | /** | 67 | /** |
57 | * 加入购物车接口 | 68 | * 加入购物车接口 |
@@ -153,4 +164,4 @@ const component = { | @@ -153,4 +164,4 @@ const component = { | ||
153 | } | 164 | } |
154 | }; | 165 | }; |
155 | 166 | ||
156 | -module.exports = component; | 167 | +module.exports = component; |
@@ -41,6 +41,11 @@ const model = { | @@ -41,6 +41,11 @@ const model = { | ||
41 | method: 'h5.product.intro' | 41 | method: 'h5.product.intro' |
42 | }, params)); | 42 | }, params)); |
43 | }, | 43 | }, |
44 | + brand(params) { | ||
45 | + return api.get('', Object.assign({ | ||
46 | + method: 'app.shop.queryShopsByBrandId' | ||
47 | + }, params)).then(camelCase); | ||
48 | + }, | ||
44 | 49 | ||
45 | /** | 50 | /** |
46 | * 加入购物车接口 | 51 | * 加入购物车接口 |
@@ -83,4 +88,4 @@ const model = { | @@ -83,4 +88,4 @@ const model = { | ||
83 | } | 88 | } |
84 | }; | 89 | }; |
85 | 90 | ||
86 | -module.exports = model; | 91 | +module.exports = model; |
@@ -45,6 +45,7 @@ const detail = require(`${cRoot}/detail`); | @@ -45,6 +45,7 @@ const detail = require(`${cRoot}/detail`); | ||
45 | router.get(/\/product\/pro_([\d]+)_([\d]+)\/(.*).html/, detail.index); // 商品详情routers | 45 | router.get(/\/product\/pro_([\d]+)_([\d]+)\/(.*).html/, detail.index); // 商品详情routers |
46 | router.get(/\/product\/product_([\d]+)\.json/, detail.product); | 46 | router.get(/\/product\/product_([\d]+)\.json/, detail.product); |
47 | router.get(/\/product\/intro_([\d]+)\.json/, detail.intro); | 47 | router.get(/\/product\/intro_([\d]+)\.json/, detail.intro); |
48 | +router.get(/\/product\/brand_([\d]+)\.json/, detail.brand); | ||
48 | router.post(/\product\/cart.json/, detail.addToCart); | 49 | router.post(/\product\/cart.json/, detail.addToCart); |
49 | router.post(/\product\/favorite.json/, detail.favorite); | 50 | router.post(/\product\/favorite.json/, detail.favorite); |
50 | router.get(/\/product\/cart-count.json/, detail.getCartCount); | 51 | router.get(/\/product\/cart-count.json/, detail.getCartCount); |
@@ -66,4 +67,4 @@ router.get('/search.json', search.fetchProducts); // ajax | @@ -66,4 +67,4 @@ router.get('/search.json', search.fetchProducts); // ajax | ||
66 | 67 | ||
67 | 68 | ||
68 | 69 | ||
69 | -module.exports = router; | 70 | +module.exports = router; |
@@ -520,8 +520,6 @@ | @@ -520,8 +520,6 @@ | ||
520 | return; | 520 | return; |
521 | } | 521 | } |
522 | this.entity = result.data; | 522 | this.entity = result.data; |
523 | - this.brand = result.data.brandInfo; | ||
524 | - | ||
525 | if (this.entity.storage === 0 || this.entity.status === 0) { | 523 | if (this.entity.storage === 0 || this.entity.status === 0) { |
526 | this.isSoldOut = true; | 524 | this.isSoldOut = true; |
527 | } | 525 | } |
@@ -556,6 +554,12 @@ | @@ -556,6 +554,12 @@ | ||
556 | $.get(`/product/product/intro_${pid}.json`, {skn: data.productSkn}).then(intro => { | 554 | $.get(`/product/product/intro_${pid}.json`, {skn: data.productSkn}).then(intro => { |
557 | this.intro = intro; | 555 | this.intro = intro; |
558 | }); | 556 | }); |
557 | + | ||
558 | + if (data.brandInfo && data.brandInfo.brandId) { | ||
559 | + $.get(`/product/product/brand_${data.brandInfo.brandId}.json`).then(brand => { | ||
560 | + this.brand = brand.data && brand.data.length ? brand.data[0] : {}; | ||
561 | + }); | ||
562 | + } | ||
559 | } | 563 | } |
560 | }) | 564 | }) |
561 | .always(() => { | 565 | .always(() => { |
-
Please register or login to post a comment