Authored by htoooth

ok,api ok

@@ -61,10 +61,9 @@ const getProductAsync = (pid, uid, isStudents, vipLevel) => { @@ -61,10 +61,9 @@ const getProductAsync = (pid, uid, isStudents, vipLevel) => {
61 params.uid = uid; 61 params.uid = uid;
62 } 62 }
63 63
64 - //if (isStudents) {  
65 - // params.is_student = isStudents;  
66 - //}  
67 - params.is_student = 1; 64 + if (isStudents) {
  65 + params.is_student = isStudents;
  66 + }
68 67
69 if (vipLevel) { 68 if (vipLevel) {
70 params.current_vip_level = vipLevel; 69 params.current_vip_level = vipLevel;
@@ -545,7 +545,6 @@ const _detailDataPkg = (origin, uid, vipLevel) => { @@ -545,7 +545,6 @@ const _detailDataPkg = (origin, uid, vipLevel) => {
545 let result = {}; // 结果输出 545 let result = {}; // 结果输出
546 546
547 origin = global.yoho.camelCase(origin); 547 origin = global.yoho.camelCase(origin);
548 - console.dir(origin);  
549 548
550 let propOrigin = _.partial(_.get, origin); 549 let propOrigin = _.partial(_.get, origin);
551 550
@@ -585,7 +584,7 @@ const _detailDataPkg = (origin, uid, vipLevel) => { @@ -585,7 +584,7 @@ const _detailDataPkg = (origin, uid, vipLevel) => {
585 result.salePrice = propOrigin('formatSalesPrice'); 584 result.salePrice = propOrigin('formatSalesPrice');
586 result.hasOtherPrice = true; 585 result.hasOtherPrice = true;
587 586
588 - if (result.marketPrice === result.salePrice) { 587 + if (result.salePrice === '0') {
589 delete result.salePrice; 588 delete result.salePrice;
590 result.hasOtherPrice = false; 589 result.hasOtherPrice = false;
591 } 590 }
@@ -594,7 +593,7 @@ const _detailDataPkg = (origin, uid, vipLevel) => { @@ -594,7 +593,7 @@ const _detailDataPkg = (origin, uid, vipLevel) => {
594 // 学生价 593 // 学生价
595 result.studentsPrice = propOrigin('studentPrice'); 594 result.studentsPrice = propOrigin('studentPrice');
596 } else { 595 } else {
597 - // VIP学生数据 596 + // VIP数据
598 result.vipPrice = _getVipDataByProductBaseInfo(origin, vipLevel, uid); 597 result.vipPrice = _getVipDataByProductBaseInfo(origin, vipLevel, uid);
599 } 598 }
600 599
@@ -609,23 +608,17 @@ const _detailDataPkg = (origin, uid, vipLevel) => { @@ -609,23 +608,17 @@ const _detailDataPkg = (origin, uid, vipLevel) => {
609 rest: '个 有货币' 608 rest: '个 有货币'
610 }; 609 };
611 610
612 - if (propOrigin('yohoCoinNum ', 0)) { 611 + if (propOrigin('yohoCoinNum')) {
613 result.activity.push({ 612 result.activity.push({
614 type: C_VALUE.type, 613 type: C_VALUE.type,
615 - des: `${C_VALUE.des}${origin.productPriceBo.yohoCoinNum}${C_VALUE.rest}`  
616 - });  
617 - } else if (propOrigin('studentCoinNum', 0)) {  
618 - result.activity.push({  
619 - type: C_VALUE.type,  
620 - des: `${C_VALUE.des}${origin.productPriceBo.studentCoinNum}${C_VALUE.rest}` 614 + des: `${C_VALUE.des}${propOrigin('yohoCoinNum')}${C_VALUE.rest}`
621 }); 615 });
622 } 616 }
623 617
624 // 上市期 618 // 上市期
625 - // TODO:  
626 if (origin.expectArrivalTime) { 619 if (origin.expectArrivalTime) {
627 result.arrivalDate = `${origin.expectArrivalTime}月`; 620 result.arrivalDate = `${origin.expectArrivalTime}月`;
628 - result.presalePrice = origin.productPriceBo.formatSalesPrice; 621 + result.presalePrice = propOrigin('formatSalesPrice');
629 delete result.salePrice; 622 delete result.salePrice;
630 result.hasOtherPrice = false; 623 result.hasOtherPrice = false;
631 } 624 }
@@ -654,7 +647,7 @@ const _detailDataPkg = (origin, uid, vipLevel) => { @@ -654,7 +647,7 @@ const _detailDataPkg = (origin, uid, vipLevel) => {
654 // 是否收藏 647 // 是否收藏
655 result.isCollect = favoriteData.product; 648 result.isCollect = favoriteData.product;
656 649
657 - if (origin.isLimitBuy === true) { 650 + if (origin.isLimitBuy) {
658 // 是否开售 651 // 是否开售
659 let isBeginSale = !!(origin.saleStatus && origin.saleStatus === 1); 652 let isBeginSale = !!(origin.saleStatus && origin.saleStatus === 1);
660 653
@@ -746,25 +739,16 @@ const _detailDataPkg = (origin, uid, vipLevel) => { @@ -746,25 +739,16 @@ const _detailDataPkg = (origin, uid, vipLevel) => {
746 let domainBrand = yield brandService.getBrandByDomainAsync(banner.brandDomain); 739 let domainBrand = yield brandService.getBrandByDomainAsync(banner.brandDomain);
747 740
748 if (domainBrand.type && domainBrand.shopId) { 741 if (domainBrand.type && domainBrand.shopId) {
749 - switch (parseInt(domainBrand.type, 10)) {  
750 - case 1:  
751 - {  
752 - // 多品店不显示  
753 - banner = [];  
754 - break;  
755 - }  
756 - case 2:  
757 - {  
758 - // 单品店显示新版的店铺banner  
759 - let basisData = yield shopService.basisTemplateAsync(domainBrand.shopId);  
760 -  
761 - banner.bgImg = basisData.shopTopBanner.banner || banner.bgImg;  
762 - break;  
763 - }  
764 - default:  
765 - {  
766 - break;  
767 - } 742 + let type = _.parseInt(domainBrand.type);
  743 +
  744 + if (type === 1) {
  745 + // 多品店不显示
  746 + banner = {};
  747 + } else if (type === 2) {
  748 + // 单品店显示新版的店铺banner
  749 + let basisData = yield shopService.basisTemplateAsync(domainBrand.shopId);
  750 +
  751 + banner.bgImg = basisData.shopTopBanner.banner || banner.bgImg;
768 } 752 }
769 } 753 }
770 } 754 }
@@ -791,10 +775,10 @@ const _getProductComfort = () => { @@ -791,10 +775,10 @@ const _getProductComfort = () => {
791 let comfort = _getCacheDataByName('ItemData::getProductComfort'); 775 let comfort = _getCacheDataByName('ItemData::getProductComfort');
792 776
793 if (!comfort || !comfort.data) { 777 if (!comfort || !comfort.data) {
794 - return result; 778 + return [];
795 } 779 }
796 780
797 - comfort.data.forEach(value => { 781 + _.get(comfort, 'data', []).forEach(value => {
798 let blocks = []; 782 let blocks = [];
799 let flag = false; 783 let flag = false;
800 784
@@ -1120,7 +1104,9 @@ const _getDetailDataBySizeInfo = (sizeInfo) => { @@ -1120,7 +1104,9 @@ const _getDetailDataBySizeInfo = (sizeInfo) => {
1120 1104
1121 // 详情配图 1105 // 详情配图
1122 _(replacePairs).forEach((value, key)=> { 1106 _(replacePairs).forEach((value, key)=> {
1123 - intro = _.replace(intro, key, value); 1107 + let re = new RegExp(key, 'gm');
  1108 +
  1109 + intro = _.replace(intro, re, value);
1124 }); 1110 });
1125 1111
1126 details += intro; 1112 details += intro;