Authored by yyq

套餐结算页

... ... @@ -25,7 +25,7 @@ const shop = (shopId, req, res, next, brandInfo) => {
let pjax = params._pjax;
// 比较品牌域名与店铺域名是否一致,不一致跳转至店铺域名
if (!pjax && shopInfo.domain && domain && domain !== shopInfo.domain) {
if (!pjax && shopInfo.domain && domain && domain !== _.toLower(shopInfo.domain)) {
res.redirect(helpers.urlFormat('', params, shopInfo.domain));
return;
}
... ... @@ -236,7 +236,7 @@ exports.getNodeContent = (req, res, next) => {
*/
exports.getAdnav = (req, res, next) => {
if (!req.xhr || !req.body.brandId) {
if (!req.xhr) {
return next();
}
... ...
... ... @@ -19,6 +19,9 @@ const needParams = ['query', 'msort', 'misort', 'gender', 'shelveTime'];
// 品牌页folder名称
const brandFolderSeries = '经典系列';
// 经典店铺list url
const shopListUrl = '/product/shoplist';
// 搜索分类信息需要的参数
const positionId = 10;
... ... @@ -291,6 +294,7 @@ const getBrandData = (params, extra, channel) => {
brand: {
brandBanner: searchHandler.handleBrandBanner(extra),
leftContent: {},
brandShopAd: true,
node: extra.node || ''
}
};
... ... @@ -477,7 +481,7 @@ const getNodeContentData = (params) => {
*/
const getAdnav = (params) => {
return Promise.all([searchApi.getBrandFolder(params), searchApi.getBrandSeries(params)]).then(result => {
return Promise.all([searchApi.getBrandShopFolder(params), searchApi.getBrandShopSeries(params)]).then(result => {
let dest = {
picTitle: '',
... ... @@ -656,6 +660,8 @@ const getShopData = (shopId, channel, params, shopInfo) => {
finalResult.leftContent = searchHandler.handleSortData(groupSort, params, params, '/product/shoplist');
_.set(finalResult, 'brandShopAd', {baseUrl: shopListUrl});
if (finalResult.allGoods) {
Object.assign(finalResult.allGoods, searchHandler.setShopSort(groupSort, Object.assign({},
params, {page: 1})), searchHandler.setGenderFilter(params));
... ...
... ... @@ -196,14 +196,21 @@ const getSortAds = (params) => {
* 获取品牌系列
* @return
*/
const getBrandSeries = (params) => {
const getBrandShopSeries = (params) => {
let finalParams = {
method: 'web.brand.series',
brand_id: params.brandId,
status: params.status || 1
};
if (params.brandId) {
finalParams.brand_id = params.brandId;
} else if (params.shopId) {
Object.assign(finalParams, {
method: 'web.shop.series',
shop_id: params.shopId
});
}
return api.get('', finalParams, config.apiCache);
};
... ... @@ -211,14 +218,21 @@ const getBrandSeries = (params) => {
* 获取品牌folder
* @return
*/
const getBrandFolder = (params) => {
const getBrandShopFolder = (params) => {
let finalParams = {
method: 'web.brand.folder',
brand_id: params.brandId,
status: params.status || 1
};
if (params.brandId) {
finalParams.brand_id = params.brandId;
} else if (params.shopId) {
Object.assign(finalParams, {
method: 'web.shop.folder',
shop_id: params.shopId
});
}
return api.get('', finalParams, config.apiCache);
};
... ... @@ -540,8 +554,8 @@ module.exports = {
getSortList,
getSortIntro,
getSortAds,
getBrandFolder,
getBrandSeries,
getBrandShopFolder,
getBrandShopSeries,
getWeekNew,
getBrandShop,
getSuggest,
... ...
... ... @@ -66,35 +66,25 @@ router.get('/index/isfav', favorite.isFavoriteBrand);// 品牌收藏状态
// 搜索
router.get('/search/index', search.index);
router.get('/search/filter/brands', search.serachFilterBrands);
// 搜索提示
router.get('/search/suggest', search.suggest);
router.get('/search/suggest', search.suggest); // 搜索提示
router.get('/api/suggest', search.suggest4Old);
// 商品分类列表页
router.get('/list/index', list.index);
// 新品到着
router.get('/list/new', list.new);
// 品牌页
router.get('/index/brand', list.brand);
router.get('/index/about', list.brandAbout);
// 品牌店铺
router.get('/index/brand', list.brand); // 品牌店铺页
router.get('/index/about', list.brandAbout); // 品牌店铺介绍页
router.post('/index/isFavoriteBrand', list.isFavoriteBrand); // 判断用户是否收藏品牌
router.post('/index/getNodeContent', list.getNodeContent); // 品牌页水牌
router.post('/index/getAdnav', list.getAdnav); // 品牌页系列
router.get('/shoplist', list.shopList); // 店铺列表页
router.post('/shop/togglecollect', favorite.collectShop); // 店铺收藏
router.post('/index/isFavoriteShop', favorite.isFavShop); // 判断用户是否收藏品牌
// 品牌页水牌
router.post('/index/getNodeContent', list.getNodeContent);
// 品牌页系列
router.post('/index/getAdnav', list.getAdnav);
// 判断用户是否收藏品牌
router.post('/index/isFavoriteBrand', list.isFavoriteBrand);
// 学生优惠routers
router.get('/students', students.index); // students 首页
... ...
... ... @@ -87,25 +87,25 @@
{{/ picLink}}
{{/ leftContent}}
{{#if brandBanner.dataId}}
{{# brandShopAd}}
<script id="pic-link-tpl" type="text/html">
\{{# picLink}}
\{{# picLink}}
\{{#if picTitle}}
<h2 class="nav-pic-title">\{{picTitle}}</h2>
<h2 class="nav-pic-title">\{{picTitle}}</h2>
\{{/if}}
<ul class="pic-nav">
\{{#each list}}
<li>
<a href="\{{href}}">
<img src="\{{src}}">
</a>
</li>
\{{/each}}
</ul>
\{{/ picLink}}
<ul class="pic-nav">
\{{#each list}}
<li>
<a href="\{{href}}">
<img src="{{baseUrl}}\{{src}}">
</a>
</li>
\{{/each}}
</ul>
\{{/ picLink}}
</script>
<div id="brand-ad" class="brand-ad"></div>
{{/if}}
<div id="brand-shop-ad" class="brand-shop-ad"></div>
{{/ brandShopAd}}
{{!-- 水牌广告 --}}
{{#if node}}
... ...
... ... @@ -188,9 +188,10 @@ $productListNav.find('h3').click(function() {
// 左侧需要ajax内容
(function() {
var $brandCard = $('#brand-card');
var $brandFavor = $('#brand-favor');
var html;
var $brandCard = $('#brand-card'),
$brandFavor = $('#brand-favor'),
$shopFavor = $('#shop-favor');
var html, adData;
if ($brandCard.length) {
$.ajax({
... ... @@ -204,19 +205,26 @@ $productListNav.find('h3').click(function() {
});
}
// 品牌页请求
if ($brandFavor.length) {
adData = {brandId: $brandFavor.data('id')};
}
if ($shopFavor.length) {
adData = {shopId: $shopFavor.data('id')};
}
// 款型系列异步请求
if (adData) {
html = $('#pic-link-tpl').html() || '';
$.ajax({
type: 'POST',
url: '/product/index/getAdnav',
data: {
brandId: $brandFavor.data('id')
}
data: adData
}).then(function(data) {
if (data) {
$('#brand-ad').html(Handlebars.compile(html)({
$('#brand-shop-ad').html(Handlebars.compile(html)({
picLink: data
}));
}
... ...
... ... @@ -5,7 +5,8 @@
*/
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload');
lazyLoad = require('yoho-jquery-lazyload'),
Handlebars = require('yoho-handlebars');
var product = require('./index/product');
... ... @@ -74,6 +75,23 @@ $('.shop-query-submit').on('click', function() {
$searchForm.submit();
});
(function() {
var $adBox = $('#brand-shop-ad');
var html = $('#pic-link-tpl').html() || '';
$.ajax({
type: 'POST',
url: '/product/index/getAdnav',
data: {shopId: shopId}
}).then(function(data) {
if (data) {
$adBox.parent().append($adBox);
$adBox.html(Handlebars.compile(html)({
picLink: data
}));
}
});
}());
// 收藏店铺
function colloectAction() {
... ...
... ... @@ -118,7 +118,7 @@
}
.brand-card img,
.brand-ad img {
.brand-shop-ad img {
max-width: 100%;
}
... ...