Merge remote-tracking branch 'origin/main' into feature/dodo-independent-company-reconciliation

This commit is contained in:
WuYongJie 2026-11-11 14:54:02 +08:00
commit 6ebfa11033
10 changed files with 363 additions and 21 deletions

View File

@ -728,6 +728,7 @@ $navigation = [
'children_inherit_parent_access' => true,
'children' => [
['slug' => 'kuka-basic-data', 'title' => '基础数据'],
['slug' => 'kuka-reconciliation', 'title' => '顾家对账'],
],
],
['slug' => 'suofeiya-posting', 'title' => '索菲亚过账'],

View File

@ -1733,11 +1733,6 @@ class FinanceLedgerPageData
'daily_available' => ['sort' => $a . '.daily_available', 'type' => 'number'],
'blocked_amount' => ['sort' => $a . '.blocked_amount', 'type' => 'number'],
'daily_withdraw' => ['sort' => $a . '.daily_available', 'type' => 'number'],
'clearing_days' => ['sort' => $a . '.clearing_days', 'type' => 'number'],
'raise_target' => ['sort' => "CAST({$a}.raise_target AS DECIMAL(18, 2))", 'filter' => $a . '.raise_target', 'type' => 'number'],
'raise_status' => ['sort' => $a . '.raise_status', 'type' => 'text'],
'raise_actions' => ['sort' => $a . '.raise_actions', 'type' => 'text'],
'done_actions' => ['sort' => $a . '.done_actions', 'type' => 'text'],
'next_action' => ['sort' => $a . '.next_action', 'type' => 'text'],
'remark' => ['sort' => $a . '.remark', 'type' => 'text'],
'owner' => ['sort' => $a . '.owner', 'type' => 'text'],

View File

@ -164,11 +164,6 @@
['daily_available', '可用金额(万元)', 'number', ['headerClass' => 'num', 'align' => 'end']],
['blocked_amount', '不可用金额(万元)', 'number', ['headerClass' => 'num', 'align' => 'end']],
['daily_withdraw', '每日可出(万元)', 'number', ['headerClass' => 'num', 'align' => 'end']],
['clearing_days', '预计出清天数', 'number', ['headerClass' => 'num', 'align' => 'end']],
['raise_target', '提额目标(万元)', 'number'],
['raise_status', '提额状态', 'text'],
['raise_actions', '提额动作', 'text'],
['done_actions', '已做动作', 'text'],
['next_action', '下一步', 'text'],
['remark', '备注', 'text'],
['owner', '责任人', 'text'],
@ -701,7 +696,7 @@
新增公司/账户
</button>
@endif
<div class="ledger-column-picker" data-ledger-column-picker data-column-storage-key="caiwu.financial-ledger.accounts.preferences.v2.{{ auth()->id() }}.{{ company_id() }}">
<div class="ledger-column-picker" data-ledger-column-picker data-column-storage-key="caiwu.financial-ledger.accounts.preferences.v3.{{ auth()->id() }}.{{ company_id() }}">
<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="选择账户总表展示列" hidden>
<p class="ledger-column-help">拖动字段可调整列顺序;拖动表头右侧边界可调整列宽,双击边界恢复默认。</p>
@ -1026,10 +1021,10 @@
</select>
@endif
</td>
<td class="center" data-account-last4>{{ $row->account_last4 }}</td><td class="center" title="{{ $moneyYuanTitle($row->single_limit) }}">{{ $moneyWan($row->single_limit) }}</td><td class="center" title="{{ $moneyYuanTitle($row->daily_limit) }}">{{ $moneyWan($row->daily_limit) }}</td><td class="center" title="{{ $moneyYuanTitle($row->monthly_limit) }}">{{ $moneyWan($row->monthly_limit) }}</td><td class="center" title="{{ $moneyYuanTitle($row->yearly_limit) }}">{{ $moneyWan($row->yearly_limit) }}</td><td class="num" data-account-current-balance="{{ (float) $row->current_balance }}" title="{{ $moneyYuanTitle($row->current_balance) }}">{{ $moneyWan($row->current_balance) }}</td><td class="num" data-account-available-amount title="{{ $moneyYuanTitle($row->daily_available) }}">{{ $moneyWan($row->daily_available) }}</td><td class="num" data-account-blocked-amount title="{{ $moneyYuanTitle($row->blocked_amount) }}">{{ $moneyWan($row->blocked_amount) }}</td><td class="num" data-account-daily-available-amount title="{{ $moneyYuanTitle($row->daily_available) }}">{{ $moneyWan($row->daily_available) }}</td><td class="num">{{ $row->clearing_days !== null ? number_format((float) $row->clearing_days, 2) : '' }}</td><td title="{{ $moneyYuanTitle($row->raise_target) }}">{{ $moneyWan($row->raise_target) }}</td><td>{{ $row->raise_status }}</td><td>{{ $row->raise_actions }}</td><td>{{ $row->done_actions }}</td><td>{{ $row->next_action }}</td><td>{{ $row->remark }}</td><td>{{ $row->owner }}</td>
<td class="center" data-account-last4>{{ $row->account_last4 }}</td><td class="center" title="{{ $moneyYuanTitle($row->single_limit) }}">{{ $moneyWan($row->single_limit) }}</td><td class="center" title="{{ $moneyYuanTitle($row->daily_limit) }}">{{ $moneyWan($row->daily_limit) }}</td><td class="center" title="{{ $moneyYuanTitle($row->monthly_limit) }}">{{ $moneyWan($row->monthly_limit) }}</td><td class="center" title="{{ $moneyYuanTitle($row->yearly_limit) }}">{{ $moneyWan($row->yearly_limit) }}</td><td class="num" data-account-current-balance="{{ (float) $row->current_balance }}" title="{{ $moneyYuanTitle($row->current_balance) }}">{{ $moneyWan($row->current_balance) }}</td><td class="num" data-account-available-amount title="{{ $moneyYuanTitle($row->daily_available) }}">{{ $moneyWan($row->daily_available) }}</td><td class="num" data-account-blocked-amount title="{{ $moneyYuanTitle($row->blocked_amount) }}">{{ $moneyWan($row->blocked_amount) }}</td><td class="num" data-account-daily-available-amount title="{{ $moneyYuanTitle($row->daily_available) }}">{{ $moneyWan($row->daily_available) }}</td><td>{{ $row->next_action }}</td><td>{{ $row->remark }}</td><td>{{ $row->owner }}</td>
</tr>
@empty
<tr><td colspan="27"><div class="ledger-empty">没有匹配的账户数据。</div></td></tr>
<tr><td colspan="22"><div class="ledger-empty">没有匹配的账户数据。</div></td></tr>
@endforelse
</tbody>
</table>

View File

@ -0,0 +1,95 @@
@php
$tabs = [
[
'slug' => 'posting-data',
'title' => '顾家过账数据',
'icon' => 'dataset',
'description' => '顾家过账数据对账页面已建立,待接入订单与过账数据。',
],
[
'slug' => 'toc-orders',
'title' => 'TOC订单',
'icon' => 'shopping_cart',
'description' => 'TOC 订单对账页面已建立,待接入订单明细。',
],
[
'slug' => 'lingshan-virtual-posting',
'title' => '灵珊虚拟过账',
'icon' => 'swap_horiz',
'description' => '灵珊虚拟过账页面已建立,待接入虚拟过账数据。',
],
[
'slug' => 'erp-product-import',
'title' => '顾家ERP商品导入',
'icon' => 'inventory_2',
'description' => '顾家 ERP 商品导入页面已建立,待接入商品导入流程。',
],
[
'slug' => 'invoice-entry-template',
'title' => '开票填写模板-货物-灵珊',
'icon' => 'description',
'description' => '灵珊货物开票填写模板页面已建立。',
],
[
'slug' => 'inventory-management-template',
'title' => '库存管理模板',
'icon' => 'warehouse',
'description' => '库存管理模板页面已建立。',
],
[
'slug' => 'lingshan-statement',
'title' => '灵珊对账单',
'icon' => 'receipt_long',
'description' => '灵珊对账单页面已建立,待接入对账数据。',
],
[
'slug' => 'oberna-statement',
'title' => '欧伯娜对账单',
'icon' => 'fact_check',
'description' => '欧伯娜对账单页面已建立,待接入对账数据。',
],
];
$validSubmenus = array_column($tabs, 'slug');
$requestedSubmenu = (string) request()->query('reconciliation_view', '');
$activeView = in_array($requestedSubmenu, $validSubmenus, true)
? $requestedSubmenu
: 'posting-data';
$placeholder = 'business.pages.posting-data.partials.kuka-posting-placeholder';
@endphp
<div class="kuka-reconciliation-page">
@include('business.pages.posting-data.partials.kuka-reconciliation-tabs', [
'tabs' => $tabs,
'activeView' => $activeView,
])
<div class="kuka-reconciliation-content" data-kuka-reconciliation-content>
@foreach ($tabs as $tab)
<section
id="kuka-reconciliation-panel-{{ $tab['slug'] }}"
data-kuka-reconciliation-panel="{{ $tab['slug'] }}"
role="tabpanel"
aria-labelledby="kuka-reconciliation-tab-{{ $tab['slug'] }}"
@if ($activeView !== $tab['slug']) hidden @endif
>
@include($placeholder, [
'title' => $tab['title'],
'description' => $tab['description'],
'icon' => $tab['icon'],
])
</section>
@endforeach
</div>
</div>
<style>
.kuka-reconciliation-page,
.kuka-reconciliation-content {
display: grid;
min-width: 0;
gap: 12px;
}
.kuka-reconciliation-content > [data-kuka-reconciliation-panel][hidden] {
display: none !important;
}
</style>

View File

@ -0,0 +1,192 @@
<nav
class="kuka-reconciliation-subnav"
data-kuka-reconciliation-tabs
aria-label="顾家对账子菜单"
>
<div class="kuka-reconciliation-subnav__scroll" role="tablist" aria-label="顾家对账">
@foreach ($tabs as $tab)
@php $selected = $activeView === $tab['slug']; @endphp
<a
id="kuka-reconciliation-tab-{{ $tab['slug'] }}"
href="{{ request()->fullUrlWithQuery(['reconciliation_view' => $tab['slug']]) }}"
class="kuka-reconciliation-subnav__tab {{ $selected ? 'is-active' : '' }}"
role="tab"
aria-selected="{{ $selected ? 'true' : 'false' }}"
aria-controls="kuka-reconciliation-panel-{{ $tab['slug'] }}"
tabindex="{{ $selected ? '0' : '-1' }}"
data-kuka-reconciliation-tab="{{ $tab['slug'] }}"
@if ($selected) aria-current="page" @endif
>
<span class="material-icons-outlined" aria-hidden="true">{{ $tab['icon'] }}</span>
<span>{{ $tab['title'] }}</span>
</a>
@endforeach
</div>
</nav>
<style>
.kuka-reconciliation-subnav {
min-width: 0;
max-width: 100%;
padding: 2px 4px;
border: 1px solid var(--vip-border, #d8d2c7);
border-radius: 8px;
background: var(--vip-surface, #fff);
}
.kuka-reconciliation-subnav__scroll {
display: flex;
align-items: center;
gap: 2px;
min-width: 0;
overflow-x: auto;
scrollbar-width: thin;
}
.kuka-reconciliation-subnav__tab {
position: relative;
display: inline-flex;
flex: 0 0 auto;
min-height: 32px;
align-items: center;
gap: 6px;
padding: 0 10px;
border-radius: 4px;
color: var(--vip-content-muted, #595959);
font-size: 12px;
font-weight: 500;
line-height: 1;
text-decoration: none;
white-space: nowrap;
transition: color 150ms ease, background-color 150ms ease;
}
.kuka-reconciliation-subnav__tab .material-icons-outlined {
font-size: 16px;
}
.kuka-reconciliation-subnav__tab:hover,
.kuka-reconciliation-subnav__tab:focus-visible {
background: var(--vip-content-accent-soft, #f7f0de);
color: var(--vip-content-accent-dark, #856632);
outline: none;
}
.kuka-reconciliation-subnav__tab:focus-visible {
box-shadow: 0 0 0 3px rgba(133, 102, 50, 0.2);
}
.kuka-reconciliation-subnav__tab.is-active {
color: var(--vip-content-accent-dark, #856632);
font-weight: 600;
}
.kuka-reconciliation-subnav__tab.is-active::after {
position: absolute;
right: 10px;
bottom: 0;
left: 10px;
height: 3px;
border-radius: 999px 999px 0 0;
background: var(--vip-content-accent, #b9954f);
content: "";
}
@media (prefers-reduced-motion: reduce) {
.kuka-reconciliation-subnav__tab { transition: none; }
}
</style>
<script>
document.addEventListener('DOMContentLoaded', () => {
const nav = document.querySelector('[data-kuka-reconciliation-tabs]');
const workspace = document.querySelector('[data-kuka-reconciliation-content]');
if (!nav || !workspace) {
return;
}
const tabs = [...nav.querySelectorAll('[data-kuka-reconciliation-tab]')];
const panels = [...workspace.querySelectorAll('[data-kuka-reconciliation-panel]')];
const validViews = new Set(tabs.map((tab) => tab.dataset.kukaReconciliationTab));
const defaultView = 'posting-data';
const currentView = () => {
const value = new URL(window.location.href).searchParams.get('reconciliation_view');
return validViews.has(value) ? value : defaultView;
};
const activate = (view, pushState = false, url = null) => {
if (!validViews.has(view)) {
view = defaultView;
}
tabs.forEach((tab) => {
const selected = tab.dataset.kukaReconciliationTab === view;
tab.classList.toggle('is-active', selected);
tab.setAttribute('aria-selected', selected ? 'true' : 'false');
tab.tabIndex = selected ? 0 : -1;
if (selected) {
tab.setAttribute('aria-current', 'page');
} else {
tab.removeAttribute('aria-current');
}
});
panels.forEach((panel) => {
panel.hidden = panel.dataset.kukaReconciliationPanel !== view;
});
if (pushState && url && window.location.href !== url) {
window.history.pushState({ kukaReconciliationView: view }, '', url);
}
};
nav.addEventListener('click', (event) => {
const tab = event.target.closest('[data-kuka-reconciliation-tab]');
if (!tab
|| event.button !== 0
|| event.ctrlKey
|| event.metaKey
|| event.shiftKey
|| event.altKey
) {
return;
}
event.preventDefault();
const view = tab.dataset.kukaReconciliationTab;
activate(view, true, new URL(tab.href, window.location.origin).href);
tab.focus({ preventScroll: true });
});
nav.addEventListener('keydown', (event) => {
if (!['ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key)) {
return;
}
event.preventDefault();
const currentIndex = Math.max(0, tabs.findIndex((tab) => tab.tabIndex === 0));
let nextIndex = currentIndex;
if (event.key === 'ArrowLeft') {
nextIndex = (currentIndex - 1 + tabs.length) % tabs.length;
} else if (event.key === 'ArrowRight') {
nextIndex = (currentIndex + 1) % tabs.length;
} else if (event.key === 'Home') {
nextIndex = 0;
} else if (event.key === 'End') {
nextIndex = tabs.length - 1;
}
const nextTab = tabs[nextIndex];
activate(
nextTab.dataset.kukaReconciliationTab,
true,
new URL(nextTab.href, window.location.origin).href,
);
nextTab.focus({ preventScroll: true });
});
window.addEventListener('popstate', () => {
if (!window.location.pathname.endsWith('/posting-data/kuka-reconciliation')) {
return;
}
activate(currentView());
});
activate(currentView());
});
</script>

View File

@ -140,8 +140,8 @@ class FinanceLedgerHeaderControlsTest extends FeatureTestCase
$response = $this->loginAs()->get($this->pageUrl());
$html = $response->assertOk()->getContent();
$this->assertSame(72, preg_match_all('/<details\b[^>]*data-ledger-header-details/', $html));
$this->assertSame(72, preg_match_all('/<span\b[^>]*data-ledger-header-label/', $html));
$this->assertSame(67, preg_match_all('/<details\b[^>]*data-ledger-header-details/', $html));
$this->assertSame(67, preg_match_all('/<span\b[^>]*data-ledger-header-label/', $html));
$this->assertSame(2, preg_match_all('/<select name="transactions_filter_value"/', $html));
$this->assertSame(1, preg_match_all('/<input\b[^>]*name="transactions_filter_value"[^>]*list="ledger-header-options-transactions-effective_account_short"/', $html));
$this->assertStringContainsString(
@ -522,6 +522,17 @@ class FinanceLedgerHeaderControlsTest extends FeatureTestCase
$this->assertStringContainsString('data-ledger-account-row="账户乙"', $allHtml);
$this->assertStringContainsString('data-ledger-account-row="账户丙支付宝"', $allHtml);
$this->assertStringContainsString('data-ledger-account-row="账户丁网商"', $allHtml);
$this->assertSame(1, preg_match('/<table class="ledger-table ledger-accounts-table">(.*?)<\/table>/s', $allHtml, $accountsTable));
$this->assertSame(22, substr_count($accountsTable[1], 'data-ledger-header-details'));
$this->assertSame(1, preg_match('/<tr data-ledger-account-row="账户甲">(.*?)<\/tr>/s', $allHtml, $accountRow));
$this->assertSame(22, substr_count($accountRow[1], '<td'));
$this->assertStringNotContainsString('>预计出清天数</span>', $allHtml);
$this->assertStringNotContainsString('>提额目标(万元)</span>', $allHtml);
$this->assertStringNotContainsString('>提额状态</span>', $allHtml);
$this->assertStringNotContainsString('>提额动作</span>', $allHtml);
$this->assertStringNotContainsString('>已做动作</span>', $allHtml);
$this->assertStringContainsString('caiwu.financial-ledger.accounts.preferences.v3.', $allHtml);
$this->assertStringContainsString('>下一步</span>', $allHtml);
$bankHtml = $this->loginAs()->get($this->pageUrl([
'accounts_view' => 'bank',

View File

@ -79,8 +79,14 @@ class KukaPostingBasePageTest extends FeatureTestCase
->firstWhere('slug', 'posting-data');
$kuka = collect($navigation['pages'])->firstWhere('slug', 'kuka-posting');
$this->assertSame(['kuka-basic-data'], array_column($kuka['children'], 'slug'));
$this->assertSame(['基础数据'], array_column($kuka['children'], 'title'));
$this->assertSame(
['kuka-basic-data', 'kuka-reconciliation'],
array_column($kuka['children'], 'slug')
);
$this->assertSame(
['基础数据', '顾家对账'],
array_column($kuka['children'], 'title')
);
@unlink($file);
}

View File

@ -0,0 +1,47 @@
<?php
namespace Tests\Feature\Business;
use Tests\Feature\FeatureTestCase;
class KukaReconciliationPageTest extends FeatureTestCase
{
public function test_renders_all_kuka_reconciliation_tabs_with_the_first_tab_active(): void
{
$this->loginAs()
->get(route('business.pages.show', [
'section' => 'posting-data',
'page' => 'kuka-reconciliation',
]))
->assertOk()
->assertSeeText('顾家对账')
->assertSeeText('顾家过账数据')
->assertSeeText('TOC订单')
->assertSeeText('灵珊虚拟过账')
->assertSeeText('顾家ERP商品导入')
->assertSeeText('开票填写模板-货物-灵珊')
->assertSeeText('库存管理模板')
->assertSeeText('灵珊对账单')
->assertSeeText('欧伯娜对账单')
->assertSee('data-kuka-reconciliation-tabs', false)
->assertSee('data-kuka-reconciliation-panel="posting-data"', false)
->assertSee('data-kuka-reconciliation-panel="oberna-statement"', false)
->assertSee('id="kuka-reconciliation-tab-posting-data"', false)
->assertSee('class="kuka-reconciliation-subnav__tab is-active"', false);
}
public function test_kuka_reconciliation_tab_can_open_directly_from_the_url(): void
{
$this->loginAs()
->get(route('business.pages.show', [
'section' => 'posting-data',
'page' => 'kuka-reconciliation',
'reconciliation_view' => 'toc-orders',
]))
->assertOk()
->assertSee('id="kuka-reconciliation-tab-toc-orders"', false)
->assertSee('class="kuka-reconciliation-subnav__tab is-active"', false)
->assertSee('data-kuka-reconciliation-panel="toc-orders"', false)
->assertSeeText('TOC 订单对账页面已建立');
}
}

View File

@ -623,11 +623,11 @@ class NavigationTest extends FeatureTestCase
);
$this->assertTrue($navigation[$postingIndex]['pages'][0]['children_inherit_parent_access']);
$this->assertSame(
['kuka-basic-data'],
['kuka-basic-data', 'kuka-reconciliation'],
array_column($navigation[$postingIndex]['pages'][0]['children'], 'slug')
);
$this->assertSame(
['基础数据'],
['基础数据', '顾家对账'],
array_column($navigation[$postingIndex]['pages'][0]['children'], 'title')
);
$this->assertSame(

View File

@ -160,7 +160,7 @@ class UserPermissionsTest extends FeatureTestCase
array_column($navigation[1]['pages'], 'title')
);
$this->assertSame(
['kuka-basic-data'],
['kuka-basic-data', 'kuka-reconciliation'],
array_column($navigation[1]['pages'][0]['children'], 'slug')
);
}
@ -172,7 +172,7 @@ class UserPermissionsTest extends FeatureTestCase
$navigation = SidebarPermissions::navigationFor($regular);
$this->assertSame(
['kuka-basic-data'],
['kuka-basic-data', 'kuka-reconciliation'],
array_column($navigation[0]['pages'][0]['children'], 'slug')
);
}