...
|
...
|
@@ -304,57 +304,55 @@ const _getIntroInfo = (productSkn, additionalData)=> { |
|
|
* @return result Object 格式化数据
|
|
|
*/
|
|
|
const _detailDataPkg = (origin) => {
|
|
|
return co(function*() {
|
|
|
if (_.isEmpty(origin) || _.isEmpty(origin)) {
|
|
|
return {};
|
|
|
}
|
|
|
if (_.isEmpty(origin) || _.isEmpty(origin)) {
|
|
|
return {};
|
|
|
}
|
|
|
|
|
|
let result = {};
|
|
|
let propOrigin = _.partial(_.get, origin);
|
|
|
let result = {};
|
|
|
let propOrigin = _.partial(_.get, origin);
|
|
|
|
|
|
// 商品名称
|
|
|
if (!propOrigin('product_name')) {
|
|
|
return result;
|
|
|
}
|
|
|
// 商品名称
|
|
|
if (!propOrigin('product_name')) {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
result.name = propOrigin('product_name');
|
|
|
result.skn = propOrigin('product_skn');
|
|
|
result.productId = propOrigin('product_id');
|
|
|
result.name = propOrigin('product_name');
|
|
|
result.skn = propOrigin('product_skn');
|
|
|
result.productId = propOrigin('product_id');
|
|
|
|
|
|
// 商品价格
|
|
|
result.marketPrice = propOrigin('format_market_price');
|
|
|
result.salePrice = propOrigin('format_sales_price');
|
|
|
result.hasOtherPrice = true;
|
|
|
// 商品价格
|
|
|
result.marketPrice = propOrigin('format_market_price');
|
|
|
result.salePrice = propOrigin('format_sales_price');
|
|
|
result.hasOtherPrice = true;
|
|
|
|
|
|
if (result.salePrice === '0') {
|
|
|
delete result.salePrice;
|
|
|
result.hasOtherPrice = false;
|
|
|
}
|
|
|
if (result.salePrice === '0') {
|
|
|
delete result.salePrice;
|
|
|
result.hasOtherPrice = false;
|
|
|
}
|
|
|
|
|
|
// 上市期
|
|
|
if (propOrigin('expect_arrival_time')) {
|
|
|
result.arrivalDate = `${propOrigin('expect_arrival_time')}月`;
|
|
|
result.presalePrice = propOrigin('format_sales_price');
|
|
|
delete result.salePrice;
|
|
|
result.hasOtherPrice = false;
|
|
|
}
|
|
|
// 上市期
|
|
|
if (propOrigin('expect_arrival_time')) {
|
|
|
result.arrivalDate = `${propOrigin('expect_arrival_time')}月`;
|
|
|
result.presalePrice = propOrigin('format_sales_price');
|
|
|
delete result.salePrice;
|
|
|
result.hasOtherPrice = false;
|
|
|
}
|
|
|
|
|
|
// sku商品信息
|
|
|
let skuData = _getSkuDataByProductBaseInfo(origin);
|
|
|
// sku商品信息
|
|
|
let skuData = _getSkuDataByProductBaseInfo(origin);
|
|
|
|
|
|
// 商品购买状态
|
|
|
let soldOut = !!(propOrigin('status') === 0 || skuData.totalStorageNum === 0);
|
|
|
let virtualGoods = propOrigin('attribute') === 3; // 虚拟商品
|
|
|
// 商品购买状态
|
|
|
let soldOut = !!(propOrigin('status') === 0 || skuData.totalStorageNum === 0);
|
|
|
let virtualGoods = propOrigin('attribute') === 3; // 虚拟商品
|
|
|
|
|
|
if (!soldOut && !virtualGoods) {
|
|
|
result.addToCart = 1;
|
|
|
}
|
|
|
if (!soldOut && !virtualGoods) {
|
|
|
result.addToCart = 1;
|
|
|
}
|
|
|
|
|
|
result.isCollect = propOrigin('is_collect');
|
|
|
result.colors = skuData.skuGoods;
|
|
|
result.isCollect = propOrigin('is_collect');
|
|
|
result.colors = skuData.skuGoods;
|
|
|
|
|
|
return result;
|
|
|
})();
|
|
|
return result;
|
|
|
};
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -377,13 +375,9 @@ const getProductInfoAsync = (pid) => { |
|
|
}
|
|
|
|
|
|
let productSkn = _.get(productData, 'data.product_skn');
|
|
|
let requestData = yield Promise.all([
|
|
|
_getProductIntroAsync(productSkn), // 商品详细介绍
|
|
|
_detailDataPkg(productData.data) // 商品详细价格
|
|
|
]);
|
|
|
|
|
|
let productDescription = requestData[0];
|
|
|
let productInfo = requestData[1];
|
|
|
let productDescription = yield _getProductIntroAsync(productSkn);
|
|
|
let productInfo = _detailDataPkg(productData.data);
|
|
|
let intro = _getIntroInfo(productSkn, productDescription);
|
|
|
|
|
|
return Object.assign(productInfo, intro);
|
...
|
...
|
@@ -707,7 +701,6 @@ const addToFav = (uid, skuList, hasPromotion, cartDelList) => { |
|
|
* @return array
|
|
|
*/
|
|
|
const checkUserIsFav = (uid, skuList) => {
|
|
|
|
|
|
return co(function * () {
|
|
|
let result = {};
|
|
|
|
...
|
...
|
@@ -724,7 +717,7 @@ const checkUserIsFav = (uid, skuList) => { |
|
|
return result;
|
|
|
}
|
|
|
|
|
|
return cartApi.checkUserIsFavProductList(uid, skuList);
|
|
|
return yield cartApi.checkUserIsFavProductList(uid, skuList);
|
|
|
})();
|
|
|
};
|
|
|
|
...
|
...
|
|