installment.page.js
2.65 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
109
var $ = require('yoho-jquery'),
ellipsis = require('yoho-mlellipsis'),
ListData = require('./installment-goods'),
bp = require('./burying-point'),
uuid = require('uuid'),
lazyLoad = require('yoho-jquery-lazyload');
var uuidVal = uuid.v4();
require('../common');
lazyLoad($('img.lazy'));
ellipsis.init();
// 商品列表翻页加载数据
new ListData({
url: '/home/installment/get-goods',
page: 1,
boxArea: $('#goods-list'),
uuid: uuidVal
});
// 标题限制行数
function setDetailText() {
var $this, $title;
$('.good-detail-text .name').each(function() {
$this = $(this);
$title = $this.find('a');
$title[0].mlellipsis(2);
});
}
setDetailText();
// 已开通tab 切换
$('.detail-tab span').on('click', function() {
var labId = 1;
$(this).addClass('on').siblings().removeClass('on');
$('.installment-cont').hide().eq($(this).index()).show();
if ($(this).index() === 1) {
setDetailText();
labId = 2;
lazyLoad($('img.lazy'));
}
// 统计:开通成功后首页头部tab切换
bp.setContYas('YB_INST_OPENED_HOME_CLICK', {
LAB_ID: labId
});
});
// 统计:开通按钮点击时
$('.open-btn').on('click', function() {
bp.setContYas('YB_INST_OPEN', {});
});
$(document).on('click', '.good-info', function() {
// 统计:商品点击时
bp.setContYas('YB_INST_HOME_GDS_LIST', {
PRD_NUM: parseInt($(this).index()) + 1, //eslint-disable-line
PRD_ID: $(this).data('goodId'),
ACTION_ID: 1,
REC_ID: uuidVal
});
});
// 统计:开通后模块位点击时
$('.nav-bit').on('click', function() {
bp.setContYas('YB_INST_REPAYMENT_CLICK', {
POS_ID: $(this).data('id')
});
});
$(window).load(function() {
if ($('.installment-only').length > 0) {
// 统计:进入页面时
bp.setContYas('YB_INST_HOME', {
IS_OPEN: $('.is-open').val()
});
// 统计:商品第一页加载时
bp.setContYas('YB_INST_HOME_GDS_LIST', {
PRD_NUM: $('.installment-only .good-info').length,
PRD_ID: bp.countGoodsId(),
ACTION_ID: 0,
REC_ID: uuidVal
});
if ($('.is-open').val() === 'true') {
// 统计:待还款金额默认页面加载时
bp.setContYas('YB_INST_OPENED_HOME_LOAD', {
LAB_ID: 1
});
}
}
});
window.setCookie('installmentUid', window.queryString.uid);
window.setCookie('yhChannel', window.queryString.yh_channel);
window.setCookie('udid', window.queryString.udid);
window.setCookie('clientType', window.queryString.client_type);