7 changed files with 172 additions and 93 deletions
-
71app/Admin/Controllers/v3/OrderDeliveryReportController.php
-
89app/Admin/Renderable/OrderDeliveryById.php
-
75app/Admin/Repositories/v3/OrderDeliveryReport.php
-
3app/Admin/routes.php
-
9app/Models/ImsCjdcOrderMain.php
-
2app/Models/v3/LanzuEmployees.php
-
14resources/lang/zh-CN/order-delivery-report.php
@ -0,0 +1,89 @@ |
|||||
|
<?php |
||||
|
namespace App\Admin\Renderable; |
||||
|
|
||||
|
use Dcat\Admin\Grid; |
||||
|
use App\Admin\Common\Type; |
||||
|
use Dcat\Admin\Grid\LazyRenderable; |
||||
|
use App\Models\ImsCjdcOrderMain as OrderMainModel; |
||||
|
|
||||
|
class OrderDeliveryById extends LazyRenderable |
||||
|
{ |
||||
|
protected $title = '配送记录'; |
||||
|
|
||||
|
public function grid(): Grid |
||||
|
{ |
||||
|
// 获取外部传递的参数
|
||||
|
$horsemanId = $this->horseman_id ?? 0; |
||||
|
$model = new OrderMainModel(); |
||||
|
if($horsemanId > 0){ |
||||
|
$model->where('horseman_id',$horsemanId); |
||||
|
} |
||||
|
|
||||
|
return Grid::make($model, function (Grid $grid) { |
||||
|
$grid->column('id','ID'); |
||||
|
$grid->column('user_id','配送员姓名'); |
||||
|
$grid->column('global_order_id','订单编号'); |
||||
|
$grid->column('market_id','下单市场'); |
||||
|
|
||||
|
$grid->column('created_at','下单时间')->display(function($createdAt){ |
||||
|
return date('Y-m-d H:i:s',$createdAt);; |
||||
|
}); |
||||
|
|
||||
|
$grid->column('status','状态') |
||||
|
->using( |
||||
|
[] |
||||
|
) |
||||
|
->label( |
||||
|
config('label.status_label') |
||||
|
); |
||||
|
$grid->column('created_at')->display(function($createdAt){ |
||||
|
return date('Y-m-d H:i:s',$createdAt); |
||||
|
}); |
||||
|
// 搜索
|
||||
|
$grid->filter(function (Grid\Filter $filter){ |
||||
|
$userTypeList = Type::USER_TYPE_LIST; |
||||
|
$moneyTypeList = Type::MONEY_TYPE_LIST; |
||||
|
$sourceTYpeList = Type::SOURCE_TYPE_LIST; |
||||
|
unset($userTypeList[0],$moneyTypeList[0]); |
||||
|
|
||||
|
$filter->equal('id','流水表ID')->width(3); |
||||
|
$filter->equal('user_id','账户ID')->width(3); |
||||
|
$filter->equal('current_balance','账户余额')->width(3); |
||||
|
|
||||
|
$filter->equal('money','流水金额')->width(3); |
||||
|
$filter->equal('source_id','关联流水ID')->width(3); |
||||
|
|
||||
|
$filter->equal('money_type','流水类型')->select($userTypeList)->width(4); |
||||
|
$filter->equal('user_type','账户类型')->select($moneyTypeList)->width(4); |
||||
|
$filter->equal('source_type','关联类型')->select($sourceTYpeList)->width(4); |
||||
|
|
||||
|
$filter->whereBetween('created_at',function($q){ |
||||
|
$start = $this->input['start'] ?? null; |
||||
|
$end = $this->input['end'] ?? null; |
||||
|
if($start !== null){ |
||||
|
$q->where('created_at','>=',strtotime($start)); |
||||
|
} |
||||
|
if($end !== null){ |
||||
|
$q->where('created_at','<=',strtotime($end)); |
||||
|
} |
||||
|
})->datetime()->width(7); |
||||
|
}); |
||||
|
$grid->model()->orderBy('id','desc'); |
||||
|
// 每页10条
|
||||
|
$grid->paginate(10); |
||||
|
|
||||
|
$grid->disableActions(); |
||||
|
$grid->disableRowSelector(); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public function default() |
||||
|
{ |
||||
|
// 获取外部传递的参数
|
||||
|
$horsemanId = $this->payload['horseman_id'] ?? 0; |
||||
|
|
||||
|
return [ |
||||
|
'horseman_id' => $horsemanId, |
||||
|
]; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
<?php |
||||
|
return [ |
||||
|
'labels' => [ |
||||
|
'OrderDeliveryReport' => '配送统计报表', |
||||
|
'order_delivery_report' => '配送统计报表', |
||||
|
'delivery_report' => '配送统计', |
||||
|
], |
||||
|
'fields' => [ |
||||
|
'user_id' => '懒ID', |
||||
|
'name' => '姓名', |
||||
|
], |
||||
|
'options' => [ |
||||
|
], |
||||
|
]; |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue