6
0
Fork 0

添加后台资金列表

release
vine_liutk 2022-01-20 10:03:47 +08:00 committed by 李静
parent 4db09cac16
commit a3874baa05
9 changed files with 304 additions and 36 deletions

View File

@ -0,0 +1,123 @@
<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\DealerEarning;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Http\Controllers\AdminController;
use Dcat\Admin\Show;
class DealerEarningController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
$earning = DealerEarning::with('user');
return Grid::make($earning, function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('user.phone');
$grid->column('type_name')->display(function () {
return $this->type_name;
})->label();
// $grid->column('earningable_type');
// $grid->column('earningable_id');
$grid->column('lvl')->display(function () {
return $this->lvl_text;
});
$grid->column('is_manager')->bool();
$grid->column('total_amount')->prepend('¥');
$grid->column('fee_rate')->append('%');
$grid->column('fee')->prepend('¥');
$grid->column('total_earnings')->prepend('¥');
$grid->column('payer_id');
// $grid->column('pay_info');
$grid->column('pay_at');
$grid->column('settle_at');
$grid->column('status_format')->display(function ($value) {
return $this->status_format;
})->using([
-1=>'待结算',
0=>'待打款',
1=>'待收款',
2=>'已完成',
])->dot();
$grid->column('remark');
// $grid->column('pay_image');
$grid->column('created_at')->sortable();
$grid->filter(function (Grid\Filter $filter) {
$filter->panel();
$filter->equal('user.phone')->width(3);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new DealerEarning(), function (Show $show) {
$show->field('id');
$show->field('user_id');
$show->field('earningable_type');
$show->field('earningable_id');
$show->field('lvl');
$show->field('is_manager');
$show->field('total_amount');
$show->field('total_earnings');
$show->field('fee');
$show->field('fee_rate');
$show->field('payer_id');
$show->field('pay_info');
$show->field('pay_at');
$show->field('settle_at');
$show->field('status');
$show->field('remark');
$show->field('pay_image');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new DealerEarning(), function (Form $form) {
$form->display('id');
$form->text('user_id');
$form->text('earningable_type');
$form->text('earningable_id');
$form->text('lvl');
$form->text('is_manager');
$form->text('total_amount');
$form->text('total_earnings');
$form->text('fee');
$form->text('fee_rate');
$form->text('payer_id');
$form->text('pay_info');
$form->text('pay_at');
$form->text('settle_at');
$form->text('status');
$form->text('remark');
$form->text('pay_image');
$form->display('created_at');
$form->display('updated_at');
});
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Admin\Repositories;
use App\Models\DealerEarning as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class DealerEarning extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}

View File

@ -172,6 +172,9 @@ Route::group([
'index',
])->names('dealers');
//渠道补贴
$router->get('dealer-earnings-channel', 'DealerEarningController@index')->name('dealer_earnings.channel');
/** api接口 **/
$router->get('api/product-categories', 'ProductCategoryController@categories')->name('api.product_categories');
$router->get('api/product-group-details', 'ProductGroupController@details')->name('api.product_group_details');

View File

@ -19,12 +19,12 @@ class DealerEarningResource extends JsonResource
'id' => $this->id,
'type' => $this->type_name,
'created_at' => $this->created_at->toDateTimeString(),
'settle_at' => $this->settle_at->toDateTimeString(),
'settle_at' => $this->settle_at?->toDateTimeString(),
'total_amount' => $this->total_amount,
'fee_rate' => $this->fee_rate,
'fee' => $this->fee,
'total_earnings'=> $this->total_earnings,
'status' => $this->settle_at ? $this->status : -1,
'status' => $this->status_format,
'status_name' => $this->status_name,
'remark' => $this->remark,
'pay_info' => $this->getPayInfo(),

View File

@ -19,7 +19,7 @@ class DealerEarningSimpleResource extends JsonResource
'type' => $this->type_name,
'created_at' => $this->created_at->toDateTimeString(),
'total_earnings'=> $this->total_earnings,
'status' => $this->settle_at ? $this->status : -1,
'status' => $this->status_format,
'status_name' => $this->status_name,
'is_payer' => $this->payer_id ? ($this->payer_id == $request->user()->id) : false,
// 'settle_at'

View File

@ -134,6 +134,11 @@ class DealerEarning extends Model
}
}
public function getStatusFormatAttribute()
{
return $this->settle_at ? $this->status->value : -1;
}
public function getTypeNameAttribute()
{
$name = '未知';

View File

@ -312,7 +312,7 @@ class AdminMenuSeeder extends Seeder
[
'title' =>'渠道补贴',
'icon'=>'',
'uri' => '',
'uri' => 'dealer-earnings-channel?type=channel',
],
[
'title' =>'进货补贴',

View File

@ -109,20 +109,37 @@ namespace Dcat\Admin {
* @property Grid\Column|Collection use_start_at
* @property Grid\Column|Collection lvl
* @property Grid\Column|Collection order_completed_at
* @property Grid\Column|Collection remark
* @property Grid\Column|Collection total_amount
* @property Grid\Column|Collection earningable_id
* @property Grid\Column|Collection earningable_type
* @property Grid\Column|Collection fee
* @property Grid\Column|Collection fee_rate
* @property Grid\Column|Collection is_manager
* @property Grid\Column|Collection pay_at
* @property Grid\Column|Collection pay_image
* @property Grid\Column|Collection pay_info
* @property Grid\Column|Collection payer_id
* @property Grid\Column|Collection settle_at
* @property Grid\Column|Collection total_earnings
* @property Grid\Column|Collection end_at
* @property Grid\Column|Collection is_settle
* @property Grid\Column|Collection real_amount
* @property Grid\Column|Collection start_at
* @property Grid\Column|Collection product_id
* @property Grid\Column|Collection sales_volume
* @property Grid\Column|Collection total_amount
* @property Grid\Column|Collection last_consignor_id
* @property Grid\Column|Collection new_consignor_id
* @property Grid\Column|Collection price
* @property Grid\Column|Collection qty
* @property Grid\Column|Collection sale_price
* @property Grid\Column|Collection allocated_at
* @property Grid\Column|Collection consignee_address
* @property Grid\Column|Collection consignee_name
* @property Grid\Column|Collection consignee_telephone
* @property Grid\Column|Collection consignee_zone
* @property Grid\Column|Collection consignor_id
* @property Grid\Column|Collection paied_time
* @property Grid\Column|Collection pay_image
* @property Grid\Column|Collection pay_info
* @property Grid\Column|Collection pay_time
* @property Grid\Column|Collection settle_state
* @property Grid\Column|Collection shipping_time
@ -136,12 +153,19 @@ namespace Dcat\Admin {
* @property Grid\Column|Collection sales_count
* @property Grid\Column|Collection unit
* @property Grid\Column|Collection path
* @property Grid\Column|Collection remark
* @property Grid\Column|Collection is_manager
* @property Grid\Column|Collection subsidy_rate
* @property Grid\Column|Collection total_purchase_amount
* @property Grid\Column|Collection total_subsidy
* @property Grid\Column|Collection change_amount
* @property Grid\Column|Collection change_from_purchase_subsidy_id
* @property Grid\Column|Collection purchase_subsidy_id
* @property Grid\Column|Collection before_lvl
* @property Grid\Column|Collection change_lvl
* @property Grid\Column|Collection bonds
* @property Grid\Column|Collection contracted_lvl_at
* @property Grid\Column|Collection failed_reason
* @property Grid\Column|Collection jobable_id
* @property Grid\Column|Collection jobable_type
* @property Grid\Column|Collection change_amount
* @property Grid\Column|Collection change_revenue
* @property Grid\Column|Collection change_sales_value
* @property Grid\Column|Collection pre_income_id
@ -190,10 +214,8 @@ namespace Dcat\Admin {
* @property Grid\Column|Collection max
* @property Grid\Column|Collection auto_complete_at
* @property Grid\Column|Collection is_change
* @property Grid\Column|Collection is_settle
* @property Grid\Column|Collection note
* @property Grid\Column|Collection out_trade_no
* @property Grid\Column|Collection pay_at
* @property Grid\Column|Collection pay_sn
* @property Grid\Column|Collection pay_way
* @property Grid\Column|Collection products_total_amount
@ -379,20 +401,37 @@ namespace Dcat\Admin {
* @method Grid\Column|Collection use_start_at(string $label = null)
* @method Grid\Column|Collection lvl(string $label = null)
* @method Grid\Column|Collection order_completed_at(string $label = null)
* @method Grid\Column|Collection remark(string $label = null)
* @method Grid\Column|Collection total_amount(string $label = null)
* @method Grid\Column|Collection earningable_id(string $label = null)
* @method Grid\Column|Collection earningable_type(string $label = null)
* @method Grid\Column|Collection fee(string $label = null)
* @method Grid\Column|Collection fee_rate(string $label = null)
* @method Grid\Column|Collection is_manager(string $label = null)
* @method Grid\Column|Collection pay_at(string $label = null)
* @method Grid\Column|Collection pay_image(string $label = null)
* @method Grid\Column|Collection pay_info(string $label = null)
* @method Grid\Column|Collection payer_id(string $label = null)
* @method Grid\Column|Collection settle_at(string $label = null)
* @method Grid\Column|Collection total_earnings(string $label = null)
* @method Grid\Column|Collection end_at(string $label = null)
* @method Grid\Column|Collection is_settle(string $label = null)
* @method Grid\Column|Collection real_amount(string $label = null)
* @method Grid\Column|Collection start_at(string $label = null)
* @method Grid\Column|Collection product_id(string $label = null)
* @method Grid\Column|Collection sales_volume(string $label = null)
* @method Grid\Column|Collection total_amount(string $label = null)
* @method Grid\Column|Collection last_consignor_id(string $label = null)
* @method Grid\Column|Collection new_consignor_id(string $label = null)
* @method Grid\Column|Collection price(string $label = null)
* @method Grid\Column|Collection qty(string $label = null)
* @method Grid\Column|Collection sale_price(string $label = null)
* @method Grid\Column|Collection allocated_at(string $label = null)
* @method Grid\Column|Collection consignee_address(string $label = null)
* @method Grid\Column|Collection consignee_name(string $label = null)
* @method Grid\Column|Collection consignee_telephone(string $label = null)
* @method Grid\Column|Collection consignee_zone(string $label = null)
* @method Grid\Column|Collection consignor_id(string $label = null)
* @method Grid\Column|Collection paied_time(string $label = null)
* @method Grid\Column|Collection pay_image(string $label = null)
* @method Grid\Column|Collection pay_info(string $label = null)
* @method Grid\Column|Collection pay_time(string $label = null)
* @method Grid\Column|Collection settle_state(string $label = null)
* @method Grid\Column|Collection shipping_time(string $label = null)
@ -406,12 +445,19 @@ namespace Dcat\Admin {
* @method Grid\Column|Collection sales_count(string $label = null)
* @method Grid\Column|Collection unit(string $label = null)
* @method Grid\Column|Collection path(string $label = null)
* @method Grid\Column|Collection remark(string $label = null)
* @method Grid\Column|Collection is_manager(string $label = null)
* @method Grid\Column|Collection subsidy_rate(string $label = null)
* @method Grid\Column|Collection total_purchase_amount(string $label = null)
* @method Grid\Column|Collection total_subsidy(string $label = null)
* @method Grid\Column|Collection change_amount(string $label = null)
* @method Grid\Column|Collection change_from_purchase_subsidy_id(string $label = null)
* @method Grid\Column|Collection purchase_subsidy_id(string $label = null)
* @method Grid\Column|Collection before_lvl(string $label = null)
* @method Grid\Column|Collection change_lvl(string $label = null)
* @method Grid\Column|Collection bonds(string $label = null)
* @method Grid\Column|Collection contracted_lvl_at(string $label = null)
* @method Grid\Column|Collection failed_reason(string $label = null)
* @method Grid\Column|Collection jobable_id(string $label = null)
* @method Grid\Column|Collection jobable_type(string $label = null)
* @method Grid\Column|Collection change_amount(string $label = null)
* @method Grid\Column|Collection change_revenue(string $label = null)
* @method Grid\Column|Collection change_sales_value(string $label = null)
* @method Grid\Column|Collection pre_income_id(string $label = null)
@ -460,10 +506,8 @@ namespace Dcat\Admin {
* @method Grid\Column|Collection max(string $label = null)
* @method Grid\Column|Collection auto_complete_at(string $label = null)
* @method Grid\Column|Collection is_change(string $label = null)
* @method Grid\Column|Collection is_settle(string $label = null)
* @method Grid\Column|Collection note(string $label = null)
* @method Grid\Column|Collection out_trade_no(string $label = null)
* @method Grid\Column|Collection pay_at(string $label = null)
* @method Grid\Column|Collection pay_sn(string $label = null)
* @method Grid\Column|Collection pay_way(string $label = null)
* @method Grid\Column|Collection products_total_amount(string $label = null)
@ -654,20 +698,37 @@ namespace Dcat\Admin {
* @property Show\Field|Collection use_start_at
* @property Show\Field|Collection lvl
* @property Show\Field|Collection order_completed_at
* @property Show\Field|Collection remark
* @property Show\Field|Collection total_amount
* @property Show\Field|Collection earningable_id
* @property Show\Field|Collection earningable_type
* @property Show\Field|Collection fee
* @property Show\Field|Collection fee_rate
* @property Show\Field|Collection is_manager
* @property Show\Field|Collection pay_at
* @property Show\Field|Collection pay_image
* @property Show\Field|Collection pay_info
* @property Show\Field|Collection payer_id
* @property Show\Field|Collection settle_at
* @property Show\Field|Collection total_earnings
* @property Show\Field|Collection end_at
* @property Show\Field|Collection is_settle
* @property Show\Field|Collection real_amount
* @property Show\Field|Collection start_at
* @property Show\Field|Collection product_id
* @property Show\Field|Collection sales_volume
* @property Show\Field|Collection total_amount
* @property Show\Field|Collection last_consignor_id
* @property Show\Field|Collection new_consignor_id
* @property Show\Field|Collection price
* @property Show\Field|Collection qty
* @property Show\Field|Collection sale_price
* @property Show\Field|Collection allocated_at
* @property Show\Field|Collection consignee_address
* @property Show\Field|Collection consignee_name
* @property Show\Field|Collection consignee_telephone
* @property Show\Field|Collection consignee_zone
* @property Show\Field|Collection consignor_id
* @property Show\Field|Collection paied_time
* @property Show\Field|Collection pay_image
* @property Show\Field|Collection pay_info
* @property Show\Field|Collection pay_time
* @property Show\Field|Collection settle_state
* @property Show\Field|Collection shipping_time
@ -681,12 +742,19 @@ namespace Dcat\Admin {
* @property Show\Field|Collection sales_count
* @property Show\Field|Collection unit
* @property Show\Field|Collection path
* @property Show\Field|Collection remark
* @property Show\Field|Collection is_manager
* @property Show\Field|Collection subsidy_rate
* @property Show\Field|Collection total_purchase_amount
* @property Show\Field|Collection total_subsidy
* @property Show\Field|Collection change_amount
* @property Show\Field|Collection change_from_purchase_subsidy_id
* @property Show\Field|Collection purchase_subsidy_id
* @property Show\Field|Collection before_lvl
* @property Show\Field|Collection change_lvl
* @property Show\Field|Collection bonds
* @property Show\Field|Collection contracted_lvl_at
* @property Show\Field|Collection failed_reason
* @property Show\Field|Collection jobable_id
* @property Show\Field|Collection jobable_type
* @property Show\Field|Collection change_amount
* @property Show\Field|Collection change_revenue
* @property Show\Field|Collection change_sales_value
* @property Show\Field|Collection pre_income_id
@ -735,10 +803,8 @@ namespace Dcat\Admin {
* @property Show\Field|Collection max
* @property Show\Field|Collection auto_complete_at
* @property Show\Field|Collection is_change
* @property Show\Field|Collection is_settle
* @property Show\Field|Collection note
* @property Show\Field|Collection out_trade_no
* @property Show\Field|Collection pay_at
* @property Show\Field|Collection pay_sn
* @property Show\Field|Collection pay_way
* @property Show\Field|Collection products_total_amount
@ -924,20 +990,37 @@ namespace Dcat\Admin {
* @method Show\Field|Collection use_start_at(string $label = null)
* @method Show\Field|Collection lvl(string $label = null)
* @method Show\Field|Collection order_completed_at(string $label = null)
* @method Show\Field|Collection remark(string $label = null)
* @method Show\Field|Collection total_amount(string $label = null)
* @method Show\Field|Collection earningable_id(string $label = null)
* @method Show\Field|Collection earningable_type(string $label = null)
* @method Show\Field|Collection fee(string $label = null)
* @method Show\Field|Collection fee_rate(string $label = null)
* @method Show\Field|Collection is_manager(string $label = null)
* @method Show\Field|Collection pay_at(string $label = null)
* @method Show\Field|Collection pay_image(string $label = null)
* @method Show\Field|Collection pay_info(string $label = null)
* @method Show\Field|Collection payer_id(string $label = null)
* @method Show\Field|Collection settle_at(string $label = null)
* @method Show\Field|Collection total_earnings(string $label = null)
* @method Show\Field|Collection end_at(string $label = null)
* @method Show\Field|Collection is_settle(string $label = null)
* @method Show\Field|Collection real_amount(string $label = null)
* @method Show\Field|Collection start_at(string $label = null)
* @method Show\Field|Collection product_id(string $label = null)
* @method Show\Field|Collection sales_volume(string $label = null)
* @method Show\Field|Collection total_amount(string $label = null)
* @method Show\Field|Collection last_consignor_id(string $label = null)
* @method Show\Field|Collection new_consignor_id(string $label = null)
* @method Show\Field|Collection price(string $label = null)
* @method Show\Field|Collection qty(string $label = null)
* @method Show\Field|Collection sale_price(string $label = null)
* @method Show\Field|Collection allocated_at(string $label = null)
* @method Show\Field|Collection consignee_address(string $label = null)
* @method Show\Field|Collection consignee_name(string $label = null)
* @method Show\Field|Collection consignee_telephone(string $label = null)
* @method Show\Field|Collection consignee_zone(string $label = null)
* @method Show\Field|Collection consignor_id(string $label = null)
* @method Show\Field|Collection paied_time(string $label = null)
* @method Show\Field|Collection pay_image(string $label = null)
* @method Show\Field|Collection pay_info(string $label = null)
* @method Show\Field|Collection pay_time(string $label = null)
* @method Show\Field|Collection settle_state(string $label = null)
* @method Show\Field|Collection shipping_time(string $label = null)
@ -951,12 +1034,19 @@ namespace Dcat\Admin {
* @method Show\Field|Collection sales_count(string $label = null)
* @method Show\Field|Collection unit(string $label = null)
* @method Show\Field|Collection path(string $label = null)
* @method Show\Field|Collection remark(string $label = null)
* @method Show\Field|Collection is_manager(string $label = null)
* @method Show\Field|Collection subsidy_rate(string $label = null)
* @method Show\Field|Collection total_purchase_amount(string $label = null)
* @method Show\Field|Collection total_subsidy(string $label = null)
* @method Show\Field|Collection change_amount(string $label = null)
* @method Show\Field|Collection change_from_purchase_subsidy_id(string $label = null)
* @method Show\Field|Collection purchase_subsidy_id(string $label = null)
* @method Show\Field|Collection before_lvl(string $label = null)
* @method Show\Field|Collection change_lvl(string $label = null)
* @method Show\Field|Collection bonds(string $label = null)
* @method Show\Field|Collection contracted_lvl_at(string $label = null)
* @method Show\Field|Collection failed_reason(string $label = null)
* @method Show\Field|Collection jobable_id(string $label = null)
* @method Show\Field|Collection jobable_type(string $label = null)
* @method Show\Field|Collection change_amount(string $label = null)
* @method Show\Field|Collection change_revenue(string $label = null)
* @method Show\Field|Collection change_sales_value(string $label = null)
* @method Show\Field|Collection pre_income_id(string $label = null)
@ -1005,10 +1095,8 @@ namespace Dcat\Admin {
* @method Show\Field|Collection max(string $label = null)
* @method Show\Field|Collection auto_complete_at(string $label = null)
* @method Show\Field|Collection is_change(string $label = null)
* @method Show\Field|Collection is_settle(string $label = null)
* @method Show\Field|Collection note(string $label = null)
* @method Show\Field|Collection out_trade_no(string $label = null)
* @method Show\Field|Collection pay_at(string $label = null)
* @method Show\Field|Collection pay_sn(string $label = null)
* @method Show\Field|Collection pay_way(string $label = null)
* @method Show\Field|Collection products_total_amount(string $label = null)

View File

@ -0,0 +1,33 @@
<?php
return [
'labels' => [
'DealerEarning' => '资金明细',
'dealer-earnings' => '资金明细',
],
'fields' => [
'user_id' => '用户',
'user'=>[
'phone' => '手机号',
],
'earningable_type' => 'earningable_type',
'earningable_id' => 'earningable_id',
'type_name' => '资金类型',
'lvl' => '经销商等级',
'is_manager' => '管理者',
'total_amount' => '总金额',
'total_earnings' => '总收入',
'fee' => '手续费',
'fee_rate' => '手续费率',
'payer_id' => '付款人',
'pay_info' => '收款信息',
'pay_at' => '付款时间',
'settle_at' => '结算时间',
'status' => '状态',
'status_format' => '状态',
'remark' => '备注',
'pay_image' => '打款凭证',
],
'options' => [
],
];