From 5bd918891d709faf5bef67e6111745fafedead8a Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Fri, 8 Mar 2024 17:28:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Eexcel=E9=93=B6=E8=A1=8C?= =?UTF-8?q?=E5=8D=A1=E8=B4=A6=E5=8D=95=E5=AF=BC=E5=87=BA=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/system/financial/Financial.php | 11 ++++ crmeb/services/ExcelService.php | 54 +++++++++++++++++++ route/admin/accounts.php | 5 ++ 3 files changed, 70 insertions(+) diff --git a/app/controller/admin/system/financial/Financial.php b/app/controller/admin/system/financial/Financial.php index 5bf2500a..aaae17ba 100755 --- a/app/controller/admin/system/financial/Financial.php +++ b/app/controller/admin/system/financial/Financial.php @@ -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); + + } + + + } diff --git a/crmeb/services/ExcelService.php b/crmeb/services/ExcelService.php index 2fac4fd4..881af72f 100755 --- a/crmeb/services/ExcelService.php +++ b/crmeb/services/ExcelService.php @@ -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 diff --git a/route/admin/accounts.php b/route/admin/accounts.php index 15b82f4f..4f886934 100755 --- a/route/admin/accounts.php +++ b/route/admin/accounts.php @@ -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,