Authored by 陈峰

Mt :erge branch 'qCloud' of http://git.yoho.cn/fe/yohobuywap-node into qCloud

... ... @@ -16,7 +16,6 @@ exports.userCenter = (req, res, next) => {
rec_pos: '100004',
uid: uid
}).then((preferenceData) => {
if (preferenceData.code === 200) {
// 获取信息成功
}
... ...
... ... @@ -6,67 +6,64 @@ const _ = require('lodash');
/**
* 分享页面基础参数
* @param {object} sizeInfo [接口原始数据]
* @return {object} [description]
* @param data
*/
const getPreferenceData = (data) => {
var dest = {};
let dest = {
goods: []
};
let list = data.data || {};
// list = camelCase(list);
_.forEach(list && list.product_list, value => {
let distGoods = [];
_.forEach(list.productList, function(value) {
if (!value.productSkn || !value.goodsList || !value.goodsList.length) {
if (!value.product_skn || !value.goods_list || !value.goods_list.length) {
return;
}
value.goodsId = value.goodsList[0].goodsId;
// let goods = value;
value.goodsId = value.goods_list && value.goods_list[0] && value.goods_list[0].goods_id;
let goods = [];
goods.push({
productSkn: value.product_skn,
productName: value.product_name,
defaultImages: value.default_images,
isSoonSoldOut: value.is_soon_sold_out,
let goods = {
product_skn: value.product_skn,
product_name: value.product_name,
default_images: value.default_images,
is_soon_sold_out: value.is_soon_sold_out === 'Y',
url: helpers.urlFormat(`/product/pro_${value.product_id}_${value.goodsId}/${value.cn_alphabet}.html`),
marketPrice: value.market_price,
salesPrice: value.sales_price
market_price: value.market_price,
sales_price: value.sales_price
};
// if (_.get(value, 'tags[0]', null)) {
// goods.tags = [];
// if (goods.is_new === 'Y') {
// goods.tags.push({is_new: true});
// } else if (goods.is_advance === 'Y') {
// goods.tags.push({isAdvance: true});
// } else if (goods.is_discount === 'Y') {
// goods.tags.push({isDiscount: true});
// } else if (goods.is_yohoood === 'Y') {
// goods.tags.push({isYohoood: true});
// } else if (goods.is_limited === 'Y') {
// goods.tags.push({isLimited: true});
// }
// }
let tags = {};
_.forEach(value.tags, tag => {
tags[tag] = true;
});
goods.tags = tags;
// goods.url = helpers.urlFormat(`/product/pro_${value.product_id}_${value.goodsId}/${value.cn_alphabet}.html`);
if (_.get(goods, 'tags[0]', null)) {
goods.tags = [];
if (goods.isNew === 'Y') {
goods.tags.push({is_new: true});
} else if (goods.is_advance === 'Y') {
goods.tags.push({isAdvance: true});
} else if (goods.is_discount === 'Y') {
goods.tags.push({isDiscount: true});
} else if (goods.is_yohoood === 'Y') {
goods.tags.push({isYohoood: true});
} else if (goods.is_limited === 'Y') {
goods.tags.push({isLimited: true});
}
}
distGoods.push(goods);
dest.goods.push(goods);
});
dest.code = list.code;
dest.goods = distGoods;
dest.rec_id = list.recId;
dest.code = data.code;
dest.rec_id = list.rec_id;
dest.message = list.message;
// 清空变量,释放内存
data = {};
return dest;
};
... ...
{{#if this}} {{!-- 剔除值为false的项 --}}
<div class="good-info {{#if @root.saleViplogin}}sale-vip{{/if}}" data-good-id="{{product_id}}" data-id="{{product_skn}}" data-bp-id="guang_goodList_{{product_name}}_false">
<div class="good-info {{#if @root.sale_vip_login}}sale-vip{{/if}}" data-good-id="{{product_id}}" data-id="{{product_skn}}" data-bp-id="guang_goodList_{{product_name}}_false">
<div class="tag-container clearfix">
{{# tags}}
{{# isNew}}
{{# is_new}}
<p class="good-tag new-tag">NEW</p>
{{/ isNew}}
{{# isHot}}
{{/ is_new}}
{{# is_hot}}
<p class="good-tag hot-tag">HOT</p>
{{/ isHot}}
{{# isAdvance}}
{{/ is_hot}}
{{# is_advance}}
<p class="good-tag renew-tag">再到着</p>
{{/ isAdvance}}
{{# isDiscount}}
{{/ is_advance}}
{{# is_discount}}
<p class="good-tag sale-tag">SALE</p>
{{/ isDiscount}}
{{# isYohood}}
{{/ is_discount}}
{{# is_yohood}}
<p class="good-tag new-festival-tag">新品节</p>
{{/ isYohood}}
{{# isLimited}}
{{/ is_yohood}}
{{# is_limited}}
<p class="good-tag limit-tag">限量商品</p>
{{/ isLimited}}
{{/ is_limited}}
{{/ tags}}
</div>
<div class="good-detail-img">
... ...
... ... @@ -136,7 +136,7 @@ exports.processProductList = (list, options) => {
let tags = {};
_.forEach(product.tags, tag => {
tags[_.camelCase(tag)] = true;
tags[tag] = true;
});
product.tags = tags;
... ...