批零提现状态枚举
parent
5beec69c39
commit
d98d31487b
|
|
@ -6,6 +6,7 @@ use App\Admin\Actions\Grid\Exports\DealerWalletWithdraw;
|
||||||
use App\Admin\Actions\Show\DealerWalletPay;
|
use App\Admin\Actions\Show\DealerWalletPay;
|
||||||
use App\Admin\Actions\Show\DealerWalletRefuse;
|
use App\Admin\Actions\Show\DealerWalletRefuse;
|
||||||
use App\Admin\Repositories\DealerWalletToBankLog;
|
use App\Admin\Repositories\DealerWalletToBankLog;
|
||||||
|
use App\Enums\DealerWalletToBankLogStatus;
|
||||||
use App\Models\DealerWalletToBankLog as DealerWalletToBankLogModel;
|
use App\Models\DealerWalletToBankLog as DealerWalletToBankLogModel;
|
||||||
use Box\Spout\Writer\Common\Creator\WriterEntityFactory;
|
use Box\Spout\Writer\Common\Creator\WriterEntityFactory;
|
||||||
use Dcat\Admin\Admin;
|
use Dcat\Admin\Admin;
|
||||||
|
|
@ -14,6 +15,7 @@ use Dcat\Admin\Grid;
|
||||||
use Dcat\Admin\Http\Controllers\AdminController;
|
use Dcat\Admin\Http\Controllers\AdminController;
|
||||||
use Dcat\Admin\Show;
|
use Dcat\Admin\Show;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
class DealerWalletToBankLogController extends AdminController
|
class DealerWalletToBankLogController extends AdminController
|
||||||
{
|
{
|
||||||
|
|
@ -35,19 +37,16 @@ class DealerWalletToBankLogController extends AdminController
|
||||||
$grid->column('rate')->append('%');
|
$grid->column('rate')->append('%');
|
||||||
$grid->column('service_amount')->prepend('¥');
|
$grid->column('service_amount')->prepend('¥');
|
||||||
$grid->column('account_amount')->prepend('¥');
|
$grid->column('account_amount')->prepend('¥');
|
||||||
$grid->column('status')->using([
|
$grid->column('status')->display(function ($v) {
|
||||||
DealerWalletToBankLogModel::STATUS_PENDING=>'待处理',
|
$text = $v->text();
|
||||||
DealerWalletToBankLogModel::STATUS_AGREE=>'同意',
|
$background = $v->color();
|
||||||
DealerWalletToBankLogModel::STATUS_REFUSE=>'拒绝',
|
|
||||||
])->dot([
|
return "<i class='fa fa-circle' style='font-size: 13px;color: {$background}'></i> {$text}";
|
||||||
0=>'primary',
|
})->filter(Grid\Column\Filter\In::make(Arr::except(DealerWalletToBankLogStatus::texts(), [
|
||||||
1=>'success',
|
DealerWalletToBankLogStatus::Failed->value,
|
||||||
2=>'danger',
|
DealerWalletToBankLogStatus::Passed->value,
|
||||||
])->filter(Grid\Column\Filter\In::make([
|
DealerWalletToBankLogStatus::Paying->value,
|
||||||
DealerWalletToBankLogModel::STATUS_PENDING=>'待处理',
|
])));
|
||||||
DealerWalletToBankLogModel::STATUS_AGREE=>'同意',
|
|
||||||
DealerWalletToBankLogModel::STATUS_REFUSE=>'拒绝',
|
|
||||||
]));
|
|
||||||
$grid->column('remarks');
|
$grid->column('remarks');
|
||||||
$grid->column('created_at')->sortable();
|
$grid->column('created_at')->sortable();
|
||||||
// $grid->column('updated_at')
|
// $grid->column('updated_at')
|
||||||
|
|
@ -62,11 +61,6 @@ class DealerWalletToBankLogController extends AdminController
|
||||||
|
|
||||||
$grid->filter(function (Grid\Filter $filter) {
|
$grid->filter(function (Grid\Filter $filter) {
|
||||||
$filter->panel();
|
$filter->panel();
|
||||||
// $filter->equal('status')->select([
|
|
||||||
// DealerWalletToBankLogModel::STATUS_PENDING=>'待处理',
|
|
||||||
// DealerWalletToBankLogModel::STATUS_AGREE=>'已同意',
|
|
||||||
// DealerWalletToBankLogModel::STATUS_REFUSE=>'已拒绝',
|
|
||||||
// ])->width(3);
|
|
||||||
$filter->equal('user.phone')->width(3);
|
$filter->equal('user.phone')->width(3);
|
||||||
$filter->between('created_at')->dateTime()->width(7);
|
$filter->between('created_at')->dateTime()->width(7);
|
||||||
});
|
});
|
||||||
|
|
@ -90,15 +84,12 @@ class DealerWalletToBankLogController extends AdminController
|
||||||
$show->field('rate')->append('%');
|
$show->field('rate')->append('%');
|
||||||
$show->field('service_amount')->prepend('¥');
|
$show->field('service_amount')->prepend('¥');
|
||||||
$show->field('account_amount')->prepend('¥');
|
$show->field('account_amount')->prepend('¥');
|
||||||
$show->field('status')->using([
|
$show->field('status')->as(function ($v) {
|
||||||
DealerWalletToBankLogModel::STATUS_PENDING=>'待处理',
|
$text = $this->status->text();
|
||||||
DealerWalletToBankLogModel::STATUS_AGREE=>'同意',
|
$background = $this->status->color();
|
||||||
DealerWalletToBankLogModel::STATUS_REFUSE=>'拒绝',
|
|
||||||
])->dot([
|
return "<i class='fa fa-circle' style='font-size: 13px;color: {$background}'></i> {$text}";
|
||||||
0=>'primary',
|
});
|
||||||
1=>'success',
|
|
||||||
2=>'danger',
|
|
||||||
]);
|
|
||||||
$show->field('pay_image')->image();
|
$show->field('pay_image')->image();
|
||||||
$show->field('remarks');
|
$show->field('remarks');
|
||||||
$show->divider('收款信息-银行');
|
$show->divider('收款信息-银行');
|
||||||
|
|
@ -214,17 +205,13 @@ class DealerWalletToBankLogController extends AdminController
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$statusArr = [
|
|
||||||
DealerWalletToBankLogModel::STATUS_PENDING=>'待处理',
|
|
||||||
DealerWalletToBankLogModel::STATUS_AGREE=>'同意',
|
|
||||||
DealerWalletToBankLogModel::STATUS_REFUSE=>'拒绝',
|
|
||||||
];
|
|
||||||
foreach ($query->cursor() as $log) {
|
foreach ($query->cursor() as $log) {
|
||||||
$payInfo = $log->getPayInfo();
|
$payInfo = $log->getPayInfo();
|
||||||
$writer->addRow(WriterEntityFactory::createRowFromArray([
|
$writer->addRow(WriterEntityFactory::createRowFromArray([
|
||||||
$log->user->phone,
|
$log->user->phone,
|
||||||
$log->account_amount,
|
$log->account_amount,
|
||||||
$statusArr[$log->status],
|
$log->status->text(),
|
||||||
$payInfo ? $payInfo['bank']['user_name'] : '',
|
$payInfo ? $payInfo['bank']['user_name'] : '',
|
||||||
$payInfo ? $payInfo['bank']['bank_name'] : '',
|
$payInfo ? $payInfo['bank']['bank_name'] : '',
|
||||||
$payInfo ? $payInfo['bank']['bank_number'] : '',
|
$payInfo ? $payInfo['bank']['bank_number'] : '',
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Admin\Forms;
|
namespace App\Admin\Forms;
|
||||||
|
|
||||||
|
use App\Enums\DealerWalletToBankLogStatus;
|
||||||
use App\Models\DealerWalletToBankLog;
|
use App\Models\DealerWalletToBankLog;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Dcat\Admin\Contracts\LazyRenderable;
|
use Dcat\Admin\Contracts\LazyRenderable;
|
||||||
|
|
@ -40,8 +41,8 @@ class DealerWalletPay extends Form implements LazyRenderable
|
||||||
$log = DealerWalletToBankLog::findOrFail($id);
|
$log = DealerWalletToBankLog::findOrFail($id);
|
||||||
$log->update([
|
$log->update([
|
||||||
'pay_info' => $log->getPayInfo(),
|
'pay_info' => $log->getPayInfo(),
|
||||||
'pay_image' => $input['pay_image']??null,
|
'pay_image' => $input['pay_image'] ?? null,
|
||||||
'status' => DealerWalletToBankLog::STATUS_AGREE,
|
'status' => DealerWalletToBankLogStatus::Success,
|
||||||
]);
|
]);
|
||||||
DB::commit();
|
DB::commit();
|
||||||
} catch (Throwable $th) {
|
} catch (Throwable $th) {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
namespace App\Admin\Forms;
|
namespace App\Admin\Forms;
|
||||||
|
|
||||||
use App\Enums\DealerWalletAction;
|
use App\Enums\DealerWalletAction;
|
||||||
|
use App\Enums\DealerWalletToBankLogStatus;
|
||||||
use App\Models\DealerWalletToBankLog;
|
use App\Models\DealerWalletToBankLog;
|
||||||
use App\Services\Dealer\WalletService;
|
use App\Services\Dealer\WalletService;
|
||||||
use Dcat\Admin\Contracts\LazyRenderable;
|
use Dcat\Admin\Contracts\LazyRenderable;
|
||||||
|
|
@ -40,8 +41,8 @@ class DealerWalletRefuse extends Form implements LazyRenderable
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
$log = DealerWalletToBankLog::findOrFail($id);
|
$log = DealerWalletToBankLog::findOrFail($id);
|
||||||
$log->update([
|
$log->update([
|
||||||
'remark' => $input['remark']??'',
|
'remark' => $input['remark'] ?? '',
|
||||||
'status' => DealerWalletToBankLog::STATUS_REFUSE,
|
'status' => DealerWalletToBankLogStatus::Refused,
|
||||||
]);
|
]);
|
||||||
//打回余额
|
//打回余额
|
||||||
$walletService = new WalletService();
|
$walletService = new WalletService();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Enums;
|
||||||
|
|
||||||
|
enum DealerWalletToBankLogStatus: int {
|
||||||
|
case Pending = 0;
|
||||||
|
case Success = 1;
|
||||||
|
case Refused = 2;
|
||||||
|
case Passed = 3; // 审核通过 - 等待付款
|
||||||
|
case Paying = 4; // 审核通过 - 付款中
|
||||||
|
case Failed = 9;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function color(): string
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
static::Pending => '#5b69bc',
|
||||||
|
static::Passed => '#dda451',
|
||||||
|
static::Paying => '#3085d6',
|
||||||
|
static::Success => '#21b978',
|
||||||
|
static::Failed => '#ea5455',
|
||||||
|
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::Passed->value => '待付款',
|
||||||
|
static::Paying->value => '付款中',
|
||||||
|
static::Success->value => '成功',
|
||||||
|
static::Failed->value => '失败',
|
||||||
|
static::Refused->value => '拒绝',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Enums\DealerWalletToBankLogStatus;
|
||||||
use Dcat\Admin\Traits\HasDateTimeFormatter;
|
use Dcat\Admin\Traits\HasDateTimeFormatter;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
@ -11,9 +12,9 @@ class DealerWalletToBankLog extends Model
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
use HasDateTimeFormatter;
|
use HasDateTimeFormatter;
|
||||||
|
|
||||||
public const STATUS_PENDING = 0;//'待处理'
|
protected $casts = [
|
||||||
public const STATUS_AGREE = 1;//'已同意'
|
'status' => DealerWalletToBankLogStatus::class,
|
||||||
public const STATUS_REFUSE = 2;//'已拒绝'
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
|
|
@ -49,7 +50,7 @@ class DealerWalletToBankLog extends Model
|
||||||
*/
|
*/
|
||||||
public function isPending()
|
public function isPending()
|
||||||
{
|
{
|
||||||
return $this->status == self::STATUS_PENDING;
|
return $this->status === DealerWalletToBankLogStatus::Pending;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue