...
|
...
|
@@ -26,10 +26,10 @@ const getSizeInfo = (sizeInfo) => { |
|
|
dest.goodsDescription.detail = {};
|
|
|
dest.goodsDescription.detail.list = [];
|
|
|
|
|
|
if (!_.isEmpty(sizeInfo.productDescBo.erpProductId)) {
|
|
|
if (_.has(sizeInfo, 'productDescBo.erpProductId')) {
|
|
|
let sex = '通用';
|
|
|
|
|
|
switch (sizeInfo.productDescBo.gender) {
|
|
|
switch (_.get(sizeInfo, 'productDescBo.gender', 0)) {
|
|
|
case 1:
|
|
|
sex = '男款';
|
|
|
break;
|
...
|
...
|
@@ -43,17 +43,17 @@ const getSizeInfo = (sizeInfo) => { |
|
|
dest.goodsDescription.title = '商品信息';
|
|
|
dest.goodsDescription.enTitle = 'DESCRIPTION';
|
|
|
temp = {};
|
|
|
temp.param = '编号:' + sizeInfo.productDescBo.erpProductId;
|
|
|
temp.param = '编号:' + _.get(sizeInfo, 'productDescBo.erpProductId', '');
|
|
|
dest.goodsDescription.detail.list.push(temp);
|
|
|
temp = {};
|
|
|
temp.param = '颜色:' + sizeInfo.productDescBo.colorName;
|
|
|
temp.param = '颜色:' + _.get(sizeInfo, 'productDescBo.colorName', '');
|
|
|
dest.goodsDescription.detail.list.push(temp);
|
|
|
temp = {};
|
|
|
temp.param = '性别:' + sex;
|
|
|
dest.goodsDescription.detail.list.push(temp);
|
|
|
}
|
|
|
|
|
|
if (!_.isEmpty(sizeInfo.productDescBo.standardBos)) {
|
|
|
if (_.has(sizeInfo, 'productDescBo.standardBos')) {
|
|
|
_.forEach(sizeInfo.productDescBo.standardBos, function(value) {
|
|
|
temp = {};
|
|
|
temp.param = value.standardName + ':' +
|
...
|
...
|
@@ -62,12 +62,12 @@ const getSizeInfo = (sizeInfo) => { |
|
|
dest.goodsDescription.detail.list.push(temp);
|
|
|
});
|
|
|
}
|
|
|
if (_.isEmpty(sizeInfo.phrase)) {
|
|
|
if (sizeInfo.phrase) {
|
|
|
dest.goodsDescription.desc = sizeInfo.phrase;
|
|
|
}
|
|
|
|
|
|
// 尺码信息
|
|
|
if (!_.isEmpty(sizeInfo.sizeInfoBo)) {
|
|
|
if (sizeInfo.sizeInfoBo) {
|
|
|
dest.sizeInfo = {};
|
|
|
dest.sizeInfo.title = '尺码信息';
|
|
|
dest.sizeInfo.enTitle = 'SIZE INFO';
|
...
|
...
|
@@ -75,9 +75,9 @@ const getSizeInfo = (sizeInfo) => { |
|
|
dest.sizeInfo.detail.list = [];
|
|
|
|
|
|
// 参考尺码
|
|
|
let boyReference = sizeInfo.productExtra.boyReference;
|
|
|
let girlReference = sizeInfo.productExtra.girlReference;
|
|
|
let gender = sizeInfo.productDescBo.gender ? sizeInfo.productDescBo.gender : 3;
|
|
|
let boyReference = _.get(sizeInfo, 'productExtra.boyReference', null);
|
|
|
let girlReference = _.get(sizeInfo, 'productExtra.girlReference', null);
|
|
|
let gender = _.get(sizeInfo, 'productDescBo.gender', 3);
|
|
|
let referenceName = '参考尺码';
|
|
|
|
|
|
if ((gender === 1 && boyReference) || (gender === 2 && girlReference)) {
|
...
|
...
|
@@ -91,16 +91,18 @@ const getSizeInfo = (sizeInfo) => { |
|
|
let referenceList = [];
|
|
|
|
|
|
// 判断是否显示参考尺码
|
|
|
let showReference = (boyReference &&
|
|
|
!_.isEmpty(sizeInfo.sizeInfoBo.sizeBoList[0].boyReferSize)) || (girlReference &&
|
|
|
!_.isEmpty(sizeInfo.sizeInfoBo.sizeBoList[0].girlReferSize));
|
|
|
let showReference = (boyReference && sizeInfo.sizeInfoBo &&
|
|
|
sizeInfo.sizeInfoBo.sizeBoList && sizeInfo.sizeInfoBo.sizeBoList[0] &&
|
|
|
sizeInfo.sizeInfoBo.sizeBoList[0].boyReferSize) ||
|
|
|
(girlReference && sizeInfo.sizeInfoBo && sizeInfo.sizeInfoBo.sizeBoList &&
|
|
|
sizeInfo.sizeInfoBo.sizeBoList[0] && sizeInfo.sizeInfoBo.sizeBoList[0].girlReferSize);
|
|
|
|
|
|
if (showReference) {
|
|
|
referenceList[0] = {};
|
|
|
referenceList[0].param = referenceName;
|
|
|
}
|
|
|
|
|
|
if (!_.isEmpty(sizeInfo.sizeInfoBo.sizeAttributeBos)) {
|
|
|
if (_.has(sizeInfo, 'sizeInfoBo.sizeAttributeBos')) {
|
|
|
|
|
|
// [{param: attrName}] th
|
|
|
let sizeNameList = [];
|
...
|
...
|
@@ -112,38 +114,40 @@ const getSizeInfo = (sizeInfo) => { |
|
|
// {id: [{param: str},......]} sizeBoGroup[id][0] 属性名, sizeBoGroup[id][index] 属性值
|
|
|
let sizeBoGroup = {};
|
|
|
|
|
|
_.forEach(sizeInfo.sizeInfoBo.sizeAttributeBos, function(attr) {
|
|
|
sizeBoGroup[attr.id] = [];
|
|
|
sizeBoGroup[attr.id][0] = {};
|
|
|
sizeBoGroup[attr.id][0].param = _.isEmpty(attr.attributeName) ?
|
|
|
' ' : attr.attributeName;
|
|
|
});
|
|
|
|
|
|
|
|
|
_.forEach(sizeInfo.sizeInfoBo.sizeBoList, function(value) {
|
|
|
if (_.has(sizeInfo, 'sizeInfoBo.sizeAttributeBos')) {
|
|
|
_.forEach(sizeInfo.sizeInfoBo.sizeAttributeBos, function(attr) {
|
|
|
sizeBoGroup[attr.id] = [];
|
|
|
sizeBoGroup[attr.id][0] = {};
|
|
|
sizeBoGroup[attr.id][0].param = attr.attributeName;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
temp = {};
|
|
|
temp.param = value.sizeName;
|
|
|
sizeNameList.push(temp);
|
|
|
if (_.has(sizeInfo, 'sizeInfoBo.sizeBoList')) {
|
|
|
_.forEach(sizeInfo.sizeInfoBo.sizeBoList, function(value) {
|
|
|
|
|
|
if (boyReference && (gender === 1 || gender === 3)) {
|
|
|
temp = {};
|
|
|
temp.param = (value.boyReferSize && value.boyReferSize.referenceName) || '';
|
|
|
referenceList.push(temp);
|
|
|
} else if (girlReference && (gender === 2 || gender === 3)) {
|
|
|
temp = {};
|
|
|
temp.param = (value.girlReferSize && value.girlReferSize.referenceName) || '';
|
|
|
referenceList.push(temp);
|
|
|
} else {
|
|
|
showReference = false;
|
|
|
}
|
|
|
|
|
|
_.forEach(value.sortAttributes, function(attr) {
|
|
|
temp = {};
|
|
|
temp.param = attr.sizeValue || ' ';
|
|
|
sizeBoGroup[attr.id].push(temp);
|
|
|
temp.param = value.sizeName;
|
|
|
sizeNameList.push(temp);
|
|
|
|
|
|
if (boyReference && (gender === 1 || gender === 3)) {
|
|
|
temp = {};
|
|
|
temp.param = (value.boyReferSize && value.boyReferSize.referenceName) || '';
|
|
|
referenceList.push(temp);
|
|
|
} else if (girlReference && (gender === 2 || gender === 3)) {
|
|
|
temp = {};
|
|
|
temp.param = (value.girlReferSize && value.girlReferSize.referenceName) || '';
|
|
|
referenceList.push(temp);
|
|
|
} else {
|
|
|
showReference = false;
|
|
|
}
|
|
|
|
|
|
_.forEach(value.sortAttributes, function(attr) {
|
|
|
temp = {};
|
|
|
temp.param = attr.sizeValue || ' ';
|
|
|
sizeBoGroup[attr.id].push(temp);
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 根据模板页面的显示,按表格一列一列来显示
|
|
|
dest.sizeInfo.detail.list[0] = {};
|
...
|
...
|
@@ -163,7 +167,7 @@ const getSizeInfo = (sizeInfo) => { |
|
|
}
|
|
|
|
|
|
// 测量方式
|
|
|
if (!_.isEmpty(sizeInfo.sizeImage)) {
|
|
|
if (sizeInfo.sizeImage) {
|
|
|
dest.measurementMethod = {};
|
|
|
|
|
|
dest.measurementMethod.title = '测量方式';
|
...
|
...
|
@@ -172,7 +176,7 @@ const getSizeInfo = (sizeInfo) => { |
|
|
}
|
|
|
|
|
|
// 模特试穿, 竖着输出排列显示
|
|
|
if (!_.isEmpty(sizeInfo.modelBos)) {
|
|
|
if (sizeInfo.modelBos) {
|
|
|
let reference = {
|
|
|
title: '模特试穿',
|
|
|
enTitle: 'REFERENCE'
|
...
|
...
|
@@ -263,7 +267,7 @@ const getSizeInfo = (sizeInfo) => { |
|
|
}
|
|
|
|
|
|
// 商品材质
|
|
|
if (!_.isEmpty(sizeInfo.productMaterialList)) {
|
|
|
if (sizeInfo.productMaterialList) {
|
|
|
dest.materials = {};
|
|
|
dest.materials.title = '商品材质';
|
|
|
dest.materials.enTitle = 'MATERIALS';
|
...
|
...
|
@@ -279,7 +283,7 @@ const getSizeInfo = (sizeInfo) => { |
|
|
}
|
|
|
|
|
|
// 洗涤提示
|
|
|
if (!_.isEmpty(sizeInfo.washTipsBoList)) {
|
|
|
if (sizeInfo.washTipsBoList) {
|
|
|
dest.washTips = {};
|
|
|
dest.washTips.list = [];
|
|
|
_.forEach(sizeInfo.washTipsBoList, function(value) {
|
...
|
...
|
@@ -288,16 +292,17 @@ const getSizeInfo = (sizeInfo) => { |
|
|
}
|
|
|
|
|
|
// 详情配图
|
|
|
|
|
|
if (!_.isEmpty(sizeInfo.productIntroBo.productIntro)) {
|
|
|
if (_.has(sizeInfo, 'productIntroBo.productIntro')) {
|
|
|
let productIntro = '';
|
|
|
|
|
|
if (!_.isEmpty(sizeInfo.productDescBo.phrase)) {
|
|
|
if (_.has(sizeInfo, 'productDescBo.phrase')) {
|
|
|
productIntro = productIntro + sizeInfo.productDescBo.phrase +
|
|
|
'<br />';
|
|
|
}
|
|
|
productIntro = productIntro + sizeInfo.productIntroBo.productIntro;
|
|
|
if (!_.isEmpty(productIntro) && productIntro !== '') {
|
|
|
if (_.has(sizeInfo, 'productIntroBo.productIntro')) {
|
|
|
productIntro = productIntro + sizeInfo.productIntroBo.productIntro;
|
|
|
}
|
|
|
if (productIntro) {
|
|
|
dest.productDetail = {};
|
|
|
dest.productDetail.title = '商品详情';
|
|
|
dest.productDetail.enTitle = 'DETAILS';
|
...
|
...
|
|