Commit fd33ed0d authored by zhuwei's avatar zhuwei

退款列表-导出excel

parent 9c08dc8d
......@@ -854,6 +854,145 @@ class Finance extends Basic
return $this->response($data['code'], $data['msg'], $data['data']);
}
/**
* 退款列表-导出excel
* @return string
*/
public function refundListExcel()
{
$data['code'] = 200;
$data['msg'] = "";
$data['data'] = [];
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
$refund = new ORefundModel();
$m_house = new GHouses();
$m_store = new AStore();
$where['a.is_del'] = 0;
if (isset($this->params['status']) && $this->params['status'] != -1) {
if ($this->params['status'] == 1) {
$where['a.status'] = ['in', '0,1'];
} else {
$where['a.status'] = $this->params['status'];
}
}
if (!empty($this->params['start_time']) && empty($this->params['end_time'])) {
$where['a.create_time'] = ['>', $this->params['start_time']. ' 00:00:00'];
}
if (!empty($this->params['end_time']) && empty($this->params['start_time'])) {
$where['a.create_time'] = ['>', $this->params['end_time']. ' 23:59:59'];
}
if (!empty($this->params['start_time']) && !empty($this->params['end_time'])) {
$where['a.create_time'] = ['between', [$this->params['start_time']. ' 00:00:00', $this->params['end_time']. ' 23:59:59']];
}
if (!empty($this->params['income_start_time']) && empty($this->params['income_end_time'])) {
$where['d.income_time'] = ['>', $this->params['income_start_time']. ' 00:00:00'];
}
if (!empty($this->params['income_end_time']) && empty($this->params['income_start_time'])) {
$where['d.income_time'] = ['>', $this->params['income_end_time']. ' 23:59:59'];
}
if (!empty($this->params['income_start_time']) && !empty($this->params['income_end_time'])) {
$where['d.income_time'] = ['between', [$this->params['income_start_time']. ' 00:00:00', $this->params['income_end_time']. ' 23:59:59']];
}
if (isset($this->params['type']) && $this->params['type'] != -1) {
$where['a.type'] = $this->params['type'];
}
if (!empty($this->params['order_id'])) {
$where['a.order_id'] = $this->params['order_id'];
}
if (!empty($this->params['id'])) {
$where['a.id'] = $this->params['id'];
}
if (!empty($this->params['house_id'])) {
$where['b.house_id'] = $this->params['house_id'];
}
if (!empty($this->params['address'])) {
$m_house = new GHouses();
$house_id = $m_house->getHouseColumn('id', ['internal_address'=> ['LIKE', '%'.trim($this->params['address']).'%']]);
if (isset($where['b.house_id'])) {
$house_id[] = $where['b.house_id'];
}
if (!empty($house_id)) {
$where['b.house_id'] = ['in', $house_id];
}
}
if (!empty($this->params['district_id'])) {
$where['c.district_id'] = $this->params['district_id'];
}
if (!empty($this->params['store_id'])) {
$where['c.store_id'] = $this->params['store_id'];
}
if (!empty($this->params['agent_id'])) {
$where['a.agent_id'] = $this->params['agent_id'];
}
if (!empty($this->params['pay_log_id'])) {
$where['a.pay_log_id'] = $this->params['pay_log_id'];
}
if (isset($this->params['is_self']) && $this->params['is_self'] != -1) {
if ($this->params['is_self']) {
$where['e.operation_id'] = $this->userId;
} else {
$where[] = ['EXP', 'a.id NOT IN (SELECT refund_id FROM o_refund_log WHERE operation_id ='.$this->userId.')'];
}
}
$fields = 'a.create_time,a.id,a.order_id,a.pay_log_id,a.refund_money,a.type,a.agent_id,a.agent_name,b.house_id,a.status,';
$fields .= 'd.income_time,a.type,c.store_id';
$list = $refund->getCheckRefundList($pageNo, $pageSize, 'a.id DESC', $fields, $where);
foreach ($list as $k=>$v) {
if (empty($v['house_id'])) {
$list[$k]['address'] = '';
} else {
$list[$k]['address'] = $m_house->getHouseValue('internal_address', ['id'=>$v['house_id']]);
}
if (empty($v['store_id'])) {
$list[$k]['store_name'] = '';
} else {
$list[$k]['store_name'] = $m_store->getStoreKeyById('store_name', ['id'=> $v['store_id']]);
}
}
$total_money = $refund->getSumMoney($where);
dump($list);exit;
if(!$list){
return '<script>alert("退款审核表失败");window.close();</script>';
}
$export = new ExportExcelUntil();
$title = [ '提交时间','退款ID','状态','订单ID','收款ID','退款金额','入账日期','退款类型','提交人','所属门店','商铺ID','商铺地址'];
$export->exportTable('退款审核 退款总计:'.$total_money, $list, 11, '实收明细表', $title);
return '';
}
/**
* 已退款列表
*
......
......@@ -231,6 +231,7 @@ Route::group('index', [
'backOutThree/:check_status' => ['index/Finance/reportList', ['method' => 'get'], ['check_status' => 8]], //财务 成交报告-待撤销-第三级数据
'reportListUndone/:check_status' => ['index/Finance/reportList', ['method' => 'get'], ['check_status' => 6]], //财务 成交报告-已撤销
'refundList' => ['index/Finance/refundList', ['method' => 'get']], //退款列表-专员审核
'refundListExcel' => ['index/Finance/refundListExcel', ['method' => 'get']], //退款列表-导出excel
'checkReportAttache/:check_status' => ['index/Finance/checkReport', ['method' => 'post'], ['check_status' => 1]], //审核成交报告-第一级审核
'checkReportManager/:check_status' => ['index/Finance/checkReport', ['method' => 'post'], ['check_status' => 2]], //审核成交报告-第二级审核
'checkReportMajordomo/:check_status' => ['index/Finance/checkReport', ['method' => 'post'], ['check_status' => 3]], //审核成交报告-第三级审核
......
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