|
@@ -72,8 +72,37 @@ class Export extends BaseService
|
|
|
{
|
|
|
// 根据条件查询订单列表
|
|
|
$orderList = $this->getDeliveryOrderList($param);
|
|
|
+ $orderListArr = $orderList->toArray();
|
|
|
+ $orderForExcelArr = [];
|
|
|
+ foreach ($orderListArr as $item) {
|
|
|
+ $orderForExcelArr[] = [
|
|
|
+ '包裹',
|
|
|
+ 'YH1049',
|
|
|
+ $item['order_no'],
|
|
|
+ '收货渠道',
|
|
|
+ '美国',
|
|
|
+ '1',
|
|
|
+ '500g',
|
|
|
+ $item['address']['region']['code'],
|
|
|
+ $item['address']['city'],
|
|
|
+ $item['address']['zip_code'],
|
|
|
+ '壹号专线',
|
|
|
+ $item['address']['name'] . ' ' . $item['address']['last_name'],
|
|
|
+ $item['address']['phone'],
|
|
|
+ $item['address']['detail'],
|
|
|
+ '包裹',
|
|
|
+ '其他',
|
|
|
+ '电子眼',
|
|
|
+ 'ele eye',
|
|
|
+ 'SEACODE',
|
|
|
+ '1',
|
|
|
+ 'dollar',
|
|
|
+ $item['total_price'],
|
|
|
+ $item['total_price'],
|
|
|
+ ];
|
|
|
+ }
|
|
|
// 格式化生成表格数据
|
|
|
- $columns = [
|
|
|
+/* $columns = [
|
|
|
'order_id',
|
|
|
'order_no',
|
|
|
'goods_detail',
|
|
@@ -97,12 +126,12 @@ class Export extends BaseService
|
|
|
'receipt_time',
|
|
|
'order_status',
|
|
|
'order_source'
|
|
|
- ];;
|
|
|
- $excelList = $this->getExcelList($orderList->toArray(), $columns);
|
|
|
+ ];*/
|
|
|
+ //$excelList = $this->getExcelList($orderList->toArray(), $columns);
|
|
|
// 获取导出的记录列名集
|
|
|
//$columns = $this->getColumns($param['columns']);
|
|
|
// 输出并写入到excel文件
|
|
|
- $filePath = $this->outputDeliveryExcel($excelList);
|
|
|
+ $filePath = $this->outputDeliveryExcel($orderForExcelArr);
|
|
|
// 新增订单导出记录
|
|
|
$this->record($param, $filePath);
|
|
|
return true;
|
|
@@ -209,9 +238,29 @@ class Export extends BaseService
|
|
|
// 写入内容数据
|
|
|
foreach ($excelList as $key => $item) {
|
|
|
$row = $key + 2;
|
|
|
- foreach (array_values($item) as $k => $val) {
|
|
|
- $sheet->setCellValueByColumnAndRow($k + 1, $row, $val);
|
|
|
- }
|
|
|
+ $sheet->setCellValueByColumnAndRow(1, $row, $item[0]);
|
|
|
+ $sheet->setCellValueByColumnAndRow(2, $row, $item[1]);
|
|
|
+ $sheet->setCellValueByColumnAndRow(3, $row, $item[2]);
|
|
|
+ $sheet->setCellValueByColumnAndRow(4, $row, $item[3]);
|
|
|
+ $sheet->setCellValueByColumnAndRow(5, $row, $item[4]);
|
|
|
+ $sheet->setCellValueByColumnAndRow(6, $row, $item[5]);
|
|
|
+ $sheet->setCellValueByColumnAndRow(7, $row, $item[6]);
|
|
|
+ $sheet->setCellValueByColumnAndRow(14, $row, $item[7]);
|
|
|
+ $sheet->setCellValueByColumnAndRow(15, $row, $item[8]);
|
|
|
+ $sheet->setCellValueByColumnAndRow(16, $row, $item[9]);
|
|
|
+ $sheet->setCellValueByColumnAndRow(17, $row, $item[10]);
|
|
|
+ $sheet->setCellValueByColumnAndRow(18, $row, $item[11]);
|
|
|
+ $sheet->setCellValueByColumnAndRow(19, $row, $item[12]);
|
|
|
+ $sheet->setCellValueByColumnAndRow(20, $row, $item[13]);
|
|
|
+ $sheet->setCellValueByColumnAndRow(23, $row, $item[14]);
|
|
|
+ $sheet->setCellValueByColumnAndRow(24, $row, $item[15]);
|
|
|
+ $sheet->setCellValueByColumnAndRow(32, $row, $item[16]);
|
|
|
+ $sheet->setCellValueByColumnAndRow(33, $row, $item[17]);
|
|
|
+ $sheet->setCellValueByColumnAndRow(34, $row, $item[18]);
|
|
|
+ $sheet->setCellValueByColumnAndRow(36, $row, $item[19]);
|
|
|
+ $sheet->setCellValueByColumnAndRow(37, $row, $item[20]);
|
|
|
+ $sheet->setCellValueByColumnAndRow(38, $row, $item[21]);
|
|
|
+ $sheet->setCellValueByColumnAndRow(39, $row, $item[22]);
|
|
|
}
|
|
|
// 生成文件路径
|
|
|
$fileName = 'order-' . time() . '.xlsx';
|