...
|
...
|
@@ -111,38 +111,34 @@ const _getProductFavoriteDataAsync = (uid, pid, bid) => { |
|
|
const _getTagsDataByProductInfo = (data) => {
|
|
|
let tags = {};
|
|
|
|
|
|
if (data.productTagBoList) {
|
|
|
data.productTagBoList.forEach(
|
|
|
value => {
|
|
|
switch (value.tagLabel) {
|
|
|
case 'is_soon_sold_out': // 即将售磬
|
|
|
tags.isFew = true;
|
|
|
break;
|
|
|
case 'is_new': // 新品NEW
|
|
|
tags.isNew = true;
|
|
|
break;
|
|
|
case 'is_discount': // SALE
|
|
|
tags.isSale = true;
|
|
|
break;
|
|
|
case 'is_limited': // 限量
|
|
|
tags.isLimit = true;
|
|
|
break;
|
|
|
case 'is_yohood': // YOHOOD
|
|
|
tags.isNewFestival = true;
|
|
|
break;
|
|
|
case 'is_advance': // 再到着
|
|
|
tags.isReNew = true;
|
|
|
break;
|
|
|
case 'midYear':// 年中热促
|
|
|
tags.isYearMidPromotion = true;
|
|
|
break;
|
|
|
case 'yearEnd':// 年终大促
|
|
|
tags.isYearEndPromotion = true;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
}
|
|
|
_.get(data, 'productTagBoList', []).forEach((value) => {
|
|
|
switch (value.tagLabel) {
|
|
|
case 'is_soon_sold_out': // 即将售磬
|
|
|
tags.isFew = true;
|
|
|
break;
|
|
|
case 'is_new': // 新品NEW
|
|
|
tags.isNew = true;
|
|
|
break;
|
|
|
case 'is_discount': // SALE
|
|
|
tags.isSale = true;
|
|
|
break;
|
|
|
case 'is_limited': // 限量
|
|
|
tags.isLimit = true;
|
|
|
break;
|
|
|
case 'is_yohood': // YOHOOD
|
|
|
tags.isNewFestival = true;
|
|
|
break;
|
|
|
case 'is_advance': // 再到着
|
|
|
tags.isReNew = true;
|
|
|
break;
|
|
|
case 'midYear':// 年中热促
|
|
|
tags.isYearMidPromotion = true;
|
|
|
break;
|
|
|
case 'yearEnd':// 年终大促
|
|
|
tags.isYearEndPromotion = true;
|
|
|
break;
|
|
|
}
|
|
|
});
|
|
|
return tags;
|
|
|
};
|
|
|
|
...
|
...
|
@@ -759,19 +755,22 @@ const _detailDataPkg = (origin, uid, vipLevel) => { |
|
|
|
|
|
if (domainBrand.type && domainBrand.shopId) {
|
|
|
switch (parseInt(domainBrand.type, 10)) {
|
|
|
case 1: {
|
|
|
case 1:
|
|
|
{
|
|
|
// 多品店不显示
|
|
|
banner = [];
|
|
|
break;
|
|
|
}
|
|
|
case 2: {
|
|
|
case 2:
|
|
|
{
|
|
|
// 单品店显示新版的店铺banner
|
|
|
let basisData = yield shopService.basisTemplateAsync(domainBrand.shopId);
|
|
|
|
|
|
banner.bgImg = basisData.shopTopBanner.banner || banner.bgImg;
|
|
|
break;
|
|
|
}
|
|
|
default: {
|
|
|
default:
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -942,84 +941,83 @@ const _sizeInfoBoSort = (sizeInfoBo) => { |
|
|
* @returns {{}}
|
|
|
*/
|
|
|
const _getSizeData = (sizeInfo) => {
|
|
|
let size = {};
|
|
|
if (!_.has(sizeInfo, 'sizeInfoBo')) {
|
|
|
return {};
|
|
|
}
|
|
|
|
|
|
// 尺码信息
|
|
|
if (sizeInfo.sizeInfoBo) {
|
|
|
sizeInfo.sizeInfoBo = _sizeInfoBoSort(sizeInfo.sizeInfoBo);
|
|
|
|
|
|
let boyReference = !!sizeInfo.productExtra.boyReference;
|
|
|
|
|
|
let girlReference = !!sizeInfo.productExtra.girlReference;
|
|
|
|
|
|
let gender = sizeInfo.productDescBo.gender || 3;
|
|
|
|
|
|
let referenceName = '参考尺码';
|
|
|
|
|
|
if ((gender === 1 && boyReference) || (gender === 2 && girlReference)) {
|
|
|
referenceName = '参考尺码';
|
|
|
} else if (gender === 3 && boyReference) {
|
|
|
referenceName = '参考尺码(男)';
|
|
|
sizeInfo.sizeInfoBo = _sizeInfoBoSort(sizeInfo.sizeInfoBo);
|
|
|
|
|
|
let boyReference = _.get(sizeInfo, 'productExtra.boyReference', false);
|
|
|
let girlReference = _.get(sizeInfo, 'productExtra.girlReference', false);
|
|
|
let gender = _.get(sizeInfo, 'productDescBo.gender', 3);
|
|
|
let referenceName = (function() {
|
|
|
if (gender === 3 && boyReference) {
|
|
|
return '参考尺码(男)';
|
|
|
} else if (gender === 3 && girlReference) {
|
|
|
referenceName = '参考尺码(女)';
|
|
|
return '参考尺码(女)';
|
|
|
} else {
|
|
|
return '参考尺码';
|
|
|
}
|
|
|
}());
|
|
|
|
|
|
// 判断是否显示参考尺码
|
|
|
let showReference = (boyReference && sizeInfo.sizeInfoBo.sizeBoList[0].boyReferSize) ||
|
|
|
(girlReference && sizeInfo.sizeInfoBo.sizeBoList[0].girlReferSize);
|
|
|
// 判断是否显示参考尺码
|
|
|
let showReference = (boyReference && _.get(sizeInfo, 'sizeInfoBo.sizeBoList[0].boyReferSize', false)) ||
|
|
|
(girlReference && _.get(sizeInfo, 'sizeInfoBo.sizeBoList[0].girlReferSize', false));
|
|
|
|
|
|
if (sizeInfo.sizeInfoBo.sizeAttributeBos) {
|
|
|
// 尺码信息头部
|
|
|
size.thead = [{name: '吊牌尺码', id: ''}];
|
|
|
|
|
|
// 显示参考尺码
|
|
|
if (showReference) {
|
|
|
size.thead[1] = {name: referenceName, id: ''};
|
|
|
}
|
|
|
if (!_.has(sizeInfo, 'sizeInfoBo.sizeAttributeBos')) {
|
|
|
return {};
|
|
|
}
|
|
|
|
|
|
sizeInfo.sizeInfoBo.sizeAttributeBos.forEach(attr => {
|
|
|
size.thead.push({
|
|
|
name: attr.attributeName || ' ',
|
|
|
id: attr.id
|
|
|
});
|
|
|
});
|
|
|
// 尺码信息头部
|
|
|
let size = {
|
|
|
thead: [{name: '吊牌尺码', id: ''}],
|
|
|
tbody: []
|
|
|
};
|
|
|
|
|
|
// 显示参考尺码
|
|
|
if (showReference) {
|
|
|
size.thead[1] = {name: referenceName, id: ''};
|
|
|
}
|
|
|
|
|
|
size.tbody = [];
|
|
|
_.get(sizeInfo, 'sizeInfoBo.sizeAttributeBos', []).forEach(attr => {
|
|
|
size.thead.push({
|
|
|
name: attr.attributeName || ' ',
|
|
|
id: attr.id
|
|
|
});
|
|
|
});
|
|
|
|
|
|
sizeInfo.sizeInfoBo.sizeBoList.forEach(value => {
|
|
|
_.get(sizeInfo, 'sizeInfoBo.sizeBoList', []).forEach(value => {
|
|
|
|
|
|
let sizes = [];
|
|
|
let sizes = [];
|
|
|
|
|
|
// 吊牌尺码
|
|
|
sizes.push(value.sizeName);
|
|
|
// 吊牌尺码
|
|
|
sizes.push(value.sizeName);
|
|
|
|
|
|
// 判断是否显示参考尺码
|
|
|
if (boyReference && (gender === 1 || gender === 3) && showReference) {
|
|
|
sizes.push(value.boyReferSize.referenceName || ' ');
|
|
|
} else if (girlReference && (gender === 2 || gender === 3) && showReference) {
|
|
|
sizes.push(value.girlReferSize.referenceName || ' ');
|
|
|
} else {
|
|
|
if (size.thead[1] && showReference) {
|
|
|
size.thead[1] = {};
|
|
|
}
|
|
|
}
|
|
|
// 判断是否显示参考尺码
|
|
|
if (boyReference && (gender === 1 || gender === 3) && showReference) {
|
|
|
sizes.push(_.get(value, 'boyReferSize.referenceName', ' '));
|
|
|
} else if (girlReference && (gender === 2 || gender === 3) && showReference) {
|
|
|
sizes.push(_.get(value, 'girlReferSize.referenceName', ' '));
|
|
|
} else {
|
|
|
if (size.thead[1] && showReference) {
|
|
|
size.thead[1] = {};
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 其他尺码信息
|
|
|
value.sortAttributes.forEach(attr => {
|
|
|
sizes.push((attr.sizeValue || BLANK_STR));
|
|
|
});
|
|
|
// 其他尺码信息
|
|
|
_.get(value, 'sortAttributes', []).forEach(attr => {
|
|
|
sizes.push(_.get(attr, 'sizeValue', BLANK_STR));
|
|
|
});
|
|
|
|
|
|
// 尺码信息
|
|
|
size.tbody.push(sizes);
|
|
|
});
|
|
|
// 尺码信息
|
|
|
size.tbody.push(sizes);
|
|
|
});
|
|
|
|
|
|
// 参考尺码为空
|
|
|
if (_.isEmpty(size.thead[1]) && showReference) {
|
|
|
// 移除这个值
|
|
|
size.thead.splice(1, 1);
|
|
|
}
|
|
|
}
|
|
|
// 参考尺码为空
|
|
|
if (_.isEmpty(size.thead[1]) && showReference) {
|
|
|
// 移除这个值
|
|
|
size.thead.splice(1, 1);
|
|
|
}
|
|
|
|
|
|
// 测量方式
|
...
|
...
|
@@ -1377,7 +1375,7 @@ const _getSeoByGoodsInfo = function(goodsInfo, navs) { |
|
|
const showMainAsync = (data) => {
|
|
|
return co(function * () {
|
|
|
let result = {};
|
|
|
let currentUserProductInfo = _.curry(_detailDataPkg)(_, data.uid, data.vipLevel);
|
|
|
let currentUserProductInfo = _.partial(_detailDataPkg, data.uid, data.vipLevel);
|
|
|
|
|
|
// 获取商品信息
|
|
|
let productInfo = yield productAPI.getProductAsync(data.pid, data.uid).then(currentUserProductInfo);
|
...
|
...
|
|