feat(admin): 优化导出功能并添加用户信息字段
- 为导出类型 2 增加 other_data 字段 - 添加用户昵称、手机号、地址等信息字段 - 优化数据查询和处理逻辑,提高导出效率
This commit is contained in:
parent
8998c281ba
commit
736ecea4fb
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user