where('recon_id', $this->settlement->recon_id) ->where('store_id', $this->settlement->store_id) ->orderBy('sort') ->get(); } public function headings(): array { return ['品名', '数量', '称重', '公布金额', '实际金额', '差额', '对账状态', '门店备注']; } public function map($item): array { return [ $item->product_name, (float) $item->quantity, (float) $item->weight, (float) $item->publish_amount, (float) $item->actual_amount, (float) $item->diff_amount, $item->is_reconciled ? '已对账' : '未对账', $item->store_remark, ]; } public function styles(Worksheet $sheet): array { $sheet->freezePane('A2'); return [ 1 => ['font' => ['bold' => true]], ]; } /** * PDF 模板视图数据 * * @return array{settlement: SettlementModel, storeName: string, reconNo: string, items: Collection} */ public function viewData(): array { return [ 'settlement' => $this->settlement, 'storeName' => $this->settlement->store?->name ?? '', 'reconNo' => $this->settlement->recon?->recon_no ?? '', 'items' => $this->collection(), ]; } }