statement->items()->orderBy('id')->get(); } public function headings(): array { return ['品名', '单价', '数量', '重量', '金额', '对账状态', '备注']; } public function map($item): array { return [ $item->product_name, (float) $item->price, (float) $item->quantity, (float) $item->weight, (float) $item->amount, $item->is_reconciled ? '已对账' : '未对账', $item->store_remark, ]; } public function styles(Worksheet $sheet): array { $sheet->freezePane('A2'); return [ 1 => ['font' => ['bold' => true]], ]; } /** * PDF 模板视图数据 * * @return array{statement: StatementModel, storeName: string, items: Collection} */ public function viewData(): array { return [ 'statement' => $this->statement, 'storeName' => $this->statement->store?->name ?? '', 'items' => $this->collection(), ]; } }