调整后台批零补贴查询
parent
3cd5260ad7
commit
6ca7416221
|
|
@ -92,9 +92,28 @@ class DealerEarningController extends AdminController
|
|||
// }
|
||||
});
|
||||
|
||||
$grid->header(function ($collection) use ($grid) {
|
||||
$query = DealerEarningModel::query();
|
||||
|
||||
// 拿到表格筛选 where 条件数组进行遍历
|
||||
$grid->model()->getQueries()->unique()->each(function ($value) use (&$query) {
|
||||
if (in_array($value['method'], ['paginate', 'get', 'orderBy', 'orderByDesc'], true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$query = call_user_func_array([$query, $value['method']], $value['arguments'] ?? []);
|
||||
});
|
||||
|
||||
// 查出统计数据
|
||||
$totalAmount = (clone $query)->sum('total_amount');
|
||||
// 自定义组件
|
||||
return "<div style='padding: 10px;'>金额:".$totalAmount.' 元</div>';
|
||||
});
|
||||
|
||||
$grid->filter(function (Grid\Filter $filter) {
|
||||
$filter->panel();
|
||||
$filter->equal('user.phone')->width(3);
|
||||
$filter->between('settle_at')->width(7);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
@ -143,45 +162,45 @@ class DealerEarningController extends AdminController
|
|||
$show->divider('收款信息-银行');
|
||||
$show->field('bank_user_name', '银行-收款人')->as(function () {
|
||||
$payInfo = $this->getPayInfo();
|
||||
return $payInfo['bank']['user_name']??'';
|
||||
return $payInfo['bank']['user_name'] ?? '';
|
||||
});
|
||||
$show->field('bank_bank_name', '银行-名称')->as(function () {
|
||||
$payInfo = $this->getPayInfo();
|
||||
return $payInfo['bank']['bank_name']??'';
|
||||
return $payInfo['bank']['bank_name'] ?? '';
|
||||
});
|
||||
$show->field('bank_bank_number', '银行-卡号')->as(function () {
|
||||
$payInfo = $this->getPayInfo();
|
||||
return $payInfo['bank']['bank_number']??'';
|
||||
return $payInfo['bank']['bank_number'] ?? '';
|
||||
});
|
||||
$show->field('bank_bank_description', '银行-开户行')->as(function () {
|
||||
$payInfo = $this->getPayInfo();
|
||||
return $payInfo['bank']['bank_description']??'';
|
||||
return $payInfo['bank']['bank_description'] ?? '';
|
||||
});
|
||||
$show->divider('收款信息-支付宝');
|
||||
$show->field('alipay_user_name', '支付宝-真实名称')->as(function () {
|
||||
$payInfo = $this->getPayInfo();
|
||||
return $payInfo['alipay']['user_name']??'';
|
||||
return $payInfo['alipay']['user_name'] ?? '';
|
||||
});
|
||||
$show->field('alipay_ali_name', '支付宝-账户')->as(function () {
|
||||
$payInfo = $this->getPayInfo();
|
||||
return $payInfo['alipay']['ali_name']??'';
|
||||
return $payInfo['alipay']['ali_name'] ?? '';
|
||||
});
|
||||
$show->field('alipay_image', '支付宝-收款码')->as(function () {
|
||||
$payInfo = $this->getPayInfo();
|
||||
return $payInfo['alipay']['image']??'';
|
||||
return $payInfo['alipay']['image'] ?? '';
|
||||
})->image();
|
||||
$show->divider('收款信息-微信');
|
||||
$show->field('wechat_user_name', '微信-真实名称')->as(function () {
|
||||
$payInfo = $this->getPayInfo();
|
||||
return $payInfo['wechat']['user_name']??'';
|
||||
return $payInfo['wechat']['user_name'] ?? '';
|
||||
});
|
||||
$show->field('wechat_wechat_name', '微信-ID')->as(function () {
|
||||
$payInfo = $this->getPayInfo();
|
||||
return $payInfo['wechat']['wechat_name']??'';
|
||||
return $payInfo['wechat']['wechat_name'] ?? '';
|
||||
});
|
||||
$show->field('wechat_image', '微信-收款码')->as(function () {
|
||||
$payInfo = $this->getPayInfo();
|
||||
return $payInfo['wechat']['image']??'';
|
||||
return $payInfo['wechat']['image'] ?? '';
|
||||
})->image();
|
||||
}
|
||||
$show->field('created_at');
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@ namespace App\Admin\Controllers;
|
|||
|
||||
use App\Admin\Repositories\DealerPurchaseLog;
|
||||
use App\Models\DealerPurchaseLog as DealerPurchaseLogModel;
|
||||
use App\Models\User;
|
||||
use Dcat\Admin\Form;
|
||||
use Dcat\Admin\Grid;
|
||||
use Dcat\Admin\Http\Controllers\AdminController;
|
||||
use Dcat\Admin\Show;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
|
||||
class DealerPurchaseLogController extends AdminController
|
||||
{
|
||||
|
|
@ -20,6 +22,12 @@ class DealerPurchaseLogController extends AdminController
|
|||
{
|
||||
$builder = DealerPurchaseLog::with(['user', 'order']);
|
||||
return Grid::make($builder, function (Grid $grid) {
|
||||
$phone = Request::input('user_phone', '');
|
||||
// dd($phone);
|
||||
if ($phone) {
|
||||
$user = User::where('phone', $phone)->first();
|
||||
$grid->model()->where('path', 'like', '%-'.$user->id.'-');
|
||||
}
|
||||
$grid->column('id')->sortable();
|
||||
$grid->column('user.phone', '手机号')->copyable();
|
||||
$grid->column('lvl', '等级')->display(function () {
|
||||
|
|
@ -51,8 +59,10 @@ class DealerPurchaseLogController extends AdminController
|
|||
|
||||
$grid->filter(function (Grid\Filter $filter) {
|
||||
$filter->panel(false);
|
||||
$filter->equal('user.phone', '手机号')->width(3);
|
||||
$filter->equal('user_phone', '手机号')->ignore()->width(3);
|
||||
$filter->between('order_completed_at', '结算时间')->dateTime()->width(7);
|
||||
|
||||
// $filter->equal('user.phone', '手机号')->width(3);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue