|
@@ -255,7 +255,17 @@ class Orders extends Auth{
|
|
|
->where($map)
|
|
|
->orderByDesc('orders_product.id')
|
|
|
->select([
|
|
|
- 'orders_product.id as id','orders_product.order_id','orders_product.custom_uid','orders_product.product_name','orders_product.sku_attr_names as product_spec','orders_product.product_thumb','orders_product.buy_num','orders_product.pay_total','orders_product.status','orders_product.insert_time',
|
|
|
+ 'orders_product.id as id',
|
|
|
+ 'orders_product.order_id',
|
|
|
+ 'orders_product.custom_uid',
|
|
|
+ 'orders_product.product_name',
|
|
|
+ 'orders_product.sku_attr_names as product_spec',
|
|
|
+ 'orders_product.product_thumb',
|
|
|
+ 'orders_product.buy_num',
|
|
|
+ 'orders_product.pay_total',
|
|
|
+ 'orders_product.coupon_total',
|
|
|
+ 'orders_product.status',
|
|
|
+ 'orders_product.insert_time',
|
|
|
'custom.username as custom_name','custom.weiban_extid as weiban_extid',
|
|
|
'orders_addr.contact_name','orders_addr.contact_shop','orders_addr.contact_phone','orders_addr.contact_province','orders_addr.contact_city','orders_addr.contact_area','orders_addr.contact_addr'
|
|
|
])->get()->toArray();
|
|
@@ -283,7 +293,7 @@ class Orders extends Auth{
|
|
|
$data[$value['order_id']]['contact_area'] = $value['contact_area'];
|
|
|
$data[$value['order_id']]['contact_addr'] = $value['contact_addr'] .($value['contact_shop'] ? '【'.$value['contact_shop'].'】' : '');
|
|
|
// 子订单
|
|
|
- $data[$value['order_id']]['product'][] = ['product_name'=>$value['product_name'],'product_spec'=>$value['product_spec'],'product_thumb'=>$value['product_thumb'],'product_price'=>$value['product_price'],'buy_num'=>$value['buy_num'],'pay_total'=>$value['pay_total']];
|
|
|
+ $data[$value['order_id']]['product'][] = ['product_name'=>$value['product_name'],'product_spec'=>$value['product_spec'],'product_thumb'=>$value['product_thumb'],'product_price'=>$value['product_price'],'buy_num'=>$value['buy_num'],'pay_total'=>$value['pay_total'],'coupon_total'=>$value['coupon_total']];
|
|
|
}
|
|
|
|
|
|
try {
|
|
@@ -323,8 +333,8 @@ class Orders extends Auth{
|
|
|
$sheet->mergeCells('H'.$row.':'.'H'.($row+$count-1));
|
|
|
$sheet->mergeCells('I'.$row.':'.'I'.($row+$count-1));
|
|
|
$sheet->mergeCells('J'.$row.':'.'J'.($row+$count-1));
|
|
|
- $sheet->mergeCells('P'.$row.':'.'P'.($row+$count-1));
|
|
|
$sheet->mergeCells('Q'.$row.':'.'Q'.($row+$count-1));
|
|
|
+ $sheet->mergeCells('R'.$row.':'.'R'.($row+$count-1));
|
|
|
}
|
|
|
// 单元格内容写入
|
|
|
$sheet->setCellValue('A'.$row, $value['order_id']);
|
|
@@ -337,15 +347,16 @@ class Orders extends Auth{
|
|
|
$sheet->setCellValue('H'.$row, $value['contact_city']);
|
|
|
$sheet->setCellValue('I'.$row, $value['contact_area']);
|
|
|
$sheet->setCellValue('J'.$row, $value['contact_addr']);
|
|
|
- $sheet->setCellValue('P'.$row, $value['weiban_extid']);
|
|
|
- $sheet->setCellValue('Q'.$row, date('Y-m-d H:i:s',$value['insert_time']));
|
|
|
+ $sheet->setCellValue('Q'.$row, $value['weiban_extid']);
|
|
|
+ $sheet->setCellValue('R'.$row, date('Y-m-d H:i:s',$value['insert_time']));
|
|
|
// 循环产品
|
|
|
foreach ($value['product'] as $v) {
|
|
|
$sheet->setCellValue('K'.$row, $v['product_name']);
|
|
|
$sheet->setCellValue('L'.$row, $v['product_spec']);
|
|
|
$sheet->setCellValue('M'.$row, $v['product_price']);
|
|
|
$sheet->setCellValue('N'.$row, $v['buy_num']);
|
|
|
- $sheet->setCellValue('O'.$row, $v['pay_total']);
|
|
|
+ $sheet->setCellValue('O'.$row, $v['coupon_total']);
|
|
|
+ $sheet->setCellValue('P'.$row, $v['pay_total']);
|
|
|
// 函数自增
|
|
|
$row++;
|
|
|
}
|
|
@@ -383,14 +394,15 @@ class Orders extends Auth{
|
|
|
$sheet->getColumnDimension('M')->setWidth(10);
|
|
|
$sheet->getColumnDimension('N')->setWidth(10);
|
|
|
$sheet->getColumnDimension('O')->setWidth(10);
|
|
|
- $sheet->getColumnDimension('P')->setWidth(50);
|
|
|
- $sheet->getColumnDimension('Q')->setWidth(20);
|
|
|
+ $sheet->getColumnDimension('P')->setWidth(10);
|
|
|
+ $sheet->getColumnDimension('Q')->setWidth(50);
|
|
|
+ $sheet->getColumnDimension('R')->setWidth(20);
|
|
|
// 默认高度
|
|
|
$sheet->getDefaultRowDimension()->setRowHeight(18);
|
|
|
// 加粗第一行
|
|
|
- $sheet->getStyle('A:Q')->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER)->setVertical(Alignment::VERTICAL_CENTER);
|
|
|
- $sheet->getStyle('A1:Q1')->getFont()->setBold(true);
|
|
|
- $sheet->getStyle('A1:Q1')->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setARGB('FF00FF00'); // ARGB颜色代码,例如绿色
|
|
|
+ $sheet->getStyle('A:R')->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER)->setVertical(Alignment::VERTICAL_CENTER);
|
|
|
+ $sheet->getStyle('A1:R1')->getFont()->setBold(true);
|
|
|
+ $sheet->getStyle('A1:R1')->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setARGB('FF00FF00'); // ARGB颜色代码,例如绿色
|
|
|
// 设置表格标题
|
|
|
$sheet
|
|
|
->setCellValue('A1', '订单ID')
|
|
@@ -407,9 +419,10 @@ class Orders extends Auth{
|
|
|
->setCellValue('L1', '产品规格')
|
|
|
->setCellValue('M1', '产品价格')
|
|
|
->setCellValue('N1', '产品数量')
|
|
|
- ->setCellValue('O1', '产品金额')
|
|
|
- ->setCellValue('P1', '微伴ID')
|
|
|
- ->setCellValue('Q1', '下单时间');
|
|
|
+ ->setCellValue('O1', '优惠金额')
|
|
|
+ ->setCellValue('P1', '产品金额')
|
|
|
+ ->setCellValue('Q1', '微伴ID')
|
|
|
+ ->setCellValue('R1', '下单时间');
|
|
|
// 返回结果
|
|
|
return $sheet;
|
|
|
}
|