From 736ecea4fb2fdd48ba8cc59dec5565d32815dbc0 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 25 Nov 2024 10:44:37 +0800 Subject: [PATCH] =?UTF-8?q?feat(admin):=20=E4=BC=98=E5=8C=96=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E5=8A=9F=E8=83=BD=E5=B9=B6=E6=B7=BB=E5=8A=A0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BF=A1=E6=81=AF=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 为导出类型 2 增加 other_data 字段 - 添加用户昵称、手机号、地址等信息字段 - 优化数据查询和处理逻辑,提高导出效率 --- .../beforehand_order/BeforehandOrderLists.php | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/app/admin/lists/beforehand_order/BeforehandOrderLists.php b/app/admin/lists/beforehand_order/BeforehandOrderLists.php index 08ff88510..4dae1ab62 100644 --- a/app/admin/lists/beforehand_order/BeforehandOrderLists.php +++ b/app/admin/lists/beforehand_order/BeforehandOrderLists.php @@ -79,12 +79,17 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte $oid=WarehouseOrder::where('financial_pm',0)->where('code','like','%'.$order_ck)->column('oid'); $this->searchWhere[] = ['outbound_id','in',$oid]; } + $file=['id', 'order_id', 'order_sn','store_id', 'order_type', 'total_num', 'total_price', 'outbound_id', 'admin_id', 'create_time', 'status', 'mark', 'warehousing_id', 'file']; + if($export==2){ + $file=['id', 'order_id', 'order_sn','store_id', 'order_type', 'total_num', 'total_price', 'outbound_id', 'admin_id', 'create_time', 'status', 'mark', 'warehousing_id', 'file','other_data']; + } return BeforehandOrder::where($this->searchWhere) - ->field(['id', 'order_id', 'order_sn','store_id', 'order_type', 'total_num', 'total_price', 'outbound_id', 'admin_id', 'create_time', 'status', 'mark', 'warehousing_id', 'file']) + ->field($file) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function ($item)use($export) { $item['outbound'] = ''; + $item['order_type_name'] = ''; if ($item->admin_id) { $item->admin_name = Admin::where(['id' => $item->admin_id])->value('name'); } else { @@ -135,6 +140,10 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte $pay_status = ''; $order_rk = ''; $order_ck = ''; + $nickname = ''; + $phone = ''; + $address = ''; + $arrival_time = ''; if($export==2 && $item['order_sn']!=''){ $find=StoreOrder::where('order_id',$item['order_sn'])->field('paid,pay_type')->find(); if($find){ @@ -171,11 +180,19 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte if($item['outbound_id']>0){ $order_ck=WarehouseOrder::where('id',$item['outbound_id'])->value('code'); } + $nickname = $item->other_data?->nickname??''; + $phone = $item->other_data?->phone??''; + $address= $item->other_data?->address??''; + $arrival_time = $item->other_data?->arrival_time??''; } $item['pay_status'] = $pay_status; $item['pay_type_name'] = $pay_type_name; $item['order_ck'] = $order_ck; $item['order_rk'] = $order_rk; + $item['nickname'] = $nickname; + $item['phone'] = $phone; + $item['address'] = $address; + $item['arrival_time'] = $arrival_time; }) ->toArray(); @@ -231,6 +248,9 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte 'create_time' => '时间', 'pay_status' => '支付状态', 'pay_type_name' => '支付方式', + 'nickname' => '用户', + 'phone' => '手机', + 'address' => '地址', ]; return $data; }