...
|
...
|
@@ -488,256 +488,15 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
|
dest.isCollect = true;
|
|
|
}
|
|
|
|
|
|
// 底部简介的URL链接
|
|
|
dest.introUrl = helpers.url('/product/intro_' + origin.erpProductId + '/' + origin.cnAlphabet + '.html', null, '');
|
|
|
// 底部简介的URL链接 待处理
|
|
|
// dest.introUrl = helpers.url('/product/intro_' + origin.erpProductId +
|
|
|
// '/' + origin.cnAlphabet + '.html', null, '');
|
|
|
dest.introUrl = 'http://localhost:6001/product/intro/51257148';
|
|
|
dest.id = origin.id;
|
|
|
|
|
|
return dest;
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 商品尺码信息处理
|
|
|
* @param {[type]} productSkn [description]
|
|
|
* @param {[type]} uid [description]
|
|
|
* @param {[type]} udid [description]
|
|
|
* @return {[type]} [description]
|
|
|
*/
|
|
|
const getSizeInfo = (sizeInfo) => {
|
|
|
var dest = {},
|
|
|
temp = {};
|
|
|
|
|
|
dest.goodsDescription = {};
|
|
|
|
|
|
if (_.isEmpty(sizeInfo.productDescBo.erpProductId)) {
|
|
|
let sex = '通用';
|
|
|
|
|
|
switch (sizeInfo.productDescBo.gender) {
|
|
|
case 1:
|
|
|
sex = '男款';
|
|
|
break;
|
|
|
case 2:
|
|
|
sex = '女款';
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
dest.goodsDescription.title = '商品信息';
|
|
|
dest.goodsDescription.enTitle = 'DESCRIPTION';
|
|
|
dest.goodsDescription.detail = {};
|
|
|
dest.goodsDescription.detail.list = {};
|
|
|
dest.goodsDescription.detail.list[0].param =
|
|
|
'编号:' + sizeInfo.productDescBo.erpProductId;
|
|
|
dest.goodsDescription.detail.list[1].param =
|
|
|
'颜色:' + sizeInfo.productDescBo.colorName;
|
|
|
dest.goodsDescription.detail.list[2].param =
|
|
|
'性别:' + sex;
|
|
|
}
|
|
|
|
|
|
if (_.isEmpty(sizeInfo.productDescBo.standardBos)) {
|
|
|
_.forEach(sizeInfo.productDescBo.standardBos, function(value) {
|
|
|
dest.goodsDescription.detail.list[3].param = value.standardName + ':' +
|
|
|
value.standardVal;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if (_.isEmpty(sizeInfo.phrase)) {
|
|
|
dest.goodsDescription.desc = sizeInfo.phrase;
|
|
|
}
|
|
|
|
|
|
// 尺码信息
|
|
|
if (!_.isEmpty(sizeInfo.sizeInfoBo)) {
|
|
|
dest.sizeInfo = {};
|
|
|
dest.sizeInfo.title = '尺码信息';
|
|
|
dest.sizeInfo.enTitle = 'SIZE INFO';
|
|
|
dest.sizeInfo.detail = [];
|
|
|
dest.sizeInfo.detail.list = [];
|
|
|
|
|
|
// 参考尺码
|
|
|
let boyReference = !_.isEmpty(sizeInfo.productExtra.boyReference);
|
|
|
let girlReference = !_.isEmpty(sizeInfo.productExtra.girlReference);
|
|
|
let gender = !_.isEmpty(sizeInfo.productDescBo.gender) ? sizeInfo.productDescBo.gender : 3;
|
|
|
let referenceName = '参考尺码';
|
|
|
|
|
|
if ((gender === 1 && boyReference) || (gender === 2 && girlReference)) {
|
|
|
referenceName = '参考尺码';
|
|
|
} else if (gender === 3 && boyReference) {
|
|
|
referenceName = '参考尺码(男)';
|
|
|
} else if (gender === 3 && girlReference) {
|
|
|
referenceName = '参考尺码(女)';
|
|
|
}
|
|
|
|
|
|
let referenceList = {};
|
|
|
|
|
|
// 判断是否显示参考尺码
|
|
|
let showReference = (boyReference &&
|
|
|
!_.isEmpty(sizeInfo.sizeInfoBo.sizeBoList[0].boyReferSize)) || (girlReference &&
|
|
|
!_.isEmpty(sizeInfo.sizeInfoBo.sizeBoList[0].girlReferSize));
|
|
|
|
|
|
if (showReference) {
|
|
|
referenceList[0] = {};
|
|
|
referenceList[0].param = referenceName;
|
|
|
}
|
|
|
|
|
|
if (!_.isEmpty(sizeInfo.sizeInfoBo.sizeAttributeBos)) {
|
|
|
let sizeNameList = {};
|
|
|
|
|
|
sizeNameList[0] = {};
|
|
|
sizeNameList[0].param = '吊牌尺码';
|
|
|
|
|
|
let sizeBoGroup = {};
|
|
|
|
|
|
_.forEach(sizeInfo.sizeInfoBo.sizeAttributeBos, function(attr) {
|
|
|
sizeBoGroup[attr.id[0]] = {};
|
|
|
sizeBoGroup[attr.id[0]].param = _.isEmpty(attr.attributeName) ?
|
|
|
' ' : attr.attributeName;
|
|
|
});
|
|
|
|
|
|
|
|
|
_.forEach(sizeInfo.sizeInfoBo.sizeBoList, function(value) {
|
|
|
// let item = {};
|
|
|
|
|
|
sizeNameList[0] = {};
|
|
|
sizeNameList[0].param = value.sizeName;
|
|
|
|
|
|
if (boyReference && (gender === 1 || gender === 3)) {
|
|
|
temp = {};
|
|
|
temp.param = _.isEmpty(value.boyReferSize.referenceName) ?
|
|
|
' ' : value.boyReferSize.referenceName;
|
|
|
sizeNameList.push(temp);
|
|
|
} else if (girlReference && (gender === 2 || gender === 3)) {
|
|
|
temp = {};
|
|
|
temp.param = _.isEmpty(value.girlReferSize.referenceName) ?
|
|
|
' ' : value.girlReferSize.referenceName;
|
|
|
sizeNameList.push(temp);
|
|
|
} else {
|
|
|
showReference = false;
|
|
|
}
|
|
|
|
|
|
_.forEach(value.sortAttributes, function(attr) {
|
|
|
temp = {};
|
|
|
temp.param = _.isEmpty(attr.sizeValue) ? ' ' : attr.sizeValue;
|
|
|
sizeBoGroup[attr.id] = [];
|
|
|
sizeBoGroup[attr.id].push(temp);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
// 根据模板页面的显示,按表格一列一列来显示
|
|
|
dest.sizeInfo.detail.list[0] = [];
|
|
|
dest.sizeInfo.detail.list[0].params = sizeNameList;
|
|
|
if (showReference) {
|
|
|
dest.sizeInfo.detail.list[1].params = referenceList;
|
|
|
}
|
|
|
_.forEach(sizeBoGroup, function(value) {
|
|
|
temp = {};
|
|
|
temp.params = value;
|
|
|
dest.sizeInfo.detail.list.push(temp);
|
|
|
});
|
|
|
} else {
|
|
|
temp = {};
|
|
|
temp[0].param = '';
|
|
|
dest.sizeInfo.detail.list[0].params.push(temp);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 测量方式
|
|
|
if (!_.isEmpty(sizeInfo.sizeImage)) {
|
|
|
dest.measurementMethod = {};
|
|
|
|
|
|
dest.measurementMethod.title = '测量方式';
|
|
|
dest.measurementMethod.enTitle = 'MEASUREMENT METHOD';
|
|
|
dest.measurementMethod.img = sizeInfo.sizeImage;
|
|
|
}
|
|
|
|
|
|
// 模特试穿, 竖着输出排列显示
|
|
|
if (!_.isEmpty(sizeInfo.modelBos)) {
|
|
|
dest.reference = {};
|
|
|
dest.reference.title = '模特试穿';
|
|
|
dest.reference.enTitle = 'REFERENCE';
|
|
|
dest.reference.detail = {};
|
|
|
dest.reference.detail.list = {};
|
|
|
|
|
|
// 控制是否显示备注
|
|
|
// let showRemark = false;
|
|
|
let remarkList = {};
|
|
|
|
|
|
remarkList[0] = {};
|
|
|
remarkList[0].param = '备注';
|
|
|
|
|
|
for (let i = 0; i < 7; i++) {
|
|
|
dest.reference.detail.list[i] = {};
|
|
|
dest.reference.detail.list[i].params = {};
|
|
|
dest.reference.detail.list[0].params[0] = {};
|
|
|
}
|
|
|
dest.reference.detail.list[0].params[0].param = '';
|
|
|
dest.reference.detail.list[1].params[0].param = '模特';
|
|
|
dest.reference.detail.list[2].params[0].param = '身高';
|
|
|
dest.reference.detail.list[3].params[0].param = '体重';
|
|
|
dest.reference.detail.list[4].params[0].param = '三围';
|
|
|
dest.reference.detail.list[5].params[0].param = '吊牌尺码';
|
|
|
dest.reference.detail.list[6].params[0].param = '试穿描述';
|
|
|
|
|
|
// _.forEach(sizeInfo.modelBos, function(value) {
|
|
|
// // 待处理
|
|
|
// });
|
|
|
|
|
|
// 显示模特备注
|
|
|
// if (showRemark) {
|
|
|
|
|
|
// }
|
|
|
|
|
|
}
|
|
|
|
|
|
// 商品材质
|
|
|
if (!_.isEmpty(sizeInfo.productMaterialList)) {
|
|
|
dest.materials = {};
|
|
|
dest.materials.title = '商品材质';
|
|
|
dest.materials.enTitle = 'MATERIALS';
|
|
|
dest.materials.list = [];
|
|
|
|
|
|
_.forEach(sizeInfo.productMaterialList, function(value) {
|
|
|
temp = {};
|
|
|
temp.img = value.imageUrl;
|
|
|
temp.desc = value.remark;
|
|
|
dest.materials.list.push();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 洗涤提示
|
|
|
if (!_.isEmpty(sizeInfo.washTipsBoList)) {
|
|
|
dest.washTips = {};
|
|
|
dest.washTips.list = [];
|
|
|
_.forEach(sizeInfo.washTipsBoList, function(value) {
|
|
|
dest.washTips.list.push(value);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 详情配图
|
|
|
|
|
|
if (!_.isEmpty(sizeInfo.productIntroBo.productIntro)) {
|
|
|
let productIntro = '';
|
|
|
|
|
|
if (!_.isEmpty(sizeInfo.productDescBo.phrase)) {
|
|
|
productIntro = productIntro + sizeInfo.productDescBo.phrase +
|
|
|
'<br />';
|
|
|
}
|
|
|
productIntro = productIntro + sizeInfo.productIntroBo.productIntro;
|
|
|
if (!_.isEmpty(productIntro) && productIntro !== '') {
|
|
|
dest.productDetail = {};
|
|
|
dest.productDetail.title = '商品详情';
|
|
|
dest.productDetail.enTitle = 'DETAILS';
|
|
|
|
|
|
// 待开发
|
|
|
}
|
|
|
|
|
|
// 清空变量,释放内存
|
|
|
sizeInfo = {};
|
|
|
}
|
|
|
|
|
|
return dest;
|
|
|
};
|
|
|
|
|
|
|
|
|
module.exports = (data) => {
|
|
|
var finalResult;
|
|
|
|
...
|
...
|
@@ -749,35 +508,14 @@ module.exports = (data) => { |
|
|
})).then(result => {
|
|
|
finalResult = detailDataPkg(result, data.uid, data.vipLevel, data.ua);
|
|
|
|
|
|
let urls = [];
|
|
|
|
|
|
let url = [];
|
|
|
|
|
|
url.url = '';
|
|
|
url.data = sign.apiSign({
|
|
|
return api.get('', sign.apiSign({
|
|
|
method: 'app.shop.queryShopsByBrandId',
|
|
|
brand_id: result.brand.id
|
|
|
});
|
|
|
|
|
|
urls.push(url);
|
|
|
|
|
|
url = {};
|
|
|
|
|
|
url.url = '';
|
|
|
url.data = sign.apiSign({
|
|
|
method: 'h5.product.intro',
|
|
|
productskn: result.productPriceBo.productSkn,
|
|
|
udid: 'f528764d624db129b32c21fbca0cb8d6'
|
|
|
});
|
|
|
|
|
|
urls.push(url);
|
|
|
|
|
|
return api.multiGet(urls).then(shops => {
|
|
|
// log.info(shops);
|
|
|
if (shops[0].code === 200) {
|
|
|
finalResult.enterStore = getShopsInfo(shops[0].data);
|
|
|
})).then(shops => {
|
|
|
if (shops.code === 200) {
|
|
|
finalResult.enterStore = getShopsInfo(shops.data);
|
|
|
}
|
|
|
finalResult.sizeInfo = getSizeInfo(shops[1]);
|
|
|
|
|
|
return finalResult;
|
|
|
});
|
|
|
});
|
...
|
...
|
|