feat: bank total company plan summary (#1558)

This commit is contained in:
shanshi 2026-11-30 11:55:06 +08:00
parent cb2a896cb1
commit 76268dd6e2
3 changed files with 78 additions and 1 deletions

View File

@ -312,10 +312,12 @@ final class NonStoreAccountMonitorPageData
$bankNonDirectAccounts = $retainedBankAccounts
->reject(static fn (array $row): bool => (bool) $row['is_direct'])
->values();
$bankCompanyPlanTotals = $this->companyPlanBreakdown($retainedBankAccounts);
$fundOverview['bank_connection_totals'] = [
'all' => $this->summary($retainedBankAccounts),
'direct' => $this->summary($bankDirectAccounts),
'non_direct' => $this->summary($bankNonDirectAccounts),
'company_plan' => $bankCompanyPlanTotals,
'all_url' => $this->pageUrl([
'view' => self::VIEW_ACCOUNTS,
'keep' => 'retained',

View File

@ -2276,7 +2276,26 @@
</tbody>
<tfoot>
<tr>
<td>合计</td>
<td>
<button
class="nsm-bank-plan-trigger"
type="button"
data-bank-plan-open
data-bank-plan-total-summary
data-bank-plan-bank="全部银行"
data-bank-plan-total-count="{{ (int) $fundOverview['bank_connection_totals']['all']['count'] }}"
data-bank-plan-total-amount="{{ number_format((float) $fundOverview['bank_connection_totals']['all']['current_balance'], 2, '.', '') }}"
data-bank-plan-retained-count="{{ (int) $fundOverview['bank_connection_totals']['company_plan']['retained_count'] }}"
data-bank-plan-retained-amount="{{ number_format((float) $fundOverview['bank_connection_totals']['company_plan']['retained_balance'], 2, '.', '') }}"
data-bank-plan-unretained-count="{{ (int) $fundOverview['bank_connection_totals']['company_plan']['unretained_count'] }}"
data-bank-plan-unretained-amount="{{ number_format((float) $fundOverview['bank_connection_totals']['company_plan']['unretained_balance'], 2, '.', '') }}"
data-bank-plan-unspecified-count="{{ (int) $fundOverview['bank_connection_totals']['company_plan']['unspecified_count'] }}"
data-bank-plan-unspecified-amount="{{ number_format((float) $fundOverview['bank_connection_totals']['company_plan']['unspecified_balance'], 2, '.', '') }}"
aria-controls="nsm-bank-plan-total"
aria-expanded="false"
title="查看全部银行公司规划分布"
>合计</button>
</td>
<td class="num">
<a
class="nsm-number-link"
@ -2342,6 +2361,46 @@
</a>
</td>
</tr>
<tr
class="nsm-bank-plan-inline-row"
id="nsm-bank-plan-total"
data-bank-plan-detail
hidden
>
<td colspan="5">
<div class="nsm-bank-plan-inline">
<span class="nsm-bank-plan-inline__item">
<span>公司规划保留</span>
<strong>{{ number_format((int) $fundOverview['bank_connection_totals']['company_plan']['retained_count']) }} 户</strong>
<strong class="nsm-bank-plan-inline__amount">
{{ $moneyWan($fundOverview['bank_connection_totals']['company_plan']['retained_balance']) }} 万元
</strong>
</span>
<span class="nsm-bank-plan-inline__item">
<span>公司规划不保留</span>
<strong>{{ number_format((int) $fundOverview['bank_connection_totals']['company_plan']['unretained_count']) }} 户</strong>
<strong class="nsm-bank-plan-inline__amount">
{{ $moneyWan($fundOverview['bank_connection_totals']['company_plan']['unretained_balance']) }} 万元
</strong>
</span>
<span class="nsm-bank-plan-inline__total">
银行合计
<strong>
{{ number_format((int) $fundOverview['bank_connection_totals']['all']['count']) }} 户 /
{{ $moneyWan($fundOverview['bank_connection_totals']['all']['current_balance']) }} 万元
</strong>
</span>
<span
class="nsm-bank-plan-inline__unspecified"
data-bank-plan-unspecified
@if ((int) $fundOverview['bank_connection_totals']['company_plan']['unspecified_count'] === 0) hidden @endif
>
另有 {{ number_format((int) $fundOverview['bank_connection_totals']['company_plan']['unspecified_count']) }} 户未填写公司规划,
{{ $moneyWan($fundOverview['bank_connection_totals']['company_plan']['unspecified_balance']) }} 万元,未计入上述两类。
</span>
</div>
</td>
</tr>
</tfoot>
</table>
</div>

View File

@ -5,6 +5,7 @@ namespace Tests\Feature\Business;
use App\Models\Auth\Permission;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
use Modules\EcommerceFinance\View\NonStoreAccountMonitorPageData;
use Tests\Feature\FeatureTestCase;
class NonStoreAccountMonitorTest extends FeatureTestCase
@ -910,6 +911,8 @@ class NonStoreAccountMonitorTest extends FeatureTestCase
]);
$html = $this->loginAs()->get($this->pageUrl())->assertOk()->getContent();
$totals = app(NonStoreAccountMonitorPageData::class)->page()['fundOverview']['bank_connection_totals'];
$planTotals = $totals['company_plan'];
$this->assertStringContainsString('data-bank-plan-open', $html);
$this->assertStringContainsString('data-bank-plan-bank="招商银行"', $html);
@ -930,6 +933,19 @@ class NonStoreAccountMonitorTest extends FeatureTestCase
$this->assertStringContainsString('toggleBankPlanDetail', $html);
$this->assertStringContainsString('hideBankPlanDetails', $html);
$this->assertStringNotContainsString('data-bank-plan-dialog', $html);
$this->assertSame(
(int) $totals['all']['count'],
(int) $planTotals['retained_count']
+ (int) $planTotals['unretained_count']
+ (int) $planTotals['unspecified_count'],
);
$this->assertMatchesRegularExpression(
'/<tfoot>.*?data-bank-plan-total-summary'
. '.*?data-bank-plan-retained-count="' . (int) $planTotals['retained_count'] . '"'
. '.*?data-bank-plan-unretained-count="' . (int) $planTotals['unretained_count'] . '"'
. '.*?id="nsm-bank-plan-total".*?公司规划保留.*?公司规划不保留.*?<\/tfoot>/s',
$html,
);
}
public function test_independent_monthly_accounts_are_included_as_other_accounts(): void