This commit is contained in:
luofei 2024-03-08 17:38:55 +08:00
commit 1a335ed8b8
3 changed files with 70 additions and 0 deletions
app/controller/admin/system/financial
crmeb/services
route/admin

@ -156,4 +156,15 @@ class Financial extends BaseController
}
public function billExport()
{
$where = $this->request->params(['date', 'status', 'financial_type', 'financial_status', 'keyword', 'is_trader', 'mer_id']);
[$page, $limit] = $this->getPage();
$data = app()->make(ExcelService::class)->withdrawalBill($where,$page,$limit);
return app('json')->success($data);
}
}

@ -676,6 +676,7 @@ class ExcelService
$query = app()->make(FinancialRepository::class)->search($where)->with('merchant');
$count = $query->count();
$list = $query->page($page, $limit)->select();
foreach ($list as $item) {
if ($item->financial_type == 1) {
if (empty($item->financial_account->bank)) {
@ -711,6 +712,59 @@ class ExcelService
return compact('count', 'header', 'title', 'export', 'foot', 'filename');
}
/**
* 提现银行账单导出
* @param array $where
* @param int $page
* @param int $limit
* @return array
*/
public function withdrawalBill(array $where, int $page, int $limit)
{
$title = [
'转账记录',
'生成时间:' . date('Y-m-d H:i:s', time())
];
$header = ['编号', '收款方账号', '收款方户名', '是否农业银行', '开户银行(行别)', '开户行大额行号', '开户行支行名称', '金额','用途(附言)'];
$filename = '转账记录_' . time();
$export = [];
$where['type'] = 0; //申请类型默认为余额
$query = app()->make(FinancialRepository::class)->search($where)->with('merchant');
$count = $query->count();
$list = $query->page($page, $limit)->select();
foreach ($list as $item) {
$checkRes = "";
if (!empty($item->financial_account) && isset($item->financial_account->bank)) {
$bankName = $item->financial_account->bank;
if (preg_match("/农业银行/i", $bankName)) {
$checkRes = "";
} else {
$checkRes = "";
}
}else{
//测试数据有未存在的数据
$bankName='';
}
$export[] = [
$item->financial_sn,
$item->financial_account->bank_code??'',
$bankName,
$checkRes,
'',//'开户银行(行别)
'',//'开户行大额行号'
$item->financial_account->bank_branch??'',
$item->extract_money,
$item->mark
];
}
$foot = '';
return compact('count', 'header', 'title', 'export', 'foot', 'filename');
}
/**
* TODO 用户提现申请
* @param array $where

@ -279,6 +279,11 @@ Route::group(function () {
Route::get('export', 'Financial/export')->name('systemFinancialExport')->option([
'_alias' => '导出',
]);
Route::get('bill', 'Financial/billExport')->name('systemFinancialBillExport')->option([
'_alias' => '账单导出',
]);
})->prefix('admin.system.financial.')->option([
'_path' => '/accounts/transferRecord',
'_auth' => true,