feat(admin): 为预订单表添加导出功能并优化订单导出内容

- 在 BeforehandOrderLists 类中实现 ListsExcelInterface 接口,添加导出文件名和导出字段方法
- 在 OrderOutbound 类中增加下单时间和送货时间字段,并调整收货地址显示格式
This commit is contained in:
mkm 2024-11-08 16:37:27 +08:00
parent b93ee02d31
commit ae439f1389
2 changed files with 48 additions and 2 deletions

View File

@ -9,13 +9,14 @@ use app\common\lists\ListsSearchInterface;
use app\common\model\auth\Admin;
use app\common\model\purchase_product_offer\PurchaseProductOffer;
use app\common\model\system_store\SystemStore;
use app\common\lists\ListsExcelInterface;
/**
* 预订单表列表
* Class BeforehandOrderLists
* @package app\admin\listsbeforehand_order
*/
class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInterface
class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
{
@ -105,5 +106,41 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
{
return BeforehandOrder::where($this->searchWhere)->count();
}
/**
* @notes 导出文件名
* @return string
* @author 乔峰
* @date 2022/11/24 16:17
*/
public function setFileName(): string
{
return '预订单表';
}
/**
* @notes 导出字段
* @return string[]
* @author 乔峰
* @date 2022/11/24 16:17
*/
public function setExcelFields(): array
{
$data=[
'id'=>'ID',
'order_id'=>'单号',
'order_type_name'=>'订单类型',
'system_store' => '门店',
'admin_name' => '门店',
'warehousing' => '入库',
'outbound' => '出库',
'total_price' => '总价',
'admin_name' => '用户',
'mark' => '备注',
'msg' => '通知',
'create_time' => '时间',
];
return $data;
}
}

View File

@ -93,8 +93,17 @@ class OrderOutbound
$sheet->mergeCells('G' . ($count + 7) . ':I' . $count + 7);
$sheet->setCellValue('G' . ($count + 7),$order['system_store_name']);
$sheet->mergeCells('B' . ($count + 8) . ':I' . $count + 8);
$sheet->mergeCells('B' . ($count + 8) . ':C' . $count + 8);
$sheet->setCellValue('A'. ($count + 8), '收货地址:');
$sheet->mergeCells('E' . ($count + 8) . ':F' . $count + 8);
$sheet->setCellValue('D'. ($count + 8), '下单时间:');
$sheet->setCellValue('E'. ($count + 8), $order['create_time']);
$sheet->setCellValue('G'. ($count + 8), '送货时间:');
$sheet->mergeCells('H' . ($count + 8) . ':I' . $count + 8);
$sheet->setCellValue('H'. ($count + 8), $other_data->arrival_time??'');
$sheet->setCellValue('B'. ($count + 8), $other_data->address??'');
$sheet->mergeCells('B' . ($count + 9) . ':E' . $count + 9);