...
|
...
|
@@ -756,23 +756,23 @@ const _detailDataPkg = (origin, uid, vipLevel) => { |
|
|
if (domainBrand.type && domainBrand.shopId) {
|
|
|
switch (parseInt(domainBrand.type, 10)) {
|
|
|
case 1:
|
|
|
{
|
|
|
{
|
|
|
// 多品店不显示
|
|
|
banner = [];
|
|
|
break;
|
|
|
}
|
|
|
banner = [];
|
|
|
break;
|
|
|
}
|
|
|
case 2:
|
|
|
{
|
|
|
{
|
|
|
// 单品店显示新版的店铺banner
|
|
|
let basisData = yield shopService.basisTemplateAsync(domainBrand.shopId);
|
|
|
let basisData = yield shopService.basisTemplateAsync(domainBrand.shopId);
|
|
|
|
|
|
banner.bgImg = basisData.shopTopBanner.banner || banner.bgImg;
|
|
|
break;
|
|
|
}
|
|
|
banner.bgImg = basisData.shopTopBanner.banner || banner.bgImg;
|
|
|
break;
|
|
|
}
|
|
|
default:
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -1033,26 +1033,17 @@ const _getSizeData = (sizeInfo) => { |
|
|
* @param productId
|
|
|
*/
|
|
|
const _getProductModelCard = () => {
|
|
|
|
|
|
let result = [];
|
|
|
|
|
|
let data = _getCacheDataByName('ItemData::getProductModelCard');
|
|
|
|
|
|
if (!data) {
|
|
|
return result;
|
|
|
if (!data || _.get(data, 'code', 400) !== 200) {
|
|
|
return [];
|
|
|
}
|
|
|
|
|
|
if (data.code && data.code === 200) {
|
|
|
_(data.data).forEach(val => {
|
|
|
result.push({
|
|
|
url: helpers.getForceSourceUrl(val.modelImg),
|
|
|
size: val.size,
|
|
|
name: val.modelName
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
return _.get(data, 'data', []).map((value) => ({
|
|
|
url: helpers.getForceSourceUrl(value.modelImg),
|
|
|
size: value.size,
|
|
|
name: value.modelName
|
|
|
}));
|
|
|
};
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -1133,10 +1124,8 @@ const _getDetailDataBySizeInfo = (sizeInfo) => { |
|
|
let details = '';
|
|
|
|
|
|
// 详情配图
|
|
|
if (_.get(sizeInfo, 'productIntroBo.productIntro', null)) {
|
|
|
if (_.get(sizeInfo, 'productIntroBo.phrase', null)) {
|
|
|
details += `${sizeInfo.productDescBo.phrase}<br/>`;
|
|
|
}
|
|
|
if (_.has(sizeInfo, 'productIntroBo.phrase')) {
|
|
|
details += `${sizeInfo.productDescBo.phrase}<br/>`;
|
|
|
}
|
|
|
|
|
|
// 图片换成懒加载方式
|
...
|
...
|
@@ -1207,42 +1196,35 @@ const _getProductModelTry = () => { |
|
|
* @param sizeInfoBo
|
|
|
*/
|
|
|
const _getSizeAttrByMaxSortId = (maxSortId, sizeList) => {
|
|
|
let attributeIds = null;
|
|
|
if (_.isEmpty(sizeList)) {
|
|
|
return [];
|
|
|
}
|
|
|
|
|
|
// 不同分类,取得属性值不同
|
|
|
switch (maxSortId) {
|
|
|
case 1:
|
|
|
case 2:
|
|
|
attributeIds = [3, 4];
|
|
|
break;
|
|
|
|
|
|
case 3:
|
|
|
attributeIds = [6, 10];
|
|
|
break;
|
|
|
case 6:
|
|
|
attributeIds = [13];
|
|
|
break;
|
|
|
default:
|
|
|
attributeIds = [];
|
|
|
}
|
|
|
let attributeIds = (function(id) {
|
|
|
if (id === 1 && id === 2) {
|
|
|
return [3, 4];
|
|
|
} else if (id === 3) {
|
|
|
return [6, 10];
|
|
|
} else if (id === 6) {
|
|
|
return [13];
|
|
|
} else {
|
|
|
return [];
|
|
|
}
|
|
|
}(maxSortId));
|
|
|
|
|
|
let sizeInfos = [];
|
|
|
|
|
|
let attributeNames = {};
|
|
|
|
|
|
if (_.isEmpty(sizeList)) {
|
|
|
return sizeInfos;
|
|
|
}
|
|
|
|
|
|
// 获取属性名称
|
|
|
sizeList.sizeAttributeBos.forEach(size => {
|
|
|
_.get(sizeList, 'sizeAttributeBos', []).forEach((size) => {
|
|
|
attributeNames[size.id] = size.attributeName;
|
|
|
});
|
|
|
|
|
|
sizeList.sizeBoList.forEach(size => {
|
|
|
_.get(sizeList, 'sizeBoList', []).forEach((size) => {
|
|
|
let sizeValues = [];
|
|
|
|
|
|
size.sortAttributes.forEach(sort => {
|
|
|
_.get(size, 'sortAttributes', []).forEach((sort) => {
|
|
|
if (_.includes(attributeIds, sort.id)) {
|
|
|
if (sort.sizeValue) {
|
|
|
sizeValues.push(
|
...
|
...
|
@@ -1270,49 +1252,50 @@ const _getSizeAttrByMaxSortId = (maxSortId, sizeList) => { |
|
|
* @return object
|
|
|
*/
|
|
|
const _getSizeInfo = (productSkn, maxSortId)=> {
|
|
|
let result = {};
|
|
|
if (!productSkn) {
|
|
|
return {};
|
|
|
}
|
|
|
|
|
|
if (productSkn) {
|
|
|
// 并发资源中是否存在数据
|
|
|
let sizeInfo = _getCacheDataByName('ItemData::sizeInfo');
|
|
|
let sizeInfo = _getCacheDataByName('ItemData::sizeInfo');
|
|
|
|
|
|
if (!sizeInfo) {
|
|
|
return result;
|
|
|
}
|
|
|
if (_.isEmpty(sizeInfo)) {
|
|
|
return {};
|
|
|
}
|
|
|
|
|
|
// 描述数据
|
|
|
result.description = _getDescriptionDataBySizeInfo(sizeInfo);
|
|
|
let result = {};
|
|
|
|
|
|
// 模特卡
|
|
|
result.modelCards = _getProductModelCard();
|
|
|
// 描述数据
|
|
|
result.description = _getDescriptionDataBySizeInfo(sizeInfo);
|
|
|
|
|
|
// 试穿模特
|
|
|
let fittingReport = _getProductModelTry();
|
|
|
// 模特卡
|
|
|
result.modelCards = _getProductModelCard();
|
|
|
|
|
|
if (!_.isEmpty(fittingReport)) {
|
|
|
result.fittingReport = fittingReport;
|
|
|
}
|
|
|
// 试穿模特
|
|
|
let fittingReport = _getProductModelTry();
|
|
|
|
|
|
if (!_.isEmpty(fittingReport)) {
|
|
|
result.fittingReport = fittingReport;
|
|
|
}
|
|
|
|
|
|
// 尺寸数据
|
|
|
result.size = _getSizeData(sizeInfo);
|
|
|
// 尺寸数据
|
|
|
result.size = _getSizeData(sizeInfo);
|
|
|
|
|
|
// 模特数据
|
|
|
let reference = getReferenceDataBySizeInfo(sizeInfo);
|
|
|
// 模特数据
|
|
|
let reference = getReferenceDataBySizeInfo(sizeInfo);
|
|
|
|
|
|
if (!_.isEmpty(reference)) {
|
|
|
result.reference = reference;
|
|
|
}
|
|
|
if (!_.isEmpty(reference)) {
|
|
|
result.reference = reference;
|
|
|
}
|
|
|
|
|
|
// 洗涤材质
|
|
|
result.material = _getMaterialDataBySizeInfo(sizeInfo);
|
|
|
// 洗涤材质
|
|
|
result.material = _getMaterialDataBySizeInfo(sizeInfo);
|
|
|
|
|
|
// 商品详情页介绍
|
|
|
result.details = _getDetailDataBySizeInfo(sizeInfo);
|
|
|
// 商品详情页介绍
|
|
|
result.details = _getDetailDataBySizeInfo(sizeInfo);
|
|
|
|
|
|
// 获取尺寸说明
|
|
|
result.sizeTitleJson =
|
|
|
sizeInfo.sizeInfoBo ? JSON.stringify(_getSizeAttrByMaxSortId(maxSortId, sizeInfo.sizeInfoBo)) : '';
|
|
|
}
|
|
|
// 获取尺寸说明
|
|
|
result.sizeTitleJson =
|
|
|
sizeInfo.sizeInfoBo ? JSON.stringify(_getSizeAttrByMaxSortId(maxSortId, sizeInfo.sizeInfoBo)) : '';
|
|
|
|
|
|
return result;
|
|
|
};
|
...
|
...
|
|