...
|
...
|
@@ -921,7 +921,7 @@ const _getLimitCodeUrl = (productCode, skn, ua) => { |
|
|
// };
|
|
|
|
|
|
let _getShopsInfo = (brandId) => {
|
|
|
if(!brandId) {
|
|
|
if (!brandId) {
|
|
|
return Promise.resolve([]);
|
|
|
}
|
|
|
return api.get('', {
|
...
|
...
|
@@ -1046,7 +1046,7 @@ const _getCommonConsult = () => { |
|
|
// });
|
|
|
// });
|
|
|
// };
|
|
|
//
|
|
|
//
|
|
|
/**
|
|
|
* [商品获取数据] pagecache重构
|
|
|
*/
|
...
|
...
|
@@ -1065,11 +1065,12 @@ let getProductData = (data) => { |
|
|
product_skn: _.toString(data.productSkn)
|
|
|
});
|
|
|
}
|
|
|
//pagecache重构
|
|
|
// if (data.uid) {
|
|
|
|
|
|
// pagecache重构
|
|
|
// if (data.uid) {
|
|
|
// params.uid = data.uid;
|
|
|
// }
|
|
|
//pagecache重构
|
|
|
// pagecache重构
|
|
|
// return _getUserProfile(params.uid).then((user) => {
|
|
|
// data.vipLevel = (user.data && user.data.vip_info && user.data.vip_info.cur_level) || '0';
|
|
|
// data.isStudent = (user.data && user.data.vip_info && user.data.vip_info.is_student) ? true : false;
|
...
|
...
|
@@ -1086,6 +1087,7 @@ let getProductData = (data) => { |
|
|
result.goods_id = data.goodsId;
|
|
|
return Promise.all([
|
|
|
_getShopsInfo(result.brand_info.brand_id),
|
|
|
|
|
|
// _getPromotionInfo(result.product_skn),
|
|
|
comment.getCommentInfo({
|
|
|
productId: result.product_id
|
...
|
...
|
@@ -1121,8 +1123,10 @@ let getProductData = (data) => { |
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
// });
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* [商品数据格式化] pagecache重构
|
|
|
*/
|
...
|
...
|
@@ -1152,7 +1156,7 @@ const _detailDataPkg = (origin, ua) => { |
|
|
// });
|
|
|
// }
|
|
|
|
|
|
// 商品促销短语
|
|
|
// 商品促销短语
|
|
|
origin.sales_phrase && (dest.goodsSubtitle = origin.sales_phrase);
|
|
|
|
|
|
// 促销信息 TODO: 换新接口 pagecache重构
|
...
|
...
|
@@ -1255,15 +1259,16 @@ const _detailDataPkg = (origin, ua) => { |
|
|
// 商品信息
|
|
|
if (origin.goods_list.length) {
|
|
|
let goodsGroup = [];
|
|
|
//pagecache重构
|
|
|
|
|
|
// pagecache重构
|
|
|
// sizeName = '',
|
|
|
// colorList = [],
|
|
|
// sizeList = {},
|
|
|
// allSizeList = {},
|
|
|
// colorStorageGroup = {},
|
|
|
// colorStorageNum = 0;
|
|
|
//pagecache重构
|
|
|
_.forEach(origin.goods_list, function(value) {
|
|
|
// pagecache重构
|
|
|
_.forEach(origin.goods_list, function(value) {
|
|
|
if (value.status === 0) {
|
|
|
return;
|
|
|
}
|
...
|
...
|
@@ -1407,7 +1412,8 @@ const _detailDataPkg = (origin, ua) => { |
|
|
numInCart: 0,
|
|
|
goodsInstore: origin.storage_sum
|
|
|
};
|
|
|
//pagecache重构
|
|
|
|
|
|
// pagecache重构
|
|
|
// let soldOut = (origin.storage_sum === 0) || (totalStorageNum === 0); // status
|
|
|
// let notForSale = origin.attribute === 2;
|
|
|
|
...
|
...
|
@@ -1464,10 +1470,11 @@ const _detailDataPkg = (origin, ua) => { |
|
|
dest.id = origin.product_id;
|
|
|
dest.goodsId = origin.goods_id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return dest;
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* [商品信息的异步数据获取]
|
|
|
*/
|
...
|
...
|
@@ -1486,7 +1493,7 @@ let getProductAsyncData = (data) => { |
|
|
product_skn: _.toString(data.productSkn)
|
|
|
});
|
|
|
}
|
|
|
if (data.uid) {
|
|
|
if (data.uid) {
|
|
|
params.uid = data.uid;
|
|
|
}
|
|
|
return _getUserProfile(params.uid).then((user) => {
|
...
|
...
|
@@ -1513,7 +1520,8 @@ let getProductAsyncData = (data) => { |
|
|
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* [商品信息格式化异步接口]
|
|
|
*/
|
...
|
...
|
@@ -1523,6 +1531,7 @@ let _detailDataPkgAsync = (origin, uid, vipLevel, ua) => { |
|
|
colorGroup = {},
|
|
|
sizeGroup = [],
|
|
|
totalStorageNum = 0;
|
|
|
|
|
|
// 用户未登录时
|
|
|
if (!uid) {
|
|
|
dest.loginUrl = helpers.urlFormat('/signin.html', {
|
...
|
...
|
@@ -1530,7 +1539,7 @@ let _detailDataPkgAsync = (origin, uid, vipLevel, ua) => { |
|
|
});
|
|
|
}
|
|
|
|
|
|
//商品促销短语
|
|
|
// 商品促销短语
|
|
|
origin.sales_phrase && (dest.goodsSubtitle = origin.sales_phrase);
|
|
|
|
|
|
// 促销信息 TODO: 换新接口
|
...
|
...
|
@@ -1547,6 +1556,7 @@ let _detailDataPkgAsync = (origin, uid, vipLevel, ua) => { |
|
|
list: discountList
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 商品价格
|
|
|
let goodsPrice = {
|
|
|
currentPrice: origin.format_sales_price === '0' ? origin.format_market_price : origin.format_sales_price
|
...
|
...
|
@@ -1583,7 +1593,8 @@ let _detailDataPkgAsync = (origin, uid, vipLevel, ua) => { |
|
|
});
|
|
|
|
|
|
}
|
|
|
//商品信息
|
|
|
|
|
|
// 商品信息
|
|
|
if (origin.goods_list.length) {
|
|
|
let goodsGroup = [],
|
|
|
sizeName = '',
|
...
|
...
|
@@ -1719,6 +1730,7 @@ let _detailDataPkgAsync = (origin, uid, vipLevel, ua) => { |
|
|
numInCart: 0,
|
|
|
goodsInstore: origin.storage_sum
|
|
|
};
|
|
|
|
|
|
// 显示加入购物车链接
|
|
|
if (!soldOut && !notForSale) {
|
|
|
_.orderBy(colorGroup);
|
...
|
...
|
@@ -1765,6 +1777,7 @@ let _detailDataPkgAsync = (origin, uid, vipLevel, ua) => { |
|
|
dest.isCollect = true;
|
|
|
dest.cartInfo.isCollect = true;
|
|
|
}
|
|
|
|
|
|
// 虚拟商品(门票)
|
|
|
if (origin.attribute * 1 === 3) {
|
|
|
dest.tickets = true;
|
...
|
...
|
@@ -1792,7 +1805,7 @@ let _detailDataPkgAsync = (origin, uid, vipLevel, ua) => { |
|
|
dest.id = origin.product_id;
|
|
|
dest.goodsId = origin.goods_id;
|
|
|
return dest;
|
|
|
}
|
|
|
};
|
|
|
module.exports = {
|
|
|
getProductData,
|
|
|
getProductAsyncData,
|
...
|
...
|
|