Authored by 郭成尧

yas

... ... @@ -39,7 +39,7 @@ const shop = {
if (shopId) {
let shopInfo = (yield listModel.getShopInfo(shopId, uid)) || {};
if (shopInfo) {
if (shopInfo && shopInfo.is_red_shop === '1') {
shopInfo.shopId = _.get(shopInfo, 'shops_id', '');
}
req.shopInfo = shopInfo;
... ... @@ -122,12 +122,15 @@ const shop = {
};
co(function* () {
let banner = yield listModel.getBrandBanner(brandId);
let brandInfo = yield listModel.getBrandIntro(brandId, uid);
let goodsListApi = yield searchModel.getBrandGoods(searchParam);
let [banner, brandInfo, goodsListApi] = yield Promise.all([
listModel.getBrandBanner(brandId),
listModel.getBrandIntro(brandId, uid),
searchModel.getBrandGoods(searchParam)
]);
let title = brandInfo.title;
let goodsList = productProcess.processProductList(_.get(goodsListApi, 'data.product_list', []));
let goodsTotal = _.get(goodsListApi, 'data.total', 0);
brandInfo.banner = banner;
... ... @@ -143,6 +146,7 @@ const shop = {
keywords: title + ',' + title + '服装服饰,' + title + '潮流服装服饰',
description: title + '|Yoho!Buy有货' + title + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。',
brandId: brandId,
goodsTotal: goodsTotal,
brandInfo: brandInfo,
goodsList: goodsList,
shopPage: true,
... ... @@ -181,6 +185,7 @@ const shop = {
let category = redShopPrcs.category(_.get(categoryData, 'data', []), shopId);
let goodsList = yield listModel.searchProductBySkn(decoratorsAll.skns);
let goodsTotal = _.get(goodsList, 'data.total', 0);
let decorators = redShopPrcs.pushGoodsInfo(decoratorsAll.decorators, goodsList);
res.render('newshop/shop-reds', {
... ... @@ -211,6 +216,7 @@ const shop = {
module: 'product',
page: 'shop-reds',
shopId,
goodsTotal,
banner, shopInfo, favCount, decorators, category
});
})().catch(next);
... ... @@ -221,7 +227,7 @@ const shop = {
*/
list(req, res, next) {
co(function* () {
let title = '商品列表';
let title = '店铺商品列表';
let shopId = req.query.shop_id;
let searchParam = {
isApp: req.yoho.isApp,
... ...
... ... @@ -45,4 +45,5 @@
{{> common/suspend-cart}}
<input type="hidden" id="brandId" value={{brandId}}>
<input type="hidden" id="goodsTotal", value="{{goodsTotal}}">
</div>
... ...
... ... @@ -15,4 +15,5 @@
{{> common/suspend-cart}}
<input type="hidden" id="shopId" value={{shopId}}>
<input type="hidden" id="goodsTotal", value="{{goodsTotal}}">
</div>
\ No newline at end of file
... ...
... ... @@ -62,4 +62,5 @@
</div>
</div>
<input type="hidden" id="shopId" name="shopId" class="shop-id" value="{{shopId}}">
<input type="hidden" id="goodsTotal", value="{{goodsTotal}}">
{{> reds-shop/footer}}
\ No newline at end of file
... ...
... ... @@ -12,12 +12,17 @@ const filter = require('plugin/filter');
const noResultHbs = require('product/search/no-result-new.hbs');
const lazyLoad = require('yoho-jquery-lazyload');
require('./yas-send');
let C_ID = window._ChannelVary[window.cookie('_Channel')];
class ProductListWithFilter {
constructor(filterParams, searchUrl) {
constructor(filterParams, searchUrl, extra) {
this.scrollActived = true; // 是否激活滚动加载,默认激活
this.filterParams = filterParams;
this.searchUrl = location.protocol + '//m.yohobuy.com/' + (searchUrl || 'product/search/search');
this.filterUrl = location.protocol + '//m.yohobuy.com/product/search/filter';
this.goodsTotal = extra && extra.goodsTotal; // YAS 需要数据
this.view = {
goodsContainer: $('#goods-container'),
container: $('#goods-container').children('.default-goods'),
... ... @@ -150,8 +155,38 @@ class ProductListWithFilter {
let noResult = !result || result.length < 1 || (result.list && result.list.length < 1);
let yasParams = {
C_ID: C_ID,
BRAND_ID: this.defaultOpt.shop_id,
PAGE_NUM: this.page,
FILTER_VALUE: this.defaultOpt ? JSON.stringify(this.defaultOpt).replace(/\{|\}|\"/g, '') : '',
SORT_TYPE: this.defaultOpt && this.defaultOpt.type
};
// 没有结果输出没有结果页面
if (noResult) {
setTimeout(function() {
if (window._yas && window._yas.sendCustomInfo) {
let num = this.view.$container.find('.good-info').length;
let goodIds = [];
this.view.$container.find('.good-info:gt(' + (num - 1) + ')').each(function() {
let goodid = $(this).data('good-id');
if (goodid) {
goodIds.push(goodid);
}
});
Object.assign(yasParams, {
PRD_LIST: JSON.stringify(goodIds).replace(/\[|\]/g, ''),
RES_QTY: this.goodsTotal ? this.goodsTotal : 0
});
window._yas.sendCustomInfo({
op: 'YB_BRAND_GOODS_LIST_L',
param: JSON.stringify(yasParams)
}, true);
}
}, 200);
if (this.isScrollLoad) {
this.view.container.after(() => {
return '<div class="search-divide">没有更多内容了...</div>';
... ...
require('product/shop/shop.page.css');
let ProductListWithFilter = require('product/list/product-list-with-filter');
let brandId = $('#brandId').val();
const brandId = $('#brandId').val();
const goodsTotal = $('#goodsTotal').val();
let productListWithFilterModel =
new ProductListWithFilter({
brand_id: brandId,
page: 2, // 首页服务端已经渲染
isShopBrand: 'Y' // 传给 filter,表明调用哪个接口获取筛选面板的数据
}, 'product/search/brand/goods');
}, 'product/search/brand/goods', {
goodsTotal: goodsTotal
});
productListWithFilterModel.getFilter();
... ...
require('product/shop/shop.page.css');
let ProductListWithFilter = require('product/list/product-list-with-filter');
let shopId = $('#shopId').val();
const shopId = $('#shopId').val();
const goodsTotal = $('#goodsTotal').val();
let productListWithFilterModel =
new ProductListWithFilter({
shop_id: shopId,
page: 2, // 首页服务端已经渲染
isShopList: 'Y' // 传给 filter,表明调用哪个接口获取筛选面板的数据
}, 'product/search/shop/goods');
}, 'product/search/shop/goods', {
goodsTotal: goodsTotal
});
productListWithFilterModel.getFilter();
... ...
... ... @@ -4,6 +4,7 @@ require('product/shop/redshop.page.css');
const $ = require('yoho-jquery');
const shopId = $('#shopId').val();
const goodsTotal = $('#goodsTotal').val();
const ProductListWithFilter = require('product/list/product-list-with-filter');
let Tab = require('../plugin/tab');
... ... @@ -16,6 +17,8 @@ let $listNav = $('#list-nav'); // 筛选项列表
*/
let productListWithFilter = new ProductListWithFilter({
shop_id: shopId
}, '', {
goodsTotal: goodsTotal
});
productListWithFilter.scrollActived = false;
... ...