微淘
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Admin\Controllers\Activity;
|
||||
|
||||
use App\Admin\Renderable\Activity\Grants;
|
||||
use App\Models\Activity;
|
||||
use App\Models\ActivityGrant;
|
||||
use App\Models\ActivityRule;
|
||||
@@ -86,7 +87,6 @@ class IndexController extends AdminController
|
||||
$query->where('identity_id', 1);
|
||||
})->get()->pluck('nickname', 'id');
|
||||
|
||||
$filter->equal('user_id', '渠道')->select($users);
|
||||
});
|
||||
|
||||
$filter->column(1 / 2, function ($filter) {
|
||||
@@ -100,10 +100,6 @@ class IndexController extends AdminController
|
||||
$grid->column('title', '活动名称');
|
||||
$grid->column('code', '活动编号');
|
||||
$grid->column('rule.code', '卡券规则');
|
||||
$grid->column('所属')->display(function () {
|
||||
return $this->user_id ? $this->user->nickname : '系统';
|
||||
});
|
||||
|
||||
$grid->column('类型')->display(function () {
|
||||
return $this->type_text;
|
||||
});
|
||||
@@ -111,6 +107,20 @@ class IndexController extends AdminController
|
||||
$grid->column('days', '延期(天)');
|
||||
$grid->column('rule.full', '满足金额');
|
||||
$grid->column('rule.take', '扣除金额');
|
||||
$grid->column('发券')
|
||||
->display(function () {
|
||||
return $this->grants->pluck('user_nickname');
|
||||
})
|
||||
->label()
|
||||
->hide();
|
||||
|
||||
$grid->column('核券')
|
||||
->display(function () {
|
||||
return $this->verifications->pluck('user_nickname');
|
||||
})
|
||||
->label()
|
||||
->hide();
|
||||
|
||||
$grid->column('开始时间')->display(function () {
|
||||
return $this->type == Activity::TYPE_SCOPE ? $this->start_at->format('Y-m-d') : '---';
|
||||
});
|
||||
|
||||
@@ -54,25 +54,27 @@ class RuleController extends AdminController
|
||||
|
||||
$form->switch('status', '状态')->default(1);
|
||||
$form->saving(function (Form $form) {
|
||||
$code = $form->code;
|
||||
if ($form->code) {
|
||||
$code = $form->code;
|
||||
|
||||
$ticket = explode('-', $code);
|
||||
if (!is_array($ticket) || count($ticket) != 3) {
|
||||
$error = new MessageBag([
|
||||
'title' => '错误',
|
||||
'message' => '规则编号格式错误',
|
||||
]);
|
||||
$ticket = explode('-', $code);
|
||||
if (!is_array($ticket) || count($ticket) != 3) {
|
||||
$error = new MessageBag([
|
||||
'title' => '错误',
|
||||
'message' => '规则编号格式错误',
|
||||
]);
|
||||
|
||||
return back()->withInput()->with(compact('error'));
|
||||
return back()->withInput()->with(compact('error'));
|
||||
}
|
||||
|
||||
$full = $ticket[1]; //full100
|
||||
$price = $ticket[2];
|
||||
preg_match('/\d+/', $full, $match);
|
||||
|
||||
$form->full = $match[0];
|
||||
$form->take = $price;
|
||||
}
|
||||
|
||||
$full = $ticket[1]; //full100
|
||||
$price = $ticket[2];
|
||||
preg_match('/\d+/', $full, $match);
|
||||
|
||||
$form->full = $match[0];
|
||||
$form->take = $price;
|
||||
|
||||
});
|
||||
|
||||
return $form;
|
||||
|
||||
@@ -59,7 +59,6 @@ class IndexController extends AdminController
|
||||
->whereHas('identity', function ($query) {
|
||||
$query->where('identity_id', 1);
|
||||
})
|
||||
->where('type', 'pingan')
|
||||
->get()
|
||||
->pluck('nickname', 'id');
|
||||
|
||||
|
||||
@@ -143,15 +143,13 @@ class IndexController extends AdminController
|
||||
$grid->column('分润规则')->display(function ($title, $column) {
|
||||
return '点击展开';
|
||||
})->modal(function ($model) {
|
||||
|
||||
|
||||
if ($model->code) {
|
||||
$codes = $model->code->map(function ($code) {
|
||||
return $code->only(['name', 'code', 'profit']);
|
||||
});
|
||||
|
||||
$table = new Table(['名称', '规则项', '分润金额(元)'], $codes->toArray());
|
||||
|
||||
return trim($table->render(), '"');
|
||||
return new Table(['名称', '规则项', '分润金额(元)'], $codes->toArray());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user