Showing
8 changed files
with
63 additions
and
10 deletions
@@ -39,7 +39,7 @@ const shop = { | @@ -39,7 +39,7 @@ const shop = { | ||
39 | if (shopId) { | 39 | if (shopId) { |
40 | let shopInfo = (yield listModel.getShopInfo(shopId, uid)) || {}; | 40 | let shopInfo = (yield listModel.getShopInfo(shopId, uid)) || {}; |
41 | 41 | ||
42 | - if (shopInfo) { | 42 | + if (shopInfo && shopInfo.is_red_shop === '1') { |
43 | shopInfo.shopId = _.get(shopInfo, 'shops_id', ''); | 43 | shopInfo.shopId = _.get(shopInfo, 'shops_id', ''); |
44 | } | 44 | } |
45 | req.shopInfo = shopInfo; | 45 | req.shopInfo = shopInfo; |
@@ -122,12 +122,15 @@ const shop = { | @@ -122,12 +122,15 @@ const shop = { | ||
122 | }; | 122 | }; |
123 | 123 | ||
124 | co(function* () { | 124 | co(function* () { |
125 | - let banner = yield listModel.getBrandBanner(brandId); | ||
126 | - let brandInfo = yield listModel.getBrandIntro(brandId, uid); | ||
127 | - let goodsListApi = yield searchModel.getBrandGoods(searchParam); | 125 | + let [banner, brandInfo, goodsListApi] = yield Promise.all([ |
126 | + listModel.getBrandBanner(brandId), | ||
127 | + listModel.getBrandIntro(brandId, uid), | ||
128 | + searchModel.getBrandGoods(searchParam) | ||
129 | + ]); | ||
128 | 130 | ||
129 | let title = brandInfo.title; | 131 | let title = brandInfo.title; |
130 | let goodsList = productProcess.processProductList(_.get(goodsListApi, 'data.product_list', [])); | 132 | let goodsList = productProcess.processProductList(_.get(goodsListApi, 'data.product_list', [])); |
133 | + let goodsTotal = _.get(goodsListApi, 'data.total', 0); | ||
131 | 134 | ||
132 | brandInfo.banner = banner; | 135 | brandInfo.banner = banner; |
133 | 136 | ||
@@ -143,6 +146,7 @@ const shop = { | @@ -143,6 +146,7 @@ const shop = { | ||
143 | keywords: title + ',' + title + '服装服饰,' + title + '潮流服装服饰', | 146 | keywords: title + ',' + title + '服装服饰,' + title + '潮流服装服饰', |
144 | description: title + '|Yoho!Buy有货' + title + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。', | 147 | description: title + '|Yoho!Buy有货' + title + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。', |
145 | brandId: brandId, | 148 | brandId: brandId, |
149 | + goodsTotal: goodsTotal, | ||
146 | brandInfo: brandInfo, | 150 | brandInfo: brandInfo, |
147 | goodsList: goodsList, | 151 | goodsList: goodsList, |
148 | shopPage: true, | 152 | shopPage: true, |
@@ -181,6 +185,7 @@ const shop = { | @@ -181,6 +185,7 @@ const shop = { | ||
181 | let category = redShopPrcs.category(_.get(categoryData, 'data', []), shopId); | 185 | let category = redShopPrcs.category(_.get(categoryData, 'data', []), shopId); |
182 | 186 | ||
183 | let goodsList = yield listModel.searchProductBySkn(decoratorsAll.skns); | 187 | let goodsList = yield listModel.searchProductBySkn(decoratorsAll.skns); |
188 | + let goodsTotal = _.get(goodsList, 'data.total', 0); | ||
184 | let decorators = redShopPrcs.pushGoodsInfo(decoratorsAll.decorators, goodsList); | 189 | let decorators = redShopPrcs.pushGoodsInfo(decoratorsAll.decorators, goodsList); |
185 | 190 | ||
186 | res.render('newshop/shop-reds', { | 191 | res.render('newshop/shop-reds', { |
@@ -211,6 +216,7 @@ const shop = { | @@ -211,6 +216,7 @@ const shop = { | ||
211 | module: 'product', | 216 | module: 'product', |
212 | page: 'shop-reds', | 217 | page: 'shop-reds', |
213 | shopId, | 218 | shopId, |
219 | + goodsTotal, | ||
214 | banner, shopInfo, favCount, decorators, category | 220 | banner, shopInfo, favCount, decorators, category |
215 | }); | 221 | }); |
216 | })().catch(next); | 222 | })().catch(next); |
@@ -221,7 +227,7 @@ const shop = { | @@ -221,7 +227,7 @@ const shop = { | ||
221 | */ | 227 | */ |
222 | list(req, res, next) { | 228 | list(req, res, next) { |
223 | co(function* () { | 229 | co(function* () { |
224 | - let title = '商品列表'; | 230 | + let title = '店铺商品列表'; |
225 | let shopId = req.query.shop_id; | 231 | let shopId = req.query.shop_id; |
226 | let searchParam = { | 232 | let searchParam = { |
227 | isApp: req.yoho.isApp, | 233 | isApp: req.yoho.isApp, |
@@ -62,4 +62,5 @@ | @@ -62,4 +62,5 @@ | ||
62 | </div> | 62 | </div> |
63 | </div> | 63 | </div> |
64 | <input type="hidden" id="shopId" name="shopId" class="shop-id" value="{{shopId}}"> | 64 | <input type="hidden" id="shopId" name="shopId" class="shop-id" value="{{shopId}}"> |
65 | +<input type="hidden" id="goodsTotal", value="{{goodsTotal}}"> | ||
65 | {{> reds-shop/footer}} | 66 | {{> reds-shop/footer}} |
@@ -12,12 +12,17 @@ const filter = require('plugin/filter'); | @@ -12,12 +12,17 @@ const filter = require('plugin/filter'); | ||
12 | const noResultHbs = require('product/search/no-result-new.hbs'); | 12 | const noResultHbs = require('product/search/no-result-new.hbs'); |
13 | const lazyLoad = require('yoho-jquery-lazyload'); | 13 | const lazyLoad = require('yoho-jquery-lazyload'); |
14 | 14 | ||
15 | +require('./yas-send'); | ||
16 | + | ||
17 | +let C_ID = window._ChannelVary[window.cookie('_Channel')]; | ||
18 | + | ||
15 | class ProductListWithFilter { | 19 | class ProductListWithFilter { |
16 | - constructor(filterParams, searchUrl) { | 20 | + constructor(filterParams, searchUrl, extra) { |
17 | this.scrollActived = true; // 是否激活滚动加载,默认激活 | 21 | this.scrollActived = true; // 是否激活滚动加载,默认激活 |
18 | this.filterParams = filterParams; | 22 | this.filterParams = filterParams; |
19 | this.searchUrl = location.protocol + '//m.yohobuy.com/' + (searchUrl || 'product/search/search'); | 23 | this.searchUrl = location.protocol + '//m.yohobuy.com/' + (searchUrl || 'product/search/search'); |
20 | this.filterUrl = location.protocol + '//m.yohobuy.com/product/search/filter'; | 24 | this.filterUrl = location.protocol + '//m.yohobuy.com/product/search/filter'; |
25 | + this.goodsTotal = extra && extra.goodsTotal; // YAS 需要数据 | ||
21 | this.view = { | 26 | this.view = { |
22 | goodsContainer: $('#goods-container'), | 27 | goodsContainer: $('#goods-container'), |
23 | container: $('#goods-container').children('.default-goods'), | 28 | container: $('#goods-container').children('.default-goods'), |
@@ -150,8 +155,38 @@ class ProductListWithFilter { | @@ -150,8 +155,38 @@ class ProductListWithFilter { | ||
150 | 155 | ||
151 | let noResult = !result || result.length < 1 || (result.list && result.list.length < 1); | 156 | let noResult = !result || result.length < 1 || (result.list && result.list.length < 1); |
152 | 157 | ||
158 | + let yasParams = { | ||
159 | + C_ID: C_ID, | ||
160 | + BRAND_ID: this.defaultOpt.shop_id, | ||
161 | + PAGE_NUM: this.page, | ||
162 | + FILTER_VALUE: this.defaultOpt ? JSON.stringify(this.defaultOpt).replace(/\{|\}|\"/g, '') : '', | ||
163 | + SORT_TYPE: this.defaultOpt && this.defaultOpt.type | ||
164 | + }; | ||
165 | + | ||
153 | // 没有结果输出没有结果页面 | 166 | // 没有结果输出没有结果页面 |
154 | if (noResult) { | 167 | if (noResult) { |
168 | + setTimeout(function() { | ||
169 | + if (window._yas && window._yas.sendCustomInfo) { | ||
170 | + let num = this.view.$container.find('.good-info').length; | ||
171 | + let goodIds = []; | ||
172 | + | ||
173 | + this.view.$container.find('.good-info:gt(' + (num - 1) + ')').each(function() { | ||
174 | + let goodid = $(this).data('good-id'); | ||
175 | + | ||
176 | + if (goodid) { | ||
177 | + goodIds.push(goodid); | ||
178 | + } | ||
179 | + }); | ||
180 | + Object.assign(yasParams, { | ||
181 | + PRD_LIST: JSON.stringify(goodIds).replace(/\[|\]/g, ''), | ||
182 | + RES_QTY: this.goodsTotal ? this.goodsTotal : 0 | ||
183 | + }); | ||
184 | + window._yas.sendCustomInfo({ | ||
185 | + op: 'YB_BRAND_GOODS_LIST_L', | ||
186 | + param: JSON.stringify(yasParams) | ||
187 | + }, true); | ||
188 | + } | ||
189 | + }, 200); | ||
155 | if (this.isScrollLoad) { | 190 | if (this.isScrollLoad) { |
156 | this.view.container.after(() => { | 191 | this.view.container.after(() => { |
157 | return '<div class="search-divide">没有更多内容了...</div>'; | 192 | return '<div class="search-divide">没有更多内容了...</div>'; |
1 | require('product/shop/shop.page.css'); | 1 | require('product/shop/shop.page.css'); |
2 | let ProductListWithFilter = require('product/list/product-list-with-filter'); | 2 | let ProductListWithFilter = require('product/list/product-list-with-filter'); |
3 | 3 | ||
4 | -let brandId = $('#brandId').val(); | 4 | +const brandId = $('#brandId').val(); |
5 | +const goodsTotal = $('#goodsTotal').val(); | ||
5 | 6 | ||
6 | let productListWithFilterModel = | 7 | let productListWithFilterModel = |
7 | new ProductListWithFilter({ | 8 | new ProductListWithFilter({ |
8 | brand_id: brandId, | 9 | brand_id: brandId, |
9 | page: 2, // 首页服务端已经渲染 | 10 | page: 2, // 首页服务端已经渲染 |
10 | isShopBrand: 'Y' // 传给 filter,表明调用哪个接口获取筛选面板的数据 | 11 | isShopBrand: 'Y' // 传给 filter,表明调用哪个接口获取筛选面板的数据 |
11 | - }, 'product/search/brand/goods'); | 12 | + }, 'product/search/brand/goods', { |
13 | + goodsTotal: goodsTotal | ||
14 | + }); | ||
12 | 15 | ||
13 | productListWithFilterModel.getFilter(); | 16 | productListWithFilterModel.getFilter(); |
1 | require('product/shop/shop.page.css'); | 1 | require('product/shop/shop.page.css'); |
2 | let ProductListWithFilter = require('product/list/product-list-with-filter'); | 2 | let ProductListWithFilter = require('product/list/product-list-with-filter'); |
3 | 3 | ||
4 | -let shopId = $('#shopId').val(); | 4 | +const shopId = $('#shopId').val(); |
5 | +const goodsTotal = $('#goodsTotal').val(); | ||
5 | 6 | ||
6 | let productListWithFilterModel = | 7 | let productListWithFilterModel = |
7 | new ProductListWithFilter({ | 8 | new ProductListWithFilter({ |
8 | shop_id: shopId, | 9 | shop_id: shopId, |
9 | page: 2, // 首页服务端已经渲染 | 10 | page: 2, // 首页服务端已经渲染 |
10 | isShopList: 'Y' // 传给 filter,表明调用哪个接口获取筛选面板的数据 | 11 | isShopList: 'Y' // 传给 filter,表明调用哪个接口获取筛选面板的数据 |
11 | - }, 'product/search/shop/goods'); | 12 | + }, 'product/search/shop/goods', { |
13 | + goodsTotal: goodsTotal | ||
14 | + }); | ||
12 | 15 | ||
13 | productListWithFilterModel.getFilter(); | 16 | productListWithFilterModel.getFilter(); |
@@ -4,6 +4,7 @@ require('product/shop/redshop.page.css'); | @@ -4,6 +4,7 @@ require('product/shop/redshop.page.css'); | ||
4 | 4 | ||
5 | const $ = require('yoho-jquery'); | 5 | const $ = require('yoho-jquery'); |
6 | const shopId = $('#shopId').val(); | 6 | const shopId = $('#shopId').val(); |
7 | +const goodsTotal = $('#goodsTotal').val(); | ||
7 | const ProductListWithFilter = require('product/list/product-list-with-filter'); | 8 | const ProductListWithFilter = require('product/list/product-list-with-filter'); |
8 | let Tab = require('../plugin/tab'); | 9 | let Tab = require('../plugin/tab'); |
9 | 10 | ||
@@ -16,6 +17,8 @@ let $listNav = $('#list-nav'); // 筛选项列表 | @@ -16,6 +17,8 @@ let $listNav = $('#list-nav'); // 筛选项列表 | ||
16 | */ | 17 | */ |
17 | let productListWithFilter = new ProductListWithFilter({ | 18 | let productListWithFilter = new ProductListWithFilter({ |
18 | shop_id: shopId | 19 | shop_id: shopId |
20 | +}, '', { | ||
21 | + goodsTotal: goodsTotal | ||
19 | }); | 22 | }); |
20 | 23 | ||
21 | productListWithFilter.scrollActived = false; | 24 | productListWithFilter.scrollActived = false; |
-
Please register or login to post a comment