Authored by htoooth

ok,api ok

... ... @@ -61,10 +61,9 @@ const getProductAsync = (pid, uid, isStudents, vipLevel) => {
params.uid = uid;
}
//if (isStudents) {
// params.is_student = isStudents;
//}
params.is_student = 1;
if (isStudents) {
params.is_student = isStudents;
}
if (vipLevel) {
params.current_vip_level = vipLevel;
... ...
... ... @@ -545,7 +545,6 @@ const _detailDataPkg = (origin, uid, vipLevel) => {
let result = {}; // 结果输出
origin = global.yoho.camelCase(origin);
console.dir(origin);
let propOrigin = _.partial(_.get, origin);
... ... @@ -585,7 +584,7 @@ const _detailDataPkg = (origin, uid, vipLevel) => {
result.salePrice = propOrigin('formatSalesPrice');
result.hasOtherPrice = true;
if (result.marketPrice === result.salePrice) {
if (result.salePrice === '0') {
delete result.salePrice;
result.hasOtherPrice = false;
}
... ... @@ -594,7 +593,7 @@ const _detailDataPkg = (origin, uid, vipLevel) => {
// 学生价
result.studentsPrice = propOrigin('studentPrice');
} else {
// VIP学生数据
// VIP数据
result.vipPrice = _getVipDataByProductBaseInfo(origin, vipLevel, uid);
}
... ... @@ -609,23 +608,17 @@ const _detailDataPkg = (origin, uid, vipLevel) => {
rest: '个 有货币'
};
if (propOrigin('yohoCoinNum ', 0)) {
if (propOrigin('yohoCoinNum')) {
result.activity.push({
type: C_VALUE.type,
des: `${C_VALUE.des}${origin.productPriceBo.yohoCoinNum}${C_VALUE.rest}`
});
} else if (propOrigin('studentCoinNum', 0)) {
result.activity.push({
type: C_VALUE.type,
des: `${C_VALUE.des}${origin.productPriceBo.studentCoinNum}${C_VALUE.rest}`
des: `${C_VALUE.des}${propOrigin('yohoCoinNum')}${C_VALUE.rest}`
});
}
// 上市期
// TODO:
if (origin.expectArrivalTime) {
result.arrivalDate = `${origin.expectArrivalTime}月`;
result.presalePrice = origin.productPriceBo.formatSalesPrice;
result.presalePrice = propOrigin('formatSalesPrice');
delete result.salePrice;
result.hasOtherPrice = false;
}
... ... @@ -654,7 +647,7 @@ const _detailDataPkg = (origin, uid, vipLevel) => {
// 是否收藏
result.isCollect = favoriteData.product;
if (origin.isLimitBuy === true) {
if (origin.isLimitBuy) {
// 是否开售
let isBeginSale = !!(origin.saleStatus && origin.saleStatus === 1);
... ... @@ -746,25 +739,16 @@ const _detailDataPkg = (origin, uid, vipLevel) => {
let domainBrand = yield brandService.getBrandByDomainAsync(banner.brandDomain);
if (domainBrand.type && domainBrand.shopId) {
switch (parseInt(domainBrand.type, 10)) {
case 1:
{
// 多品店不显示
banner = [];
break;
}
case 2:
{
// 单品店显示新版的店铺banner
let basisData = yield shopService.basisTemplateAsync(domainBrand.shopId);
banner.bgImg = basisData.shopTopBanner.banner || banner.bgImg;
break;
}
default:
{
break;
}
let type = _.parseInt(domainBrand.type);
if (type === 1) {
// 多品店不显示
banner = {};
} else if (type === 2) {
// 单品店显示新版的店铺banner
let basisData = yield shopService.basisTemplateAsync(domainBrand.shopId);
banner.bgImg = basisData.shopTopBanner.banner || banner.bgImg;
}
}
}
... ... @@ -791,10 +775,10 @@ const _getProductComfort = () => {
let comfort = _getCacheDataByName('ItemData::getProductComfort');
if (!comfort || !comfort.data) {
return result;
return [];
}
comfort.data.forEach(value => {
_.get(comfort, 'data', []).forEach(value => {
let blocks = [];
let flag = false;
... ... @@ -1120,7 +1104,9 @@ const _getDetailDataBySizeInfo = (sizeInfo) => {
// 详情配图
_(replacePairs).forEach((value, key)=> {
intro = _.replace(intro, key, value);
let re = new RegExp(key, 'gm');
intro = _.replace(intro, re, value);
});
details += intro;
... ...