...
|
...
|
@@ -12,6 +12,8 @@ const sign = require(`${library}/sign`); |
|
|
const _ = require('lodash');
|
|
|
const helpers = require(`${library}/helpers`);
|
|
|
|
|
|
// const log = require(`${library}/logger`);
|
|
|
|
|
|
var api = new API();
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -50,7 +52,7 @@ const getShopsInfo = (data) => { |
|
|
*/
|
|
|
const procShowStatus = (data, showStatus, isBeginSale) => {
|
|
|
switch (showStatus) {
|
|
|
case 1:// 开售前/后,立即分享获得限购码(用户未领取限购码)
|
|
|
case 1: // 开售前/后,立即分享获得限购码(用户未领取限购码)
|
|
|
// 显示获取限购码按钮
|
|
|
data.canGetLimitCode = true;
|
|
|
|
...
|
...
|
@@ -336,7 +338,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
|
build.storage = size.goodsSizeStorageNum;
|
|
|
build.id = size.id;
|
|
|
allSizeList[sizeName] = (allSizeList[sizeName] === null ||
|
|
|
typeof allSizeList[sizeName] === 'undefined') ? build :
|
|
|
typeof allSizeList[sizeName] === 'undefined') ? build :
|
|
|
allSizeList[sizeName];
|
|
|
|
|
|
colorStorageNum += parseInt(size.goodsSizeStorageNum, 10);
|
...
|
...
|
@@ -383,9 +385,9 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
|
colorGroup[i].color = {};
|
|
|
colorGroup[i].color[keyForColorArr] = {};
|
|
|
colorGroup[i].color[keyForColorArr].colorNum =
|
|
|
(colorStorageGroup[colorArr.skcId][sizeName] !== null &&
|
|
|
typeof colorStorageGroup[colorArr.skcId][sizeName] !== 'undefined') ?
|
|
|
colorStorageGroup[colorArr.skcId][sizeName] : 0;
|
|
|
(colorStorageGroup[colorArr.skcId][sizeName] !== null &&
|
|
|
typeof colorStorageGroup[colorArr.skcId][sizeName] !== 'undefined') ?
|
|
|
colorStorageGroup[colorArr.skcId][sizeName] : 0;
|
|
|
});
|
|
|
colorGroup[i].id = value.id;
|
|
|
|
...
|
...
|
@@ -451,7 +453,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
|
dest.cartInfo.colors = colorGroup;
|
|
|
dest.cartInfo.sizes = sizeGroup;
|
|
|
|
|
|
// 限购商品
|
|
|
// 限购商品
|
|
|
if (origin.isLimitBuy === 'Y') {
|
|
|
// 是否开售
|
|
|
let isBeginSale = (origin.saleStatus !== null && typeof origin.saleStatus !== 'undefined' &&
|
...
|
...
|
@@ -500,12 +502,15 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
|
* @param {[type]} udid [description]
|
|
|
* @return {[type]} [description]
|
|
|
*/
|
|
|
/* const getSizeInfo = (sizeInfo) => {
|
|
|
const getSizeInfo = (sizeInfo) => {
|
|
|
var dest = {},
|
|
|
temp = {};
|
|
|
|
|
|
dest.goodsDescription = {};
|
|
|
|
|
|
if (_.isEmpty(sizeInfo.productDescBo.erpProductId)) {
|
|
|
let sex = '通用';
|
|
|
|
|
|
switch (sizeInfo.productDescBo.gender) {
|
|
|
case 1:
|
|
|
sex = '男款';
|
...
|
...
|
@@ -517,8 +522,6 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
|
break;
|
|
|
}
|
|
|
|
|
|
dest.goodsDescription = {};
|
|
|
|
|
|
dest.goodsDescription.title = '商品信息';
|
|
|
dest.goodsDescription.enTitle = 'DESCRIPTION';
|
|
|
dest.goodsDescription.detail = {};
|
...
|
...
|
@@ -532,7 +535,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
|
}
|
|
|
|
|
|
if (_.isEmpty(sizeInfo.productDescBo.standardBos)) {
|
|
|
_.forEach(sizeInfo.productDescBo.standardBos, function(value, key) {
|
|
|
_.forEach(sizeInfo.productDescBo.standardBos, function(value) {
|
|
|
dest.goodsDescription.detail.list[3].param = value.standardName + ':' +
|
|
|
value.standardVal;
|
|
|
});
|
...
|
...
|
@@ -547,8 +550,8 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
|
dest.sizeInfo = {};
|
|
|
dest.sizeInfo.title = '尺码信息';
|
|
|
dest.sizeInfo.enTitle = 'SIZE INFO';
|
|
|
dest.sizeInfo.detail = {};
|
|
|
dest.sizeInfo.detail.list = {};
|
|
|
dest.sizeInfo.detail = [];
|
|
|
dest.sizeInfo.detail.list = [];
|
|
|
|
|
|
// 参考尺码
|
|
|
let boyReference = !_.isEmpty(sizeInfo.productExtra.boyReference);
|
...
|
...
|
@@ -568,8 +571,8 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
|
|
|
|
// 判断是否显示参考尺码
|
|
|
let showReference = (boyReference &&
|
|
|
!_.isEmpty(sizeInfo.sizeInfoBo.sizeBoList[0].boyReferSize)) || (girlReference &&
|
|
|
!_.isEmpty(sizeInfo.sizeInfoBo.sizeBoList[0].girlReferSize));
|
|
|
!_.isEmpty(sizeInfo.sizeInfoBo.sizeBoList[0].boyReferSize)) || (girlReference &&
|
|
|
!_.isEmpty(sizeInfo.sizeInfoBo.sizeBoList[0].girlReferSize));
|
|
|
|
|
|
if (showReference) {
|
|
|
referenceList[0] = {};
|
...
|
...
|
@@ -585,17 +588,16 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
|
let sizeBoGroup = {};
|
|
|
|
|
|
_.forEach(sizeInfo.sizeInfoBo.sizeAttributeBos, function(attr) {
|
|
|
sizeBoGroup[attr.id[0]].param = _.isEmpty(value.attributeName) ?
|
|
|
sizeBoGroup[attr.id[0]] = {};
|
|
|
sizeBoGroup[attr.id[0]].param = _.isEmpty(attr.attributeName) ?
|
|
|
' ' : attr.attributeName;
|
|
|
});
|
|
|
|
|
|
let item = {};
|
|
|
|
|
|
_.forEach(sizeInfo.sizeInfoBo.sizeBoList, function(value) {
|
|
|
item = {};
|
|
|
|
|
|
let sizeNameList = {};
|
|
|
// let item = {};
|
|
|
|
|
|
sizeNameList[0] = {};
|
|
|
sizeNameList[0].param = value.sizeName;
|
|
|
|
|
|
if (boyReference && (gender === 1 || gender === 3)) {
|
...
|
...
|
@@ -615,11 +617,13 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
|
_.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;
|
...
|
...
|
@@ -654,12 +658,13 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
|
dest.reference.detail.list = {};
|
|
|
|
|
|
// 控制是否显示备注
|
|
|
let showRemark = false;
|
|
|
// let showRemark = false;
|
|
|
let remarkList = {};
|
|
|
|
|
|
remarkList[0] = {};
|
|
|
remarkList[0].param = '备注';
|
|
|
|
|
|
for (var i = 0; i < 7; i++) {
|
|
|
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] = {};
|
...
|
...
|
@@ -672,14 +677,14 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
|
dest.reference.detail.list[5].params[0].param = '吊牌尺码';
|
|
|
dest.reference.detail.list[6].params[0].param = '试穿描述';
|
|
|
|
|
|
_.forEach(sizeInfo.modelBos, function(value) {
|
|
|
// 待处理
|
|
|
});
|
|
|
// _.forEach(sizeInfo.modelBos, function(value) {
|
|
|
// // 待处理
|
|
|
// });
|
|
|
|
|
|
// 显示模特备注
|
|
|
if (showRemark) {
|
|
|
// if (showRemark) {
|
|
|
|
|
|
}
|
|
|
// }
|
|
|
|
|
|
}
|
|
|
|
...
|
...
|
@@ -688,7 +693,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
|
dest.materials = {};
|
|
|
dest.materials.title = '商品材质';
|
|
|
dest.materials.enTitle = 'MATERIALS';
|
|
|
dest.materials.list = {};
|
|
|
dest.materials.list = [];
|
|
|
|
|
|
_.forEach(sizeInfo.productMaterialList, function(value) {
|
|
|
temp = {};
|
...
|
...
|
@@ -701,7 +706,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
|
// 洗涤提示
|
|
|
if (!_.isEmpty(sizeInfo.washTipsBoList)) {
|
|
|
dest.washTips = {};
|
|
|
dest.washTips.list = {};
|
|
|
dest.washTips.list = [];
|
|
|
_.forEach(sizeInfo.washTipsBoList, function(value) {
|
|
|
dest.washTips.list.push(value);
|
|
|
});
|
...
|
...
|
@@ -711,6 +716,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
|
|
|
|
if (!_.isEmpty(sizeInfo.productIntroBo.productIntro)) {
|
|
|
let productIntro = '';
|
|
|
|
|
|
if (!_.isEmpty(sizeInfo.productDescBo.phrase)) {
|
|
|
productIntro = productIntro + sizeInfo.productDescBo.phrase +
|
|
|
'<br />';
|
...
|
...
|
@@ -721,7 +727,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
|
dest.productDetail.title = '商品详情';
|
|
|
dest.productDetail.enTitle = 'DETAILS';
|
|
|
|
|
|
// 待开发
|
|
|
// 待开发
|
|
|
}
|
|
|
|
|
|
// 清空变量,释放内存
|
...
|
...
|
@@ -729,7 +735,8 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
|
}
|
|
|
|
|
|
return dest;
|
|
|
};*/
|
|
|
};
|
|
|
|
|
|
|
|
|
module.exports = (data) => {
|
|
|
var finalResult;
|
...
|
...
|
@@ -742,13 +749,35 @@ module.exports = (data) => { |
|
|
})).then(result => {
|
|
|
finalResult = detailDataPkg(result, data.uid, data.vipLevel, data.ua);
|
|
|
|
|
|
return api.get('', sign.apiSign({
|
|
|
let urls = [];
|
|
|
|
|
|
let url = [];
|
|
|
|
|
|
url.url = '';
|
|
|
url.data = sign.apiSign({
|
|
|
method: 'app.shop.queryShopsByBrandId',
|
|
|
brand_id: result.brand.id
|
|
|
})).then(shops => {
|
|
|
if (shops.code === 200) {
|
|
|
finalResult.enterStore = getShopsInfo(shops.data);
|
|
|
});
|
|
|
|
|
|
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);
|
|
|
}
|
|
|
finalResult.sizeInfo = getSizeInfo(shops[1]);
|
|
|
return finalResult;
|
|
|
});
|
|
|
});
|
...
|
...
|
|