Authored by zzzzzzz

优化

... ... @@ -566,21 +566,20 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
totalStorageNum = 0;
// 商品名称
if (origin.productName === null || typeof origin.productName === 'undefined') {
if (!origin.productName) {
return dest;
}
dest.goodsName = origin.productName;
// 是否是虚拟商品
dest.virtualGoods = ((origin.attribute * 1 === 3) ? true : false);
dest.virtualGoods = (origin.attribute * 1 === 3);
// 用户未登录时
if (!uid) {
let params = {};
params.refer = helpers.urlFormat('/product/show_' + origin.productSkn + '.html');
dest.loginUrl = helpers.urlFormat('/signin.html', params);
dest.loginUrl = helpers.urlFormat('/signin.html', {
refer: helpers.urlFormat('/product/show_' + origin.productSkn + '.html')
});
}
// 商品促销短语
... ... @@ -824,7 +823,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
dest.bannerTop = {
list: bannerList
};
} else if (goodsGroup[0] !== null && typeof goodsGroup[0] !== 'undefined') {
} else if (goodsGroup[0]) {
dest.bannerTop = {
img: goodsGroup[0].img
};
... ... @@ -858,15 +857,12 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
// 限购商品
if (origin.isLimitBuy) {
// 是否开售
let isBeginSale = (origin.saleStatus !== null && typeof origin.saleStatus !== 'undefined' &&
origin.saleStatus === 1);
let isBeginSale = (origin.saleStatus === 1);
// 限购商品有关的展示状态
let showStatus = 1;
if (origin.showStatus !== null && typeof origin.showStatus !== 'undefined') {
showStatus = parseInt(origin.showStatus, 10);
}
origin.showStatus && (showStatus = parseInt(origin.showStatus, 10));
// 处理限购商品有关的按钮状态
dest = _procShowStatus(dest, showStatus, isBeginSale);
... ... @@ -886,7 +882,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
// 是否收藏
dest.isCollect = false;
if (origin.isCollect !== null && typeof origin.isCollect !== 'undefined' && origin.isCollect === 'Y') {
if (origin.isCollect === 'Y') {
dest.isCollect = true;
dest.cartInfo.isCollect = true;
}
... ... @@ -1017,7 +1013,6 @@ let getProductData = (data) => {
result.promotionBoList = info[1];
finalResult = _detailDataPkg(result, data.uid, data.vipLevel, data.ua);
finalResult.enterStore = info[0];
Object.assign(finalResult.feedbacks, info[2]);
/* 如果有咨询,显示咨询,否则显示常见问题 */
... ... @@ -1045,4 +1040,4 @@ let getProductData = (data) => {
module.exports = {
getProductData
};
};
\ No newline at end of file
... ...