|
@@ -286,8 +286,9 @@ class Orders extends Auth{
|
|
'orders_product.sku_attr_names as product_spec',
|
|
'orders_product.sku_attr_names as product_spec',
|
|
'orders_product.product_thumb',
|
|
'orders_product.product_thumb',
|
|
'orders_product.buy_num',
|
|
'orders_product.buy_num',
|
|
- 'orders_product.pay_total',
|
|
|
|
|
|
+ 'orders_product.price_total',
|
|
'orders_product.coupon_total',
|
|
'orders_product.coupon_total',
|
|
|
|
+ 'orders_product.pay_total',
|
|
'orders_product.status',
|
|
'orders_product.status',
|
|
'orders_product.insert_time',
|
|
'orders_product.insert_time',
|
|
'custom.username as custom_name','custom.weiban_extid as weiban_extid',
|
|
'custom.username as custom_name','custom.weiban_extid as weiban_extid',
|
|
@@ -301,7 +302,8 @@ class Orders extends Auth{
|
|
$value['order_id'] = $Model->idToCode($value['order_id']);
|
|
$value['order_id'] = $Model->idToCode($value['order_id']);
|
|
$value['status'] = $Model->getState($value['status'],'state');
|
|
$value['status'] = $Model->getState($value['status'],'state');
|
|
$value['custom_uid'] = $Custom->idToCode($value['custom_uid']);
|
|
$value['custom_uid'] = $Custom->idToCode($value['custom_uid']);
|
|
- $value['product_price'] = $value['buy_num'] ? ($value['pay_total'] / $value['buy_num']) : $value['buy_num'];
|
|
|
|
|
|
+ $value['product_price'] = $value['buy_num'] ? ($value['price_total'] / $value['buy_num']) : $value['buy_num'];
|
|
|
|
+ $value['pay_price'] = $value['buy_num'] ? ($value['pay_total'] / $value['buy_num']) : $value['buy_num'];
|
|
// 重组
|
|
// 重组
|
|
$data[$value['order_id']]['order_id'] = $value['order_id'];
|
|
$data[$value['order_id']]['order_id'] = $value['order_id'];
|
|
$data[$value['order_id']]['custom_uid'] = $value['custom_uid'];
|
|
$data[$value['order_id']]['custom_uid'] = $value['custom_uid'];
|
|
@@ -317,14 +319,14 @@ class Orders extends Auth{
|
|
$data[$value['order_id']]['contact_area'] = $value['contact_area'];
|
|
$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']]['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'],'coupon_total'=>$value['coupon_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'],'pay_price'=>$value['pay_price'],'buy_num'=>$value['buy_num'],'pay_total'=>$value['pay_total'],'price_total'=>$value['price_total'],'coupon_total'=>$value['coupon_total']];
|
|
}
|
|
}
|
|
|
|
|
|
try {
|
|
try {
|
|
// 去下载
|
|
// 去下载
|
|
$this->toDown($data);
|
|
$this->toDown($data);
|
|
} catch (\Throwable $th) {
|
|
} catch (\Throwable $th) {
|
|
- dd($th);
|
|
|
|
|
|
+ echo $th->getMessage();
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@@ -357,8 +359,8 @@ class Orders extends Auth{
|
|
$sheet->mergeCells('H'.$row.':'.'H'.($row+$count-1));
|
|
$sheet->mergeCells('H'.$row.':'.'H'.($row+$count-1));
|
|
$sheet->mergeCells('I'.$row.':'.'I'.($row+$count-1));
|
|
$sheet->mergeCells('I'.$row.':'.'I'.($row+$count-1));
|
|
$sheet->mergeCells('J'.$row.':'.'J'.($row+$count-1));
|
|
$sheet->mergeCells('J'.$row.':'.'J'.($row+$count-1));
|
|
- $sheet->mergeCells('Q'.$row.':'.'Q'.($row+$count-1));
|
|
|
|
$sheet->mergeCells('R'.$row.':'.'R'.($row+$count-1));
|
|
$sheet->mergeCells('R'.$row.':'.'R'.($row+$count-1));
|
|
|
|
+ $sheet->mergeCells('S'.$row.':'.'S'.($row+$count-1));
|
|
}
|
|
}
|
|
// 单元格内容写入
|
|
// 单元格内容写入
|
|
$sheet->setCellValue('A'.$row, $value['order_id']);
|
|
$sheet->setCellValue('A'.$row, $value['order_id']);
|
|
@@ -371,16 +373,17 @@ class Orders extends Auth{
|
|
$sheet->setCellValue('H'.$row, $value['contact_city']);
|
|
$sheet->setCellValue('H'.$row, $value['contact_city']);
|
|
$sheet->setCellValue('I'.$row, $value['contact_area']);
|
|
$sheet->setCellValue('I'.$row, $value['contact_area']);
|
|
$sheet->setCellValue('J'.$row, $value['contact_addr']);
|
|
$sheet->setCellValue('J'.$row, $value['contact_addr']);
|
|
- $sheet->setCellValue('Q'.$row, $value['weiban_extid']);
|
|
|
|
- $sheet->setCellValue('R'.$row, date('Y-m-d H:i:s',$value['insert_time']));
|
|
|
|
|
|
+ $sheet->setCellValue('R'.$row, $value['weiban_extid']);
|
|
|
|
+ $sheet->setCellValue('S'.$row, date('Y-m-d H:i:s',$value['insert_time']));
|
|
// 循环产品
|
|
// 循环产品
|
|
foreach ($value['product'] as $v) {
|
|
foreach ($value['product'] as $v) {
|
|
$sheet->setCellValue('K'.$row, $v['product_name']);
|
|
$sheet->setCellValue('K'.$row, $v['product_name']);
|
|
$sheet->setCellValue('L'.$row, $v['product_spec']);
|
|
$sheet->setCellValue('L'.$row, $v['product_spec']);
|
|
$sheet->setCellValue('M'.$row, $v['product_price']);
|
|
$sheet->setCellValue('M'.$row, $v['product_price']);
|
|
- $sheet->setCellValue('N'.$row, $v['buy_num']);
|
|
|
|
- $sheet->setCellValue('O'.$row, $v['coupon_total']);
|
|
|
|
- $sheet->setCellValue('P'.$row, $v['pay_total']);
|
|
|
|
|
|
+ $sheet->setCellValue('N'.$row, $v['pay_price']);
|
|
|
|
+ $sheet->setCellValue('O'.$row, $v['buy_num']);
|
|
|
|
+ $sheet->setCellValue('P'.$row, $v['coupon_total']);
|
|
|
|
+ $sheet->setCellValue('Q'.$row, $v['pay_total']);
|
|
// 函数自增
|
|
// 函数自增
|
|
$row++;
|
|
$row++;
|
|
}
|
|
}
|
|
@@ -419,14 +422,15 @@ class Orders extends Auth{
|
|
$sheet->getColumnDimension('N')->setWidth(10);
|
|
$sheet->getColumnDimension('N')->setWidth(10);
|
|
$sheet->getColumnDimension('O')->setWidth(10);
|
|
$sheet->getColumnDimension('O')->setWidth(10);
|
|
$sheet->getColumnDimension('P')->setWidth(10);
|
|
$sheet->getColumnDimension('P')->setWidth(10);
|
|
- $sheet->getColumnDimension('Q')->setWidth(50);
|
|
|
|
- $sheet->getColumnDimension('R')->setWidth(20);
|
|
|
|
|
|
+ $sheet->getColumnDimension('Q')->setWidth(10);
|
|
|
|
+ $sheet->getColumnDimension('R')->setWidth(50);
|
|
|
|
+ $sheet->getColumnDimension('S')->setWidth(20);
|
|
// 默认高度
|
|
// 默认高度
|
|
$sheet->getDefaultRowDimension()->setRowHeight(18);
|
|
$sheet->getDefaultRowDimension()->setRowHeight(18);
|
|
// 加粗第一行
|
|
// 加粗第一行
|
|
- $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->getStyle('A:S')->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER)->setVertical(Alignment::VERTICAL_CENTER);
|
|
|
|
+ $sheet->getStyle('A1:S1')->getFont()->setBold(true);
|
|
|
|
+ $sheet->getStyle('A1:S1')->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setARGB('FF00FF00'); // ARGB颜色代码,例如绿色
|
|
// 设置表格标题
|
|
// 设置表格标题
|
|
$sheet
|
|
$sheet
|
|
->setCellValue('A1', '订单ID')
|
|
->setCellValue('A1', '订单ID')
|
|
@@ -441,12 +445,13 @@ class Orders extends Auth{
|
|
->setCellValue('J1', '收货地址')
|
|
->setCellValue('J1', '收货地址')
|
|
->setCellValue('K1', '产品名称')
|
|
->setCellValue('K1', '产品名称')
|
|
->setCellValue('L1', '产品规格')
|
|
->setCellValue('L1', '产品规格')
|
|
- ->setCellValue('M1', '产品价格')
|
|
|
|
- ->setCellValue('N1', '产品数量')
|
|
|
|
- ->setCellValue('O1', '优惠金额')
|
|
|
|
- ->setCellValue('P1', '产品金额')
|
|
|
|
- ->setCellValue('Q1', '微伴ID')
|
|
|
|
- ->setCellValue('R1', '下单时间');
|
|
|
|
|
|
+ ->setCellValue('M1', '产品单价')
|
|
|
|
+ ->setCellValue('N1', '折后单价')
|
|
|
|
+ ->setCellValue('O1', '产品数量')
|
|
|
|
+ ->setCellValue('P1', '优惠金额')
|
|
|
|
+ ->setCellValue('Q1', '产品金额')
|
|
|
|
+ ->setCellValue('R1', '微伴ID')
|
|
|
|
+ ->setCellValue('S1', '下单时间');
|
|
// 返回结果
|
|
// 返回结果
|
|
return $sheet;
|
|
return $sheet;
|
|
}
|
|
}
|