yas-bottom.js
3.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
var $ = require('yoho-jquery');
var yas = require('../common/data-yas');
exports.yasBottom = function() {
/* 获取商品编码*/
function getPrdId() {
return +$('.main').data('id');
}
/* 点击商品详情页模块导航时埋点*/
$('.shoppingCar .shoppingCar-nav ul').on('click', 'li', function() {
var $this = $(this);
var $index = $this.index() + 1;
yas.givePoint('YB_GDS_NAVIGATION_C', {PRD_ID: getPrdId(), NAV_INDE: $index});
});
/* 点击商品评价模块中的全部/有图/图片时埋点*/
$('.cc-content .comment-tabs').on('click', 'h2', function() {
var $this = $(this);
var $index = $this.index() + 1;
yas.givePoint('YB_GDS_REVIEWS_TAB_C', {PRD_ID: getPrdId(), POS_ID: $index});
});
$('.comments').on('click', '.img-preview .img-thumb', function() {
yas.givePoint('YB_GDS_REVIEWS_TAB_C', {PRD_ID: getPrdId(), POS_ID: 3});
});
/* 点击商品详情页中的【我要咨询】时埋点*/
$('#common-advice').click(function() {
yas.givePoint('YB_GDS_CONSULT_C', {PRD_ID: getPrdId()});
});
/* 点击商品详情页底部店铺推荐和最近浏览TAB时埋点*/
$('.bottom-tab p').on('click', 'span', function() {
var $this = $(this);
var $index = $this.index() + 1;
if ($index !== 3) {
yas.givePoint('YB_GDS_RECOMMEND_REVIEW_TAB_C', {PRD_ID: getPrdId(), TAB_ID: $index});
}
});
/* 点击商品详情页底部店铺推荐和最近浏览中的商品时*/
$('.recommend-content .img-list').on('click', 'li', function() {
var $this = $(this);
var relatedID = +$this.find('.goods-id').text();
var option = {
PRD_ID: getPrdId(),
RELATED_ID: relatedID,
TAB_ID: 1
};
yas.givePoint('YB_GDS_RECOMMEND_REVIEW_GOODS_C', option);
});
$('#latest-walk-goods').on('click', '.good', function() {
var $this = $(this);
var relatedID = +$this.find('a').attr('href').split('_')[1];
var option = {
PRD_ID: getPrdId(),
RELATED_ID: relatedID,
TAB_ID: 2
};
yas.givePoint('YB_GDS_RECOMMEND_REVIEW_GOODS_C', option);
});
/* 点击商品详情页底部店铺推荐和最近浏览中的【换一换】按钮时埋点*/
$('.bottom-tab .change').click(function() {
yas.givePoint('YB_GDS_RECOMMEND_REVIEW_CHANGE_C', {PRD_ID: getPrdId(), TAB_ID: 1});
});
/* 点击套餐详情页中的商品时埋点*/
$('.package-box').on('click', '.package-pro .good-info', function() {
var $this = $(this);
var $index = $this.index() === 0 ? $this.index() + 1 : ($this.index() / 2) + 1;
var id = $this.find('.good-thumb').attr('href').split('_')[1];
var option = {
PRD_ID: getPrdId(),
PACKAGE_GOODS: id,
PACKAGE_INDEX: $index
};
yas.givePoint('YB_GDS_PACKAGE_GOODS_C', option);
});
/* 点击套餐详情页中的立即购买按钮时埋点*/
$('.package-box').on('click', '#buy-detail', function() {
var arr = [];
var good = $('.package-box .package-pro').find('.good-info');
good.each(function(i, ele) {
var $this = $(this);
var id = $this.find('.good-thumb').attr('href').split('_')[1];
arr.push(id);
});
yas.givePoint('YB_GDS_PACKAGE_BUY_NOW_C', {
PRD_ID: getPrdId(),
PACKAGE_GOODS: arr.join(';')
});
});
};