Authored by htoooth

Merge remote-tracking branch 'origin/release/5.2' into release/5.2

... ... @@ -37,7 +37,7 @@ exports.getCouponData = (channel, params) => {
result.headerData = requestData[1].headerData;
do {
do { // eslint-disable-line
if (!coupon.data || !Array.isArray(coupon.data) || coupon.data.length === 0) {
break;
}
... ... @@ -86,13 +86,13 @@ exports.getCouponStatus = (params) => {
return Promise.coroutine(function*() {
const coupon = yield api.get('', Object.assign(params, {
method: 'app.promotion.queryCouponCenter'
}), config.apiCache);
}));
const result = {
code: coupon.code,
categories: []
};
do {
do { // eslint-disable-line
if (!coupon.data || !Array.isArray(coupon.data) || coupon.data.length === 0) {
break;
}
... ...
... ... @@ -328,10 +328,9 @@ const _detailDataPkg = (origin) => {
// 商品购买状态
let soldOut = !!(propOrigin('status') === 0 || skuData.totalStorageNum === 0);
let notForSale = propOrigin('attribute') === 2; // 非卖品
let virtualGoods = propOrigin('attribute') === 3; // 虚拟商品
if (!soldOut && !notForSale && !virtualGoods) {
if (!soldOut && !virtualGoods) {
result.addToCart = 1;
}
... ...
... ... @@ -136,22 +136,15 @@ exports.getCommentList = (uid, isComment, page, limit) => {
return co(process)();
};
exports.getCommentList4Order = (uid, orderId) => {
// limit = limit || 10;
// http://api.yoho.cn/?app_version=5.0.0&client_secret=e8098ddd3129372e8c93daea6600eda4&client_type=android&gender=1%2C3&
// method=show.toShareOrderList&
// orderCode=1617595089&os_version=android6.0.1%3AMI_MAX&screen_size=1080x1920&session_key=
// 720e95e42f9c1edc5940f1d49c34b68e&uid=9963947&v=7&yh_channel=1
exports.getCommentList4Order = (uid, orderCode) => {
const process = function*() {
let result = yield api.post('', {
// method: 'web.show.queryOrderProductCommentList',
method: 'show.toShareOrderList',
// method: 'show.toShareOrderList',
method: 'web.show.queryCommentListByOrderCode',
uid: uid,
orderCode: orderId// ,
// orderId: orderId
orderCode: orderCode
});
let commentList = {
... ... @@ -162,7 +155,7 @@ exports.getCommentList4Order = (uid, orderId) => {
// 接口返回成功, 处理数据
if (result.code === 200 && !_.isEmpty(result.data)) {
let order = {
/* let order = {
// orderNum: value.orderCode,
// orderTime: value.createTime,
orderNum: orderId,
... ... @@ -190,28 +183,63 @@ exports.getCommentList4Order = (uid, orderId) => {
commentList.goodsNum++;
});
order.goods.length && commentList.orders.push(order);
order.goods.length && commentList.orders.push(order);*/
// let total = commentList.orders.length;
_.forEach(result.data, (value) => {
let order = {
orderNum: value.orderCode,
orderTime: value.createTime,
orderId: value.orderId,
goods: []
};
// let totalPage = Math.ceil(total / limit);
// let begin = (page - 1) * limit;
_.forEach(value.orderGoods, (v) => {
let cnAlphabet = v.cnAlphabet || '';
let good = {
href: helpers.getUrlBySkc(v.productId, v.goodsId, cnAlphabet),
thumb: helpers.image(imgUtils.getImageUrl(v.imageUrl, 100, 100), 100, 100),
name: v.productName || '',
productSkn: v.productSkn,
productId: v.productId,
goodsId: v.goodsId,
erpSkuId: v.erpSkuId,
orderId: value.orderId,
orderCode: value.orderCode,
orderTime: value.createTime ? value.createTime.substr(0, 10) : ''
};
// commentList.orders = commentList.orders.slice(begin, begin + limit); // [begin, begin+limit)
if (v.commentDetailBoDetail && v.commentDetailBoDetail.length > 0) {
good.comments = v.commentDetailBoDetail.map((cm) => {
return {
content: cm.content,
createTime: moment(cm.createTime * 1000).format('YYYY-MM-DD HH:mm:ss'),
satisfied: cm.satisfied,
size: cm.size,
sizeLabel: sizeLabelMap[cm.size],
url: helpers.image(cm.url, 100, 100),
sourceUrl: helpers.image(cm.url, 400, 400),
height: cm.height,
weight: cm.weight
};
});
}
order.goods.push(good);
commentList.goodsNum++;
});
order.goods.length && commentList.orders.push(order);
});
// pagerObj = pager(total, {
// isComment: isComment ? 'Y' : 'N'//,
// //page: page
// });
} else {
commentList.empty = NO_UNCOMMENT_GOODS; // 空数据 提示文字
}
return {
comment: commentList,
isFromOrder: true// ,
// pager: pagerObj
isFromOrder: true
};
};
... ...
... ... @@ -1481,7 +1481,8 @@ const recommendAsync = (skn, page, limit) => {
price: formatPrice(helpers.round(salePrice, 2)),
product_name: rp.product_name,
url: productUrl(rp.product_id, defaultGoods.goods_id, rp.cn_alphabet),
pic_url: productImageUrl(rp)
pic_url: productImageUrl(rp),
goods_id: defaultGoods.goods_id
};
});
... ...
... ... @@ -89,6 +89,7 @@ const handleBrandCheckedData = (params, origin) => {
// 分拆品牌参数
let brands = _.split(params.brand, ',');
let intBrands = [];
let brandTotalName = '';
_.forEach(brands, value => {
intBrands.push(parseInt(value, 10));
... ... @@ -138,6 +139,8 @@ const handleBrandCheckedData = (params, origin) => {
// 建议保留,需要品牌可以单个删除时放开注释即可
// dest.push(checked);
brandTotalName += checked.name + '、';
dest[0].totalName = brandTotalName;
}
});
}
... ... @@ -262,7 +265,6 @@ const formatterFilterBrands = (source, paramBrand, params) => {
showMulti: true
});
}
if (paramBrand) {
_.forEach(paramBrand, value => {
let brand = {
... ... @@ -812,6 +814,7 @@ exports.handleSeniorFilterData = (data, params) => {
if (conName.length) {
conditions.push({
name: _.join(conName, '、'),
itemType: '风格',
href: handleFilterUrl(params, {}, {style: true})
});
}
... ...
... ... @@ -407,19 +407,6 @@
'', /*品牌名*/ '', /*商品库存状态1或是0*/ '', /*网络价*/ '', /*收藏人数*/ ''
]);
_mvq.push(['$logData']);
var _goodsData = {
id: '{{productId}}',// 商品ID
name: '{{productName}}', // 商品名称
brand: '{{brandName}}', // 商品品牌(非必填)
origPrice: '{{marketPrice}}', // 商品原价(非必填)
price: '{{salePrice}}', // 商品售价
imgUrl: '{{imageUrl}}', // 商品预览图
productUrl: '{{productUrl}}', // 商品URL地址
categoryId: '{{smallSortId}}', // 所属分类ID
category: '{{fullSortName}}', // 所属分类完整路径, // 所属分类完整路径
soldOut: '{{soldOut}}' // 状态 1下架,0在售(必填)
};
(function() {
var mvl = document.createElement('script');
mvl.type = 'text/javascript';
... ...
... ... @@ -27,20 +27,6 @@ var _gaq = _gaq || [];
})();
</script>
<script>
window._py = window._py||[];
window._py.push(['a', 'MC..o8vMMWxEXDCiqYckD81lUX']);
window._py.push(['domain','stats.ipinyou.com']);
window._py.push(['e','']);
if(typeof _goodsData!='undefined'){
window._py.push(['pi',_goodsData]);
}
-function(d){
var f = 'https:' == d.location.protocol;var c = d.createElement('script');c.type='text/javascript';c.async=1;
c.src=(f ? 'https' : 'http') + '://'+(f?'fm.ipinyou.com':'fm.p0y.cn')+'/j/t/adv.js';
var h = d.getElementsByTagName("script")[0];h.parentNode.insertBefore(c, h);
}(document);
</script>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
... ...
... ... @@ -98,7 +98,7 @@
<a href="//www.yohobuy.com/shopping/cart">
<span class="iconfont ">&#xe600;</span>
{{#unless @root.pc.common.removeCartCount}}
<span class="goods-num-tip">0</span>
<span class="goods-num-tip hide">0</span>
{{/unless}}
</a>
{{#unless @root.pc.common.disCartHover}}
... ...
... ... @@ -6,7 +6,8 @@
<span class="title">已选条件:</span>
<div class="attr-content clearfix">
{{#each conditions}}
<a class="tag" href="{{href}}" name="{{name}}" itemType="{{itemType}}">
<a class="tag" href="{{href}}" name="{{name}}" itemType="{{itemType}}"
{{#if totalName}} totalName="{{totalName}}" {{/if}}>
{{#if name}}
{{name}}
{{^}}
... ... @@ -131,7 +132,7 @@
</script>
{{#if ageLevel}}
<div class="channel section">
<div class="people section">
<span class="title">人群:</span>
<div class="attr-content clearfix">
... ...
{{# products}}
<li class="img-item">
<span class="hide goods-id">{{goods_id}}</span>
<div class="good">
<a href="{{url}}" target="_blank">
<img class="lazy" src="{{pic_url}}"/>
... ...
... ... @@ -15,7 +15,7 @@ function getCookie(name) {
// 频道、性别、品类、折扣、人群、颜色、尺码、分类
function _getCommonFilterValue() {
var $section = $('.channel, .sort, .discount, .misort, .color, .size');
var $section = $('.people, .sort, .discount, .misort, .color');
var $attrchecked = $section.find('.attr-content .attr.checked');
var filterValue = '';
... ... @@ -36,26 +36,39 @@ function _getOtherFilterValue() {
$('.checked-conditions .attr-content .tag').each(function() {
var type = $(this).attr('itemType'),
name = $(this).attr('name');
switch (type) {
case 'brands':
type = '品牌';
break;
case 'price':
type = '价格';
break;
default:
break;
name = $(this).attr('name'),
totalName = $(this).attr('totalName');
if (type !== '') {
switch (type) {
case 'brand':
type = '品牌';
break;
case 'price':
type = '价格';
break;
case 'size':
type = '尺码';
break;
case 'gender':
type = '性别';
break;
default:
break;
}
if (totalName) {
filterValue += type + ':' + totalName + ';';
} else {
filterValue += type + ':' + name + ';';
}
}
filterValue += type + ':' + name + ';';
});
return filterValue;
}
/** *埋点方法***/
function givePoint(op, parameter) {
function yasEvent(op, parameter) {
var CID = 1;
if (!window._yas || !window._yas.sendCustomInfo) {
... ... @@ -85,7 +98,7 @@ function givePoint(op, parameter) {
parameter = $.extend({
C_ID: CID
}, parameter);
console.info(op);
console.info(parameter);
window._yas.sendCustomInfo({
op: op,
... ... @@ -97,7 +110,14 @@ function getFilterValue() {
return _getCommonFilterValue() + _getOtherFilterValue();
}
function givePoint(op, parameter) {
var sto = setInterval(function() {
if (window._yas && window._yas.sendCustomInfo) {
yasEvent(op, parameter);
clearInterval(sto);
}
}, 100);
}
exports.givePoint = givePoint;
exports.getFilterValue = getFilterValue;
... ...
... ... @@ -312,7 +312,7 @@ function submitSearch() {
// 同步mini购物车数据
function syncCratInfo(strG) {
var info, total;
var info, total = 0;
if (strG) {
window.setCookie('_g', strG, {
... ... @@ -335,6 +335,8 @@ function syncCratInfo(strG) {
});
$goodsNum.text(total);
}
total ? $goodsNum.removeClass('hide') : $goodsNum.addClass('hide');
}
function loadCartDetail(key) {
... ...
... ... @@ -418,6 +418,9 @@ bindEvent.add(function() {
return;
}
// 加入购物车埋點
yas.givePoint('YB_GDS_DT_ADD_TO_SC', {PRD_ID: getSku(), PRD_NUM: getNum() });
$.ajax({
type: 'POST',
url: '/cart/index/add',
... ... @@ -1020,6 +1023,47 @@ $('.comments').on('click', '.img-preview [data-role="preview-right"]', function(
$img.css('transform', 'rotate(' + rotate + 'deg)');
});
function randomString(len) {
var $chars = 'ABCDEFGHJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-';
var maxPos = $chars.length,
pwd = '',
i;
for (i = 0; i < len; i++) {
pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
}
return pwd;
}
/*
* 页面加载完
*/
function initPageYas() {
var $goodsIdArr = [],
loadYas = {};
$('.recommend-slider .img-item .goods-id').each(function() {
$goodsIdArr.push($(this).html());
});
loadYas = {
REC_POSE: 100013,
REC_ID: randomString(40),
PRD_ID: $goodsIdArr.join(','),
PRD_NUM: $goodsIdArr.length,
ORDER_CODE: '',
ACTION_ID: 0,
PAGE_NUM: 1
};
// 关键词搜索结果页展示时
yas.givePoint('YB_CHOOSE_FOR_YOU_Y', loadYas);
}
// 店铺推荐
function loadRecommend() {
$.ajax({
... ... @@ -1054,6 +1098,28 @@ function loadRecommend() {
$('.individual-comment').find('.block-title').find('.title').addClass('cur').prev('.sep').addClass('hide');
$('#recommend-shop').detach();
}
// 页面加载完,埋点
initPageYas();
// 点击为您推荐商品埋点
$('.recommend-slider .img-item').click(function() {
var $this = $(this);
var loadYas = {
REC_POSE: 100013,
REC_ID: randomString(40),
PRD_ID: $this.find('.goods-id').html(),
PRD_NUM: parseInt($this.index(), 10) + 1,
ORDER_CODE: '',
ACTION_ID: 1,
PAGE_NUM: 1
};
// 关键词搜索结果页展示时
yas.givePoint('YB_CHOOSE_FOR_YOU_Y', loadYas);
});
});
}
... ... @@ -1147,3 +1213,4 @@ bindEvent.fire();
// 数据懒加载
dataLazyLoad.init({cls: '.datalazyload', threshold: 0});
... ...
... ... @@ -12,7 +12,7 @@ var lazyLoad = require('yoho-jquery-lazyload');
var product = require('./index/product');
var qs = {};
var $footPage = $('.foot-pager1').data('total'),
var $footPage = $('.foot-pager').data('total'),
$productIdArr = [],
$leftUl = $('.sort-container .sort-child-list'),
$leftLi = $leftUl.find('li.active');
... ... @@ -60,70 +60,77 @@ function getLocalTime(nS) {
* 页面加载完
*/
$(function() {
var sto = setInterval(function() {
var loadYas = {};
if (window._yas && window._yas.sendCustomInfo) {
loadYas = {
RES_QTY: $footPage || 0,
PRD_LIST: $productIdArr.join(',')
};
switch (listType) {
case 'search':
loadYas.KEYWORD = qs.query || '';
break;
case 'brand':
loadYas.BRAND_ID = brandId;
break;
case 'new':
loadYas.SHELF_TIME = 'ALL';
break;
default:// 品类查找sort
loadYas.CATEGORY_ID = qs.misort || qs.msort || '';
break;
}
loadYas = $.extend(loadYas, commonParams);
// 关键词搜索结果页展示时
yas.givePoint('YB_KEYWORD_GOODS_LIST_L', loadYas);
clearInterval(sto);
}
}, 100);
// 点击搜索列表商品
$('.good-item-wrapper').click(function() {
var $this = $(this),
proId = $this.find('.product-id').html(),
aIndex = $this.attr('activeIndex'),
pageNum = qs.pager || 1,
limit = qs.limit || 60,
proNum = (parseInt(pageNum, 10) - 1) * limit + parseInt(aIndex, 10),
shelveTime = $this.find('.shelve-time').html();
var loadYas = {
PRD_ID: proId,
PRD_NUM: proNum
};
switch (listType) {
case 'search':
loadYas.KEYWORD = qs.query || '';
break;
case 'brand':
loadYas.BRAND_ID = brandId;
break;
case 'new':
loadYas.SHELF_TIME = getLocalTime(shelveTime);
break;
default:// 品类查找sort
loadYas.CATEGORY_ID = qs.misort || qs.msort || '';
break;
}
loadYas = $.extend(loadYas, commonParams);
// 点击搜索列表商品埋点
yas.givePoint('YB_KEYWORD_GOODS_LIST_C', loadYas);
});
var loadYas = {
RES_QTY: $footPage || 0,
PRD_LIST: $productIdArr.join(',')
};
var opt = '';
switch (listType) {
case 'search':
loadYas.KEYWORD = qs.query || '';
opt = 'YB_KEYWORD_GOODS_LIST_L';
break;
case 'brand':
loadYas.BRAND_ID = brandId;
opt = 'YB_BRAND_GOODS_LIST_L';
break;
case 'new':
loadYas.SHELF_TIME = 'ALL';
opt = 'YB_NEW_GOODS_LIST_L';
break;
default:// 品类查找sort
loadYas.CATEGORY_ID = qs.misort || qs.msort || '';
opt = 'YB_CATEGORY_GOODS_LIST_L';
break;
}
loadYas = $.extend(loadYas, commonParams);
// 关键词搜索结果页展示时
yas.givePoint(opt, loadYas);
});
// 点击搜索列表商品
$('.good-item-wrapper').click(function() {
var $this = $(this),
proId = $this.find('.product-id').html(),
aIndex = $this.attr('activeIndex'),
pageNum = qs.pager || 1,
limit = qs.limit || 60,
proNum = (parseInt(pageNum, 10) - 1) * limit + parseInt(aIndex, 10),
shelveTime = $this.find('.shelve-time').html();
var loadYas = {
PRD_ID: proId,
PRD_NUM: proNum
};
var opt = '';
switch (listType) {
case 'search':
loadYas.KEYWORD = qs.query || '';
opt = 'YB_KEYWORD_GOODS_LIST_C';
break;
case 'brand':
loadYas.BRAND_ID = brandId;
opt = 'YB_BRAND_GOODS_LIST_C';
break;
case 'new':
loadYas.SHELF_TIME = getLocalTime(shelveTime);
opt = 'YB_NEW_GOODS_LIST_C';
break;
default:// 品类查找sort
loadYas.CATEGORY_ID = qs.misort || qs.msort || '';
opt = 'YB_CATEGORY_GOODS_LIST_C';
break;
}
loadYas = $.extend(loadYas, commonParams);
// 点击搜索列表商品埋点
yas.givePoint(opt, loadYas);
});
... ...
... ... @@ -12,7 +12,7 @@ var lazyLoad = require('yoho-jquery-lazyload');
var product = require('./index/product');
var qs = {};
var $footPage = $('.foot-pager1').data('total'),
var $footPage = $('.foot-pager').data('total'),
$productIdArr = [],
$leftUl = $('.sort-container .sort-child-list'),
$leftLi = $leftUl.find('li.active');
... ... @@ -58,70 +58,77 @@ function getLocalTime(nS) {
* 页面加载完
*/
$(function() {
var sto = setInterval(function() {
var loadYas = {};
if (window._yas && window._yas.sendCustomInfo) {
loadYas = {
RES_QTY: $footPage || 0,
PRD_LIST: $productIdArr.join(',')
};
switch (listType) {
case 'search':
loadYas.KEYWORD = qs.query || '';
break;
case 'brand':
loadYas.BRAND_ID = brandId;
break;
case 'new':
loadYas.SHELF_TIME = 'ALL';
break;
default:// 品类查找sort
loadYas.CATEGORY_ID = qs.misort || qs.msort || '';
break;
}
loadYas = $.extend(loadYas, commonParams);
// 关键词搜索结果页展示时
yas.givePoint('YB_KEYWORD_GOODS_LIST_L', loadYas);
clearInterval(sto);
}
}, 100);
// 点击搜索列表商品
$('.good-item-wrapper').click(function() {
var $this = $(this),
proId = $this.find('.product-id').html(),
aIndex = $this.attr('activeIndex'),
pageNum = qs.pager || 1,
limit = qs.limit || 60,
proNum = (parseInt(pageNum, 10) - 1) * limit + parseInt(aIndex, 10),
shelveTime = $this.find('.shelve-time').html();
var loadYas = {
PRD_ID: proId,
PRD_NUM: proNum
};
switch (listType) {
case 'search':
loadYas.KEYWORD = qs.query || '';
break;
case 'brand':
loadYas.BRAND_ID = brandId;
break;
case 'new':
loadYas.SHELF_TIME = getLocalTime(shelveTime);
break;
default:// 品类查找sort
loadYas.CATEGORY_ID = qs.misort || qs.msort || '';
break;
}
loadYas = $.extend(loadYas, commonParams);
// 点击搜索列表商品埋点
yas.givePoint('YB_KEYWORD_GOODS_LIST_C', loadYas);
});
var loadYas = {
RES_QTY: $footPage || 0,
PRD_LIST: $productIdArr.join(',')
};
var opt = '';
switch (listType) {
case 'search':
loadYas.KEYWORD = qs.query || '';
opt = 'YB_KEYWORD_GOODS_LIST_L';
break;
case 'brand':
loadYas.BRAND_ID = brandId;
opt = 'YB_BRAND_GOODS_LIST_L';
break;
case 'new':
loadYas.SHELF_TIME = 'ALL';
opt = 'YB_NEW_GOODS_LIST_L';
break;
default:// 品类查找sort
loadYas.CATEGORY_ID = qs.misort || qs.msort || '';
opt = 'YB_CATEGORY_GOODS_LIST_L';
break;
}
loadYas = $.extend(loadYas, commonParams);
// 关键词搜索结果页展示时
yas.givePoint(opt, loadYas);
});
// 点击搜索列表商品
$('.good-item-wrapper').click(function() {
var $this = $(this),
proId = $this.find('.product-id').html(),
aIndex = $this.attr('activeIndex'),
pageNum = qs.pager || 1,
limit = qs.limit || 60,
proNum = (parseInt(pageNum, 10) - 1) * limit + parseInt(aIndex, 10),
shelveTime = $this.find('.shelve-time').html();
var loadYas = {
PRD_ID: proId,
PRD_NUM: proNum
};
var opt = '';
switch (listType) {
case 'search':
loadYas.KEYWORD = qs.query || '';
opt = 'YB_KEYWORD_GOODS_LIST_C';
break;
case 'brand':
loadYas.BRAND_ID = brandId;
opt = 'YB_BRAND_GOODS_LIST_C';
break;
case 'new':
loadYas.SHELF_TIME = getLocalTime(shelveTime);
opt = 'YB_NEW_GOODS_LIST_C';
break;
default:// 品类查找sort
loadYas.CATEGORY_ID = qs.misort || qs.msort || '';
opt = 'YB_CATEGORY_GOODS_LIST_C';
break;
}
loadYas = $.extend(loadYas, commonParams);
// 点击搜索列表商品埋点
yas.givePoint(opt, loadYas);
});
... ...