You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
139 lines
4.4 KiB
139 lines
4.4 KiB
<?php
|
|
|
|
namespace App\AdminAgent\Controllers;
|
|
|
|
use App\AdminAgent\Repositories\Withdrawal;
|
|
use App\Traits\DemandTraits;
|
|
use App\Traits\WithdrawalTraits;
|
|
use Dcat\Admin\Admin;
|
|
use Dcat\Admin\Form;
|
|
use Dcat\Admin\Grid;
|
|
use Dcat\Admin\Layout\Column;
|
|
use Dcat\Admin\Layout\Content;
|
|
use Dcat\Admin\Layout\Row;
|
|
use Dcat\Admin\Http\Controllers\AdminController;
|
|
use Dcat\Admin\Widgets\Card;
|
|
|
|
class WalletController extends AdminController
|
|
{
|
|
public function index(Content $content)
|
|
{
|
|
return $content
|
|
->body(
|
|
<<<HTML
|
|
<div class="content-header">
|
|
<section class="content-header breadcrumbs-top">
|
|
<h1 class=" float-left">
|
|
<span class="text-capitalize">我的钱包</span>
|
|
|
|
</h1>
|
|
<div class="clearfix"></div>
|
|
|
|
</section>
|
|
</div>
|
|
HTML
|
|
|
|
)
|
|
->body($this->build())
|
|
->body(function (Row $row) {
|
|
|
|
$row->column(4, function (Column $column){
|
|
$column->row(Card::make('当前余额', function () {
|
|
$balance = Admin::user()->balance;
|
|
return <<<HTML
|
|
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px">
|
|
<h2 class="ml-1 font-large-1 text-primary">$balance</h2>
|
|
</div>
|
|
HTML;
|
|
}));
|
|
});
|
|
|
|
$row->column(4, function (Column $column){
|
|
$column->row(Card::make('已提现', function () {
|
|
$price = \App\Models\Withdrawal::query()
|
|
->where([
|
|
'user_id' => Admin::user()->id,
|
|
'user_type' => DemandTraits::$col[0],
|
|
'status' => WithdrawalTraits::$state[3]
|
|
])
|
|
->sum('price');
|
|
return <<<HTML
|
|
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px">
|
|
<h2 class="ml-1 font-large-1 text-primary">$price</h2>
|
|
</div>
|
|
HTML;
|
|
}));
|
|
|
|
});
|
|
|
|
$row->column(4, function (Column $column) {
|
|
$column->row(Card::make('提现中', function () {
|
|
$price = \App\Models\Withdrawal::query()
|
|
->where([
|
|
'user_id' => Admin::user()->id,
|
|
'user_type' => DemandTraits::$col[0],
|
|
'status' => WithdrawalTraits::$state[0]
|
|
])
|
|
->sum('price');
|
|
return <<<HTML
|
|
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px">
|
|
<h2 class="ml-1 font-large-1 text-primary">$price</h2>
|
|
</div>
|
|
HTML;
|
|
}));
|
|
|
|
});
|
|
|
|
})
|
|
->body(
|
|
Grid::make(new Withdrawal(), function (Grid $grid) {
|
|
$grid->disableActions();
|
|
//$grid->disable();
|
|
$grid->column('id')->sortable();
|
|
$grid->column('price','提现金额');
|
|
$grid->column('pay_type','提现方式')->using(WithdrawalTraits::$userTypeText);
|
|
//$grid->column('pay_id');
|
|
$grid->column('status','状态')->using(WithdrawalTraits::$stateText)->dot([
|
|
|
|
1 => Admin::color()->yellow(),
|
|
2 => 'danger',
|
|
3 => 'success',
|
|
4 => Admin::color()->info(),
|
|
|
|
]);
|
|
$grid->column('created_at');
|
|
$grid->column('updated_at')->sortable();
|
|
$grid->disableCreateButton();
|
|
$grid->disableRowSelector();
|
|
$grid->filter(function (Grid\Filter $filter) {
|
|
$filter->equal('id')->width(3);
|
|
$filter->equal('status','状态')->select(WithdrawalTraits::$stateTextSelect)->width(2);
|
|
});
|
|
})
|
|
|
|
);
|
|
}
|
|
|
|
protected function build()
|
|
{
|
|
Form::dialog('支付宝提现')
|
|
->click('.alipay-create-form') // 绑定点击按钮
|
|
->url('/withdrawak_alipay/create') // 表单页面链接,此参数会被按钮中的 “data-url” 属性替换。。
|
|
->width('700px') // 指定弹窗宽度,可填写百分比,默认 720px
|
|
->height('650px') // 指定弹窗高度,可填写百分比,默认 690px
|
|
->success('Dcat.reload()'); // 新增成功后刷新页面
|
|
|
|
Form::dialog('银行卡提现')
|
|
->click('.bank-create-form') // 绑定点击按钮
|
|
->url('/withdrawak_bank/create') // 表单页面链接,此参数会被按钮中的 “data-url” 属性替换。。
|
|
->width('700px') // 指定弹窗宽度,可填写百分比,默认 720px
|
|
->height('650px') // 指定弹窗高度,可填写百分比,默认 690px
|
|
->success('Dcat.reload()'); // 新增成功后刷新页面
|
|
|
|
return "
|
|
<div style='padding:30px 0'>
|
|
<span class='btn btn-success alipay-create-form'> 支付宝提现 </span>
|
|
<span class='btn btn-success bank-create-form'> 银行卡提现 </span>
|
|
</div>";
|
|
}
|
|
}
|