Commit fa63bf67 authored by zhuwei's avatar zhuwei

业绩excel导出

parent 89c11cf5
...@@ -8,7 +8,9 @@ namespace app\index\controller; ...@@ -8,7 +8,9 @@ namespace app\index\controller;
*/ */
use app\index\extend\Basic; use app\index\extend\Basic;
use app\index\service\PerformanceService; use app\index\service\PerformanceService;
use app\index\untils\ExportExcelUntil;
use think\Request; use think\Request;
use \think\Session;
class Performance extends Basic class Performance extends Basic
{ {
...@@ -166,6 +168,69 @@ class Performance extends Basic ...@@ -166,6 +168,69 @@ class Performance extends Basic
} }
/**
* 导出分佣提成明细表
*
* @return string
*/
public function getPerformanceExcel()
{
$export = new ExportExcelUntil();
$data = Session::get('excelPerformance');
/**
* {
["agent_id"] => int(5739)
["store_id"] => int(3742)
["district_id"] => int(16)
["performance_total"] => string(8) "22231.20"
["bargain_sum_total"] => string(2) "17"
["paylog_total"] => string(1) "7"
["march_in_num_total"] => string(1) "7"
["look_at_num_total"] => string(2) "20"
["add_house_num_total"] => string(2) "63"
["add_user_num_total"] => string(2) "40"
["index_"] => int(1)
["name"] => string(10) "总测试1"
["img"] => string(82) "https://localhost/static/user_header/20180615/6528100f422ffa6f7d1cb1293c1eaaed.jpg"
["store_name"] => string(6) "大大"
["district_name"] => string(9) "测试郭"
["team_num"] => int(7)
}
*/
foreach ($data['data'] as $key => $v) {
$e_data_old['index_'] = $v['index_'];
if($data['type'] == 3){
$e_data_old['name'] = $v['district_name'];
}elseif ($data['type'] == 2){
$e_data_old['name'] = $v['store_name'];
}else{
$e_data_old['name'] = $v['name'];
}
$e_data_old['performance_total'] = $v['performance_total'];
$e_data_old['paylog'] = $v['paylog_total'];
$e_data_old['bargain_sum'] = $v['bargain_sum_total'];
$e_data_old['march_in_num'] = $v['march_in_num_total'];
$e_data_old['look_at_num'] = $v['look_at_num_total'];
$e_data_old['add_house_num'] = $v['add_house_num_total'];
$e_data_old['add_user_num'] = $v['add_user_num_total'];
$e_data_old['team_num'] = $v['team_num'];
$e_data_new[]=$e_data_old;
}
if($data['type'] == 3){
$title = [ '排名', '部门', '业绩(元)', '成交单数', '收款数', '进场数', '报备数', '新增商铺', '新增客户', '团队人数' ];
}elseif ($data['type'] == 2){
$title = [ '排名', '门店', '业绩(元)', '成交单数', '收款数', '进场数', '报备数', '新增商铺', '新增客户', '团队人数' ];
}else{
$title = [ '排名', '经纪人', '业绩(元)', '成交单数', '收款数', '进场数', '报备数', '新增商铺', '新增客户', '团队人数' ];
}
$export->exportTable('业绩排行', $e_data_new, 10, '业绩排行表', $title);
return '';
}
......
...@@ -8,6 +8,8 @@ use app\model\OMarchInModel; ...@@ -8,6 +8,8 @@ use app\model\OMarchInModel;
use app\model\OReportModel; use app\model\OReportModel;
use app\model\TAgentTotalModel; use app\model\TAgentTotalModel;
use app\model\Users; use app\model\Users;
use \think\Session;
/** /**
* Created by PhpStorm. * Created by PhpStorm.
...@@ -296,6 +298,7 @@ class PerformanceService ...@@ -296,6 +298,7 @@ class PerformanceService
} }
} }
//dump($arr);exit; //dump($arr);exit;
Session::set('excelPerformance',['data'=>$arr,'type'=>$type]);
return ['list'=>$arr,'total'=>0]; return ['list'=>$arr,'total'=>0];
} }
......
...@@ -290,7 +290,8 @@ Route::group('index', [ ...@@ -290,7 +290,8 @@ Route::group('index', [
'selectDistrictPerformance' => [ 'index/Performance/selectDistrictPerformance', [ 'method' => 'POST|GET' ] ], //区域业绩排行 朱伟 2018-07-31 'selectDistrictPerformance' => [ 'index/Performance/selectDistrictPerformance', [ 'method' => 'POST|GET' ] ], //区域业绩排行 朱伟 2018-07-31
'selectStorePerformance' => [ 'index/Performance/selectStorePerformance', [ 'method' => 'POST|GET' ] ], //门店业绩排行 朱伟 2018-07-31 'selectStorePerformance' => [ 'index/Performance/selectStorePerformance', [ 'method' => 'POST|GET' ] ], //门店业绩排行 朱伟 2018-07-31
'selectIndividualPerformance' => [ 'index/Performance/selectIndividualPerformance', [ 'method' => 'POST|GET' ] ], //个人业绩排行 朱伟 2018-07-31 'selectIndividualPerformance' => [ 'index/Performance/selectIndividualPerformance', [ 'method' => 'POST|GET' ] ], //个人业绩排行 朱伟 2018-07-31
'transformFollowUp' => [ 'index/HouseFollowUp/transformFollowUp', [ 'method' => 'GET' ] ], //个人业绩排行 朱伟 2018-07-31 'transformFollowUp' => [ 'index/HouseFollowUp/transformFollowUp', [ 'method' => 'GET' ] ], //个人业绩排行 朱伟 2018-07-31
'getPerformanceExcel' => [ 'index/Performance/getPerformanceExcel', [ 'method' => 'POST|GET' ] ], //区域业绩排行 朱伟 2018-07-31
......
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