fix: show rolling three month sales headers
This commit is contained in:
parent
d7c0cb6a17
commit
89ffd4e9d5
@ -1,5 +1,11 @@
|
||||
@php
|
||||
$slug = $page['slug'] ?? '';
|
||||
$recentCompletedMonthSalesColumns = collect(range(3, 1))
|
||||
->map(fn (int $monthsAgo): string => now()
|
||||
->startOfMonth()
|
||||
->subMonthsNoOverflow($monthsAgo)
|
||||
->format('n月销量'))
|
||||
->all();
|
||||
$definitions = [
|
||||
'overview' => [
|
||||
'title' => '经营总览', 'description' => '跨主体经营、风险与任务的当日视图',
|
||||
@ -51,7 +57,7 @@
|
||||
],
|
||||
'entity-report' => [
|
||||
'title' => '主体维度经营报表', 'description' => '按公司主体汇总店铺经营表现',
|
||||
'columns' => ['市', '主体', '公司类型', 'ERP系统店铺名称', '店铺所属利润中心', '店铺负责人', '部门负责人', '开店时间', '状态', '展示近3个月月度销量', '连续12个月店铺累计销量', '连续12个月主体累计销量', '能否变更主体', '规划', '新主体(变更流程同步新主体)'],
|
||||
'columns' => ['市', '主体', '公司类型', 'ERP系统店铺名称', '店铺所属利润中心', '店铺负责人', '部门负责人', '开店时间', '状态', ...$recentCompletedMonthSalesColumns, '连续12个月店铺累计销量', '连续12个月主体累计销量', '能否变更主体', '规划', '新主体(变更流程同步新主体)'],
|
||||
'rows' => [['青岛 / 青岛哲晖义商贸有限公司', '小规模纳税人', '6 家', '华北项目组', '¥962,408', '+8.3%', '关注', '变更'], ['济南 / 济南弈辰电子商务有限公司', '一般纳税人', '3 家', '山东项目组', '¥815,220', '-3.7%', '正常', '保留']],
|
||||
],
|
||||
'trademark-progress' => [
|
||||
|
||||
45
tests/Feature/Business/PrototypePageTest.php
Normal file
45
tests/Feature/Business/PrototypePageTest.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Business;
|
||||
|
||||
use Illuminate\Support\Carbon;
|
||||
use Tests\Feature\FeatureTestCase;
|
||||
|
||||
class PrototypePageTest extends FeatureTestCase
|
||||
{
|
||||
protected function tearDown(): void
|
||||
{
|
||||
Carbon::setTestNow();
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function testEntityReportShowsPreviousThreeCompleteMonthsAsSeparateSalesHeaders(): void
|
||||
{
|
||||
Carbon::setTestNow('2026-08-20 12:00:00');
|
||||
|
||||
$augustResponse = $this->loginAs()->get(route('business.pages.show', [
|
||||
'section' => 'company-management',
|
||||
'page' => 'entity-report',
|
||||
]));
|
||||
|
||||
$augustResponse
|
||||
->assertOk()
|
||||
->assertSeeTextInOrder(['5月销量', '6月销量', '7月销量'])
|
||||
->assertDontSeeText('8月销量')
|
||||
->assertDontSeeText('展示近3个月月度销量');
|
||||
|
||||
Carbon::setTestNow('2026-09-01 00:00:00');
|
||||
|
||||
$septemberResponse = $this->get(route('business.pages.show', [
|
||||
'section' => 'company-management',
|
||||
'page' => 'entity-report',
|
||||
]));
|
||||
|
||||
$septemberResponse
|
||||
->assertOk()
|
||||
->assertSeeTextInOrder(['6月销量', '7月销量', '8月销量'])
|
||||
->assertDontSeeText('5月销量')
|
||||
->assertDontSeeText('9月销量');
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user