parent
3aab35ac22
commit
d2b3dc3f60
@ -222,6 +222,10 @@ class FinanceLedgerPageData
|
||||
'a.account_no',
|
||||
'a.bank_name',
|
||||
'a.bound_alipay',
|
||||
'a.alipay_merchant_no',
|
||||
'a.alipay_account_kind',
|
||||
'a.alipay_store_name',
|
||||
'a.remark',
|
||||
'a.owner',
|
||||
] as $column) {
|
||||
$builder->orWhere($column, 'like', '%' . $keyword . '%');
|
||||
|
||||
@ -294,21 +294,18 @@
|
||||
];
|
||||
}
|
||||
if ($standaloneAccountView === 'non_store') {
|
||||
array_splice($ledgerTableHeaders['accounts'], 2, 0, [
|
||||
$ledgerTableHeaders['accounts'] = [
|
||||
['company_name', '公司名称', 'text'],
|
||||
['account_short', '账户简称', 'text'],
|
||||
['legal_representative', '法人', 'text'],
|
||||
['alipay_account_kind', '账户类型', 'text'],
|
||||
['alipay_merchant_no', '商户号', 'text'],
|
||||
]);
|
||||
$bankCityBranchIndex = array_search(
|
||||
'bank_city_branch',
|
||||
array_column($ledgerTableHeaders['accounts'], 0),
|
||||
true,
|
||||
);
|
||||
if ($bankCityBranchIndex !== false) {
|
||||
array_splice($ledgerTableHeaders['accounts'], $bankCityBranchIndex + 1, 0, [
|
||||
['alipay_store_name', '店铺', 'text'],
|
||||
]);
|
||||
}
|
||||
['account_no', '支付宝账号', 'text'],
|
||||
['account_status', '账户状态', 'enum', ['options' => $accountStatusOptions, 'headerClass' => 'ledger-status-column']],
|
||||
['account_should_keep', '是否保留', 'enum', ['options' => $optionMap($accountKeepOptions), 'headerClass' => 'ledger-keep-column']],
|
||||
['alipay_store_name', '店铺', 'text'],
|
||||
['remark', '备注', 'text'],
|
||||
];
|
||||
}
|
||||
$accountTableColumnCount = count($ledgerTableHeaders['accounts']);
|
||||
@endphp
|
||||
@ -819,13 +816,15 @@
|
||||
<input type="hidden" name="tab" value="accounts">
|
||||
@endif
|
||||
<input type="hidden" name="accounts_view" value="{{ $accountView }}">
|
||||
<div class="ledger-field"><label for="accounts-q">关键词</label><input id="accounts-q" name="accounts_q" value="{{ request('accounts_q') }}" placeholder="{{ $standaloneAccountView === 'wangshang' ? '公司、法人、网商账号' : '公司、账号、责任人' }}"></div>
|
||||
<div class="ledger-field"><label for="accounts-q">关键词</label><input id="accounts-q" name="accounts_q" value="{{ request('accounts_q') }}" placeholder="{{ $standaloneAccountView === 'wangshang' ? '公司、法人、网商账号' : ($standaloneAccountView === 'non_store' ? '公司、法人、商户号、支付宝账号' : '公司、账号、责任人') }}"></div>
|
||||
<div class="ledger-field" style="min-width:11rem"><label for="accounts-short">账户简称</label><input id="accounts-short" name="accounts_short" list="ledger-account-list" value="{{ request('accounts_short') }}" placeholder="选择或输入"></div>
|
||||
@if ($standaloneAccountView !== 'wangshang')
|
||||
<div class="ledger-field" style="min-width:8rem"><label for="accounts-status">账户状态</label><select id="accounts-status" name="accounts_status"><option value="">全部状态</option>@foreach ($accountStatusOptions as $statusCode => $statusLabel)<option value="{{ $statusCode }}" @selected(request('accounts_status') === $statusCode)>{{ $statusLabel }}</option>@endforeach</select></div>
|
||||
<div class="ledger-field" style="min-width:8rem"><label for="accounts-region">地区</label><select id="accounts-region" name="accounts_region"><option value="">全部地区</option>@foreach (($accountFilterOptions['regions'] ?? []) as $region)<option value="{{ $region }}" @selected(request('accounts_region') === $region)>{{ $region }}</option>@endforeach<option value="__empty__" @selected(request('accounts_region') === '__empty__')>未填写</option></select></div>
|
||||
<div class="ledger-field" style="min-width:8rem"><label for="accounts-bank">所属银行</label><select id="accounts-bank" name="accounts_bank"><option value="">全部银行</option>@foreach ($accountBankOptions as $bank)<option value="{{ $bank }}" @selected(request('accounts_bank') === $bank)>{{ $bank }}</option>@endforeach<option value="__empty__" @selected(request('accounts_bank') === '__empty__')>未填写</option></select></div>
|
||||
<div class="ledger-field" style="min-width:8rem"><label for="accounts-balance">当前余额</label><select id="accounts-balance" name="accounts_balance"><option value="">全部金额</option><option value="0-5" @selected(request('accounts_balance') === '0-5')>0-5万</option><option value="5-20" @selected(request('accounts_balance') === '5-20')>5-20万</option><option value="20-plus" @selected(request('accounts_balance') === '20-plus')>20万以上</option></select></div>
|
||||
@if ($standaloneAccountView !== 'non_store')
|
||||
<div class="ledger-field" style="min-width:8rem"><label for="accounts-region">地区</label><select id="accounts-region" name="accounts_region"><option value="">全部地区</option>@foreach (($accountFilterOptions['regions'] ?? []) as $region)<option value="{{ $region }}" @selected(request('accounts_region') === $region)>{{ $region }}</option>@endforeach<option value="__empty__" @selected(request('accounts_region') === '__empty__')>未填写</option></select></div>
|
||||
<div class="ledger-field" style="min-width:8rem"><label for="accounts-bank">所属银行</label><select id="accounts-bank" name="accounts_bank"><option value="">全部银行</option>@foreach ($accountBankOptions as $bank)<option value="{{ $bank }}" @selected(request('accounts_bank') === $bank)>{{ $bank }}</option>@endforeach<option value="__empty__" @selected(request('accounts_bank') === '__empty__')>未填写</option></select></div>
|
||||
<div class="ledger-field" style="min-width:8rem"><label for="accounts-balance">当前余额</label><select id="accounts-balance" name="accounts_balance"><option value="">全部金额</option><option value="0-5" @selected(request('accounts_balance') === '0-5')>0-5万</option><option value="5-20" @selected(request('accounts_balance') === '5-20')>5-20万</option><option value="20-plus" @selected(request('accounts_balance') === '20-plus')>20万以上</option></select></div>
|
||||
@endif
|
||||
@endif
|
||||
@if ($activeAccountFilterCount > 0)
|
||||
<span class="ledger-filter-state" data-account-filter-state role="status" aria-live="polite" title="当前有 {{ $activeAccountFilterCount }} 个筛选条件生效"><span class="material-icons-outlined" aria-hidden="true">filter_alt</span><span>筛选中</span><b>{{ $activeAccountFilterCount }}</b></span>
|
||||
@ -841,7 +840,7 @@
|
||||
新增公司/账户
|
||||
</button>
|
||||
@endif
|
||||
<div class="ledger-column-picker" data-ledger-column-picker data-column-storage-key="caiwu.financial-ledger.accounts.preferences.v7.{{ auth()->id() }}.{{ company_id() }}.{{ $standaloneAccountView ?? 'all' }}">
|
||||
<div class="ledger-column-picker" data-ledger-column-picker data-column-storage-key="caiwu.financial-ledger.accounts.preferences.v8.{{ auth()->id() }}.{{ company_id() }}.{{ $standaloneAccountView ?? 'all' }}">
|
||||
<button class="ledger-btn" type="button" data-ledger-column-toggle aria-expanded="false"><span class="material-icons-outlined" aria-hidden="true">view_column</span>列设置</button>
|
||||
<div class="ledger-column-panel" data-ledger-column-panel role="group" aria-label="选择{{ $standaloneAccountView === null ? '账户总表' : $standaloneAccountTitle }}展示列" hidden>
|
||||
<p class="ledger-column-help">拖动字段可调整列顺序;拖动表头右侧边界可调整列宽,双击边界恢复默认。</p>
|
||||
@ -1210,6 +1209,43 @@
|
||||
</td>
|
||||
<td class="center" data-account-last4>{{ $row->account_last4 }}</td>
|
||||
<td>{{ $row->remark }}</td>
|
||||
@elseif ($standaloneAccountView === 'non_store')
|
||||
<td>{{ $row->company_name }}</td>
|
||||
<td>
|
||||
{{ $accountDisplayShort }}
|
||||
@if ($canEditAccounts)
|
||||
<button class="ledger-row-edit" type="button" title="编辑账户 {{ $accountDisplayShort }}" aria-label="编辑账户 {{ $accountDisplayShort }}" data-ledger-account-edit data-edit-url="{{ route('business.financial-ledger.accounts.edit', ['id' => $row->id]) }}" data-save-url="{{ route('business.financial-ledger.accounts.update', ['id' => $row->id]) }}"><span class="material-icons-outlined" aria-hidden="true">edit</span></button>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $row->legal_representative }}</td>
|
||||
<td>{{ $row->alipay_account_kind }}</td>
|
||||
<td>{{ $row->alipay_merchant_no }}</td>
|
||||
<td>{{ $row->account_no }}</td>
|
||||
<td class="ledger-status-column">
|
||||
@if ($canEditAccountStatus)
|
||||
<span class="ledger-status-badge ledger-account-readonly" data-account-edit-display data-account-status-display data-status="{{ $row->account_status }}">{{ $accountStatusOptions[$row->account_status] ?? '正常' }}</span>
|
||||
<select class="ledger-inline-select ledger-status-select ledger-account-editor" data-account-editor data-account-status data-account-short="{{ $row->account_short }}" data-status="{{ $row->account_status }}" data-url="{{ route('business.financial-ledger.accounts.status') }}" aria-label="账户 {{ $row->account_short }} 状态" disabled>
|
||||
@foreach ($accountStatusOptions as $statusCode => $statusLabel)
|
||||
<option value="{{ $statusCode }}" @selected($row->account_status === $statusCode)>{{ $statusLabel }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@else
|
||||
<span class="ledger-status-badge ledger-account-readonly" data-status="{{ $row->account_status }}">{{ $accountStatusOptions[$row->account_status] ?? '正常' }}</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="ledger-keep-column" data-account-short="{{ $row->account_short }}" data-account-should-keep="{{ $row->account_should_keep }}">
|
||||
<span class="ledger-account-readonly" data-account-edit-display data-account-keep-display>{{ $row->account_should_keep ?: '未填写' }}</span>
|
||||
@if ($canEditAccountStatus)
|
||||
<select class="ledger-inline-select ledger-keep-select ledger-account-editor" data-account-editor data-account-keep data-account-short="{{ $row->account_short }}" data-url="{{ route('business.financial-ledger.accounts.keep') }}" aria-label="账户 {{ $row->account_short }} 是否保留" disabled>
|
||||
<option value="" @selected(($row->account_should_keep ?? '') === '')>未填写</option>
|
||||
@foreach ($accountKeepOptions as $keepOption)
|
||||
<option value="{{ $keepOption }}" @selected($row->account_should_keep === $keepOption)>{{ $keepOption }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $row->alipay_store_name }}</td>
|
||||
<td>{{ $row->remark }}</td>
|
||||
@else
|
||||
<td>{{ $row->company_name }}</td>
|
||||
<td>
|
||||
@ -1218,11 +1254,6 @@
|
||||
<button class="ledger-row-edit" type="button" title="编辑账户 {{ $accountDisplayShort }}" aria-label="编辑账户 {{ $accountDisplayShort }}" data-ledger-account-edit data-edit-url="{{ route('business.financial-ledger.accounts.edit', ['id' => $row->id]) }}" data-save-url="{{ route('business.financial-ledger.accounts.update', ['id' => $row->id]) }}"><span class="material-icons-outlined" aria-hidden="true">edit</span></button>
|
||||
@endif
|
||||
</td>
|
||||
@if ($standaloneAccountView === 'non_store')
|
||||
<td>{{ $row->legal_representative }}</td>
|
||||
<td>{{ $row->alipay_account_kind }}</td>
|
||||
<td>{{ $row->alipay_merchant_no }}</td>
|
||||
@endif
|
||||
<td>{{ $row->bank_affiliation ?: '未填写' }}</td>
|
||||
<td class="ledger-status-column">
|
||||
@if ($canEditAccountStatus)
|
||||
@ -1240,9 +1271,6 @@
|
||||
<td>{{ $row->account_no }}</td>
|
||||
<td>{{ $row->bank_name }}</td>
|
||||
<td>{{ $row->bank_city_branch }}</td>
|
||||
@if ($standaloneAccountView === 'non_store')
|
||||
<td>{{ $row->alipay_store_name }}</td>
|
||||
@endif
|
||||
<td class="ledger-plan-column">
|
||||
<span class="ledger-account-readonly" data-account-edit-display data-account-plan-display>{{ $row->company_plan ?: '未填写' }}</span>
|
||||
@if ($canEditAccountStatus)
|
||||
|
||||
@ -50,7 +50,7 @@ class FinanceLedgerAlipayBasicImportTest extends FeatureTestCase
|
||||
'account_should_keep' => '否',
|
||||
]);
|
||||
|
||||
$this->loginAs()->get($this->pageUrl())
|
||||
$response = $this->loginAs()->get($this->pageUrl())
|
||||
->assertOk()
|
||||
->assertSee('导入支付宝基本信息')
|
||||
->assertSee('data-alipay-import-form', false)
|
||||
@ -59,6 +59,32 @@ class FinanceLedgerAlipayBasicImportTest extends FeatureTestCase
|
||||
->assertSee('店铺')
|
||||
->assertSee('208800000001')
|
||||
->assertSee('display@example.com');
|
||||
|
||||
$html = $response->getContent();
|
||||
$this->assertSame(
|
||||
1,
|
||||
preg_match('/<table class="ledger-table ledger-accounts-table">(.*?)<\/table>/s', $html, $table),
|
||||
);
|
||||
preg_match_all('/data-ledger-header-field="([^"]+)"/', $table[1], $columns);
|
||||
$this->assertSame([
|
||||
'company_name',
|
||||
'account_short',
|
||||
'legal_representative',
|
||||
'alipay_account_kind',
|
||||
'alipay_merchant_no',
|
||||
'account_no',
|
||||
'account_status',
|
||||
'account_should_keep',
|
||||
'alipay_store_name',
|
||||
'remark',
|
||||
], $columns[1]);
|
||||
$this->assertSame(
|
||||
1,
|
||||
preg_match('/<tr data-ledger-account-row="展示支付宝"[^>]*>(.*?)<\/tr>/s', $html, $row),
|
||||
);
|
||||
$this->assertSame(10, substr_count($row[1], '<td'));
|
||||
$this->assertStringNotContainsString('data-ledger-header-field="bank_affiliation"', $table[1]);
|
||||
$this->assertStringNotContainsString('data-ledger-header-field="current_balance"', $table[1]);
|
||||
}
|
||||
|
||||
public function test_import_updates_existing_adds_new_and_preserves_other_accounts(): void
|
||||
|
||||
@ -564,7 +564,7 @@ class FinanceLedgerHeaderControlsTest extends FeatureTestCase
|
||||
$this->assertStringNotContainsString('>提额动作</span>', $allHtml);
|
||||
$this->assertStringNotContainsString('>已做动作</span>', $allHtml);
|
||||
$this->assertStringNotContainsString('>下一步</span>', $allHtml);
|
||||
$this->assertStringContainsString('caiwu.financial-ledger.accounts.preferences.v5.', $allHtml);
|
||||
$this->assertStringContainsString('caiwu.financial-ledger.accounts.preferences.v8.', $allHtml);
|
||||
|
||||
$bankHtml = $this->loginAs()->get($this->pageUrl([
|
||||
'accounts_view' => 'bank',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user