@php $showDirectoryIntro = $showDirectoryIntro ?? true; $showDirectoryIndex = $showDirectoryIndex ?? true; $enableColumnResize = $enableColumnResize ?? false; $columnWidths = is_array($columnWidths ?? null) ? $columnWidths : []; $directoryRows = $rows ?? collect(); $directoryFields = $directory['fields'] ?? []; $isInventoryReportPage = ($page['slug'] ?? '') === 'inventory-report'; $inventoryWarehouseMappings = $isInventoryReportPage ? ($inventoryWarehouseMappings ?? collect()) : collect(); $inventoryUnmappedWarehouseSummary = $isInventoryReportPage ? ($inventoryUnmappedWarehouseSummary ?? []) : []; $inventoryUnmappedWarehouseRows = $inventoryUnmappedWarehouseSummary['missing'] ?? []; $requestedInventoryWarehouseMappingView = $inventoryWarehouseMappingView ?? 'mapped'; $inventoryWarehouseMappingView = in_array( $requestedInventoryWarehouseMappingView, ['mapped', 'unmapped'], true, ) ? $requestedInventoryWarehouseMappingView : 'mapped'; $warehouseMappingPreview = $isInventoryReportPage ? session('warehouse_mapping_preview') : null; // 页面配置在部分导航上下文中会省略父级 slug,优先使用当前路由参数避免功能开关失配。 $directoryRouteSection = request()->route('section') ?: request()->segment(3) ?: ($section['slug'] ?? ''); $directoryRoutePage = request()->route('page') ?: request()->segment(4) ?: ($page['slug'] ?? ''); $directoryPageKey = (string) $directoryRouteSection . '/' . (string) $directoryRoutePage; $columnPreferenceVersion = (string) ($columnPreferenceVersion ?? ''); if ($columnPreferenceVersion === '') { $columnPreferenceVersion = $directoryPageKey === 'company-management/subject-operating-report' ? 'subject-service-company-income-v2' : ($directoryPageKey === 'store-management/store-report' ? 'empty-month-columns-v1' : ''); } $isInternalFlowReportPage = $directoryPageKey === 'store-management/internal-flow-report'; $internalFlowProjection = $isInternalFlowReportPage ? request()->attributes->get('internal-flow-report.projection') : null; $internalFlowProjectionError = $isInternalFlowReportPage ? request()->attributes->get('internal-flow-report.projection-error') : null; $internalFlowForecastMonthLabel = (string) ( $internalFlowProjection['forecast_month_label'] ?? now()->format('n') . '月' ); $internalFlowSourceMonthLabel = (string) ( $internalFlowProjection['source_month_label'] ?? now()->startOfMonth()->subMonthNoOverflow()->format('n') . '月' ); $internalFlowCostToIncomeRules = $isInternalFlowReportPage ? (array) config('internal_flow_report.cost_to_income', []) : []; // “最近三个月销量”必须是三个独立的月份列;月份按当前月向前取三个完整月份。 // 保留原字段名作为兼容契约,渲染时展开为 *_1、*_2、*_3 三个值。 $directoryFields = collect($directoryFields)->flatMap(function (array $field): array { if (($field['name'] ?? null) !== 'recent_three_month_sales') { return [$field]; } return collect(range(3, 1))->map(function (int $monthsAgo): array { $month = now()->startOfMonth()->subMonthsNoOverflow($monthsAgo); return [ 'name' => 'recent_three_month_sales_' . (4 - $monthsAgo), 'label' => $month->format('n月') . '销量', 'kind' => 'number', ]; })->all(); })->values()->all(); if ($isInternalFlowReportPage) { $directoryFields = collect($directoryFields)->map(function (array $field) use ($internalFlowForecastMonthLabel): array { if (($field['name'] ?? null) === 'projected_sales') { $field['label'] = '预计' . $internalFlowForecastMonthLabel . '销量'; } return $field; })->values()->all(); } if ($directoryPageKey === 'company-management/subject-operating-report') { $previousSettlementMonthLabel = now() ->startOfMonth() ->subMonthNoOverflow() ->format('n'); $directoryFields = collect($directoryFields)->map(function (array $field) use ($previousSettlementMonthLabel): array { if (($field['name'] ?? null) === 'previous_month_settlement_income') { $field['label'] = $previousSettlementMonthLabel . '月店铺结算收入-服务公司'; } return $field; })->values()->all(); } $directoryStatusCountData = request()->attributes->get('directory.status-counts'); $directoryStatusCountData = is_array($directoryStatusCountData) ? $directoryStatusCountData : []; $directoryStatusCountFields = collect($directoryStatusCountData['fields'] ?? []) ->filter(static fn (mixed $field): bool => is_array($field) && filled($field['name'] ?? null) && filled($field['label'] ?? null)) ->values() ->all(); $directoryStatusCountFieldNames = array_column($directoryStatusCountFields, 'name'); $directoryStatusCountTotal = max((int) ($directoryStatusCountData['total'] ?? 0), 0); // 字段配置里带 group 的目录表按 Excel 样式渲染两层合并表头:同组字段共用一个一级标题, // 未分组的列标题跨两行显示,列顺序固定为配置顺序。 $directoryHasGroupedHeader = collect($directoryFields)->contains(fn (array $field): bool => filled($field['group'] ?? null)); $directoryLastFieldName = collect($directoryFields)->last()['name'] ?? null; $directoryIsPaginated = is_object($directoryRows) && method_exists($directoryRows, 'total'); $directoryTotal = $directoryIsPaginated ? $directoryRows->total() : (is_countable($directoryRows) ? count($directoryRows) : 0); $directoryCurrentPage = $directoryIsPaginated ? $directoryRows->currentPage() : 1; $directoryLastPage = $directoryIsPaginated ? $directoryRows->lastPage() : 1; $directoryPerPage = $directoryIsPaginated ? $directoryRows->perPage() : 0; $directoryUsesFieldQuery = in_array($directoryPageKey, [ 'company-management/basic-information', 'store-management/basic-information', 'trademark-management/information', 'store-management/store-accounts', 'store-management/store-report', 'company-management/subject-operating-report', 'company-management/company-cost-arrangement', 'company-management/tax-forecast', 'company-management/personnel-inventory', 'store-management/internal-flow-report', 'financial-operations/courier-freight', 'financial-risk-control/process-statistics', ], true); $directoryQueryPageDescriptions = [ 'company-management/basic-information' => '公司主体、状态和登记资料的查询与导出', 'store-management/basic-information' => '店铺主体、平台和经营资料的查询与导出', 'trademark-management/information' => '商标主体、状态和登记资料的查询与导出', 'store-management/store-accounts' => '店铺账号资料的查询与安全状态导出', 'store-management/store-report' => '按店铺、主体和月份销量查询经营数据并导出', 'company-management/subject-operating-report' => '按主体和收入月份查询经营汇总并导出', 'company-management/company-cost-arrangement' => '按公司类型和发票类型查询成本安排字段', 'company-management/tax-forecast' => '按税务类型、工商类型和征收方式查询税金预测口径;规则参数在「规则信息 → 税金预测表逻辑配置」维护', 'company-management/personnel-inventory' => '按人员、职位和公司类型查询人员盘点字段', 'product-inventory/monthly-weighted-average-price' => '按月份、商品编码、仓储方和分类查询商品月加权平均单价', 'store-management/internal-flow-report' => '按抬头、标签查询内部流转明细并导出', 'financial-operations/courier-freight' => '按来源(月份)和交易单号查询快递方提供的成本运费明细', ]; @endphp
@if ($directoryUsesFieldQuery) {{ $directory['status'] ?? '尚未同步' }}
{{ $page['title'] ?? $section['title'] }}

{{ $directoryQueryPageDescriptions[$directoryPageKey] ?? '按当前字段查询、筛选并导出业务数据' }}

@if ($directoryPageKey === 'company-management/basic-information' && request()->filled('shareholder_company'))
当前仅显示 {{ request('shareholder_company') }} 作为股东持股的其他公司,共 {{ number_format($directoryTotal) }} 家。 清除持股筛选
@endif @if (!empty($upstreamError)) @elseif ($isInternalFlowReportPage && !empty($internalFlowProjectionError)) @elseif ($isInternalFlowReportPage && $directoryTotal > 0)
预计{{ $internalFlowForecastMonthLabel }}销量取自主体维度经营报表{{ $internalFlowSourceMonthLabel }}业绩;买家开票按 20%、内部开票额度按 25%、所需进项成本按 80% 计算。心选可按索菲亚收票金额倒推收入:收入 = 金额 ÷ 90%,心选不向买家开票,内部开票按全额收入计算。内部开票按标签 1→2→3→4 顺延,票不足时计入剩余缺口。
@elseif ($directoryTotal > 0 && in_array($directoryPageKey, ['store-management/store-accounts', 'store-management/store-report', 'company-management/subject-operating-report', 'company-management/company-cost-arrangement', 'company-management/personnel-inventory'], true))
已从共享业务镜像读取 {{ $directoryTotal }} 条数据,当前页面为只读展示。
@endif @else @if ($isInventoryReportPage)
@else @if ($showDirectoryIntro)
@if (!empty($directory['title'])) {{ $directory['title'] }} @else {{ $page['title'] ?? $section['title'] }}{{ ($page['slug'] ?? '') === 'performance-details' ? '' : ' · 字段结构' }} @endif @if (!empty($directory['description']) && ($page['slug'] ?? '') !== 'performance-details')

{{ $directory['description'] }}

@endif
{{ $directory['status'] ?? '尚未同步' }}
@endif @endif @if (!empty($upstreamError)) @elseif (! $showDirectoryIntro) {{-- 页面已通过自身标题和汇总区说明数据范围,不再重复展示目录提示。 --}} @elseif (($directory['status'] ?? null) === '演示数据' && $directoryTotal > 0)
已按附件模板导入 {{ $directoryTotal }} 条演示数据,当前页面为只读展示。
@elseif ($directoryTotal > 0)
已从共享业务镜像读取 {{ $directoryTotal }} 条数据,当前页面为只读展示。
@elseif (($directory['status'] ?? null) === '既有只读上游')
当前页面只读显示既有上游资料;未匹配的 Excel 字段保留为空,不代表业务上没有数据。
@elseif (($directory['status'] ?? null) === '共享镜像' && $directoryTotal > 0)
当前显示团队共享业务镜像数据,分页和汇总均基于已同步镜像。
@else
{{ $directory['empty'] ?? '数据尚未同步,当前只展示已确认的字段结构。' }}
@endif @endif @if (($page['slug'] ?? '') === 'performance-details' && !empty($receiptStats)) @php $receiptMetricCards = [ ['metric' => 'income_amount', 'label' => '账单收入', 'value' => $receiptStats['income_total']], ['metric' => 'discount_amount', 'label' => '优惠收入', 'value' => $receiptStats['discount_total'] ?? 0], ['metric' => 'offset_amount', 'label' => '冲减收入', 'value' => $receiptStats['offset_total'] ?? 0], ['metric' => 'default_compensation_amount', 'label' => '违约赔付', 'value' => $receiptStats['default_compensation_total'] ?? 0], ['metric' => 'refund_amount', 'label' => '退款金额', 'value' => $receiptStats['refund_total'] ?? 0], ['metric' => 'planting_amount', 'label' => '种菜金额', 'value' => $receiptStats['planting_total'] ?? 0], ['metric' => 'paid_amount', 'label' => '订单核对金额', 'value' => $receiptStats['paid_total'] ?? 0], ['metric' => 'difference', 'label' => '差额合计', 'value' => $receiptStats['difference_total']], ]; @endphp
金额指标 点击任一指标,查看平台、店铺与账单项目明细;明细合计会与指标总额自动核对。
@foreach ($receiptMetricCards as $metricCard) @endforeach

指标明细

按平台、店铺和账单项目汇总

当前筛选合计(万元) ¥0.00
平台 总金额(万元)
加载中…
共 0 条平台汇总

业绩明细口径说明

仅在需要核对字段时查看,不占用主页面空间。

匹配口径

  • 一行 = 一个店铺 + 一个线上订单号。
  • 订单实付取订单级实付,并扣除虚拟条码行实付;合单/拆单只归入一次。
  • 账单项目通过科目映射表转换为收入、优惠收入、冲减收入、违约赔付或退款。

金额关系

  • 差额 = 收入 + 优惠收入 + 冲减收入 + 违约赔付 − 订单实付。
  • 命中“订单实付按卖家实收核对”或“订单实付按应付/已付核对”时,订单核对金额展示实际参与比对的金额。
  • 退款金额、种菜金额单独展示,不参与差额计算。
  • 点击指标卡后,账单类指标按平台、店铺、账单名称汇总;明细合计应与指标总额一致。

状态说明

  • “已匹配/未匹配”表示订单与账单是否找到对应关系。
  • “订单实付按卖家实收核对”“订单实付按应付/已付核对”是差额口径,不是未匹配异常。
@endif @if (!empty($directoryFields)) @php $directoryQueryFields = match ($directoryPageKey) { 'company-management/basic-information' => [ ['name' => 'unified_social_credit_code', 'label' => '统一社会信用代码', 'placeholder' => '输入完整或部分代码'], ['name' => 'company_name', 'label' => '公司名称', 'placeholder' => '输入公司名称关键词'], ['name' => 'taxpayer_type', 'label' => '税务类型'], ['name' => 'business_registration_type', 'label' => '工商类型'], ['name' => 'company_status', 'label' => '公司状态'], ['name' => 'legal_representative', 'label' => '法人', 'placeholder' => '按姓名查询'], ['name' => 'city', 'label' => '城市', 'placeholder' => '城市较多,使用搜索'], ['name' => 'related_people', 'label' => '相关人员', 'placeholder' => '输入人员姓名,模糊匹配'], ['name' => 'company_type', 'label' => '公司类型'], ], 'product-inventory/monthly-weighted-average-price' => [ ['name' => 'month', 'label' => '月份', 'kind' => 'date'], ['name' => 'product_code', 'label' => '商品编码', 'placeholder' => '按商品编码精确查询'], ['name' => 'warehouse_provider', 'label' => '仓储方', 'placeholder' => '支持包含查询'], ['name' => 'category', 'label' => '分类', 'placeholder' => '支持包含查询'], ], 'store-management/internal-flow-report' => [ ['name' => 'company_name', 'label' => '抬头', 'placeholder' => '输入公司名称关键词'], ['name' => 'tag', 'label' => '标签'], ], 'company-management/tax-forecast' => [ ['name' => 'company_name', 'label' => '公司名称', 'placeholder' => '输入公司名称关键词'], ['name' => 'taxpayer_type', 'label' => '公司税务类型'], ['name' => 'business_registration_type', 'label' => '工商类型'], ['name' => 'collection_method', 'label' => '征收方式'], ['name' => 'forecast_month', 'label' => '预测月份', 'placeholder' => '例如 2026-10'], ], default => $directoryFields, }; $directoryExcludedQueryFields = match ($directoryPageKey) { 'store-management/basic-information' => ['opened_at', 'renewed_at'], 'trademark-management/information' => ['registration_date', 'expiry_date'], // 快递运费:金额 / 配件类别 / 运费差 / 其他附加费 / 退件费都不做查询条件(后三列来自快递应付的汇总快照)。 'financial-operations/courier-freight' => [ 'part', 'freight_amount', 'freight_difference', 'settled_freight', 'other_surcharge_amount', 'return_fee_amount', ], // 流程统计:查询条件保留外部店铺申请页那一套(单据编号/申请人/日期/审批人/店铺/平台/负责人/利润中心/商标/类型/状态),其余列只做展示。 'financial-risk-control/process-statistics' => [ 'current_node', 'node_entered_at', 'shop_name', 'customer_manager', 'change_reason', 'close_reason', 'expected_closing_time', 'refund_type', 'refund_amount', 'change_successful', ], default => [], }; if (!empty($directoryExcludedQueryFields)) { $directoryQueryFields = collect($directoryQueryFields) ->reject(fn (array $field): bool => in_array( $field['name'], $directoryExcludedQueryFields, true, )) ->values() ->all(); } $directoryMoreQueryFields = collect($directoryQueryFields) ->filter(function (array $field) use ($directoryPageKey): bool { $kind = $field['kind'] ?? 'text'; return in_array($directoryPageKey, [ 'store-management/store-report', 'company-management/subject-operating-report', 'company-management/company-cost-arrangement', 'company-management/personnel-inventory', ], true) && in_array($kind, ['date', 'number', 'integer', 'secret', 'secret_status'], true); }) ->values() ->all(); $directoryPrimaryQueryFields = collect($directoryQueryFields) ->reject(fn (array $field): bool => in_array($field['name'], array_column($directoryMoreQueryFields, 'name'), true)) // 自动跟随上游补进来的列只做展示,不生成查询条件(后端没有对应的筛选口径)。 ->reject(fn (array $field): bool => (bool) ($field['followed'] ?? false)) ->values() ->all(); $directorySelectFields = match (($section['slug'] ?? '') . '/' . ($page['slug'] ?? '')) { 'company-management/basic-information' => ['taxpayer_type', 'business_registration_type', 'company_status', 'company_type'], 'store-management/basic-information' => ['platform', 'store_status', 'withdrawal_account'], 'trademark-management/information' => ['trademark_status'], 'store-management/store-accounts' => ['account_type', 'password_configured'], 'store-management/store-report' => ['status', 'can_change', 'company_type'], 'company-management/subject-operating-report' => ['company_type', 'tax_type', 'business_registration_type', 'can_change_entity'], 'company-management/company-cost-arrangement' => ['company_type', 'invoice_type'], 'company-management/tax-forecast' => ['taxpayer_type', 'business_registration_type', 'collection_method'], 'company-management/personnel-inventory' => ['company_type'], 'store-management/internal-flow-report' => ['tag'], 'financial-operations/courier-freight' => ['source'], default => [], }; // 这些字段渲染成可搜索多选(按钮 + 复选面板),提交为 xxx[],多个取值取并集。 $directoryMultiSelectOptions = match (($section['slug'] ?? '') . '/' . ($page['slug'] ?? '')) { 'store-management/store-accounts' => [ 'authorization_status' => ['已授权', '已过期', '未授权'], 'store_status' => ['正常', '关闭中', '已关闭'], // 该店铺最近一单申请流程(开店/变更/关店/主体注销自动)的类型与审批状态。 'flow_type' => ['店铺开店', '店铺变更', '店铺关店', '主体注销自动流程'], 'approval_status' => ['流程中', '待审批', '完成', '拒绝', '撤回', '暂存', '待签署', '已签署'], ], 'financial-risk-control/process-statistics' => [ 'flow_type' => ['店铺开店', '店铺变更', '店铺关店', '主体注销自动流程'], 'approval_status' => ['流程中', '待审批', '完成', '拒绝', '撤回', '暂存', '待签署', '已签署'], 'node_waiting_days' => array_keys( \Modules\EcommerceFinance\Repositories\ShopInfoFlowMirrorRepository::WAITING_DAY_BUCKETS ), 'platform' => [ '京东', '京东供销', '京东自营', '京喜企业店', '唯品会', '唯品会MP', '外贸', '外贸部', '天猫', '小红书', '希音', '得物', '快手小店', '抖音小店', '拼多多', '拼多多跨境', '淘宝', '淘宝分销', '淘工厂', '红星', '视频号小店', '贝贝', '速卖通', '阿里巴巴', '阿里巴巴国际站', ], ], default => [], }; $directoryMultiSelectFields = array_keys($directoryMultiSelectOptions); $companyInformationTaxpayerOptions = array_values(array_unique(array_merge( ['一般纳税人', '小规模纳税人', '个体工商户', '无税务登记', 'CORP'], (array) request()->attributes->get('company-information.taxpayer-type-options', []), ))); $companyInformationBusinessRegistrationOptions = array_values(array_unique(array_merge( ['核定', '个人独资企业', '/'], (array) request()->attributes->get('company-information.business-registration-type-options', []), ))); $directoryQuerySuggestionOptions = match (($section['slug'] ?? '') . '/' . ($page['slug'] ?? '')) { 'financial-risk-control/process-statistics' => [ 'current_approver' => (array) request()->attributes->get('process-statistics.current-approvers', []), ], default => [], }; $directoryColumnNames = collect($directoryFields)->pluck('name')->all(); $requestedDirectoryColumns = array_values(array_intersect( array_filter(explode(',', (string) request('columns', ''))), $directoryColumnNames, )); // 主体维度经营报表、店铺维度报表:没有数据的月份列默认隐藏,仍保留在「筛选字段」中供手动勾选显示。 $directoryDefaultColumns = $directoryColumnNames; $directoryDefaultHiddenColumns = match ($directoryPageKey) { 'company-management/subject-operating-report' => request()->attributes->get('subject-operating-report.default_hidden_columns', []), 'store-management/store-report' => request()->attributes->get('store-report.default_hidden_columns', []), default => [], }; if ((array) $directoryDefaultHiddenColumns !== []) { $directoryDefaultColumns = array_values(array_diff( $directoryColumnNames, (array) $directoryDefaultHiddenColumns, )); } $visibleDirectoryColumns = request()->has('columns') ? $requestedDirectoryColumns : $directoryDefaultColumns; $directoryQueryFormId = 'directory-query-form-' . ($page['slug'] ?? 'page'); @endphp @if ($directoryUsesFieldQuery) @if ($directoryMultiSelectFields !== []) @include('business.pages.partials.multi-select') @endif
查询条件 类型较少的字段直接选择,内容较多的字段支持关键词搜索
{{-- 这个空表单只是给下面的控件当 form= 的提交目标;不隐藏的话会占掉栅格第一格, 把筛选字段整体挤到第二列去。 --}} @if (request()->has('columns')) @endif @if ($directoryPageKey === 'company-management/basic-information' && request()->filled('shareholder_company')) @endif @foreach ($directoryPrimaryQueryFields as $field) @php $kind = $field['kind'] ?? 'text'; @endphp @continue($kind === 'secret' && $field['name'] !== 'withdrawal_account') @continue(($page['slug'] ?? '') === 'store-accounts' && in_array($field['name'], [ 'account', 'password_configured', 'bound_phone', 'verification_contact', 'account_group_name', 'created_at', 'updated_at', ], true)) @if (in_array($field['name'], $directoryMultiSelectFields, true)) @php $multiSelected = array_values(array_filter( array_map(static fn (mixed $value): string => is_scalar($value) ? trim((string) $value) : '', (array) request($field['name'], [])), static fn (string $value): bool => $value !== '', )); @endphp
{{ $field['label'] }}
@continue @endif @endforeach @if ($directoryMoreQueryFields !== [])
更多查询条件({{ count($directoryMoreQueryFields) }})
@foreach ($directoryMoreQueryFields as $field) @php $kind = $field['kind'] ?? 'text'; @endphp @continue($kind === 'secret' && $field['name'] !== 'withdrawal_account') @continue(($page['slug'] ?? '') === 'store-accounts' && in_array($field['name'], [ 'account', 'password_configured', 'bound_phone', 'verification_contact', 'account_group_name', 'created_at', 'updated_at', ], true)) @endforeach
@endif
@if ($directoryStatusCountFields !== []) @endif
筛选字段{{ count($visibleDirectoryColumns) < count($directoryFields) ? ' ' . count($visibleDirectoryColumns) . '/' . count($directoryFields) : '' }}
勾选需要显示的表头,可重复调整。 @foreach ($directoryFields as $field) @endforeach
导出 Excel
默认全选,可取消不需要导出的表头。 @foreach ($directoryFields as $field) @endforeach
@if ($directoryStatusCountFields !== [])

状态数量查询

输入状态名称,直接查看它在当前筛选结果中的数量。

基于当前筛选结果,全量 {{ number_format($directoryStatusCountTotal) }} 条; 显示全部状态

@foreach ($directoryStatusCountFields as $statusCountField)
{{ $statusCountField['label'] }} {{ count($statusCountField['values'] ?? []) }} 种状态
    @foreach (($statusCountField['values'] ?? []) as $statusCountValue)
  • {{ $statusCountValue['label'] }} {{ number_format((int) $statusCountValue['count']) }}条
  • @endforeach
@endforeach
数量按当前筛选条件下的全部记录统计,不受当前页 50 条限制。
@endif @if ($directoryMultiSelectFields !== []) @endif @endif @if (($page['slug'] ?? '') === 'store-report' && ! $directoryUsesFieldQuery)
@php $storeFilterTextFields = [ ['name' => 'store_name', 'label' => '店铺名称:'], ['name' => 'store_id', 'label' => '店铺ID:'], ['name' => 'profit_center', 'label' => '利润中心:'], ['name' => 'store_manager', 'label' => '店铺负责人:'], ['name' => 'department_manager', 'label' => '部门负责人:'], ['name' => 'entity', 'label' => '主体:'], ['name' => 'company_type', 'label' => '公司类型:'], ]; $storeFilterDateFields = [ ['name' => 'opened_at', 'label' => '开店时间:'], ['name' => 'effective_at', 'label' => '生效时间:'], ['name' => 'invalid_at', 'label' => '失效时间:'], ]; @endphp @foreach ($storeFilterTextFields as $filter) @endforeach @foreach ($storeFilterDateFields as $filter) @endforeach
清除
@elseif (($page['slug'] ?? '') === 'performance-details') @include('business.pages.partials.multi-select')
{{-- 查询时保留当前每页条数 --}}
平台:
店铺名称:
主体:
差额:
差额异常备注:
匹配状态:
匹配原因:
清除
@elseif (in_array(($page['slug'] ?? ''), ['inventory-report', 'monthly-weighted-average-price'], true))
清除
@endif @include('business.pages.partials.business-summary-cards', [ 'summaryCards' => request()->attributes->get('business-page-summary-cards', []), ]) @if (! $directoryUsesFieldQuery) @php $directoryMonthOptions = []; if ($directoryHasGroupedHeader) { $directoryMonthOptions = \Illuminate\Support\Facades\DB::connection((string) config('upstream_mirrors.connection', 'business_mirror')) ->table('product_monthly_weighted_average_states') ->where('status', 'computed') ->orderByDesc('report_month') ->pluck('report_month') ->map(static fn ($month): string => substr((string) $month, 0, 10)) ->all(); } $directoryActiveMonth = substr(trim((string) request('month', '')), 0, 10) ?: ($directoryMonthOptions[0] ?? ''); @endphp
@if (in_array(($page['slug'] ?? ''), ['inventory-report', 'monthly-weighted-average-price', 'performance-details'], true)) @else
@endif
@endif
@if ($showDirectoryIndex && ! $directoryHasGroupedHeader) @endif @if ($directoryHasGroupedHeader) @php $groupedHeaderRuns = []; foreach ($directoryFields as $field) { $group = $field['group'] ?? null; $lastIndex = count($groupedHeaderRuns) - 1; if ($group !== null && $lastIndex >= 0 && $groupedHeaderRuns[$lastIndex]['group'] === $group) { $groupedHeaderRuns[$lastIndex]['fields'][] = $field; } else { $groupedHeaderRuns[] = ['group' => $group, 'fields' => [$field]]; } } @endphp @foreach ($groupedHeaderRuns as $headerRun) @if ($headerRun['group'] === null) @foreach ($headerRun['fields'] as $field) @endforeach @else @endif @endforeach @else @foreach ($directoryFields as $field) @endforeach @endif @if ($directoryHasGroupedHeader) @foreach ($directoryFields as $field) @continue(!isset($field['group'])) @endforeach @endif @forelse ($directoryRows as $rowIndex => $row) @if ($showDirectoryIndex && ! $directoryHasGroupedHeader) @endif @foreach ($directoryFields as $field) @php $source = array_key_exists('source', $field) ? $field['source'] : $field['name']; $value = $source ? data_get($row, $source) : null; $companyName = trim((string) data_get($row, 'company_name', '')); $manualReceiptRule = $internalFlowCostToIncomeRules[$companyName] ?? null; $kind = $field['kind'] ?? 'text'; $display = $value; if ($kind === 'secret') { $display = filled($value) ? '已配置' : '—'; } elseif ($kind === 'secret_status') { $display = $value === null || $value === '' ? '状态未同步' : ($value ? '已设置' : '未设置'); } elseif ($kind === 'date' && filled($value)) { $display = substr((string) $value, 0, 10); } elseif ($kind === 'percent' && is_numeric($value)) { $percent = rtrim(rtrim(number_format((float) $value * 100, 2, '.', ''), '0'), '.'); $display = $percent . '%'; } elseif ($kind === 'number' && is_numeric($value)) { $display = number_format((float) $value, 2); } elseif ($kind === 'integer' && is_numeric($value)) { $display = number_format((int) $value); } elseif ($kind === 'boolean' && $value !== null && $value !== '') { $display = in_array($value, [true, 1, '1', '是', '✔'], true) ? '是' : '否'; } $badgeTone = null; if ($kind === 'badge') { $badgeText = trim((string) ($display ?? '')); $badgeTone = (string) (($field['tones'] ?? [])[$badgeText] ?? 'neutral'); if ($badgeTone === 'neutral') { $badgeTone = match (true) { in_array($badgeText, ['正常', '开店中', '存续中', '有效', '已完成', '已通过', '是'], true) => 'success', in_array($badgeText, ['已注销', '已关闭', '关店', '拒绝', '已拒绝'], true) => 'danger', in_array($badgeText, ['待维护', '关店中', '关闭中', '未启用', '未设置', '待处理', '待审批', '暂存'], true) => 'warning', in_array($badgeText, ['/'], true) => 'muted', default => 'neutral', }; } } @endphp @endforeach @empty @endforelse
{{ $directory['index_label'] ?? '序号' }}{{ $field['label'] }}{{ $headerRun['group'] }} @if ($directoryUsesFieldQuery) @php $isSorted = request('sort') === $field['name']; $direction = $isSorted ? request('direction', 'asc') : null; $nextDirection = $isSorted && $direction === 'asc' ? 'desc' : 'asc'; @endphp
{{ $field['label'] }}
升序 降序 @if (in_array($field['name'], $directoryStatusCountFieldNames, true)) @endif
@elseif ($isInventoryReportPage && $field['name'] === 'warehouse_short_name') @else {{ $field['label'] }} @endif
{{ $field['label'] }}
{{ $rowIndex + 1 + (($directoryCurrentPage - 1) * $directoryPerPage) }} @if (($page['slug'] ?? '') === 'store-accounts' && $field['name'] === 'password_configured') {{ filled($display) ? $display : '—' }} @if ($value === false) 未设置 @else 读取中… @endif @elseif ( $isInternalFlowReportPage && ( $field['name'] === 'receipt_from_supplier' || ( is_array($manualReceiptRule) && $field['name'] === ($manualReceiptRule['receipt_field'] ?? null) ) ) ) @php $receiptField = $field['name']; $isSuofeiyaReceipt = $receiptField === 'receipt_from_suofeiya'; $receiptLabel = $isSuofeiyaReceipt ? '收票-索菲亚' : '收票-供应商'; $receiptRoute = $isSuofeiyaReceipt ? 'business.internal-flow-report.suofeiya-receipt' : 'business.internal-flow-report.supplier-receipt'; @endphp
@csrf @method('PATCH')
@else @if ($kind === 'badge' && filled($display)) {{ $display }} @else {{ filled($display) ? $display : ($isInventoryReportPage && $field['name'] === 'warehouse_short_name' ? '' : '—') }} @endif @endif
{{ !empty($upstreamError) ? '资料暂时无法读取,请按上方提示检查连接;这不代表业务数据为 0。' : ($directory['empty'] ?? '尚未同步数据。') }}
@if ($directoryIsPaginated && empty($upstreamError)) @php $directoryIsReceiptMatchPage = ($page['slug'] ?? '') === 'performance-details'; $directoryLastPageSafe = max((int) $directoryLastPage, 1); @endphp
共 {{ number_format($directoryTotal) }} 条 · 第 {{ number_format($directoryCurrentPage) }} / {{ number_format($directoryLastPageSafe) }} 页 @if ($directoryIsReceiptMatchPage) @endif @if ($directoryRows->onFirstPage()) @if ($directoryIsReceiptMatchPage) « @endif 上一页 @else @if ($directoryIsReceiptMatchPage) « @endif 上一页 @endif · @if ($directoryRows->hasMorePages()) 下一页 @if ($directoryIsReceiptMatchPage) » @endif @else 下一页 @if ($directoryIsReceiptMatchPage) » @endif @endif @if ($directoryIsReceiptMatchPage && $directoryLastPageSafe > 1) @endif
@if ($directoryIsReceiptMatchPage) @endif @endif @if ($isInventoryReportPage)
@php // 入库明细数据:先做只读展示(数据来自 inventory:inbound-detail:import 导入的原始明细)。 $inboundConnection = (string) config('upstream_mirrors.connection', 'business_mirror'); $inboundMonths = \Illuminate\Support\Facades\DB::connection($inboundConnection) ->table('inventory_inbound_detail_rows') ->selectRaw('report_month, count(*) as total') ->groupBy('report_month') ->orderByDesc('report_month') ->get(); $inboundMonth = substr(trim((string) request('detail_month', '')), 0, 10); if ($inboundMonth === '' || ! $inboundMonths->contains(fn ($row): bool => substr((string) $row->report_month, 0, 10) === $inboundMonth)) { $inboundMonth = $inboundMonths->first() ? substr((string) $inboundMonths->first()->report_month, 0, 10) : ''; } $inboundPage = max((int) request('detail_page', 1), 1); $inboundPerPage = 25; $inboundWarehouse = trim((string) request('detail_warehouse', '')); $inboundBarcode = trim((string) request('detail_barcode', '')); $inboundQuery = \Illuminate\Support\Facades\DB::connection($inboundConnection) ->table('inventory_inbound_detail_rows'); if ($inboundMonth !== '') { $inboundQuery->where('report_month', $inboundMonth); } if ($inboundWarehouse !== '') { $like = '%' . addcslashes($inboundWarehouse, '%_\\') . '%'; $inboundQuery->where(function ($inner) use ($like): void { $inner->where('warehouse', 'like', $like)->orWhere('warehouse_short_name', 'like', $like); }); } if ($inboundBarcode !== '') { $inboundQuery->where('barcode', 'like', '%' . addcslashes($inboundBarcode, '%_\\') . '%'); } $inboundTotal = (clone $inboundQuery)->count(); $inboundRows = $inboundQuery ->orderBy('row_key') ->forPage($inboundPage, $inboundPerPage) ->get(); $inboundLastPage = max((int) ceil($inboundTotal / $inboundPerPage), 1); @endphp @endif @if (($page['slug'] ?? '') === 'subject-operating-report') @endif @endif
@if (($page['slug'] ?? '') === 'store-accounts') @include('business.pages.partials.store-account-password') @endif @once @endonce