Authored by 郭成尧

del-note-code

... ... @@ -219,17 +219,6 @@ let getProductData = (data) => {
});
}
// pagecache重构
// if (data.uid) {
// params.uid = data.uid;
// }
// pagecache重构
// return _getUserProfile(params.uid).then((user) => {
// data.vipLevel = (user.data && user.data.vip_info && user.data.vip_info.cur_level) || '0';
// data.isStudent = (user.data && user.data.vip_info && user.data.vip_info.is_student) ? true : false;
// params.is_student = data.isStudent ? 1 : 0;
// params.current_vip_level = data.vipLevel;
return api.get('', params, {
code: 200,
cache: true
... ... @@ -308,31 +297,9 @@ const _detailDataPkg = (origin, ua) => {
// 是否是虚拟商品
dest.virtualGoods = (origin.attribute * 1 === 3);
// 用户未登录时 pagecache重构
// if (!uid) {
// dest.loginUrl = helpers.urlFormat('/signin.html', {
// refer: helpers.urlFormat('/product/show_' + origin.product_skn + '.html')
// });
// }
// 商品促销短语
origin.sales_phrase && (dest.goodsSubtitle = origin.sales_phrase);
// 促销信息
// if (origin.promotionBoList) {
// let discountList = [];
// _.forEach(origin.promotionBoList, function(value) {
// discountList.push({
// text: `【${value.promotionType}】${value.promotionTitle}`
// });
// });
// discountList.length && (dest.goodsDiscount = {
// list: discountList
// });
// }
// 商品标签
if (origin.tags) {
let productTags = {};
... ... @@ -344,42 +311,6 @@ const _detailDataPkg = (origin, ua) => {
dest.tags = productTags;
}
// 商品价格 pagecache重构
// let goodsPrice = {
// currentPrice: origin.format_sales_price === '0' ? origin.format_market_price : origin.format_sales_price
// };
// if (origin.format_sales_price !== '0' && origin.format_market_price !== origin.format_sales_price) {
// goodsPrice.previousPrice = origin.format_market_price;
// }
// dest.goodsPrice = goodsPrice;
// 商品返回 YOHO 币 pagecache重构
// origin.yohoCoinNum && (dest.commodityReturn = origin.yohoCoinNum);
// VIP 商品价格 pagecache重构
// if (origin.vip) {
// let vipList = [];
// let levelList = {
// 银卡: 1,
// 金卡: 2,
// 白金: 3
// };
// _.forEach(origin.vip, function(value) {
// vipList.push({
// level: levelList[value.caption],
// text: value.price,
// currentLevel: (value.vipLevel === vipLevel)
// });
// });
// vipList.length && (dest.vipLevel = {
// list: vipList
// });
// }
// 上市期
origin.expect_arrival_time && (dest.periodOfMarket = origin.expect_arrival_time);
... ... @@ -419,20 +350,7 @@ const _detailDataPkg = (origin, ua) => {
let goodsGroup = [];
// pagecache重构
// sizeName = '',
// colorList = [],
// sizeList = {},
// allSizeList = {},
// colorStorageGroup = {},
// colorStorageNum = 0;
// pagecache重构
_.forEach(origin.goods_list, function(value) {
// 未上架也显示
// if (value.status === 0 && !origin.isLimitBuy) {
// return;
// }
// colorStorageNum = 0;
// 商品分组
if (value.images_list) {
... ... @@ -443,105 +361,6 @@ const _detailDataPkg = (origin, ua) => {
});
});
}
// // 商品的尺码列表
// colorStorageGroup[value.product_skc] = {};
// if (value.size_list) {
// sizeList[value.product_skc] = [];
// _.forEach(value.size_list, function(size) {
// sizeList[value.product_skc].push({
// id: size.size_id,
// skuId: size.product_sku,
// goodsId: value.goods_id,
// colorId: value.color_id,
// name: size.size_name,
// sizeNum: size.storage_number
// });
// sizeName = size.size_name;
// // 所有尺码列表,赋值用于前端展示默认尺码的时候
// // 判断出没有库存则显示灰色
// let build = {
// id: size.size_id,
// storage: size.storage_number
// };
// allSizeList[sizeName] = (allSizeList[sizeName] === null ||
// typeof allSizeList[sizeName] === 'undefined') ? build : allSizeList[sizeName];
// colorStorageNum += parseInt(size.storage_number, 10);
// colorStorageGroup[value.product_skc][sizeName] = parseInt(size.storage_number, 10);
// });
// // 颜色分组
// colorList.push({
// id: value.color_id,
// skcId: value.product_skc,
// name: value.color_name,
// colorNum: colorStorageNum
// });
// }
// // 缩略图
// thumbImageList.push({
// img: value.color_image
// });
// // 商品库存总数
// totalStorageNum += _.toNumber(colorStorageNum);
// });
// // 遍历所有尺码,构建颜色显示数据
// let i = 1;
// sizeGroup[0] = {
// size: []
// };
// _.forEach(allSizeList, (value, key) => {
// // 默认尺码
// sizeGroup[0].size.push({
// name: key,
// sizeNum: _.toNumber(value.storage) > 0 ? true : false,
// id: value.id
// });
// colorGroup[i] = {
// color: []
// };
// // 各个颜色的尺码, 每行显示一个尺码对应的颜色
// _.forEach(colorList, (colorArr) => {
// let tempColorArr = _.cloneDeep(colorArr);
// if (colorStorageGroup[tempColorArr.skcId] &&
// colorStorageGroup[tempColorArr.skcId][key]) {
// tempColorArr.colorNum = colorStorageGroup[tempColorArr.skcId][key];
// } else {
// tempColorArr.colorNum = 0;
// }
// colorGroup[i].color.push(Object.assign({}, tempColorArr));
// });
// colorGroup[i].id = value.id;
// ++i;
// });
// colorGroup[0] = {
// color: []
// };
// // 遍历所有颜色, 构建尺码显示数据
// i = 1;
// _.forEach(colorList, function(value) {
// // 各个尺码的颜色, 每行显示一个颜色的对应尺码
// sizeGroup[i] = {
// size: sizeList[value.skcId],
// colorId: value.skcId
// };
// // 默认颜色
// colorGroup[0].color.push(value);
// ++i;
});
... ... @@ -572,58 +391,6 @@ const _detailDataPkg = (origin, ua) => {
goodsInstore: origin.storage_sum
};
// pagecache重构
// let soldOut = (origin.storage_sum === 0) || (totalStorageNum === 0); // status
// let notForSale = origin.attribute === 2;
// 显示加入购物车链接 pagecache重构
// if (!soldOut && !notForSale) {
// _.orderBy(colorGroup);
// Object.assign(dest.cartInfo, {
// productId: origin.product_id,
// thumbs: thumbImageList,
// name: dest.goodsName ? dest.goodsName : '',
// price: dest.goodsPrice.previousPrice ? dest.goodsPrice.previousPrice : '',
// salePrice: dest.goodsPrice.currentPrice ? dest.goodsPrice.currentPrice : '',
// totalNum: totalStorageNum,
// colors: _.toArray(colorGroup),
// sizes: sizeGroup
// });
// // 限购商品
// if (origin.isLimitBuy) {
// // 是否开售
// let isBeginSale = (origin.saleStatus === 1);
// // 限购商品有关的展示状态
// let showStatus = 1;
// origin.showStatus && (showStatus = parseInt(origin.showStatus, 10));
// // 处理限购商品有关的按钮状态
// dest = _procShowStatus(dest, showStatus, isBeginSale);
// dest.cartInfo.limitProductCode = origin.limitProductCode;
// dest.cartInfo.limitCodeUrl = _getLimitCodeUrl(origin.limitProductCode, origin.product_skn, ua);
// dest.cartInfo.limitProductPay = helpers.urlFormat('/cart/index/orderEnsure');
// } else {
// dest.cartInfo.addToCartUrl = helpers.urlFormat('/product/buy_' + origin.product_id + '_' +
// origin.goods_list.goods_id + '.html');
// }
// } else if (notForSale) {
// dest.cartInfo.notForSale = true;
// } else if (soldOut) {
// dest.cartInfo.soldOut = true;
// }
// // 是否收藏
// dest.isCollect = false;
// if (origin.is_collect === 'Y') {
// dest.isCollect = true;
// dest.cartInfo.isCollect = true;
// }
// 底部简介URL链接
dest.introUrl = '/product/detail/intro/' + origin.product_skn;
dest.id = origin.product_id;
... ... @@ -976,12 +743,6 @@ let _detailDataPkgAsync = (origin, uid, vipLevel, ua) => {
return callback();
}
// 是否收藏 使用单独收藏接口获取
// dest.isCollect = false;
// if (origin.is_collect === 'Y') {
// dest.isCollect = true;
// dest.cartInfo.isCollect = true;
// }
function callback() {
// 虚拟商品(门票)
if (origin.attribute * 1 === 3) {
... ... @@ -1001,11 +762,6 @@ let _detailDataPkgAsync = (origin, uid, vipLevel, ua) => {
// 清空活动
dest.goodsDiscount = [];
// 来自登录页,自动弹出选择框
// if (isset($_GET['product_type']) && $_GET['product_type'] == 'ticket') {
// $result['showPannel'] = true;
// }
}
dest.id = origin.product_id;
dest.goodsId = origin.goods_id;
... ...