Commit c9aa2042 authored by hujun's avatar hujun

导出

parent dc138d76
...@@ -186,24 +186,24 @@ class OfficePayLog extends Basic ...@@ -186,24 +186,24 @@ class OfficePayLog extends Basic
// } // }
// $where['agent_id'] = $this->params['agent_id']; // $where['agent_id'] = $this->params['agent_id'];
switch ($this->params['type']) { // switch ($this->params['type']) {
case 1 : // case 1 :
$where['status'] = 1; // $where['status'] = 1;
break; // break;
case 2 : // case 2 :
$where['status'] = 4; // $where['status'] = 4;
break; // break;
case 3 : // case 3 :
$where['status'] = 3; // $where['status'] = 3;
break; // break;
case 4 : // case 4 :
$where['status'] = 2; // $where['status'] = 2;
break; // break;
default : // default :
return $this->response(101, '类型错误'); // return $this->response(101, '类型错误');
} // }
$field = 'id,create_time,agent_name,refund_money,order_id,pay_log_id,bank,card_no,name,remark'; $field = 'id,create_time,agent_name,refund_money,order_id,pay_log_id,bank,card_no,name,remark,receipt_number';
$where['is_del'] = 0; $where['is_del'] = 0;
$m_refund = new OfficeORefundModel(); $m_refund = new OfficeORefundModel();
...@@ -227,7 +227,13 @@ class OfficePayLog extends Basic ...@@ -227,7 +227,13 @@ class OfficePayLog extends Basic
$refund_data[$k]['image_array'] = $m_img->getImgList(['img_id' => $v['id'], 'img_type' => 3]); $refund_data[$k]['image_array'] = $m_img->getImgList(['img_id' => $v['id'], 'img_type' => 3]);
$refund_data[$k]['check_log'] = $m_check_log->getListAll('create_time,operation_name', ['refund_id' => $v['id'], 'is_del' => 0]); $refund_data[$k]['check_log'] = $m_check_log->getListAll('create_time,operation_name', ['refund_id' => $v['id'], 'is_del' => 0]);
$refund_data[$k]['file_path'] = 'static/chat_image/'; $refund_data[$k]['file_path'] = 'static/chat_image/';
if ($v['status'] == 2) {
$refund_data[$k]['transfer_image_array'] = $m_img->getImgList(['img_id' => $v['id'], 'img_type' => 4]);
} else {
$refund_data[$k]['transfer_image_array'] = [];
}
} }
return $this->response("101", $refund_data); return $this->response(200, $refund_data);
} }
} }
\ No newline at end of file
...@@ -11,7 +11,9 @@ namespace app\index\controller; ...@@ -11,7 +11,9 @@ namespace app\index\controller;
use app\api_broker\service\OfficeOrderLogService; use app\api_broker\service\OfficeOrderLogService;
use app\index\extend\Basic; use app\index\extend\Basic;
use app\index\untils\ExportExcelUntil; use app\index\untils\ExportExcelUntil;
use app\model\AAgents;
use app\model\OfficeOPartialCommission; use app\model\OfficeOPartialCommission;
use app\model\OfficeORealIncome;
use app\model\OfficeOTaxes; use app\model\OfficeOTaxes;
use think\Request; use think\Request;
...@@ -214,4 +216,120 @@ class OfficeFinance extends Basic ...@@ -214,4 +216,120 @@ class OfficeFinance extends Basic
$data = $service_->selectListByOrderNo($params["order_id"]); $data = $service_->selectListByOrderNo($params["order_id"]);
return $this->response("200", "request success", $data); return $this->response("200", "request success", $data);
} }
/**
* 导出分佣提成明细表
*
* @return string
*/
public function exportExcel()
{
$pageNo = 1;
$pageSize = 250000;
$where = [];
$where['a.confirm_status'] = 1;
$where['a.is_del'] = 0;
$where['b.status'] = ['in','10,11,13'];
if (!empty($this->params['create_time']) && empty($this->params['end_time'])) {
$where['f.income_time'] = [ '>= time', $this->params['create_time'] . ' 00:00:00' ];
}
if (!empty($this->params['end_time']) && empty($this->params['create_time'])) {
$where['f.income_time'] = [ '<= time', $this->params['end_time'] . ' 23:59:59' ];
}
if (!empty($this->params['end_time']) && !empty($this->params['create_time'])) {
$where['f.income_time'] = [ 'between time', [ $this->params['create_time'] . ' 00:00:00', $this->params['end_time'] . ' 23:59:59' ] ];
}
if (!empty($this->params['internal_address'])) {
$where['d.internal_address'] = [ 'like', '%' . $this->params['internal_address'] . '%' ];
}
if (!empty($this->params['house_number'])) {
$where['b.house_number'] = [ 'like', '%' . $this->params['house_number'] . '%' ];
}
if (!empty($this->params['bargain_id'])) {
$where[] = [ 'EXP', 'b.id =' . $this->params['bargain_id'] . ' or father_id=' . $this->params['bargain_id'] ];
}
if (!empty($this->params['store_id'])) {
$where['e.store_id'] = $this->params['store_id'];
}
if (!empty($this->params['district_id'])) {
$where['e.district_id'] = $this->params['district_id'];
}
if (!empty($this->params['partial_id'])) {
$where['e.id'] = $this->params['partial_id'];
}
$field = 'a.id,a.confirm_date,a.practical_fee,b.scale_fee,b.scale,b.role,d.internal_address,b.agent_id,cash,';
$field .= 'service_charge,charity_fund,real_fee,a.real_income_id,a.should_commission,d.internal_address,b.father_id,b.id as bargain_id';
$m_commission = new OfficeOPartialCommission();
try {
$data = $m_commission->getCommissionBargainColumn($pageNo, $pageSize, 'a.id desc', $field, $where);
$m_agent = new AAgents();
$m_real = new OfficeORealIncome();
$fields_str = 'a.id,a.name,a.phone,b.store_name,c.district_name';
$result = [];
foreach ($data as $k => $v) {
if ($v['father_id'] >0 ) {
$result[$k]['bargain_id'] = $v['father_id'];
} else {
$result[$k]['bargain_id'] = $v['bargain_id'];
}
$result[$k]['income_time'] = $m_real->where('id', $v['real_income_id'])->value('income_time');
if ($v['agent_id']) {
$agent_data = $m_agent->getStoreDistrict($fields_str, [ 'a.id' => $v['agent_id'] ]);
$result[$k]['district_store'] = $agent_data['store_name'] . '-' . $agent_data['store_name'];
$result[$k]['agent'] = $agent_data['name'] . '-' . $agent_data['phone'];
}
$result[$k]['internal_address'] = $v['internal_address'];
switch ($v['role']) {
case 1:
$result[$k]['role'] = '盘方';
break;
case 2:
$result[$k]['role'] = '客方';
break;
case 3:
$result[$k]['role'] = '反签';
break;
case 4:
$result[$k]['role'] = '独家';
break;
case 5:
$result[$k]['role'] = '合作方';
break;
case 6:
$result[$k]['role'] = 'APP盘下载方';
break;
case 7:
$result[$k]['role'] = 'APP客下载方';
break;
default:
$result[$k]['role'] = '未定义';
}
$result[$k]['scale'] = $v['scale'];
$result[$k]['should_commission'] = $v['should_commission'];
$result[$k]['real_fee'] = $v['real_fee'];
$result[$k]['service_charge'] = $v['service_charge'];
$result[$k]['charity_fund'] = $v['charity_fund'];
$result[$k]['cash'] = $v['cash'];
$result[$k]['practical_fee'] = $v['practical_fee'];
}
} catch (\Exception $e) {
return '<script>alert("导出分佣提成明细列表失败");window.close();</script>';
}
$export = new ExportExcelUntil();
$title = [ '成交报告ID','收佣日期', '所属部门/门店', '业务员','商铺地址','分佣角色', '分佣比例(%)','应分佣金(元)', '预分佣金(元)', '手续费(元)', '慈善基金(元)', '现金奖(元)', '实收佣金(元)' ];
$export->exportTable('实收明细表', $result, 12, '实收明细表', $title);
return '';
}
} }
...@@ -1209,6 +1209,8 @@ Route::group('office_index', [ ...@@ -1209,6 +1209,8 @@ Route::group('office_index', [
'partialCommissionList' => ['index/OfficeFinance/partialCommissionList', ['method' => 'get']], //分佣提成明细表 'partialCommissionList' => ['index/OfficeFinance/partialCommissionList', ['method' => 'get']], //分佣提成明细表
'getTallAgeList' => ['index/OfficeFinance/getTallAgeList', ['method' => 'GET']], //税费承担明细表 'getTallAgeList' => ['index/OfficeFinance/getTallAgeList', ['method' => 'GET']], //税费承担明细表
'selectReportAll' => ['index/OfficeFinance/selectReportAll', ['method' => 'GET']], //时间轴 'selectReportAll' => ['index/OfficeFinance/selectReportAll', ['method' => 'GET']], //时间轴
'exportExcel' => ['index/OfficeFinance/exportExcel', ['method' => 'get']], //导出分佣
'performanceInfo' => ['index/OfficePerformanceInfo/performanceInfo', ['method' => 'GET|POST']],//业绩明细办公楼 'performanceInfo' => ['index/OfficePerformanceInfo/performanceInfo', ['method' => 'GET|POST']],//业绩明细办公楼
'selectDistrictPerformance' => ['index/OfficePerformance/selectDistrictPerformance', ['method' => 'GET|POST']],//区域业绩排行 'selectDistrictPerformance' => ['index/OfficePerformance/selectDistrictPerformance', ['method' => 'GET|POST']],//区域业绩排行
'selectStorePerformance' => ['index/OfficePerformance/selectStorePerformance', ['method' => 'GET|POST']],//门店排行 'selectStorePerformance' => ['index/OfficePerformance/selectStorePerformance', ['method' => 'GET|POST']],//门店排行
......
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