修复后台excel导出问题

This commit is contained in:
liu 2024-03-11 10:56:35 +08:00
parent db8e9eb6b3
commit f7f1d7c388

View File

@ -122,7 +122,7 @@ class ExcelService
*/ */
public function order(array $where, int $page, int $limit) public function order(array $where, int $page, int $limit)
{ {
$paytype = [0 => '余额', 1 => '微信', 2 => '小程序', 3 => 'H5', 4 => '支付宝', 5 => '支付宝扫码', 6 => '微信扫码',]; $paytype = [0 => '余额', 1 => '微信', 2 => '小程序', 3 => 'H5', 4 => '支付宝', 5 => '支付宝扫码', 6 => '微信扫码',8=>'信用购-先货后款',9=>'商户余额支付'];
$make = app()->make(StoreOrderRepository::class); $make = app()->make(StoreOrderRepository::class);
$status = $where['status']; $status = $where['status'];
$del = $where['mer_id'] > 0 ? 0 : null; $del = $where['mer_id'] > 0 ? 0 : null;
@ -140,12 +140,14 @@ class ExcelService
$export = []; $export = [];
foreach ($list as $item) { foreach ($list as $item) {
$product = []; $product = [];
foreach ($item['orderProduct'] as $value) { foreach ($item['orderProduct'] as $value) {
$product[] = [ $product[] = [
$value['cart_info']['product']['store_name'], $value['cart_info']['product']['store_name']??'',
$value['cart_info']['productAttr']['sku'] ?: '无', $value['cart_info']['productAttr']['sku'] ?: '无',
$value['product_num'] . ' ' . $value['unit_name'], $value['product_num'] . ' ' . $value['unit_name']??'',
$value['cart_info']['productAttr']['price'] $value['cart_info']['productAttr']['price']??''
]; ];
} }
$one = [ $one = [
@ -170,6 +172,8 @@ class ExcelService
]; ];
$export[] = $one; $export[] = $one;
} }
$header = ['商户名称', '订单编号', '订单类型', '推广人', '用户信息', '商品名称', '商品规格', '商品数量', '商品价格', '优惠', '实付邮费(元)', '实付金额(元)', '已退款金额(元)', '收货人', '收货人电话', '收货地址', '物流/电话', '下单时间', '支付方式', '支付状态', '商家备注']; $header = ['商户名称', '订单编号', '订单类型', '推广人', '用户信息', '商品名称', '商品规格', '商品数量', '商品价格', '优惠', '实付邮费(元)', '实付金额(元)', '已退款金额(元)', '收货人', '收货人电话', '收货地址', '物流/电话', '下单时间', '支付方式', '支付状态', '商家备注'];
$filename = '订单列表_' . date('YmdHis'); $filename = '订单列表_' . date('YmdHis');
$title = ['订单列表', '导出时间:' . date('Y-m-d H:i:s', time())]; $title = ['订单列表', '导出时间:' . date('Y-m-d H:i:s', time())];