调整财务系统一级菜单顺序
This commit is contained in:
parent
a2c6388e73
commit
4bdfa8106e
@ -104,6 +104,15 @@ class Pages extends Controller
|
||||
'jd-promotion', 'douyin-promotion', 'dewu-promotion', 'vip-promotion',
|
||||
];
|
||||
|
||||
protected const ACCOUNT_BALANCE_SECTION = 'account-balance-data';
|
||||
|
||||
protected const ACCOUNT_BALANCE_PAGES = [
|
||||
'bank-balance',
|
||||
'store-receiving-balance',
|
||||
'marketing-account-balance',
|
||||
'deposit-account-balance',
|
||||
];
|
||||
|
||||
public function home()
|
||||
{
|
||||
$section = collect(SidebarPermissions::navigationFor(user()))->first();
|
||||
@ -128,6 +137,17 @@ class Pages extends Controller
|
||||
|
||||
public function show(string $section, ?string $page = null, ?string $tab = null)
|
||||
{
|
||||
if ($section === 'billing-transactions' && in_array($page, self::ACCOUNT_BALANCE_PAGES, true)) {
|
||||
$url = route('business.pages.show', array_filter([
|
||||
'section' => self::ACCOUNT_BALANCE_SECTION,
|
||||
'page' => $page,
|
||||
'tab' => $tab,
|
||||
], static fn (mixed $value): bool => $value !== null));
|
||||
$query = request()->getQueryString();
|
||||
|
||||
return redirect()->to($url . ($query === null ? '' : '?' . $query));
|
||||
}
|
||||
|
||||
$sectionConfig = collect(SidebarPermissions::navigationFor(user()))->firstWhere('slug', $section);
|
||||
|
||||
abort_if(empty($sectionConfig), 403, '当前账号没有该页面权限。');
|
||||
@ -1330,14 +1350,17 @@ class Pages extends Controller
|
||||
|
||||
public function export(Request $request, string $section, string $page, string $tab)
|
||||
{
|
||||
abort_unless($section === 'billing-transactions', 404);
|
||||
abort_unless(in_array($section, ['billing-transactions', self::ACCOUNT_BALANCE_SECTION], true), 404);
|
||||
|
||||
$sectionConfig = collect(SidebarPermissions::navigationFor(user()))->firstWhere('slug', $section);
|
||||
abort_if(empty($sectionConfig), 403, '当前账号没有该页面权限。');
|
||||
$pageConfig = collect($sectionConfig['pages'] ?? [])->firstWhere('slug', $page);
|
||||
abort_if(empty($pageConfig), 403, '当前账号没有该页面权限。');
|
||||
abort_unless(collect($pageConfig['tabs'] ?? [])->pluck('slug')->contains($tab), 404);
|
||||
|
||||
if ($page === 'marketing-account-bills') {
|
||||
abort_unless($section === 'billing-transactions', 404);
|
||||
|
||||
if (in_array($tab, self::PROMOTION_MARKETING_TABS, true)) {
|
||||
return $this->exportPlatformPromotionAccounts($request, $section, $page, $tab);
|
||||
}
|
||||
@ -1345,7 +1368,7 @@ class Pages extends Controller
|
||||
return $this->exportMarketingAccountBills($request, $section, $page, $tab);
|
||||
}
|
||||
|
||||
abort_unless($page === 'marketing-account-balance', 404);
|
||||
abort_unless($section === self::ACCOUNT_BALANCE_SECTION && $page === 'marketing-account-balance', 404);
|
||||
abort_unless(in_array($tab, ['taobao-alipay', 'pinduoduo'], true), 404);
|
||||
|
||||
$storeName = mb_substr(trim((string) $request->query('store_name', '')), 0, 191);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
$navigation = [
|
||||
[
|
||||
'slug' => 'company-management',
|
||||
'title' => '公司管理',
|
||||
@ -323,7 +323,7 @@ return [
|
||||
'title' => '账单流水数据',
|
||||
'icon' => 'receipt_long',
|
||||
'pages' => [
|
||||
['slug' => 'store-receiving-balance', 'title' => '店铺收款账户余额'],
|
||||
['slug' => 'bank-transactions', 'title' => '银行账户流水'],
|
||||
[
|
||||
'slug' => 'store-receiving-bills',
|
||||
'title' => '店铺收款账户账单',
|
||||
@ -337,19 +337,6 @@ return [
|
||||
['slug' => 'dewu', 'title' => '得物账户'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'slug' => 'marketing-account-balance',
|
||||
'title' => '店铺营销账户余额',
|
||||
'tabs' => [
|
||||
['slug' => 'taobao-alipay', 'title' => '淘系账户'],
|
||||
['slug' => 'taobao-wechat', 'title' => '阿里巴巴账户'],
|
||||
['slug' => 'pinduoduo', 'title' => '拼多多账户'],
|
||||
['slug' => 'jd-wallet', 'title' => '京东账户'],
|
||||
['slug' => 'douyin', 'title' => '抖音账户'],
|
||||
['slug' => 'dewu', 'title' => '得物账户'],
|
||||
['slug' => 'vipshop', 'title' => '唯品会账户'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'slug' => 'marketing-account-bills',
|
||||
'title' => '店铺营销账户账单',
|
||||
@ -358,16 +345,12 @@ return [
|
||||
['slug' => 'taobao-wechat', 'title' => '淘系微信账户'],
|
||||
['slug' => 'pinduoduo', 'title' => '拼多多账户'],
|
||||
['slug' => 'jd-wallet', 'title' => '京东网银钱包账户'],
|
||||
['slug' => 'douyin', 'title' => '抖音账户'],
|
||||
['slug' => 'dewu', 'title' => '得物账户'],
|
||||
['slug' => 'vipshop', 'title' => '唯品会账户'],
|
||||
['slug' => 'jd-promotion', 'title' => '京东京准通'],
|
||||
['slug' => 'douyin-promotion', 'title' => '抖音千川'],
|
||||
['slug' => 'dewu-promotion', 'title' => '得物推广账户'],
|
||||
['slug' => 'vip-promotion', 'title' => '唯品会推广流水'],
|
||||
],
|
||||
],
|
||||
['slug' => 'deposit-account-balance', 'title' => '店铺保证金账户余额'],
|
||||
[
|
||||
'slug' => 'deposit-account-bills',
|
||||
'title' => '店铺保证金账户账单',
|
||||
@ -381,8 +364,29 @@ return [
|
||||
['slug' => 'vipshop', 'title' => '唯品会账户'],
|
||||
],
|
||||
],
|
||||
['slug' => 'bank-transactions', 'title' => '银行账户流水'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'slug' => 'account-balance-data',
|
||||
'title' => '账单余额数据',
|
||||
'icon' => 'account_balance_wallet',
|
||||
'pages' => [
|
||||
['slug' => 'bank-balance', 'title' => '银行账户余额'],
|
||||
['slug' => 'store-receiving-balance', 'title' => '店铺收款账户余额'],
|
||||
[
|
||||
'slug' => 'marketing-account-balance',
|
||||
'title' => '店铺营销账户余额',
|
||||
'tabs' => [
|
||||
['slug' => 'taobao-alipay', 'title' => '淘系账户'],
|
||||
['slug' => 'taobao-wechat', 'title' => '阿里巴巴账户'],
|
||||
['slug' => 'pinduoduo', 'title' => '拼多多账户'],
|
||||
['slug' => 'jd-wallet', 'title' => '京东账户'],
|
||||
['slug' => 'douyin', 'title' => '抖音账户'],
|
||||
['slug' => 'dewu', 'title' => '得物账户'],
|
||||
['slug' => 'vipshop', 'title' => '唯品会账户'],
|
||||
],
|
||||
],
|
||||
['slug' => 'deposit-account-balance', 'title' => '店铺保证金账户余额'],
|
||||
],
|
||||
],
|
||||
[
|
||||
@ -421,7 +425,7 @@ return [
|
||||
],
|
||||
[
|
||||
'slug' => 'refunds',
|
||||
'title' => '退款',
|
||||
'title' => '退款数据',
|
||||
'icon' => 'assignment_return',
|
||||
'pages' => [
|
||||
['slug' => 'jingxi-refund-data', 'title' => '京喜退款数据'],
|
||||
@ -646,3 +650,39 @@ return [
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
// Keep the requested finance-data sections together while preserving every other section's order.
|
||||
$requestedSectionOrder = [
|
||||
'invoice-management',
|
||||
'fund-management',
|
||||
'order-data',
|
||||
'refunds',
|
||||
'billing-transactions',
|
||||
'account-balance-data',
|
||||
'product-inventory',
|
||||
];
|
||||
$requestedSections = [];
|
||||
$otherSections = [];
|
||||
$insertAt = null;
|
||||
|
||||
foreach ($navigation as $section) {
|
||||
if (in_array($section['slug'], $requestedSectionOrder, true)) {
|
||||
if ($insertAt === null) {
|
||||
$insertAt = count($otherSections);
|
||||
}
|
||||
$requestedSections[$section['slug']] = $section;
|
||||
continue;
|
||||
}
|
||||
|
||||
$otherSections[] = $section;
|
||||
}
|
||||
|
||||
$orderedRequestedSections = array_values(array_filter(
|
||||
array_map(static fn (string $slug): ?array => $requestedSections[$slug] ?? null, $requestedSectionOrder)
|
||||
));
|
||||
|
||||
return array_values(array_merge(
|
||||
array_slice($otherSections, 0, $insertAt ?? count($otherSections)),
|
||||
$orderedRequestedSections,
|
||||
array_slice($otherSections, $insertAt ?? count($otherSections))
|
||||
));
|
||||
|
||||
@ -26,6 +26,61 @@ class MarketingAccountBillsTabsTest extends FeatureTestCase
|
||||
$this->app->instance(MarketingAccountBillMirrorRepository::class, $mirror);
|
||||
}
|
||||
|
||||
public function testBillingNavigationSeparatesFlowAndBalancePages(): void
|
||||
{
|
||||
$navigation = collect(config('business_navigation'));
|
||||
$flowPages = collect($navigation->firstWhere('slug', 'billing-transactions')['pages'])
|
||||
->pluck('slug')->all();
|
||||
$balancePages = collect($navigation->firstWhere('slug', 'account-balance-data')['pages'])
|
||||
->pluck('slug')->all();
|
||||
|
||||
$this->assertSame([
|
||||
'bank-transactions',
|
||||
'store-receiving-bills',
|
||||
'marketing-account-bills',
|
||||
'deposit-account-bills',
|
||||
], $flowPages);
|
||||
$this->assertSame([
|
||||
'bank-balance',
|
||||
'store-receiving-balance',
|
||||
'marketing-account-balance',
|
||||
'deposit-account-balance',
|
||||
], $balancePages);
|
||||
}
|
||||
|
||||
public function testMarketingAccountBillsOmitsRemovedPlatformTabs(): void
|
||||
{
|
||||
$page = collect(config('business_navigation'))
|
||||
->firstWhere('slug', 'billing-transactions')['pages'];
|
||||
$tabs = collect(collect($page)->firstWhere('slug', 'marketing-account-bills')['tabs'])
|
||||
->pluck('slug')->all();
|
||||
|
||||
$this->assertNotContains('douyin', $tabs);
|
||||
$this->assertNotContains('dewu', $tabs);
|
||||
$this->assertNotContains('vipshop', $tabs);
|
||||
$this->assertContains('jd-promotion', $tabs);
|
||||
$this->assertContains('douyin-promotion', $tabs);
|
||||
$this->assertContains('dewu-promotion', $tabs);
|
||||
$this->assertContains('vip-promotion', $tabs);
|
||||
}
|
||||
|
||||
public function testLegacyMarketingAccountBalanceUrlRedirectsToBalanceMenu(): void
|
||||
{
|
||||
$this->allowMarketingAccountBalancePage();
|
||||
|
||||
$this->loginAs()
|
||||
->get(route('business.pages.show', [
|
||||
'section' => 'billing-transactions',
|
||||
'page' => 'marketing-account-balance',
|
||||
'tab' => 'taobao-alipay',
|
||||
]))
|
||||
->assertRedirect(route('business.pages.show', [
|
||||
'section' => 'account-balance-data',
|
||||
'page' => 'marketing-account-balance',
|
||||
'tab' => 'taobao-alipay',
|
||||
]));
|
||||
}
|
||||
|
||||
public function testMarketingAccountBalanceRedirectsToTaobaoAndShowsRestoredControls(): void
|
||||
{
|
||||
$this->allowMarketingAccountBalancePage();
|
||||
@ -42,18 +97,18 @@ class MarketingAccountBillsTabsTest extends FeatureTestCase
|
||||
|
||||
$this->loginAs()
|
||||
->get(route('business.pages.show', [
|
||||
'section' => 'billing-transactions',
|
||||
'section' => 'account-balance-data',
|
||||
'page' => 'marketing-account-balance',
|
||||
]))
|
||||
->assertRedirect(route('business.pages.show', [
|
||||
'section' => 'billing-transactions',
|
||||
'section' => 'account-balance-data',
|
||||
'page' => 'marketing-account-balance',
|
||||
'tab' => 'taobao-alipay',
|
||||
]));
|
||||
|
||||
$this->loginAs()
|
||||
->get(route('business.pages.show', [
|
||||
'section' => 'billing-transactions',
|
||||
'section' => 'account-balance-data',
|
||||
'page' => 'marketing-account-balance',
|
||||
'tab' => 'pinduoduo',
|
||||
]))
|
||||
@ -91,7 +146,14 @@ class MarketingAccountBillsTabsTest extends FeatureTestCase
|
||||
])), false)
|
||||
->assertDontSeeText('淘系微信账户')
|
||||
->assertDontSeeText('京东网银钱包账户')
|
||||
->assertDontSeeText('抖音账户')
|
||||
->assertDontSeeText('得物账户')
|
||||
->assertDontSeeText('唯品会账户')
|
||||
->assertSeeText('抖音千川')
|
||||
->assertSeeText('得物推广账户')
|
||||
->assertSeeText('唯品会推广流水')
|
||||
->assertSee('class="my-6 business-page--marketing-account-bills"', false);
|
||||
|
||||
}
|
||||
|
||||
public function testPinduoduoBillsPageShowsExportForTheCurrentFilters(): void
|
||||
@ -415,14 +477,14 @@ class MarketingAccountBillsTabsTest extends FeatureTestCase
|
||||
|
||||
$this->loginAs()
|
||||
->get(route('business.pages.export', [
|
||||
'section' => 'billing-transactions',
|
||||
'section' => 'account-balance-data',
|
||||
'page' => 'marketing-account-balance',
|
||||
'tab' => 'taobao-alipay',
|
||||
'store_name' => '测试店铺',
|
||||
'month' => '2026-08',
|
||||
]))
|
||||
->assertRedirect(route('business.pages.show', [
|
||||
'section' => 'billing-transactions',
|
||||
'section' => 'account-balance-data',
|
||||
'page' => 'marketing-account-balance',
|
||||
'tab' => 'taobao-alipay',
|
||||
'store_name' => '测试店铺',
|
||||
@ -454,7 +516,7 @@ class MarketingAccountBillsTabsTest extends FeatureTestCase
|
||||
|
||||
$this->loginAs()
|
||||
->get(route('business.pages.show', [
|
||||
'section' => 'billing-transactions',
|
||||
'section' => 'account-balance-data',
|
||||
'page' => 'marketing-account-balance',
|
||||
'tab' => 'taobao-alipay',
|
||||
]))
|
||||
@ -481,12 +543,12 @@ class MarketingAccountBillsTabsTest extends FeatureTestCase
|
||||
|
||||
$this->loginAs()
|
||||
->get(route('business.pages.export', [
|
||||
'section' => 'billing-transactions',
|
||||
'section' => 'account-balance-data',
|
||||
'page' => 'marketing-account-balance',
|
||||
'tab' => 'taobao-alipay',
|
||||
]))
|
||||
->assertRedirect(route('business.pages.show', [
|
||||
'section' => 'billing-transactions',
|
||||
'section' => 'account-balance-data',
|
||||
'page' => 'marketing-account-balance',
|
||||
'tab' => 'taobao-alipay',
|
||||
]))
|
||||
@ -564,7 +626,7 @@ class MarketingAccountBillsTabsTest extends FeatureTestCase
|
||||
|
||||
$this->loginAs();
|
||||
$url = route('business.pages.show', [
|
||||
'section' => 'billing-transactions',
|
||||
'section' => 'account-balance-data',
|
||||
'page' => 'marketing-account-balance',
|
||||
'tab' => 'taobao-alipay',
|
||||
]) . '?page=2';
|
||||
@ -602,7 +664,7 @@ class MarketingAccountBillsTabsTest extends FeatureTestCase
|
||||
setting()->set('system.sidebar_permissions', json_encode([
|
||||
'configured' => [$subject],
|
||||
'subjects' => [
|
||||
$subject => ['billing-transactions/marketing-account-balance'],
|
||||
$subject => ['account-balance-data/marketing-account-balance'],
|
||||
],
|
||||
], JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
|
||||
@ -48,19 +48,54 @@ class NavigationTest extends FeatureTestCase
|
||||
$slugs = array_column($navigation, 'slug');
|
||||
|
||||
$invoiceIndex = array_search('invoice-management', $slugs, true);
|
||||
$fundIndex = array_search('fund-management', $slugs, true);
|
||||
$orderIndex = array_search('order-data', $slugs, true);
|
||||
$refundIndex = array_search('refunds', $slugs, true);
|
||||
$billingIndex = array_search('billing-transactions', $slugs, true);
|
||||
$balanceIndex = array_search('account-balance-data', $slugs, true);
|
||||
$productIndex = array_search('product-inventory', $slugs, true);
|
||||
$receivablesIndex = array_search('store-receivables', $slugs, true);
|
||||
$orderData = $navigation[$orderIndex] ?? null;
|
||||
$refund = $navigation[$refundIndex] ?? null;
|
||||
|
||||
$this->assertNotFalse($invoiceIndex);
|
||||
$this->assertNotFalse($fundIndex);
|
||||
$this->assertNotFalse($orderIndex);
|
||||
$this->assertNotFalse($refundIndex);
|
||||
$this->assertNotFalse($billingIndex);
|
||||
$this->assertNotFalse($balanceIndex);
|
||||
$this->assertNotFalse($productIndex);
|
||||
$this->assertNotFalse($receivablesIndex);
|
||||
$this->assertSame(
|
||||
[
|
||||
'invoice-management',
|
||||
'fund-management',
|
||||
'order-data',
|
||||
'refunds',
|
||||
'billing-transactions',
|
||||
'account-balance-data',
|
||||
'product-inventory',
|
||||
],
|
||||
array_slice($slugs, $invoiceIndex, 7)
|
||||
);
|
||||
$this->assertSame(
|
||||
[
|
||||
'票务管理',
|
||||
'资金管理',
|
||||
'订单数据',
|
||||
'退款数据',
|
||||
'账单流水数据',
|
||||
'账单余额数据',
|
||||
'商品及库存管理',
|
||||
],
|
||||
array_column(array_slice($navigation, $invoiceIndex, 7), 'title')
|
||||
);
|
||||
$this->assertGreaterThan($invoiceIndex, $orderIndex);
|
||||
$this->assertGreaterThan($orderIndex, $refundIndex);
|
||||
$this->assertLessThan($receivablesIndex, $refundIndex);
|
||||
$this->assertGreaterThan($refundIndex, $billingIndex);
|
||||
$this->assertGreaterThan($billingIndex, $balanceIndex);
|
||||
$this->assertGreaterThan($balanceIndex, $productIndex);
|
||||
$this->assertLessThan($receivablesIndex, $productIndex);
|
||||
$this->assertSame('订单数据', $orderData['title']);
|
||||
$this->assertSame(
|
||||
['raw-data', 'bill-offset'],
|
||||
@ -87,7 +122,7 @@ class NavigationTest extends FeatureTestCase
|
||||
['账单冲减'],
|
||||
array_column(array_slice($orderData['pages'], 1), 'title')
|
||||
);
|
||||
$this->assertSame('退款', $refund['title']);
|
||||
$this->assertSame('退款数据', $refund['title']);
|
||||
$this->assertSame('assignment_return', $refund['icon']);
|
||||
$this->assertSame(
|
||||
['jingxi-refund-data', 'non-jingxi-refund-data', 'small-payment-work-orders'],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user