Authored by 陈峰

移除商品sale相关页面、商品详情页、首页频道页、分类页、星潮教室的camelCase

... ... @@ -7,7 +7,6 @@
const _ = require('lodash');
const api = global.yoho.API;
const helpers = global.yoho.helpers;
const camelCase = global.yoho.camelCase;
const genderMap = {
boys: '1,3',
... ... @@ -27,7 +26,6 @@ let _processCateData = (list, channel) => {
};
});
list = camelCase(list);
_.map(list, function(item, key) {
item.focus = key === channel;
... ... @@ -36,30 +34,30 @@ let _processCateData = (list, channel) => {
if (firstItem.sub && firstItem.sub.length) {
_.map(firstItem.sub, function(secondItem) {
secondItem.url = helpers.urlFormat('/', {
sort: _.get(secondItem, 'relationParameter.sort'),
sort_name: secondItem.categoryName,
sort: _.get(secondItem, 'relation_parameter.sort'),
sort_name: secondItem.category_name,
gender: genderMap[key] || ''
}, 'list');
});
firstItem.sub.unshift({
categoryName: `全部${firstItem.categoryName}`,
category_name: `全部${firstItem.category_name}`,
url: helpers.urlFormat('/', {
sort: _.get(firstItem, 'relationParameter.sort'),
sort_name: firstItem.categoryName,
sort: _.get(firstItem, 'relation_parameter.sort'),
sort_name: firstItem.category_name,
gender: genderMap[key] || ''
}, 'list')
});
} else {
firstItem.url = helpers.urlFormat('/', {
sort: _.get(firstItem, 'relationParameter.sort'),
sort_name: firstItem.categoryName,
sort: _.get(firstItem, 'relation_parameter.sort'),
sort_name: firstItem.category_name,
gender: genderMap[key] || ''
}, 'list');
}
});
});
return {
nav,
list
... ...
... ... @@ -8,7 +8,6 @@ const utils = '../../../utils';
const contentCodeConfig = require('../../../config/content-code');
const _ = require('lodash');
const api = global.yoho.ServiceAPI;
const camelCase = global.yoho.camelCase;
const logger = global.yoho.logger;
const resourcesProcess = require(`${utils}/resources-process`);
... ... @@ -87,13 +86,12 @@ const _processSideBar = (list, choosed) => {
let offset = 0; // 分割数组用到的游标
list = list || [];
list = camelCase(list);
_.forEach(list, (item, i) => {
if (item.sub) {
item.sub.unshift({
sortName: item.sortName,
sortNameEn: item.sortNameEn,
sort_name: item.sort_name,
sort_name_en: item.sort_name_en,
back: true,
isSelect: false,
bgColor: _getSidebarColor(choosed)
... ... @@ -101,7 +99,7 @@ const _processSideBar = (list, choosed) => {
}
// 如果有分隔符,分割数组
if (item.separativeSign === 'Y') {
if (item.separative_sign === 'Y') {
formatData.push(list.slice(offset, i));
offset = i;
}
... ... @@ -180,16 +178,16 @@ const _getChannelList = () => {
list.channelList = [];
list.yohood = {};
result.data.list = camelCase(result.data.list || []);
result.data.list = result.data.list || [];
_.forEach(result.data.list, function(item) {
const channel = channelList[item.yhChannel - 1];
const channel = channelList[item.yh_channel - 1];
if (channel) {
list.channelList.push(channel);
}
if (_.toNumber(item.yhChannel) === 5) {
if (_.toNumber(item.yh_channel) === 5) {
list.yohood.showYohood = true;
list.yohood.yohoodHref = 'http://www.yohood.cn';
}
... ...
... ... @@ -20,9 +20,9 @@
{{# this}}
<li class="p-level-item{{#if @first}} focus{{/if}}">
{{#if url}}
<a href={{url}}> {{categoryName}}</a>
<a href={{url}}> {{category_name}}</a>
{{^}}
{{categoryName}}
{{category_name}}
{{/if}}
</li>
{{/ this}}
... ... @@ -33,7 +33,7 @@
{{# sub}}
<li>
<a href={{url}}>
{{categoryName}}
{{category_name}}
</a>
</li>
{{/ sub}}
... ...
... ... @@ -2,20 +2,20 @@
{{#sideNav}}
<ul {{#if @first}}class="first"{{/if}}>
{{#this}}
<li class="{{lowerCase sortNameEn}}">
{{#if sortUrl}}
<a href="{{sortUrl}}" style="{{#if sortNameColor}}color:{{sortNameColor}};{{/if}}">
<li class="{{lowerCase sort_name_en}}">
{{#if sort_url}}
<a href="{{sort_url}}" style="{{#if sort_name_color}}color:{{sort_name_color}};{{/if}}">
{{else}}
<a href="javascript:;" style="{{#if sortNameColor}}color:{{sortNameColor}};{{/if}}">
<a href="javascript:;" style="{{#if sort_name_color}}color:{{sort_name_color}};{{/if}}">
{{/if}}
{{# sortIco}}
{{# sort_ico}}
<span class="nav-img" style="background-image: url({{image . 60 60}})"></span>
{{/ sortIco}}
{{^ sortIco}}
{{/ sort_ico}}
{{^ sort_ico}}
<i class="nav-icon"></i>
{{/ sortIco}}
<em>{{sortName}}</em>
<span class="title">{{sortNameEn}}</span>
{{/ sort_ico}}
<em>{{sort_name}}</em>
<span class="title">{{sort_name_en}}</span>
{{# sub}}
<span class="enter-subnav iconfont">&#xe614;</span>
{{/ sub}}
... ... @@ -24,16 +24,16 @@
<ul class="sub-nav">
{{# sub}}
<li class="{{# isSelect}}current{{/ isSelect}}" style="background-color:{{bgColor}};">
{{#if sortUrl}}
<a href="{{sortUrl}}" style="{{#if sortNameColor}}color:{{sortNameColor}};{{/if}}">
{{#if sort_url}}
<a href="{{sort_url}}" style="{{#if sort_name_color}}color:{{sort_name_color}};{{/if}}">
{{else}}
<a href="javascript:;" style="{{#if sortNameColor}}color:{{sortNameColor}};{{/if}}">
<a href="javascript:;" style="{{#if sort_name_color}}color:{{sort_name_color}};{{/if}}">
{{/if}}
{{# back}}
<i class="nav-back iconfont">&#xe610;</i>
{{/ back}}
<em>{{sortName}}</em>
<span class="title">{{sortNameEn}}</span>
<em>{{sort_name}}</em>
<span class="title">{{sort_name_en}}</span>
</a>
</li>
{{/ sub}}
... ...
... ... @@ -11,7 +11,6 @@ const api = global.yoho.API;
const serviceAPI = global.yoho.ServiceAPI;
const singleAPI = global.yoho.SingleAPI;
const helpers = global.yoho.helpers;
const camelCase = global.yoho.camelCase;
const _ = require('lodash');
/**
... ...
... ... @@ -102,8 +102,8 @@ const getResources = (params, options) => {
list = {
title: res.data.title,
moreUrl: res.data.more_url,
moreName: res.data.more_name,
more_url: res.data.more_url,
more_name: res.data.more_name,
image: res.data.image
};
... ... @@ -112,8 +112,8 @@ const getResources = (params, options) => {
case 'titleFloor':
list = {
name: res.data.title.name,
moreUrl: res.data.title.more_url,
moreName: res.data.title.more_name
more_url: res.data.title.more_url,
more_name: res.data.title.more_name
};
if (res.data.title.name === '热门商品') {
... ...
... ... @@ -8,7 +8,6 @@ const utils = '../../../utils';
const contentCodeConfig = require('../../../config/content-code');
const resourcesProcess = require(`${utils}/resources-process`);
const logger = global.yoho.logger;
const camelCase = global.yoho.camelCase;
const helpers = global.yoho.helpers;
const _ = require('lodash');
const serviceAPI = global.yoho.ServiceAPI;
... ... @@ -49,7 +48,6 @@ const _processIndexData = (dataList) => {
let list = dataList.data || {};
list = camelCase(list);
formatData.md5 = dataList.md5;
... ... @@ -97,8 +95,8 @@ const _processIndexData = (dataList) => {
title: data.title,
articeTxt: data.intro,
src: data.src,
publishTime: helpers.dateFormat('MM月DD日 hh:mm', data.publishTime),
viewsNum: data.viewsNum
publish_time: helpers.dateFormat('MM月DD日 hh:mm', data.publish_time),
views_num: data.views_num
}, avatar));
});
}
... ... @@ -131,11 +129,10 @@ const _processGuangData = (list, flag) => {
const formatData = [];
list = list || [];
list = camelCase(list);
_.forEach(list, (data, key) => {
if (flag) {
data.publishTime = helpers.dateFormat('MM月DD日 hh:mm', data.publishTime);
data.publish_time = helpers.dateFormat('MM月DD日 hh:mm', data.publish_time);
}
if (data.isFavor === 'N') {
... ...
... ... @@ -94,8 +94,8 @@
</div>
</div>
<div class="artice-o">
<span class="time"><i class="iconfont time-ico">&#xe603;</i>{{publishTime}}</span>
<span class="see"><i class="iconfont see-ico">&#xe602;</i>{{viewsNum}}</span>
<span class="time"><i class="iconfont time-ico">&#xe603;</i>{{publish_time}}</span>
<span class="see"><i class="iconfont see-ico">&#xe602;</i>{{views_num}}</span>
</div>
</a>
</li>
... ...
... ... @@ -15,8 +15,8 @@
<a href="{{url}}"><h2 class="title">{{title}}</h2></a>
<p class="cont-txt">{{intro}}</p>
<div class="count-area">
<span class="time"><i class="iconfont time-ico">&#xe603;</i>{{publishTime}}</span>
<span class="see"><i class="iconfont see-ico">&#xe602;</i>{{viewsNum}}</span>
<span class="time"><i class="iconfont time-ico">&#xe603;</i>{{publish_time}}</span>
<span class="see"><i class="iconfont see-ico">&#xe602;</i>{{views_num}}</span>
{{#if share.url}}
<a href="{{share.url}}" class="iconfont forward">&#xe600;</a>
... ...
... ... @@ -35,7 +35,7 @@ const _reviewStatus = (res, req, uid, status) => {
installmentOnly: {
title: {
title: '分期专享',
moreUrl: helpers.appUrlFormat(req.originalUrl, 'go.instalmentlist', {
more_url: helpers.appUrlFormat(req.originalUrl, 'go.instalmentlist', {
title: '分期专享'
})
},
... ... @@ -101,7 +101,7 @@ const index = (req, res) => {
let installmentOnly = {
title: {
title: '分期专享',
moreUrl: helpers.appUrlFormat(req.originalUrl, 'go.instalmentlist', {
more_url: helpers.appUrlFormat(req.originalUrl, 'go.instalmentlist', {
title: '分期专享'
})
},
... ...
... ... @@ -102,6 +102,7 @@ let breakingYards = (req, res, next) => {
saleModel.getBreakCodeData({
yhChannel: params.channel
}).then((result) => {
res.render('sale/break-code', Object.assign(params.renderData, result));
}).catch(next);
};
... ... @@ -135,6 +136,7 @@ let discountDetail = (req, res, next) => {
saleModel.getDiscountDetailData(id, req.yoho.channel).then((result) => {
params.renderData.pageHeader.navTitle = result.title;
res.render('sale/discount-detail', Object.assign(params.renderData, result));
}).catch(next);
};
... ... @@ -193,7 +195,7 @@ let search = (req, res, next) => {
}
saleModel.getSearchData(params, uid).then((result) => {
let vipLevel = result[1].curLevel;
let vipLevel = result[1].cur_level;
let vipObj = {};
if (req.query.saleType === '2') {
... ...
... ... @@ -222,11 +222,11 @@ const _getLimitCodeUrl = (productCode, skn, ua) => {
// if (origin.productPriceBo) {
// let originPrice = origin.productPriceBo;
// let goodsPrice = {
// currentPrice: originPrice.formatSalesPrice
// currentPrice: originPrice.format_sales_price
// };
// if (originPrice.formatMarketPrice !== originPrice.formatSalesPrice) {
// goodsPrice.previousPrice = originPrice.formatMarketPrice;
// if (originPrice.format_market_price !== originPrice.format_sales_price) {
// goodsPrice.previousPrice = originPrice.format_market_price;
// }
// dest.goodsPrice = goodsPrice;
... ... @@ -566,12 +566,12 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
totalStorageNum = 0;
// 商品名称
if (!origin.productName) {
if (!origin.product_name) {
dest.feedbacks = {};
return dest;
}
dest.goodsName = origin.productName;
dest.goodsName = origin.product_name;
// 是否是虚拟商品
dest.virtualGoods = (origin.attribute * 1 === 3);
... ... @@ -579,12 +579,12 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
// 用户未登录时
if (!uid) {
dest.loginUrl = helpers.urlFormat('/signin.html', {
refer: helpers.urlFormat('/product/show_' + origin.productSkn + '.html')
refer: helpers.urlFormat('/product/show_' + origin.product_skn + '.html')
});
}
// 商品促销短语
origin.salesPhrase && (dest.goodsSubtitle = origin.salesPhrase);
origin.sales_phrase && (dest.goodsSubtitle = origin.sales_phrase);
// 促销信息 TODO: 换新接口
if (origin.promotionBoList) {
... ... @@ -614,11 +614,11 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
// 商品价格
let goodsPrice = {
currentPrice: origin.formatSalesPrice === '0' ? origin.formatMarketPrice : origin.formatSalesPrice
currentPrice: origin.format_sales_price === '0' ? origin.format_market_price : origin.format_sales_price
};
if (origin.formatSalesPrice !== '0' && origin.formatMarketPrice !== origin.formatSalesPrice) {
goodsPrice.previousPrice = origin.formatMarketPrice;
if (origin.format_sales_price !== '0' && origin.format_market_price !== origin.format_sales_price) {
goodsPrice.previousPrice = origin.format_market_price;
}
dest.goodsPrice = goodsPrice;
... ... @@ -648,8 +648,8 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
});
}
// 上市期
// TODO 接口文档,实际接口数据中都没有找到这个字段,所以不知道有什么用途
origin.expectArrivalTime && (dest.periodOfMarket = `${origin.expectArrivalTime}月`);
// 商品咨询
... ... @@ -659,7 +659,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
};
let consultParams = {
product_id: origin.productId
product_id: origin.product_id
};
if (_.has(dest, 'feedbacks.consultsNum')) {
... ... @@ -671,20 +671,20 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
// 商品评价
dest.feedbacks.commentsUrl = helpers.urlFormat('/product/detail/comments', {
product_id: origin.productId,
product_id: origin.product_id,
});
// 品牌信息
if (origin.brand) {
let extra = `?productSkn=${origin.productSkn}&brandId=${origin.brandInfo.brandId}`;
let extra = `?productSkn=${origin.product_skn}&brandId=${origin.brand_info.brand_id}`;
dest.preferenceUrl = `/product/detail/preference${extra}`;
}
dest.productSkn = origin.productSkn;
dest.productSkn = origin.product_skn;
// 商品信息
if (origin.goodsList) {
if (origin.goods_list) {
let goodsGroup = [],
sizeName = '',
colorList = [],
... ... @@ -693,7 +693,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
colorStorageGroup = {},
colorStorageNum = 0;
_.forEach(origin.goodsList, function(value) {
_.forEach(origin.goods_list, function(value) {
if (value.status === 0) {
return;
}
... ... @@ -701,56 +701,56 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
colorStorageNum = 0;
// 商品分组
if (value.imagesList) {
_.forEach(value.imagesList, function(good) {
if (value.images_list) {
_.forEach(value.images_list, function(good) {
goodsGroup.push({
goodsId: value.goodsId,
img: good.imageUrl
goodsId: value.goods_id,
img: good.image_url
});
});
}
// 商品的尺码列表
colorStorageGroup[value.productSkc] = {};
if (value.sizeList) {
sizeList[value.productSkc] = [];
_.forEach(value.sizeList, function(size) {
sizeList[value.productSkc].push({
id: size.sizeId,
skuId: size.productSku,
goodsId: value.goodsId,
colorId: value.colorId,
name: size.sizeName,
sizeNum: size.storageNumber
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.sizeName;
sizeName = size.size_name;
// 所有尺码列表,赋值用于前端展示默认尺码的时候
// 判断出没有库存则显示灰色
let build = {
id: size.sizeId,
storage: size.storageNumber
id: size.size_id,
storage: size.storage_number
};
allSizeList[sizeName] = (allSizeList[sizeName] === null ||
typeof allSizeList[sizeName] === 'undefined') ? build : allSizeList[sizeName];
colorStorageNum += parseInt(size.storageNumber, 10);
colorStorageGroup[value.productSkc][sizeName] = parseInt(size.storageNumber, 10);
colorStorageNum += parseInt(size.storage_number, 10);
colorStorageGroup[value.product_skc][sizeName] = parseInt(size.storage_number, 10);
});
// 颜色分组
colorList.push({
id: value.colorId,
skcId: value.productSkc,
name: value.colorName,
id: value.color_id,
skcId: value.product_skc,
name: value.color_name,
colorNum: colorStorageNum
});
}
// 缩略图
thumbImageList.push({
img: value.colorImage
img: value.color_image
});
// 商品库存总数
... ... @@ -835,9 +835,9 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
dest.cartInfo = {
cartUrl: helpers.urlFormat('/cart/index/index'),
numInCart: 0,
goodsInstore: origin.storageSum
goodsInstore: origin.storage_sum
};
let soldOut = (origin.storageSum === 0) || (totalStorageNum === 0); // status
let soldOut = (origin.storage_sum === 0) || (totalStorageNum === 0); // status
let notForSale = origin.attribute === 2;
// 显示加入购物车链接
... ... @@ -845,7 +845,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
_.orderBy(colorGroup);
Object.assign(dest.cartInfo, {
productId: origin.productId,
productId: origin.product_id,
thumbs: thumbImageList,
name: dest.goodsName ? dest.goodsName : '',
price: dest.goodsPrice.previousPrice ? dest.goodsPrice.previousPrice : '',
... ... @@ -869,11 +869,11 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
dest = _procShowStatus(dest, showStatus, isBeginSale);
dest.cartInfo.limitProductCode = origin.limitProductCode;
dest.cartInfo.limitCodeUrl = _getLimitCodeUrl(origin.limitProductCode, origin.productSkn, ua);
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.productId + '_' +
origin.goodsList.goodsId + '.html');
dest.cartInfo.addToCartUrl = helpers.urlFormat('/product/buy_' + origin.product_id + '_' +
origin.goods_list.goods_id + '.html');
}
} else if (notForSale) {
dest.cartInfo.notForSale = true;
... ... @@ -883,14 +883,14 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
// 是否收藏
dest.isCollect = false;
if (origin.isCollect === 'Y') {
if (origin.is_collect === 'Y') {
dest.isCollect = true;
dest.cartInfo.isCollect = true;
}
// 底部简介URL链接
dest.introUrl = '/product/detail/intro/' + origin.productSkn;
dest.id = origin.productId;
dest.introUrl = '/product/detail/intro/' + origin.product_skn;
dest.id = origin.product_id;
// 虚拟商品(门票)
if (origin.attribute * 1 === 3) {
... ... @@ -898,7 +898,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
dest.ticketsConfirm = helpers.urlFormat('/cart/index/ticketsConfirm');
// 展览票
if (origin.productSkn * 1 === SINGLE_TICKETS_SKN) {
if (origin.product_skn * 1 === SINGLE_TICKETS_SKN) {
dest.single = true;
} else {
// 套票
... ... @@ -1000,19 +1000,19 @@ let getProductData = (data) => {
return api.get('', params, {
code: 200
}).then(global.yoho.camelCase).then(result => {
}).then(result => {
if (result.code === 500 || !result.data) {
return {};
}
result = result.data;
return Promise.all([
_getShopsInfo(result.brandInfo.brandId),
_getPromotionInfo(result.productSkn),
_getShopsInfo(result.brand_info.brand_id),
_getPromotionInfo(result.product_skn),
comment.getCommentInfo({
productId: result.productId
productId: result.product_id
}),
_getCommonConsult(),
comment.getConsults(result.productId, 1, 2)
comment.getConsults(result.product_id, 1, 2)
]).then((info) => {
result.promotionBoList = info[1];
finalResult = _detailDataPkg(result, data.uid, data.vipLevel, data.ua);
... ...
... ... @@ -79,8 +79,8 @@ const _convertNavData = (list) => {
_.forEach(list, (item) => {
formatData.push({
id: item.id,
name: item.sortName,
url: encodeURI(item.sortUrl)
name: item.sort_name,
url: encodeURI(item.sort_url)
});
});
... ...
... ... @@ -32,8 +32,8 @@ const getPreferenceData = (data) => {
goods.url = helpers.urlFormat(`/product/pro_${value.productId}_${value.goodsId}/${value.cnAlphabet}.html`);
if (_.get(goods, 'tags[0]', null)) {
goods.tags = [];
if (goods.isNew === 'Y') {
goods.tags.push({isNew: true});
if (goods.is_new === 'Y') {
goods.tags.push({is_new: true});
} else if (goods.isAdvance === 'Y') {
goods.tags.push({isAdvance: true});
} else if (goods.isDiscount === 'Y') {
... ...
... ... @@ -8,7 +8,6 @@ const utils = '../../../utils';
const contentCodeConfig = require('../../../config/content-code');
const logger = global.yoho.logger;
const camelCase = global.yoho.camelCase;
const resourcesProcess = require(`${utils}/resources-process`);
const productProcess = require(`${utils}/product-process`);
const processTime = require(`${utils}/time-process`);
... ... @@ -87,7 +86,6 @@ const _processDiscount = (list) => {
let flag = true;
list = list || [];
list = camelCase(list);
// list为1条数据是表示详情页,flag 设为false,不需要拼接跳转链接
if (list.length === 1) {
... ... @@ -96,7 +94,7 @@ const _processDiscount = (list) => {
_.forEach(list, (data) => {
if (flag === true) {
Object.assign(data, processTime(data.leftTime));
Object.assign(data, processTime(data.left_time));
}
formatData.push(data);
... ... @@ -133,8 +131,6 @@ const _processBreakingSort = (list) => {
const sub = [];
list = list || [];
list = camelCase(list);
_.forEach(list, (data, index) => {
const allSub = [];
... ... @@ -142,12 +138,12 @@ const _processBreakingSort = (list) => {
sub.push(data.sub);
_.forEach(data.sub, (dataSub) => {
allSub.push(dataSub.sizeId);
allSub.push(dataSub.size_id);
});
sort.push({
sortName: data.sortName,
sortId: data.sortId,
sort_name: data.sort_name,
sort_id: data.sort_id,
allSub: allSub
});
});
... ... @@ -274,7 +270,7 @@ const getSearchData = (params, uid) => {
}),
_getUserProfile(uid).then((result) => {
if (result && result.code === 200) {
return result.data.vip_info ? camelCase(result.data.vip_info) : {};
return result.data.vip_info ? result.data.vip_info : {};
} else {
logger.error('api get user info code no 200');
return {};
... ... @@ -371,15 +367,15 @@ const getDiscountDetailData = (id, yhChannel) => {
return _discount(param).then((result) => {
if (result && result.code === 200) {
res = _processDiscount(result.data);
if (res[0] && res[0].coverUrl) {
res[0].coverUrl = res[0].coverUrl.replace('/extent/{width}x{height}', '');
if (res[0] && res[0].cover_url) {
res[0].cover_url = res[0].cover_url.replace('/extent/{width}x{height}', '');
}
return {
title: res[0] && res[0].title,
productPool: res[0] && res[0].productPool,
product_pool: res[0] && res[0].product_pool,
activity: {
coverUrl: res[0] && res[0].coverUrl,
leftTime: res[0] && res[0].leftTime
cover_url: res[0] && res[0].cover_url,
left_time: res[0] && res[0].left_time
}
};
} else {
... ...
... ... @@ -11,9 +11,9 @@
<ul id="list-nav" class="list-nav clearfix">
{{# sortData}}
<li data-id="{{sortId}}" data-allSub="{{allSub}}">
<li data-id="{{sort_id}}" data-allSub="{{allSub}}">
<a href="javascript:void(0);">
<span class="span-test">{{sortName}}</span>
<span class="span-test">{{sort_name}}</span>
</a>
</li>
{{/ sortData}}
... ... @@ -31,7 +31,7 @@
<div class="swiper-size" id="size-swiper-{{key}}" {{#if @first}}style="display:block"{{/if}}>
<ul class="swiper-wrapper">
{{# this}}
<li class="swiper-slide" data-id="{{sizeId}}">{{sizeName}}</li>
<li class="swiper-slide" data-id="{{size_id}}">{{size_name}}</li>
{{/ this}}
</ul>
</div>
... ...
<div class="discount-detail-page goods-page yoho-page" data-product-pool="{{productPool}}">
<div class="discount-detail-page goods-page yoho-page" data-product-pool="{{product_pool}}">
{{> sale/banner}}
<ul id="list-nav" class="list-nav clearfix">
... ...
... ... @@ -6,8 +6,8 @@
{{/content}}
{{# activity}}
<img src="{{image coverUrl 640 200}}"/>
<p class="activity-time" data-time-s="{{leftTime}}"><i class="iconfont time-ico">&#xe603;</i><span></span></p>
<img src="{{image cover_url 640 200}}"/>
<p class="activity-time" data-time-s="{{left_time}}"><i class="iconfont time-ico">&#xe603;</i><span></span></p>
{{/ activity}}
</div>
... ...
... ... @@ -16,9 +16,9 @@ module.exports = {
siteUrl: '//m.yohobuy.com',
assetUrl: '//localhost:5001',
domains: {
api: 'http://api.yoho.yohoops.org/',
service: 'http://service.yoho.yohoops.org/',
liveApi: 'http://api.live.yoho.cn/'
api: 'http://api.yoho.cn/',
service: 'http://service.yoho.cn/',
liveApi: 'http://testapi.live.yohops.com:9999/'
},
subDomains: {
host: '.m.yohobuy.com',
... ...
{{# title}}
<div class="floor-header-more">
<h2>{{#if title}}{{title}}{{else}}{{name}}{{/if}}</h2>
{{#if moreUrl}}
<a class="more-btn iconfont" href="{{moreUrl}}">&#xe618;</a>
{{#if more_url}}
<a class="more-btn iconfont" href="{{more_url}}">&#xe618;</a>
{{/if}}
</div>
{{/ title}}
... ...
{{#if this}} {{!-- 剔除值为false的项 --}}
<div class="good-info {{#if @root.saleViplogin}}sale-vip{{/if}}" data-id="{{productSkn}}" data-bp-id="guang_goodList_{{productName}}_false">
<div class="good-info {{#if @root.saleViplogin}}sale-vip{{/if}}" 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}}
{{# isAdvance}}
{{/ is_new}}
{{# 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">
<a class="good-thumb" href="{{url}}">
<img class="lazy" data-original="{{image defaultImages 235 314}}">
<img class="lazy" data-original="{{image default_images 235 314}}">
</a>
{{# isSoonSoldOut}}
{{# is_soon_sold_out}}
<p class="few-tag">即将售罄</p>
{{/ isSoonSoldOut}}
{{/ is_soon_sold_out}}
{{#if noStorage}}
<div class="no-storage">
... ... @@ -35,22 +35,22 @@
</div>
<div class="good-detail-text">
<div class="name">
<a href="{{url}}">{{productName}}</a>
<a href="{{url}}">{{product_name}}</a>
</div>
<div class="price">
{{#if @root.saleViplogin}}
<i class="vip-grade vip-grade-{{@root.vipLevel}}"></i>
<span class="sale-price {{^marketPrice}}no-price{{/marketPrice}}">¥
{{#if @root.vipPrice1}}{{round vip1Price}}{{/if}}
{{#if @root.vipPrice2}}{{round vip2Price}}{{/if}}
{{#if @root.vipPrice3}}{{round vip3Price}}{{/if}}
<span class="sale-price {{^market_price}}no-price{{/market_price}}">¥
{{#if @root.vipPrice1}}{{round vip1_price}}{{/if}}
{{#if @root.vipPrice2}}{{round vip2_price}}{{/if}}
{{#if @root.vipPrice3}}{{round vip3_price}}{{/if}}
</span>
{{else}}
<span class="sale-price {{^marketPrice}}no-price{{/marketPrice}}">¥{{round salesPrice}}</span>
<span class="sale-price {{^market_price}}no-price{{/market_price}}">¥{{round sales_price}}</span>
{{/if}}
{{#marketPrice}}
{{#market_price}}
<span class="market-price">¥{{round .}}</span>
{{/marketPrice}}
{{/market_price}}
</div>
{{#if @root.saleVip}}
<div class="vip-info">
... ...
{{#data}}
{{> common/floor-header-more}}
<div class="creative-life">
{{# bigImage}}
{{# big_image}}
<a class="banner" href="{{url}}">
<img class="lazy" data-original="{{image src 640 403}}">
</a>
{{/ bigImage}}
{{/ big_image}}
<ul class="classify-list clearfix">
{{# list}}
<li class="classify">
... ...
... ... @@ -6,10 +6,10 @@
{{#list}}
<li>
<a href="/product/sale/discount/detail?id={{id}}&channel={{@root.channel}}">
<img class="lazy" data-original="{{image coverUrl 640 250}}" />
<img class="lazy" data-original="{{image cover_url 640 250}}" />
<p class="discount-cont">
<span class="discount-title">{{title}}</span>
<span class="discount-time {{#if warnColor}}red-color{{/if}}">{{time}}</span>
<span class="discount-time {{#if warn_color}}red-color{{/if}}">{{time}}</span>
</p>
</a>
</li>
... ...
{{#data}}
{{> common/floor-header-more}}
<div class="goods-category">
{{# bigImage}}
{{# big_image}}
{{#if bigList}}
<div class="category-swiper">
<ul class="swiper-wrapper">
... ... @@ -25,7 +25,7 @@
</a>
</div>
{{/if}}
{{/ bigImage}}
{{/ big_image}}
{{#if list}}
<ul class="category-list clearfix">
{{# list}}
... ...
... ... @@ -187,7 +187,7 @@ gulp.task('webpack-dev-server', () => {
new WebpackDevServer(webpack(devConfig), {
contentBase: '.',
publicPath: '//localhost:5001/',
publicPath: 'http://localhost:5001/',
hot: true,
stats: {
colors: true
... ...
'use strict';
require('../app');
const _ = require('lodash');
const camelCase = global.yoho.camelCase;
const helpers = global.yoho.helpers;
/**
* 根据性别来决定 默认图片获取字段 如果是 2、3
*
* 则优先从cover2 --》 cover1 -- 》 images_url
* 否则优先从cover1 --》 cover2 -- 》 images_url
* 则优先从cover_2 --》 cover_1 -- 》 images_url
* 否则优先从cover_1 --》 cover_2 -- 》 images_url
*
*/
const _procProductImg = (product, gender, yhChannel) => {
if (gender === '2,3' || gender === '2' || gender === '3' && yhChannel === '2') {
return product.cover2 || product.imagesUrl || product.cover1 || '';
return product.cover_2 || product.images_url || product.cover_1 || '';
}
return product.cover1 || product.imagesUrl || product.cover2 || '';
return product.cover_1 || product.images_url || product.cover_2 || '';
};
const toArray = (obj) => {
... ... @@ -87,74 +86,73 @@ exports.processProductList = (list, options) => {
showPoint: true,
gender: '2,3'
}, options);
list = camelCase(list);
_.forEach(list, (product) => {
// 商品信息有问题,则不显示
if (!product.productId || !product.goodsList || product.goodsList.length === 0) {
if (!product.product_id || !product.goods_list || product.goods_list.length === 0) {
return;
}
// 如果库存为0,显示已抢完
if (product.storageNum === 0) {
if (product.storage_num === 0) {
product.noStorage = true;
}
// 市场价和售价一样,则不显示市场价
if (product.marketPrice === product.salesPrice) {
product.marketPrice = false;
if (product.market_price === product.sales_price) {
product.market_price = false;
}
// 判别默认的商品是否将默认的图片URL赋值到skn
let flag = false;
// 如果设置了默认图片,就取默认的图片
_.forEach(product.goodsList, (goods) => {
_.forEach(product.goods_list, (goods) => {
if (flag) {
return;
}
if (goods.isDefault === 'Y') {
// product.defaultImages = procProductImg(goods);
product.defaultImages = product.defaultImages;
if (goods.is_default === 'Y') {
// product.default_images = procProductImg(goods);
product.default_images = product.default_images;
flag = true;
}
});
// 如果还未赋值,则取第一个skc产品的默认图片
if (!flag) {
product.defaultImages = _procProductImg(product.goodsList[0], product.gender, options.yh_channel);
product.default_images = _procProductImg(product.goods_list[0], product.gender, options.yh_channel);
}
product.isSoonSoldOut = product.isSoonSoldOut === 'Y';
product.url = helpers.urlFormat(`/product/pro_${product.productId}_${product.goodsList[0].goodsId}/${product.cnAlphabet}.html`); // eslint-disable-line
product.is_soon_sold_out = product.is_soon_sold_out === 'Y';
product.url = helpers.urlFormat(`/product/pro_${product.product_id}_${product.goods_list[0].goods_id}/${product.cn_alphabet}.html`); // eslint-disable-line
// APP访问需要加附加的参数
// 备注:如果以后APP的接口太多,可以把这边参数提取出来,变成一个公共的方法来生成,便于以后管理维护
if (options.isApp) {
product.url += `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"${product.productSkn}"}}`; // eslint-disable-line
product.url += `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"${product.product_skn}"}}`; // eslint-disable-line
}
if (options.showTags) {
product.tags = {};
product.tags.isNew = options.showNew && product.isNew === 'Y'; // 新品
product.tags.isDiscount = options.showSale && product.isDiscount === 'Y'; // 在售
product.tags.isLimited = product.isLimited === 'Y'; // 限量
product.tags.isYohood = product.isYohood === 'Y'; // YOHOOD
product.tags.midYear = product.midYear === 'Y'; // 年中
product.tags.yearEnd = product.yearEnd === 'Y'; // 年末
product.tags.isAdvance = product.isAdvance === 'Y'; // 再到着
product.tags.is_new = options.showNew && product.is_new === 'Y'; // 新品
product.tags.is_discount = options.showSale && product.is_discount === 'Y'; // 在售
product.tags.is_limited = product.is_limited === 'Y'; // 限量
product.tags.is_yohood = product.is_yohood === 'Y'; // YOHOOD
product.tags.mid_year = product.mid_year === 'Y'; // 年中
product.tags.year_end = product.year_end === 'Y'; // 年末
product.tags.is_advance = product.is_advance === 'Y'; // 再到着
// 打折与即将售完组合显示打折
if (product.isSoonSoldOut && product.tags.isDiscount) {
product.tags.isNew = false;
} else if (product.tags.isDiscount &&
(product.tags.isNew || product.tags.isLimited || product.tags.isYohood || product.tags.isAdvance)) {
if (product.is_soon_sold_out && product.tags.is_discount) {
product.tags.is_new = false;
} else if (product.tags.is_discount &&
(product.tags.is_new || product.tags.is_limited || product.tags.is_yohood || product.tags.is_advance)) {
// 打折与其它组合则隐藏打折
product.tags.isDiscount = false;
} else if (product.tags.isYohood && product.tags.isNew) {
product.tags.is_discount = false;
} else if (product.tags.is_yohood && product.tags.is_new) {
// YOHOOD和新品组合显示YOHOOD
product.tags.isNew = false;
product.tags.is_new = false;
}
}
... ... @@ -181,7 +179,7 @@ exports.processFilter = (list, options) => {
name: '所有品牌',
title: '品牌',
dataId: 'id',
subsName: 'brandName',
subsName: 'brand_name',
firstSub: 0,
dataType: 'brand',
sortNum: '2'
... ... @@ -189,8 +187,8 @@ exports.processFilter = (list, options) => {
color: {
name: '所有颜色',
title: '颜色',
dataId: 'colorId',
subsName: 'colorName',
dataId: 'color_id',
subsName: 'color_name',
firstSub: 0,
dataType: 'color',
sortNum: '4'
... ... @@ -216,8 +214,8 @@ exports.processFilter = (list, options) => {
groupSort: {
name: '所有品类',
title: '品类',
dataId: 'relationParameter',
subsName: 'categoryName',
dataId: 'relation_parameter',
subsName: 'category_name',
firstSub: 0,
dataType: 'sort',
sortNum: '3'
... ... @@ -234,8 +232,8 @@ exports.processFilter = (list, options) => {
size: {
name: '所有尺码',
title: '尺码',
dataId: 'sizeId',
subsName: 'sizeName',
dataId: 'size_id',
subsName: 'size_name',
firstSub: 0,
dataType: 'size',
sortNum: '5'
... ... @@ -255,7 +253,7 @@ exports.processFilter = (list, options) => {
gender: '1,2,3', // 默认选择的性别,默认1,2,3表示所有
exclude: null // 需要排除的字段
}, options);
list = camelCase(list);
_.forEach(list, (item, key) => {
let classify = {
... ... @@ -266,7 +264,7 @@ exports.processFilter = (list, options) => {
return;
}
if ((options.hideSize && key === 'size') || (options.hideSort && key === 'groupSort')) {
if ((options.hideSize && key === 'size') || (options.hideSort && key === 'group_sort')) {
return;
}
... ... @@ -294,8 +292,8 @@ exports.processFilter = (list, options) => {
subs.dataId = sub._key;
} else if (filtersType[key].dataId === 'key') {
subs.dataId = index;
} else if (filtersType[key].dataId === 'relationParameter') {
subs.dataId = sub.relationParameter['sort']; // eslint-disable-line
} else if (filtersType[key].dataId === 'relation_parameter') {
subs.dataId = sub.relation_parameter['sort']; // eslint-disable-line
} else {
subs.dataId = sub[filtersType[key].dataId];
}
... ...
const _ = require('lodash');
const processTime = require('./time-process');
const camelCase = global.yoho.camelCase;
/**
* 处理楼层数据
... ... @@ -11,10 +10,9 @@ module.exports = (list) => {
const formatData = [];
list = list || [];
list = camelCase(list);
_.forEach(list, (floor) => {
floor[_.camelCase(floor.templateName)] = true;
floor[_.camelCase(floor.template_name)] = true;
// 特殊资源位处理
// PLUS
... ... @@ -26,9 +24,9 @@ module.exports = (list) => {
// 潮流时装/经典裤裙/时尚靴履/潮人配饰/潮流上装
if (floor.recommendContentOne && floor.data) {
if (floor.data.bigImage && floor.data.bigImage.length > 1) {
floor.data.bigImage = {
bigList: floor.data.bigImage
if (floor.data.big_image && floor.data.big_image.length > 1) {
floor.data.big_image = {
bigList: floor.data.big_image
};
}
}
... ... @@ -36,14 +34,14 @@ module.exports = (list) => {
// OUTLETS
if (floor.titleImage && floor.data) {
if (floor.data.image) {
floor.data.bigImage = {
floor.data.big_image = {
bigList: [floor.data.image]
};
}
floor.data.title = {
moreName: floor.data.moreName,
moreUrl: floor.data.moreUrl,
more_name: floor.data.more_name,
more_url: floor.data.more_url,
title: floor.data.title
};
}
... ...