余额提现状态枚举
parent
d590a90350
commit
f78debbb37
|
|
@ -4,6 +4,7 @@ namespace App\Admin\Controllers;
|
|||
|
||||
use App\Admin\Widgets\InfoBox;
|
||||
use App\Enums\PayWay;
|
||||
use App\Enums\WalletToBankLogStatus;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Order;
|
||||
use App\Models\WalletLog;
|
||||
|
|
@ -65,7 +66,7 @@ class MonthlyStatisticsController extends Controller
|
|||
->sum('change_balance');
|
||||
|
||||
// 提现总额
|
||||
$withdrawAmount = WalletToBankLog::where('status', WalletToBankLog::STATUS_AGREE)
|
||||
$withdrawAmount = WalletToBankLog::where('status', WalletToBankLogStatus::Completed)
|
||||
->whereBetween('updated_at', [$start, $end])
|
||||
->sum('amount');
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace App\Admin\Controllers;
|
|||
|
||||
use App\Admin\Actions\Grid\WalletToBankLogVerify;
|
||||
use App\Admin\Repositories\WalletToBankLog;
|
||||
use App\Models\WalletToBankLog as WalletToBankLogModel;
|
||||
use App\Enums\WalletToBankLogStatus;
|
||||
use Dcat\Admin\Admin;
|
||||
use Dcat\Admin\Form;
|
||||
use Dcat\Admin\Grid;
|
||||
|
|
@ -37,15 +37,12 @@ class WalletToBankLogController extends AdminController
|
|||
$grid->column('account_amount')->display(function ($v) {
|
||||
return bcdiv($v, 100, 2);
|
||||
})->prepend('¥');
|
||||
$grid->column('status')->using([
|
||||
WalletToBankLogModel::STATUS_PENDING=>'待处理',
|
||||
WalletToBankLogModel::STATUS_AGREE=>'同意',
|
||||
WalletToBankLogModel::STATUS_REFUSE=>'拒绝',
|
||||
])->dot([
|
||||
0=>'primary',
|
||||
1=>'success',
|
||||
2=>'danger',
|
||||
]);
|
||||
$grid->column('status')->display(function ($v) {
|
||||
$text = $v->text();
|
||||
$background = $v->color();
|
||||
|
||||
return "<i class='fa fa-circle' style='font-size: 13px;color: {$background}'></i> {$text}";
|
||||
});
|
||||
$grid->column('remarks');
|
||||
$grid->column('created_at')->sortable();
|
||||
|
||||
|
|
@ -54,18 +51,14 @@ class WalletToBankLogController extends AdminController
|
|||
$grid->model()->orderBy('created_at', 'desc');
|
||||
|
||||
$grid->actions(function (Grid\Displayers\Actions $actions) {
|
||||
if ($actions->row->status == 0 && Admin::user()->can('dcat.admin.wallet_to_bank_logs.verify')) {
|
||||
if ($actions->row->status == WalletToBankLogStatus::Pending && Admin::user()->can('dcat.admin.wallet_to_bank_logs.verify')) {
|
||||
$actions->append(new WalletToBankLogVerify());
|
||||
}
|
||||
});
|
||||
|
||||
$grid->filter(function (Grid\Filter $filter) {
|
||||
$filter->panel();
|
||||
$filter->equal('status')->select([
|
||||
WalletToBankLogModel::STATUS_PENDING=>'待处理',
|
||||
WalletToBankLogModel::STATUS_AGREE=>'已同意',
|
||||
WalletToBankLogModel::STATUS_REFUSE=>'已拒绝',
|
||||
])->width(3);
|
||||
$filter->equal('status')->select(WalletToBankLogStatus::texts())->width(3);
|
||||
$filter->equal('user.phone')->width(3);
|
||||
$filter->equal('username')->width(3);
|
||||
$filter->between('created_at')->dateTime()->width(7);
|
||||
|
|
|
|||
|
|
@ -76,9 +76,10 @@ class WalletToBankLogVerify extends Form implements LazyRenderable
|
|||
$this->currency('account_amount')->symbol('¥')->value(bcdiv($log->account_amount, 100, 2))->disable();
|
||||
|
||||
$this->radio('status')->options([
|
||||
1 => '成功',
|
||||
1 => '通过',
|
||||
2 => '拒绝',
|
||||
])->default(1);
|
||||
|
||||
$this->text('remarks')->rules('required_if:status,2', ['required_if'=>'拒绝时需要填写备注']);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
enum WalletToBankLogStatus: int {
|
||||
case Pending = 0;
|
||||
case Completed = 1;
|
||||
case Refused = 2;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function color(): string
|
||||
{
|
||||
return match ($this) {
|
||||
static::Pending => '#5b69bc',
|
||||
static::Completed => '#21b978',
|
||||
static::Refused => '#b3b9bf',
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function text(): string
|
||||
{
|
||||
return static::texts()[$this->value];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function texts(): array
|
||||
{
|
||||
return [
|
||||
static::Pending->value => '待处理',
|
||||
static::Completed->value => '已完成',
|
||||
static::Refused->value => '已拒绝',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\WalletToBankLogStatus;
|
||||
use Dcat\Admin\Traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
|
@ -11,9 +12,13 @@ class WalletToBankLog extends Model
|
|||
use HasFactory;
|
||||
use HasDateTimeFormatter;
|
||||
|
||||
public const STATUS_PENDING = 0;//'待处理'
|
||||
public const STATUS_AGREE = 1;//'已同意'
|
||||
public const STATUS_REFUSE = 2;//'已拒绝'
|
||||
public const STATUS_PENDING = 0; // 待审核
|
||||
public const STATUS_AGREE = 1; // 已完成
|
||||
public const STATUS_REFUSE = 2; // 已拒绝
|
||||
|
||||
protected $casts = [
|
||||
'status' => WalletToBankLogStatus::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
|
|
|
|||
Loading…
Reference in New Issue