feat: 修改了订单导出功能,增加了支付时间和发货时间的计算,并更新了订单详情表单。
This commit is contained in:
parent
e8dbf9440c
commit
5f007b5b1d
@ -154,9 +154,11 @@ class StoreOrderController extends BaseAdminController
|
|||||||
$id = $this->request->post('id');
|
$id = $this->request->post('id');
|
||||||
$system_store = $this->request->post('system_store');
|
$system_store = $this->request->post('system_store');
|
||||||
$xlsx = new OrderDetail();
|
$xlsx = new OrderDetail();
|
||||||
|
$order=StoreOrder::where('id',$id)->findOrEmpty();
|
||||||
|
$time= strtotime('+1 day', $order['pay_time']);
|
||||||
|
$order['pay_time']=date('Y-m-d H:i:s',$order['pay_time']);
|
||||||
|
$order['delivery_time']=date('Y-m-d', $time);
|
||||||
$data = StoreOrderCartInfo::where('oid', $id)->select();
|
$data = StoreOrderCartInfo::where('oid', $id)->select();
|
||||||
$total_num=0;
|
|
||||||
$total_price=0;
|
|
||||||
foreach ($data as $key => &$value) {
|
foreach ($data as $key => &$value) {
|
||||||
$find=StoreProduct::where('id',$value->product_id)->find();
|
$find=StoreProduct::where('id',$value->product_id)->find();
|
||||||
$value->store_name=$find['store_name']??'';
|
$value->store_name=$find['store_name']??'';
|
||||||
@ -166,10 +168,8 @@ class StoreOrderController extends BaseAdminController
|
|||||||
}else{
|
}else{
|
||||||
$value->unit_name='';
|
$value->unit_name='';
|
||||||
}
|
}
|
||||||
$total_num+=$value->cart_num;
|
|
||||||
$total_price+=$value->total_price;
|
|
||||||
}
|
}
|
||||||
$file_path = $xlsx->export($data,$system_store,$total_num,$total_price);
|
$file_path = $xlsx->export($data,$system_store,$order);
|
||||||
|
|
||||||
return $this->success('导出成功', ['url' => $file_path]);
|
return $this->success('导出成功', ['url' => $file_path]);
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ use app\admin\controller\BaseAdminController;
|
|||||||
use app\admin\lists\store_order_cart_info\StoreOrderCartInfoLists;
|
use app\admin\lists\store_order_cart_info\StoreOrderCartInfoLists;
|
||||||
use app\admin\lists\store_order_cart_info\StoreOrderCartInfoTwoLists;
|
use app\admin\lists\store_order_cart_info\StoreOrderCartInfoTwoLists;
|
||||||
use app\admin\logic\store_order_cart_info\StoreOrderCartInfoLogic;
|
use app\admin\logic\store_order_cart_info\StoreOrderCartInfoLogic;
|
||||||
|
use app\common\model\store_order\StoreOrder;
|
||||||
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
||||||
use app\common\model\store_product\StoreProduct;
|
use app\common\model\store_product\StoreProduct;
|
||||||
use app\common\model\store_product_unit\StoreProductUnit;
|
use app\common\model\store_product_unit\StoreProductUnit;
|
||||||
@ -80,7 +81,10 @@ class StoreOrderCartInfoController extends BaseAdminController
|
|||||||
$data = StoreOrderCartInfo::where($where)->select();
|
$data = StoreOrderCartInfo::where($where)->select();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
$order['pay_time']='';
|
||||||
|
$order['delivery_time']='';
|
||||||
|
$order['order_id']='';
|
||||||
|
|
||||||
$total_num=0;
|
$total_num=0;
|
||||||
$total_price=0;
|
$total_price=0;
|
||||||
foreach ($data as $key => &$value) {
|
foreach ($data as $key => &$value) {
|
||||||
@ -95,7 +99,9 @@ class StoreOrderCartInfoController extends BaseAdminController
|
|||||||
$total_num+=$value->cart_num;
|
$total_num+=$value->cart_num;
|
||||||
$total_price+=$value->total_price;
|
$total_price+=$value->total_price;
|
||||||
}
|
}
|
||||||
$file_path = $xlsx->export($data,$system_store,$total_num,$total_price);
|
$order['total_num']=$total_num;
|
||||||
|
$order['total_price']=$total_price;
|
||||||
|
$file_path = $xlsx->export($data,$system_store,$order);
|
||||||
return $this->success('导出成功', ['url' => $file_path]);
|
return $this->success('导出成功', ['url' => $file_path]);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,9 +14,9 @@ class OrderDetail
|
|||||||
public $company='共投里海';
|
public $company='共投里海';
|
||||||
public $address='泸州龙马潭区海吉星122栋';
|
public $address='泸州龙马潭区海吉星122栋';
|
||||||
public $phone='08302669767';
|
public $phone='08302669767';
|
||||||
public $tel='08302669767';
|
public $tel='17309099881';
|
||||||
|
|
||||||
public function export($data,$system_store,$total_num,$total_price)
|
public function export($data,$system_store,$order)
|
||||||
{
|
{
|
||||||
$spreadsheet = new Spreadsheet();
|
$spreadsheet = new Spreadsheet();
|
||||||
$sheet = $spreadsheet->getActiveSheet();
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
@ -32,8 +32,11 @@ class OrderDetail
|
|||||||
$sheet->setCellValue('A2', '店铺名称');
|
$sheet->setCellValue('A2', '店铺名称');
|
||||||
$sheet->setCellValue('B2', $system_store);
|
$sheet->setCellValue('B2', $system_store);
|
||||||
$sheet->setCellValue('F2', '送货时间');
|
$sheet->setCellValue('F2', '送货时间');
|
||||||
|
$sheet->setCellValue('G2', $order['delivery_time']??'');
|
||||||
$sheet->setCellValue('A3', '开单日期');
|
$sheet->setCellValue('A3', '开单日期');
|
||||||
|
$sheet->setCellValue('B3', $order['pay_time']??'');
|
||||||
$sheet->setCellValue('F3', '单号');
|
$sheet->setCellValue('F3', '单号');
|
||||||
|
$sheet->setCellValue('G3', $order['order_id']??'');
|
||||||
$sheet->setCellValue('A4', '序号');
|
$sheet->setCellValue('A4', '序号');
|
||||||
$sheet->setCellValue('B4', '商品名称');
|
$sheet->setCellValue('B4', '商品名称');
|
||||||
$sheet->setCellValue('D4', '规格');
|
$sheet->setCellValue('D4', '规格');
|
||||||
@ -71,10 +74,10 @@ class OrderDetail
|
|||||||
|
|
||||||
$sheet->mergeCells('B' . ($count + 6) . ':E' . $count + 6);
|
$sheet->mergeCells('B' . ($count + 6) . ':E' . $count + 6);
|
||||||
$sheet->setCellValue('A' . $count + 6, '合计数量');
|
$sheet->setCellValue('A' . $count + 6, '合计数量');
|
||||||
$sheet->setCellValue('B' . $count + 6,$total_num);
|
$sheet->setCellValue('B' . $count + 6,$order['total_num']);
|
||||||
$sheet->mergeCells('G' . ($count + 6) . ':J' . $count + 6);
|
$sheet->mergeCells('G' . ($count + 6) . ':J' . $count + 6);
|
||||||
$sheet->setCellValue('F' . $count + 6, '合计价格');
|
$sheet->setCellValue('F' . $count + 6, '合计价格');
|
||||||
$sheet->setCellValue('G' . $count + 6, $total_price);
|
$sheet->setCellValue('G' . $count + 6, $order['total_price']);
|
||||||
|
|
||||||
$sheet->mergeCells('A' . ($count + 7) . ':J' . $count + 7);
|
$sheet->mergeCells('A' . ($count + 7) . ':J' . $count + 7);
|
||||||
|
|
||||||
@ -97,7 +100,7 @@ class OrderDetail
|
|||||||
$sheet->mergeCells('A' . ($count + 10) . ':J' . $count + 10);
|
$sheet->mergeCells('A' . ($count + 10) . ':J' . $count + 10);
|
||||||
|
|
||||||
$sheet->setCellValue('A' . $count + 11, '仓库',);
|
$sheet->setCellValue('A' . $count + 11, '仓库',);
|
||||||
$sheet->setCellValue('B' . $count + 11, $this->warehouse);
|
// $sheet->setCellValue('B' . $count + 11, $this->warehouse);
|
||||||
$sheet->mergeCells('B' . ($count + 11) . ':C' . $count + 11);
|
$sheet->mergeCells('B' . ($count + 11) . ':C' . $count + 11);
|
||||||
$sheet->setCellValue('D' . $count + 11, '送货');
|
$sheet->setCellValue('D' . $count + 11, '送货');
|
||||||
$sheet->mergeCells('E' . ($count + 11) . ':F' . $count + 11);
|
$sheet->mergeCells('E' . ($count + 11) . ':F' . $count + 11);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user