添加进货补贴明细
parent
da455ad458
commit
d87767765f
|
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
|
||||
namespace App\Admin\Controllers;
|
||||
|
||||
use App\Admin\Repositories\DealerPurchaseLog;
|
||||
use Dcat\Admin\Form;
|
||||
use Dcat\Admin\Grid;
|
||||
use Dcat\Admin\Http\Controllers\AdminController;
|
||||
use Dcat\Admin\Show;
|
||||
|
||||
class DealerPurchaseLogController extends AdminController
|
||||
{
|
||||
/**
|
||||
* Make a grid builder.
|
||||
*
|
||||
* @return Grid
|
||||
*/
|
||||
protected function grid()
|
||||
{
|
||||
$builder = DealerPurchaseLog::with(['user', 'order']);
|
||||
return Grid::make($builder, function (Grid $grid) {
|
||||
$grid->column('id')->sortable();
|
||||
$grid->column('user.phone', '手机号');
|
||||
$grid->column('lvl', '等级')->display(function () {
|
||||
return $this->lvl->text();
|
||||
});
|
||||
$grid->column('order.sn', '订单编号');
|
||||
$grid->column('total_amount');
|
||||
$grid->column('remark');
|
||||
$grid->column('order_completed_at');
|
||||
$grid->column('created_at')->sortable();
|
||||
|
||||
$grid->filter(function (Grid\Filter $filter) {
|
||||
$filter->panel(false);
|
||||
$filter->equal('user.phone', '手机号')->width(3);
|
||||
$filter->between('order_completed_at', '结算时间')->dateTime()->width(7);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a show builder.
|
||||
*
|
||||
* @param mixed $id
|
||||
*
|
||||
* @return Show
|
||||
*/
|
||||
protected function detail($id)
|
||||
{
|
||||
return Show::make($id, new DealerPurchaseLog(), function (Show $show) {
|
||||
$show->field('id');
|
||||
$show->field('user_id');
|
||||
$show->field('order_id');
|
||||
$show->field('lvl');
|
||||
$show->field('total_amount');
|
||||
$show->field('remark');
|
||||
$show->field('order_completed_at');
|
||||
$show->field('created_at');
|
||||
$show->field('updated_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a form builder.
|
||||
*
|
||||
* @return Form
|
||||
*/
|
||||
protected function form()
|
||||
{
|
||||
return Form::make(new DealerPurchaseLog(), function (Form $form) {
|
||||
$form->display('id');
|
||||
$form->text('user_id');
|
||||
$form->text('order_id');
|
||||
$form->text('lvl');
|
||||
$form->text('total_amount');
|
||||
$form->text('remark');
|
||||
$form->text('order_completed_at');
|
||||
|
||||
$form->display('created_at');
|
||||
$form->display('updated_at');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace App\Admin\Repositories;
|
||||
|
||||
use App\Models\DealerPurchaseLog as Model;
|
||||
use Dcat\Admin\Repositories\EloquentRepository;
|
||||
|
||||
class DealerPurchaseLog extends EloquentRepository
|
||||
{
|
||||
/**
|
||||
* Model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $eloquentClass = Model::class;
|
||||
}
|
||||
|
|
@ -184,6 +184,7 @@ Route::group([
|
|||
//批零明细
|
||||
$router->get('dealer-manager-sales-logs', 'DealerManagerSalesLogController@index')->name('dealer_manager_sales_logs.index');
|
||||
$router->get('dealer-manage-subsidy-logs', 'DealerManageSubsidyLogController@index')->name('dealer_manage_subsidy_logs.index');
|
||||
$router->get('dealer-purchase-logs', 'DealerPurchaseLogController@index')->name('dealer_purchase_logs.index');
|
||||
|
||||
/** api接口 **/
|
||||
$router->get('api/product-categories', 'ProductCategoryController@categories')->name('api.product_categories');
|
||||
|
|
|
|||
|
|
@ -3,10 +3,13 @@
|
|||
namespace App\Models;
|
||||
|
||||
use App\Enums\DealerLvl;
|
||||
use Dcat\Admin\Traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DealerPurchaseLog extends Model
|
||||
{
|
||||
use HasDateTimeFormatter;
|
||||
|
||||
protected $casts = [
|
||||
'lvl' => DealerLvl::class,
|
||||
'order_completed_at' => 'datetime',
|
||||
|
|
@ -21,4 +24,14 @@ class DealerPurchaseLog extends Model
|
|||
'remark',
|
||||
'order_completed_at',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
public function order()
|
||||
{
|
||||
return $this->belongsTo(DealerOrder::class, 'order_id');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -324,6 +324,11 @@ class AdminMenuSeeder extends Seeder
|
|||
'icon' => '',
|
||||
'uri' => 'dealer-earnings-purchase?filter-earningable_type[]=dealer_purchase_subsidy',
|
||||
],
|
||||
[
|
||||
'title' =>'进货补贴明细',
|
||||
'icon' => '',
|
||||
'uri' => 'dealer-purchase-logs',
|
||||
],
|
||||
[
|
||||
'title'=>'管理津贴',
|
||||
'icon' => '',
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'labels' => [
|
||||
'DealerPurchaseLog' => '进货补贴明细',
|
||||
'dealer-purchase-logs' => '进货补贴明细',
|
||||
],
|
||||
'fields' => [
|
||||
'user_id' => '用户',
|
||||
'order_id' => '订单',
|
||||
'lvl' => '经销商等级',
|
||||
'total_amount' => '订单金额',
|
||||
'remark' => '备注',
|
||||
'order_completed_at' => '订单完成时间',
|
||||
],
|
||||
'options' => [
|
||||
],
|
||||
];
|
||||
Loading…
Reference in New Issue