diff --git a/app/Http/Controllers/Business/Pages.php b/app/Http/Controllers/Business/Pages.php index 90ad36b8..91344433 100644 --- a/app/Http/Controllers/Business/Pages.php +++ b/app/Http/Controllers/Business/Pages.php @@ -2209,8 +2209,6 @@ class Pages extends Controller 'online_order_no' => trim((string) request('online_order_no', '')), 'product_code' => trim((string) request('product_code', '')), 'warehouse_short_name' => trim((string) request('warehouse_short_name', '')), - 'missing_price' => request()->boolean('missing_price') ? '1' : '', - 'include_excluded' => request()->boolean('include_excluded') ? '1' : '', ]; $empty = new LengthAwarePaginator([], 0, $limit, $page, [ @@ -2230,7 +2228,9 @@ class Pages extends Controller ]; } - $applyFilters = static function ($query, bool $excludedWarehouseOnly = false) use ($filters): void { + // 页面不再提供「只看未匹配单价 / 包含-不看仓」两个开关:默认全部数据展示, + // 已匹配与未匹配单价、所有仓库(含「-不看」仓)都纳入统计与列表。 + $applyFilters = static function ($query) use ($filters): void { $query->where('report_month', $filters['month'] . '-01'); if ($filters['platform'] !== '') { $query->where('platform', $filters['platform']); @@ -2243,32 +2243,12 @@ class Pages extends Controller if ($filters['warehouse_short_name'] !== '') { $query->where('warehouse_short_name', $filters['warehouse_short_name']); } - if ($filters['missing_price'] === '1') { - $query->whereNull('unit_price'); - } - // 仓库映射表里标「不看」的仓(次品 / 销退 / 虚拟 / 信誉 / 京东云仓等)默认不展示: - // 这些仓在商品月加权平均单价里本来就没有价,展示出来只会让「未匹配单价」虚高。 - if ($excludedWarehouseOnly) { - $query->where('warehouse_short_name', 'like', '%-不看%'); - - return; - } - if ($filters['include_excluded'] !== '1') { - $query->where(static function ($inner): void { - $inner->whereNull('warehouse_short_name') - ->orWhere('warehouse_short_name', 'not like', '%-不看%'); - }); - } }; $countQuery = $base(); $applyFilters($countQuery); $total = (int) $countQuery->count(); - $excludedQuery = $base(); - $applyFilters($excludedQuery, true); - $excludedRows = (int) $excludedQuery->count(); - $aggQuery = $base(); $applyFilters($aggQuery); $agg = $aggQuery->selectRaw(' @@ -2322,7 +2302,6 @@ class Pages extends Controller 'missing_price_rows' => (int) ($agg->missing_price_rows ?? 0), 'missing_price_quantity' => round((float) ($agg->missing_price_quantity ?? 0), 2), 'missing_warehouse_rows' => (int) ($agg->missing_warehouse_rows ?? 0), - 'excluded_rows' => $excludedRows, 'fallback_price_rows' => (int) ($agg->fallback_price_rows ?? 0), 'catalog_price_rows' => (int) ($agg->catalog_price_rows ?? 0), 'unit_mismatch_rows' => (int) ($agg->unit_mismatch_rows ?? 0), @@ -2604,15 +2583,7 @@ class Pages extends Controller if ($warehouse !== '') { $query->where('warehouse_short_name', $warehouse); } - if ($request->boolean('missing_price')) { - $query->whereNull('unit_price'); - } - if (! $request->boolean('include_excluded')) { - $query->where(static function ($inner): void { - $inner->whereNull('warehouse_short_name') - ->orWhere('warehouse_short_name', 'not like', '%-不看%'); - }); - } + // 导出与页面一致:全部数据(含未匹配单价与「-不看」仓)。 $filename = '商品成本_' . ($month === null ? 'all' : substr($month, 0, 7)) . '.csv'; diff --git a/resources/views/business/pages/financial-operations/product-costs.blade.php b/resources/views/business/pages/financial-operations/product-costs.blade.php index 5b22bf02..a4aa553f 100644 --- a/resources/views/business/pages/financial-operations/product-costs.blade.php +++ b/resources/views/business/pages/financial-operations/product-costs.blade.php @@ -92,14 +92,6 @@ @endforeach - -