Authored by yyq

经典店铺

... ... @@ -15,6 +15,7 @@ const searchHandler = require('./search-handler');
const listHandler = require('./list-handler');
const headerModel = require('../../../doraemon/models/header');
const productProcess = require('../../../utils/product-process-simple');
const handleStaticUrl = require(`${global.utils}/parameter`).fullParamToMinPath;
const DEFAULT_IMG = '01091c21f2317a64f123f1649fbbccf7ba';
... ... @@ -397,10 +398,14 @@ function getShopInfoAsync(domain, channel, params) {
function _getShopListData(channel, params, shopInfo) {
let gender = _getGender(channel),
shopId = params.shopId,
shopId = params.shopId|| params.shop_id,
domain = params.domain,
navBar = params.navBar || 1;
let searchParams = searchHandler.getSearchParams(params);
const baseUrl = `/shop/${domain}-${shopId}`;
params.shopId && delete params.shopId;
params.domain && delete params.domain;
return co(function* () {
let result = yield Promise.props({
... ... @@ -455,20 +460,22 @@ function _getShopListData(channel, params, shopInfo) {
let totalPage = _.get(info, 'data.total', 1);
Object.assign(resData, {
filters: searchHandler.handleFilterDataAll(info.data, params),
opts: searchHandler.handleOptsData(params, totalPage),
filters: listHandler.handleFilterData(info.data, params, baseUrl),
opts: listHandler.handleOptsData(params, totalPage, baseUrl),
goods: productProcess.processProductList(goodsList, {
newCoverSort: true,
showDiscount: false,
gender: _getGender(channel),
query: params.query
}),
hasNextPage: searchHandler.handleNextPage(params, totalPage),
footPager: searchHandler.handlePagerData(totalPage, params)
hasNextPage: listHandler.handleNextPage(params, totalPage, baseUrl),
footPager: listHandler.handlePagerData(totalPage, params, true, baseUrl)
});
if (_.has(resData, 'filters.checkedConditions')) {
_.set(resData, 'filters.checkedConditions.clearUrl',
`?navBar=${params.navBar}&shopId=${params.shopId}`);
handleStaticUrl(baseUrl, {navBar: params.navBar}));
}
} else {
resData.searchEmpty = true;
... ... @@ -478,7 +485,7 @@ function _getShopListData(channel, params, shopInfo) {
if (params.query && plist.length) {
resData.allGoods = {
name: '全部商品 ALL',
sort: searchHandler.handleOptsData(params, data.total || 0),
sort: listHandler.handleOptsData(params, data.total || 0, baseUrl),
list: productProcess.processProductList(plist, {
newCoverSort: true,
showDiscount: false,
... ... @@ -495,7 +502,7 @@ function _getShopListData(channel, params, shopInfo) {
let groupSort = _.get(result.sort, 'data', []),
noPageQs = Object.assign({}, params, {page: 1});
resData.leftContent = searchHandler.handleSortData(groupSort, noPageQs, params);
resData.leftContent = listHandler.handleSortData(groupSort, noPageQs, params, baseUrl);
_.set(resData, 'brandShopAd', {baseUrl: shopListUrl});
... ...