Commit 995ac1c5 authored by agping's avatar agping

pk列表 修改

parent 5cbbc9aa
...@@ -144,8 +144,8 @@ ...@@ -144,8 +144,8 @@
</div> </div>
<div class="pk-container-detail-con"> <div class="pk-container-detail-con">
<div class="pk-container-detail-team"> <div class="pk-container-detail-team">
<!--<span class="team-span team-span-pk">团队PK榜</span>--> <span class="team-span-active team-span-pk">团队PK榜</span>
<span class="team-span-active team-span-pk">店长PK榜</span> <span class="team-span team-span-pk">店长PK榜</span>
<span class="team-span team-span-pk">经理PK榜</span> <span class="team-span team-span-pk">经理PK榜</span>
<span class="team-span team-span-pk">主任PK榜</span> <span class="team-span team-span-pk">主任PK榜</span>
<span class="team-span team-span-pk">顾问PK榜</span> <span class="team-span team-span-pk">顾问PK榜</span>
......
...@@ -8,6 +8,7 @@ define(['doT', 'text!temp/pk_list_template_tpl.html.html', 'css!style/home.css', ...@@ -8,6 +8,7 @@ define(['doT', 'text!temp/pk_list_template_tpl.html.html', 'css!style/home.css',
mainTabIndex: 1, mainTabIndex: 1,
mainTabIndexTwo: 0, mainTabIndexTwo: 0,
mainTabArr: [], mainTabArr: [],
mainTabIndexTeam: 1,
init: function() { init: function() {
//初始化dot //初始化dot
$(document.body).append(template); $(document.body).append(template);
...@@ -22,7 +23,7 @@ define(['doT', 'text!temp/pk_list_template_tpl.html.html', 'css!style/home.css', ...@@ -22,7 +23,7 @@ define(['doT', 'text!temp/pk_list_template_tpl.html.html', 'css!style/home.css',
$('#end_date').html(day_end); $('#end_date').html(day_end);
// pkList.getCitySite(); // pkList.getCitySite();
pkList.getList(0); pkList.getTeamList(0);
pkList.event(); pkList.event();
}, },
event: function() { event: function() {
...@@ -33,24 +34,42 @@ define(['doT', 'text!temp/pk_list_template_tpl.html.html', 'css!style/home.css', ...@@ -33,24 +34,42 @@ define(['doT', 'text!temp/pk_list_template_tpl.html.html', 'css!style/home.css',
e.stopPropagation(); e.stopPropagation();
var _this = $(this); var _this = $(this);
_this.removeClass('team-span').addClass('team-span-active').siblings().removeClass('team-span-active').addClass('team-span'); _this.removeClass('team-span').addClass('team-span-active').siblings().removeClass('team-span-active').addClass('team-span');
if(_this.index() == 0){ if(_this.index() == 0){//团队pk
pkList.mainTabIndex = 1 pkList.getTeamList();
pkList.mainTabIndexTeam = 1;
}; };
if(_this.index() == 1){ if(_this.index() == 1){
pkList.mainTabIndex = 2; pkList.mainTabIndex = 1;
pkList.mainTabIndexTeam = 0;
pkList.getList();
}; };
if(_this.index() == 2){ if(_this.index() == 2){
pkList.mainTabIndex = 3; pkList.mainTabIndex = 2;
pkList.mainTabIndexTeam = 0;
pkList.getList();
}; };
if(_this.index() == 3){ if(_this.index() == 3){
pkList.mainTabIndex = 4; pkList.mainTabIndex = 3;
pkList.mainTabIndexTeam = 0;
pkList.getList();
}; };
if(_this.index() == 4){ if(_this.index() == 4){
pkList.mainTabIndex = 4;
pkList.mainTabIndexTeam = 0;
pkList.getList();
};
if(_this.index() == 5){
pkList.mainTabIndex = 0; pkList.mainTabIndex = 0;
pkList.mainTabIndexTeam = 0;
pkList.getList();
}; };
$(".pk-container-detail-a>span").eq(0).removeClass('a-span').addClass('a-span-active').siblings().removeClass('a-span-active').addClass('a-span'); $(".pk-container-detail-a>span").eq(0).removeClass('a-span').addClass('a-span-active').siblings().removeClass('a-span-active').addClass('a-span');
pkList.mainTabIndexTwo = 0; pkList.mainTabIndexTwo = 0;
pkList.getList();
}); });
_doc.on('click', '.pk-container-detail-a>span', function(e){ _doc.on('click', '.pk-container-detail-a>span', function(e){
...@@ -59,12 +78,23 @@ define(['doT', 'text!temp/pk_list_template_tpl.html.html', 'css!style/home.css', ...@@ -59,12 +78,23 @@ define(['doT', 'text!temp/pk_list_template_tpl.html.html', 'css!style/home.css',
var _this = $(this); var _this = $(this);
_this.removeClass('a-span').addClass('a-span-active').siblings().removeClass('a-span-active').addClass('a-span'); _this.removeClass('a-span').addClass('a-span-active').siblings().removeClass('a-span-active').addClass('a-span');
pkList.mainTabIndexTwo = _this.attr('data-id')*1 - 1; pkList.mainTabIndexTwo = _this.attr('data-id')*1 - 1;
if(pkList.mainTabIndexTeam){
var doTtmpl = doT.template(document.getElementById('team_pk_list_tpl').innerHTML);
}else{
var doTtmpl = doT.template(document.getElementById('pk_list_tpl').innerHTML); var doTtmpl = doT.template(document.getElementById('pk_list_tpl').innerHTML);
}
$("#pk_list").html(doTtmpl(pkList.mainTabArr[pkList.mainTabIndexTwo])); $("#pk_list").html(doTtmpl(pkList.mainTabArr[pkList.mainTabIndexTwo]));
}); });
$(".export-pk").click(function() { //导出列表 $(".export-pk").click(function() { //导出列表
if(pkList.mainTabIndexTeam){
pkList.exportTeamList();
}else{
pkList.exportList(); pkList.exportList();
}
}); });
}, },
//pk导出列表 //pk导出列表
...@@ -75,7 +105,12 @@ define(['doT', 'text!temp/pk_list_template_tpl.html.html', 'css!style/home.css', ...@@ -75,7 +105,12 @@ define(['doT', 'text!temp/pk_list_template_tpl.html.html', 'css!style/home.css',
window.open('/index/exportReport?'+ window.open('/index/exportReport?'+
'position='+ position +'&AuthToken=' + AuthToken); 'position='+ position +'&AuthToken=' + AuthToken);
}, },
//pk列表 团队导出
exportTeamList: function() {
var params = {};
var AuthToken = user_info_obj.AuthToken;
window.open('/index/exportReportStore?'+'&AuthToken=' + AuthToken);
},
getList: function(pageNo) { getList: function(pageNo) {
$(".pk-container-detail-a>span").hide(); $(".pk-container-detail-a>span").hide();
var params = {}; var params = {};
...@@ -117,7 +152,47 @@ define(['doT', 'text!temp/pk_list_template_tpl.html.html', 'css!style/home.css', ...@@ -117,7 +152,47 @@ define(['doT', 'text!temp/pk_list_template_tpl.html.html', 'css!style/home.css',
} }
}); });
}, },
//团队 pk
getTeamList: function(pageNo) {
$(".pk-container-detail-a>span").hide();
var params = {};
params.AuthToken = user_info_obj.AuthToken;
$.ajax({
type: 'GET',
url: '/index/getStoreRandKingList',//团队
data: params,
timeout: 30000,
dataType: 'json',
beforeSend: function() {
$('#main_loading_pic').show();
},
success: function(data) {
if(typeof data === 'object') {
var _length = data.data.length;
$(".pk-container-detail-a>span").eq(_length).prevAll().show();
if (data.code == 200) {
pkList.mainTabArr = data.data;
var doTtmpl = doT.template(document.getElementById('team_pk_list_tpl').innerHTML);
$("#pk_list").html(doTtmpl(data.data[pkList.mainTabIndexTwo]));
add_page(data.data.total,pageNo,pkList.pageSize,pkList.getList);
}else {
alert(data['msg']);
};
}else{
alert('数据错误');
};
},
error: function() {
alert('error');
},
complete: function(xhr, textStatus){
$('#main_loading_pic').hide();
if(textStatus === 'timeout'){
alert('请求超时');
};
}
});
},
getCitySite:function(){ getCitySite:function(){
//显示 隐藏城市 默认显示 当前账号 所在城市 //显示 隐藏城市 默认显示 当前账号 所在城市
$.ajax({ $.ajax({
......
...@@ -21,3 +21,27 @@ ...@@ -21,3 +21,27 @@
</tr> </tr>
[% } %] [% } %]
</script> </script>
<script id="team_pk_list_tpl" type="text/template">
[% var sw=function(s){return ++s}; %]
[% if(it) { %]
<tr>
<th class="text-center">排名</th>
<th class="text-center">所属门店</th>
<!--<th class="text-center">经纪人</th>-->
<th class="text-center">业绩(元)</th>
</tr>
[% for(var item in it){ %]
<tr class="text-center">
<td>[%= sw(item) %]</td>
<td>[%= it[item]["store_name"] %]</td>
<!--<td>[%= it[item]["name"] %]</td>-->
<td>[%= it[item]["performance"] %]</td>
</tr>
[% } %]
[% }else{ %]
<tr>
<td colspan="8" style="text-align:center;"> 暂无数据</td>
</tr>
[% } %]
</script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment