...
|
...
|
@@ -822,11 +822,80 @@ let _productInfoBySkns = (skns) => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
const getLimitProductData = (uid, limitProductCode) => {
|
|
|
const param = {
|
|
|
method: 'app.limitProduct.limitProductDetail',
|
|
|
limitProductCode,
|
|
|
uid
|
|
|
};
|
|
|
|
|
|
return api.get('', param).then(result => {
|
|
|
if (!(result && result.data)) {
|
|
|
return Promise.reject(result);
|
|
|
}
|
|
|
|
|
|
let obj = {};
|
|
|
|
|
|
// if (!result.data.hasOwnProperty('attachment')) {
|
|
|
// return
|
|
|
// }
|
|
|
|
|
|
obj.price = result.data.price;
|
|
|
obj.name = result.data.productName;
|
|
|
obj.releaseDate = `${result.data.saleTime}发售`;
|
|
|
obj.banner = helpers.image(result.data.defaultUrl, 750, '');
|
|
|
obj.description = result.data.description;
|
|
|
obj.attaches = [];
|
|
|
|
|
|
result.data.attachment = result.data.attachment || [];
|
|
|
|
|
|
for (let item of result.data.attachment) {
|
|
|
if (item.isDefault === 1) { // 排除默认图片
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
let attach = {};
|
|
|
|
|
|
switch (item.attachType) {
|
|
|
case 1:
|
|
|
attach.isImg = true;
|
|
|
attach.attachUrl = helpers.image(item.attachUrl, 750, '');
|
|
|
attach.attachName = item.intro;
|
|
|
attach.intro = item.intro;
|
|
|
break;
|
|
|
case 2:
|
|
|
attach.isVideo = true;
|
|
|
attach.attachUrl = item.attachUrl;
|
|
|
attach.img = helpers.image(item.intro, 750, '');
|
|
|
break;
|
|
|
case 3:
|
|
|
attach.isText = true;
|
|
|
attach.intro = item.intro;
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
attach.orderBy = item.orderBy;
|
|
|
|
|
|
obj.attaches.push(attach);
|
|
|
}
|
|
|
|
|
|
if (obj.attaches.length > 1) {
|
|
|
obj.attaches.sort((v1, v2) => {
|
|
|
return v1.orderBy - v2.orderBy;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
return obj;
|
|
|
});
|
|
|
};
|
|
|
|
|
|
module.exports = {
|
|
|
getProductData,
|
|
|
getProductAsyncData,
|
|
|
getNewProductAsyncData,
|
|
|
getUserProfile: _getUserProfile,
|
|
|
productInfoBySkns: _productInfoBySkns,
|
|
|
detailDataPkgAsync: _detailDataPkgAsync
|
|
|
detailDataPkgAsync: _detailDataPkgAsync,
|
|
|
getLimitProductData
|
|
|
}; |
...
|
...
|
|