Authored by zzzzzzz

优化

@@ -566,21 +566,20 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { @@ -566,21 +566,20 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
566 totalStorageNum = 0; 566 totalStorageNum = 0;
567 567
568 // 商品名称 568 // 商品名称
569 - if (origin.productName === null || typeof origin.productName === 'undefined') { 569 + if (!origin.productName) {
570 return dest; 570 return dest;
571 } 571 }
572 572
573 dest.goodsName = origin.productName; 573 dest.goodsName = origin.productName;
574 574
575 // 是否是虚拟商品 575 // 是否是虚拟商品
576 - dest.virtualGoods = ((origin.attribute * 1 === 3) ? true : false); 576 + dest.virtualGoods = (origin.attribute * 1 === 3);
577 577
578 // 用户未登录时 578 // 用户未登录时
579 if (!uid) { 579 if (!uid) {
580 - let params = {};  
581 -  
582 - params.refer = helpers.urlFormat('/product/show_' + origin.productSkn + '.html');  
583 - dest.loginUrl = helpers.urlFormat('/signin.html', params); 580 + dest.loginUrl = helpers.urlFormat('/signin.html', {
  581 + refer: helpers.urlFormat('/product/show_' + origin.productSkn + '.html')
  582 + });
584 } 583 }
585 584
586 // 商品促销短语 585 // 商品促销短语
@@ -824,7 +823,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { @@ -824,7 +823,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
824 dest.bannerTop = { 823 dest.bannerTop = {
825 list: bannerList 824 list: bannerList
826 }; 825 };
827 - } else if (goodsGroup[0] !== null && typeof goodsGroup[0] !== 'undefined') { 826 + } else if (goodsGroup[0]) {
828 dest.bannerTop = { 827 dest.bannerTop = {
829 img: goodsGroup[0].img 828 img: goodsGroup[0].img
830 }; 829 };
@@ -858,15 +857,12 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { @@ -858,15 +857,12 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
858 // 限购商品 857 // 限购商品
859 if (origin.isLimitBuy) { 858 if (origin.isLimitBuy) {
860 // 是否开售 859 // 是否开售
861 - let isBeginSale = (origin.saleStatus !== null && typeof origin.saleStatus !== 'undefined' &&  
862 - origin.saleStatus === 1); 860 + let isBeginSale = (origin.saleStatus === 1);
863 861
864 // 限购商品有关的展示状态 862 // 限购商品有关的展示状态
865 let showStatus = 1; 863 let showStatus = 1;
866 864
867 - if (origin.showStatus !== null && typeof origin.showStatus !== 'undefined') {  
868 - showStatus = parseInt(origin.showStatus, 10);  
869 - } 865 + origin.showStatus && (showStatus = parseInt(origin.showStatus, 10));
870 866
871 // 处理限购商品有关的按钮状态 867 // 处理限购商品有关的按钮状态
872 dest = _procShowStatus(dest, showStatus, isBeginSale); 868 dest = _procShowStatus(dest, showStatus, isBeginSale);
@@ -886,7 +882,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { @@ -886,7 +882,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
886 882
887 // 是否收藏 883 // 是否收藏
888 dest.isCollect = false; 884 dest.isCollect = false;
889 - if (origin.isCollect !== null && typeof origin.isCollect !== 'undefined' && origin.isCollect === 'Y') { 885 + if (origin.isCollect === 'Y') {
890 dest.isCollect = true; 886 dest.isCollect = true;
891 dest.cartInfo.isCollect = true; 887 dest.cartInfo.isCollect = true;
892 } 888 }
@@ -1017,7 +1013,6 @@ let getProductData = (data) => { @@ -1017,7 +1013,6 @@ let getProductData = (data) => {
1017 result.promotionBoList = info[1]; 1013 result.promotionBoList = info[1];
1018 finalResult = _detailDataPkg(result, data.uid, data.vipLevel, data.ua); 1014 finalResult = _detailDataPkg(result, data.uid, data.vipLevel, data.ua);
1019 finalResult.enterStore = info[0]; 1015 finalResult.enterStore = info[0];
1020 -  
1021 Object.assign(finalResult.feedbacks, info[2]); 1016 Object.assign(finalResult.feedbacks, info[2]);
1022 1017
1023 /* 如果有咨询,显示咨询,否则显示常见问题 */ 1018 /* 如果有咨询,显示咨询,否则显示常见问题 */