|
@@ -41,6 +41,7 @@ class Orders extends Auth{
|
|
|
public function index(Model $Model,OrdersProduct $OrdersProduct,Product $Product,Custom $Custom){
|
|
|
// 接受参数
|
|
|
$code = request('order_code','');
|
|
|
+ $orders_other = request('orders_other',0);
|
|
|
$productCode = request('product_code','');
|
|
|
$phone = request('phone','');
|
|
|
$customCode = request('custom_code','');
|
|
@@ -59,6 +60,8 @@ class Orders extends Auth{
|
|
|
$map = [];
|
|
|
// 编码ID
|
|
|
if( $id ) $map[] = ['orders_product.order_id','=',$id];
|
|
|
+ // 编码ID
|
|
|
+ if( $orders_other ) $map[] = $orders_other == 1 ? ['orders_product.product_id','>',0] : ['orders_product.product_id','=',0];
|
|
|
if( $uid ) $map[] = ['custom.uid','=',$uid];
|
|
|
if( $productId ) $map[] = ['orders_product.product_id','=',$productId];
|
|
|
if( $productName ) $map[] = ['orders_product.product_name','LIKE','%'.$productName.'%'];
|
|
@@ -357,6 +360,7 @@ class Orders extends Auth{
|
|
|
// 接受参数
|
|
|
$code = request('order_code','');
|
|
|
$productCode = request('product_code','');
|
|
|
+ $orders_other = request('orders_other',0);
|
|
|
$customCode = request('custom_code','');
|
|
|
$productName = request('product_name','');
|
|
|
$phone = request('phone','');
|
|
@@ -375,6 +379,8 @@ class Orders extends Auth{
|
|
|
// 编码ID
|
|
|
if( $id ) $map[] = ['orders_product.order_id','=',$id];
|
|
|
if( $uid ) $map[] = ['custom.uid','=',$uid];
|
|
|
+ // 编码ID
|
|
|
+ if( $orders_other ) $map[] = $orders_other == 1 ? ['orders_product.product_id','>',0] : ['orders_product.product_id','=',0];
|
|
|
if( $productId ) $map[] = ['orders_product.product_id','=',$productId];
|
|
|
if( $productName ) $map[] = ['orders_product.product_name','=',$productName];
|
|
|
if( $phone ) $map[] = ['orders_addr.contact_phone','=',$phone];
|
|
@@ -394,6 +400,7 @@ class Orders extends Auth{
|
|
|
'orders_product.id as id',
|
|
|
'orders_product.order_id',
|
|
|
'orders_product.custom_uid',
|
|
|
+ 'orders_product.product_id',
|
|
|
'orders_product.product_name',
|
|
|
'orders_product.sku_attr_names as product_spec',
|
|
|
'orders_product.product_thumb',
|
|
@@ -431,7 +438,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'],'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']];
|
|
|
+ $data[$value['order_id']]['product'][] = ['product_id'=>$value['product_id'] ? $Product->idToCode($value['product_id']) : '— —','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 {
|
|
@@ -486,17 +493,18 @@ 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('R'.$row, $value['weiban_extid']);
|
|
|
- $sheet->setCellValue('S'.$row, date('Y-m-d H:i:s',$value['insert_time']));
|
|
|
+ $sheet->setCellValue('S'.$row, $value['weiban_extid']);
|
|
|
+ $sheet->setCellValue('T'.$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['pay_price']);
|
|
|
- $sheet->setCellValue('O'.$row, $v['buy_num']);
|
|
|
- $sheet->setCellValue('P'.$row, $v['coupon_total']);
|
|
|
- $sheet->setCellValue('Q'.$row, $v['pay_total']);
|
|
|
+ $sheet->setCellValue('K'.$row, $v['product_id']);
|
|
|
+ $sheet->setCellValue('L'.$row, $v['product_name']);
|
|
|
+ $sheet->setCellValue('M'.$row, $v['product_spec']);
|
|
|
+ $sheet->setCellValue('N'.$row, $v['product_price']);
|
|
|
+ $sheet->setCellValue('O'.$row, $v['pay_price']);
|
|
|
+ $sheet->setCellValue('P'.$row, $v['buy_num']);
|
|
|
+ $sheet->setCellValue('Q'.$row, $v['coupon_total']);
|
|
|
+ $sheet->setCellValue('R'.$row, $v['pay_total']);
|
|
|
// 函数自增
|
|
|
$row++;
|
|
|
}
|
|
@@ -529,21 +537,22 @@ class Orders extends Auth{
|
|
|
$sheet->getColumnDimension('H')->setWidth(15);
|
|
|
$sheet->getColumnDimension('I')->setWidth(15);
|
|
|
$sheet->getColumnDimension('J')->setWidth(50);
|
|
|
- $sheet->getColumnDimension('K')->setWidth(80);
|
|
|
+ $sheet->getColumnDimension('K')->setWidth(20);
|
|
|
$sheet->getColumnDimension('L')->setWidth(80);
|
|
|
- $sheet->getColumnDimension('M')->setWidth(10);
|
|
|
+ $sheet->getColumnDimension('M')->setWidth(80);
|
|
|
$sheet->getColumnDimension('N')->setWidth(10);
|
|
|
$sheet->getColumnDimension('O')->setWidth(10);
|
|
|
$sheet->getColumnDimension('P')->setWidth(10);
|
|
|
$sheet->getColumnDimension('Q')->setWidth(10);
|
|
|
- $sheet->getColumnDimension('R')->setWidth(50);
|
|
|
- $sheet->getColumnDimension('S')->setWidth(20);
|
|
|
+ $sheet->getColumnDimension('R')->setWidth(10);
|
|
|
+ $sheet->getColumnDimension('S')->setWidth(50);
|
|
|
+ $sheet->getColumnDimension('T')->setWidth(20);
|
|
|
// 默认高度
|
|
|
$sheet->getDefaultRowDimension()->setRowHeight(18);
|
|
|
// 加粗第一行
|
|
|
- $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->getStyle('A:T')->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER)->setVertical(Alignment::VERTICAL_CENTER);
|
|
|
+ $sheet->getStyle('A1:T1')->getFont()->setBold(true);
|
|
|
+ $sheet->getStyle('A1:T1')->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setARGB('FF00FF00'); // ARGB颜色代码,例如绿色
|
|
|
// 设置表格标题
|
|
|
$sheet
|
|
|
->setCellValue('A1', '订单ID')
|
|
@@ -556,15 +565,16 @@ class Orders extends Auth{
|
|
|
->setCellValue('H1', '市')
|
|
|
->setCellValue('I1', '区县')
|
|
|
->setCellValue('J1', '收货地址')
|
|
|
- ->setCellValue('K1', '产品名称')
|
|
|
- ->setCellValue('L1', '产品规格')
|
|
|
- ->setCellValue('M1', '产品单价')
|
|
|
- ->setCellValue('N1', '折后单价')
|
|
|
- ->setCellValue('O1', '产品数量')
|
|
|
- ->setCellValue('P1', '优惠金额')
|
|
|
- ->setCellValue('Q1', '产品金额')
|
|
|
- ->setCellValue('R1', '微伴ID')
|
|
|
- ->setCellValue('S1', '下单时间');
|
|
|
+ ->setCellValue('K1', '产品编码')
|
|
|
+ ->setCellValue('L1', '产品名称')
|
|
|
+ ->setCellValue('M1', '产品规格')
|
|
|
+ ->setCellValue('N1', '产品单价')
|
|
|
+ ->setCellValue('O1', '折后单价')
|
|
|
+ ->setCellValue('P1', '产品数量')
|
|
|
+ ->setCellValue('Q1', '优惠金额')
|
|
|
+ ->setCellValue('R1', '产品金额')
|
|
|
+ ->setCellValue('S1', '微伴ID')
|
|
|
+ ->setCellValue('T1', '下单时间');
|
|
|
// 返回结果
|
|
|
return $sheet;
|
|
|
}
|