...
|
...
|
@@ -216,6 +216,7 @@ function _getSkuDataByProductBaseInfo(data) { |
|
|
let defaultImage = '';// 默认图
|
|
|
let defaultSkuFlag = false; // 选中状态
|
|
|
let marketPrice = _.get(data, 'market_price', 0.0);
|
|
|
let imageAlt = _imageAlt(data); // eslint-disable-line
|
|
|
|
|
|
if (_.isEmpty(_.get(data, 'goods_list', []))) {
|
|
|
return {
|
...
|
...
|
@@ -256,7 +257,8 @@ function _getSkuDataByProductBaseInfo(data) { |
|
|
url: '',
|
|
|
shower: good.image_url,
|
|
|
img: good.image_url,
|
|
|
title: goodsDetail.title
|
|
|
title: goodsDetail.title,
|
|
|
imageAlt
|
|
|
});
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -335,7 +337,8 @@ function _getSkuDataByProductBaseInfo(data) { |
|
|
return {
|
|
|
defaultImage: defaultImage,
|
|
|
skuGoods: skuGoods,
|
|
|
totalStorageNum: totalStorageNum
|
|
|
totalStorageNum: totalStorageNum,
|
|
|
imageAlt
|
|
|
};
|
|
|
}
|
|
|
|
...
|
...
|
@@ -909,6 +912,51 @@ function _getIntroInfo(productSkn, maxSortId, additionalData) { |
|
|
return result;
|
|
|
}
|
|
|
|
|
|
function _genderHelper(gender) {
|
|
|
gender = gender || '';
|
|
|
|
|
|
switch (gender) {
|
|
|
case '1':
|
|
|
case '1,3': {
|
|
|
return '男款';
|
|
|
}
|
|
|
case '2':
|
|
|
case '2,3': {
|
|
|
return '女款';
|
|
|
}
|
|
|
default: {
|
|
|
return '';
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function _imageAlt(goodsInfo) {
|
|
|
let navs = _getSortNavAsync({data: goodsInfo}, null);
|
|
|
let alt = '';
|
|
|
|
|
|
if (_.get(goodsInfo, 'brand_info.brand_name_en')) {
|
|
|
alt += _.get(goodsInfo, 'brand_info.brand_name_en') + '|';
|
|
|
}
|
|
|
|
|
|
if (_.get(goodsInfo, 'brand_info.brand_name_cn')) {
|
|
|
alt += _.get(goodsInfo, 'brand_info.brand_name_cn') + '|';
|
|
|
}
|
|
|
|
|
|
if (_.get(goodsInfo, 'gender')) {
|
|
|
alt += _genderHelper(_.get(goodsInfo, 'data.gender', '1,3')) + '|';
|
|
|
}
|
|
|
|
|
|
if (_.get(navs, '[1].name')) {
|
|
|
alt += navs[1].name + '|';
|
|
|
}
|
|
|
|
|
|
if (_.get(goodsInfo, 'product_name', '')) {
|
|
|
alt += _.get(goodsInfo, 'product_name', '');
|
|
|
}
|
|
|
|
|
|
return alt;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取seo信息
|
|
|
*
|
...
|
...
|
@@ -917,38 +965,35 @@ function _getIntroInfo(productSkn, maxSortId, additionalData) { |
|
|
* @return array
|
|
|
*/
|
|
|
function _getSeoByGoodsInfo(goodsInfo, navs) {
|
|
|
let title = '';
|
|
|
let brandName = '';
|
|
|
let sortName = '';
|
|
|
let productName = _.get(goodsInfo, 'data.product_name', '');
|
|
|
|
|
|
goodsInfo = goodsInfo || {};
|
|
|
navs = navs || [];
|
|
|
|
|
|
if (goodsInfo.brandName) {
|
|
|
title = goodsInfo.brandName + ' ';
|
|
|
brandName = goodsInfo.brandName;
|
|
|
if (_.get(goodsInfo, 'data.brand_info.brand_name', '')) {
|
|
|
brandName = _.get(goodsInfo, 'data.brand_info.brand_name');
|
|
|
}
|
|
|
|
|
|
if (_.get(navs, '[1].name')) {
|
|
|
sortName = navs[1].name;
|
|
|
title += navs[1].name + '|';
|
|
|
}
|
|
|
|
|
|
title += goodsInfo.name + '正品 | YOHO!BUY 有货';
|
|
|
let title = `【${brandName}${sortName}】` + productName + ' | YOHO!BUY 有货';
|
|
|
|
|
|
let keywords = brandName + sortName + ',' + brandName + '专卖店,' + brandName + '官方授权店,' +
|
|
|
brandName + '正品,' + brandName + '打折,' + brandName + '折扣店,' + brandName + '真品,' + brandName + '代购';
|
|
|
let keywords = brandName + sortName + ',' + brandName + sortName + '价格,' + brandName + sortName + '图片';
|
|
|
|
|
|
let description = `YOHO!BUY 有货-${brandName}官方授权店,${goodsInfo.name}图片、报价、介绍。` +
|
|
|
`YOHO!BUY 有货${brandName}专卖店提供${brandName}正品、${brandName}真品、 ${brandName}打折、${brandName}代购等。`;
|
|
|
let description = `${productName},有货网仅售${_.get(goodsInfo, 'data.format_sales_price')}元,` +
|
|
|
`购买${brandName + sortName},了解${brandName + sortName}商品信息就上有货网!`;
|
|
|
|
|
|
let cononicalURL = goodsInfo.productUrl;
|
|
|
let cononicalURL = helpers.getUrlBySkc(_.get(goodsInfo, 'data.product_skn'));
|
|
|
|
|
|
return {
|
|
|
title: title,
|
|
|
keywords: keywords.replace(/~+/, ''),
|
|
|
description: description,
|
|
|
cononicalURL: cononicalURL
|
|
|
cononicalURL: cononicalURL,
|
|
|
};
|
|
|
}
|
|
|
|
...
|
...
|
@@ -1193,6 +1238,7 @@ function _detailDataPkg(origin, uid, vipLevel, cookies) { |
|
|
|
|
|
result.img = skuData.defaultImage;
|
|
|
result.colors = skuData.skuGoods;
|
|
|
result.imageAlt = skuData.imageAlt;
|
|
|
let totalStorageNum = skuData.totalStorageNum;
|
|
|
|
|
|
// 限购商品
|
...
|
...
|
@@ -1534,7 +1580,7 @@ function showMainAsync(req, data) { |
|
|
result.detail.goodsInfo.imageBanner = _getProductActivityBanner(productDescription.banner);
|
|
|
|
|
|
// seo
|
|
|
result.seo = _getSeoByGoodsInfo(productInfo.goodsInfo, sortNavigator);
|
|
|
result.seo = _getSeoByGoodsInfo(productData, sortNavigator);
|
|
|
|
|
|
// 商品页面统计
|
|
|
result.statGoodsInfo = Object.assign({fullSortName: sortNavigator.map(x => x.name).join('-')},
|
...
|
...
|
@@ -1595,7 +1641,7 @@ function recommendAsync(skn, page, limit) { |
|
|
}
|
|
|
|
|
|
const formatPrice = p => `¥${p}`;
|
|
|
const productUrl = (productSkn) => helpers.getUrlBySkc(productSkn);
|
|
|
const productUrl = helpers.getUrlBySkc;
|
|
|
const productImageUrl = Fn.pipe(Fn.prop('default_images'), _.partial(helpers.image, _, 280, 382, 2, 70));
|
|
|
|
|
|
let products = _.get(recommendData, 'data.product_list', []).map((rp) => {
|
...
|
...
|
|