Authored by 李靖

默认选中

<div class="yoho-family-page yoho-page">
<div class="score-detail-c">
<div class="tab">
<div id="source" class="tab-item">版块
<div id="source" class="tab-item">
<span class="name">版块</span>
<span class="iconfont down">&#xe613;</span>
<span class="iconfont up">&#xe612;</span>
<ul class="list">
<li data-source="0">
全部
<li data-source="-1">
<span class="title">全部</span>
<span class="tick"></span>
</li>
<li data-source="1">
Yoho!Buy
<span class="title">Yoho!Buy</span>
<span class="tick"></span>
</li>
<li data-source="3">
Yoho!Now
<span class="title">Yoho!Now</span>
<span class="tick"></span>
</li>
<li data-source="2">
Mars
<span class="title">Mars</span>
<span class="tick"></span>
</li>
<li data-source="6">
Yo!Coffee
<span class="title">Yo!Coffee</span>
<span class="tick"></span>
</li>
<li data-source="5">
Yo!Green
<span class="title">Yo!Green</span>
<span class="tick"></span>
</li>
<li data-source="7">
Yo!Little
<span class="title">Yo!Little</span>
<span class="tick"></span>
</li>
</ul>
</div>
<div id="queryType" class="tab-item">积分明细
<div id="queryType" class="tab-item">
<span class="name">积分明细</span>
<span class="iconfont down">&#xe613;</span>
<span class="iconfont up">&#xe612;</span>
<ul class="list">
<li data-type="0">
全部
<span class="title">全部</span>
<span class="tick"></span>
</li>
<li data-type="1">
收入
<span class="title">收入</span>
<span class="tick"></span>
</li>
<li data-type="2">
支出
<span class="title">支出</span>
<span class="tick"></span>
</li>
</ul>
</div>
<div id="time" class="tab-item">最近三月
<div id="time" class="tab-item">
<span class="name">最近一年</span>
<span class="iconfont down">&#xe613;</span>
<span class="iconfont up">&#xe612;</span>
<ul class="list">
<li data-begin="0">
全部
<span class="title">全部</span>
<span class="tick"></span></li>
<li data-begin="7776000000">
最近三月
<span class="title">最近三月</span>
<span class="tick"></span>
</li>
<li data-begin="15552000000">
最近六月
<span class="title">最近六月</span>
<span class="tick"></span>
</li>
<li data-begin="31104000000">
最近一年
<span class="title">最近一年</span>
<span class="tick"></span>
</li>
</ul>
... ...
... ... @@ -14,17 +14,21 @@ class ScoreDetail extends Page {
$scoreDetailC: $('.score-detail-c'),
$chosen: $('.tab-item .list').find('li'),
$defaultChosen: $('.tab-item .list').find('li:first'),
$result: $('.result')
$defaultChosenTime: $('#time .list').find('li:last'),
$result: $('.result'),
$source: $('#source').find('.name'),
$queryType: $('#queryType').find('.name'),
$time: $('#time').find('.name')
};
this.view = {
resultRender
};
this.source = -1;
this.source = window.queryString.plateType || -1;
this.queryType = 0;
this.beginTime = '';
this.endTime = '';
this.endTime = Date.parse(new Date());
this.beginTime = parseInt(this.endTime, 10) - parseInt(31104000000, 10); // 默认显示一年内
this.page = 1;
this.loading = false;
this.end = false;
... ... @@ -33,11 +37,22 @@ class ScoreDetail extends Page {
}
init() {
this.selector.$defaultChosen.addClass('chosen');
this.setHeight();
this.bindEvents();
this.chosenData();
this.scroll();
this.defaultTab();
}
defaultTab() {
this.selector.$defaultChosen.addClass('chosen');
this.selector.$defaultChosenTime.addClass('chosen').siblings('li').removeClass('chosen');
if (window.queryString.plateType) {
let $defaultSource = $('#source').find(`li[data-source=${window.queryString.plateType}]`);
$defaultSource.addClass('chosen').siblings('li').removeClass('chosen');
this.selector.$source.text($defaultSource.find('.title').text());
}
}
scroll() {
... ... @@ -73,16 +88,22 @@ class ScoreDetail extends Page {
switch ($parensId) {
case 'source':
this.source = $this.data('source');
this.selector.$source.text($this.find('.title').text());
break;
case 'queryType':
this.queryType = $this.data('type');
this.selector.$queryType.text($this.find('.title').text());
break;
case 'time':
if ($this.data('begin')) {
this.beginTime = $this.data('begin');
this.endTime = Date.parse(new Date());
this.beginTime = parseInt(this.endTime, 10) - parseInt(this.beginTime, 10);
} else {
this.beginTime = '';
this.endTime = '';
}
this.selector.$time.text($this.find('.title').text());
break;
default:
tip.show('请稍后再试~~');
... ...