增加核销途径
This commit is contained in:
@@ -32,7 +32,7 @@ class IndexController extends AdminController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Index interface.
|
* Index interface.
|
||||||
* @param Content $content
|
* @param Content $content
|
||||||
* @return Content
|
* @return Content
|
||||||
*/
|
*/
|
||||||
public function index(Content $content)
|
public function index(Content $content)
|
||||||
@@ -45,8 +45,8 @@ class IndexController extends AdminController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit interface.
|
* Edit interface.
|
||||||
* @param mixed $id
|
* @param mixed $id
|
||||||
* @param Content $content
|
* @param Content $content
|
||||||
* @return Content
|
* @return Content
|
||||||
*/
|
*/
|
||||||
public function edit($id, Content $content)
|
public function edit($id, Content $content)
|
||||||
@@ -59,7 +59,7 @@ class IndexController extends AdminController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create interface.
|
* Create interface.
|
||||||
* @param Content $content
|
* @param Content $content
|
||||||
* @return Content
|
* @return Content
|
||||||
*/
|
*/
|
||||||
public function create(Content $content)
|
public function create(Content $content)
|
||||||
@@ -93,6 +93,8 @@ class IndexController extends AdminController
|
|||||||
$filter->column(1 / 2, function ($filter) {
|
$filter->column(1 / 2, function ($filter) {
|
||||||
$filter->between('start_at', '开始时间')->datetime();
|
$filter->between('start_at', '开始时间')->datetime();
|
||||||
$filter->between('end_at', '结束时间')->datetime();
|
$filter->between('end_at', '结束时间')->datetime();
|
||||||
|
$filter->equal('channel', '核销途径')->select(Activity::CHANNELS);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -101,12 +103,19 @@ class IndexController extends AdminController
|
|||||||
$grid->column('title', '活动名称');
|
$grid->column('title', '活动名称');
|
||||||
$grid->column('code', '活动编号');
|
$grid->column('code', '活动编号');
|
||||||
$grid->column('total', '可发券总数');
|
$grid->column('total', '可发券总数');
|
||||||
$grid->column('coupons_count', '可发券总数');
|
$grid->column('coupons_count', '已发券总数');
|
||||||
$grid->column('rule.code', '卡券规则');
|
$grid->column('rule.code', '卡券规则');
|
||||||
$grid->column('类型')->display(function () {
|
$grid->column('类型')->display(function () {
|
||||||
return $this->type_text;
|
return $this->type_text;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$grid->column('channel', '核销途径')
|
||||||
|
->using(Activity::CHANNELS)
|
||||||
|
->label([
|
||||||
|
Activity::CHANNEL_YSD => 'info',
|
||||||
|
Activity::CHANNEL_UNION => 'success',
|
||||||
|
]);
|
||||||
|
|
||||||
$grid->column('days', '延期(天)');
|
$grid->column('days', '延期(天)');
|
||||||
$grid->column('rule.full', '满足金额');
|
$grid->column('rule.full', '满足金额');
|
||||||
$grid->column('rule.take', '扣除金额');
|
$grid->column('rule.take', '扣除金额');
|
||||||
@@ -159,7 +168,7 @@ class IndexController extends AdminController
|
|||||||
->required();
|
->required();
|
||||||
|
|
||||||
$form->number('total', '总数')
|
$form->number('total', '总数')
|
||||||
->help('可发券总数')
|
->help('可发券总数,0为不限制')
|
||||||
->default(10000)
|
->default(10000)
|
||||||
->required();
|
->required();
|
||||||
|
|
||||||
@@ -173,6 +182,12 @@ class IndexController extends AdminController
|
|||||||
})
|
})
|
||||||
->required();
|
->required();
|
||||||
|
|
||||||
|
$form->radio('channel', '核销途径')
|
||||||
|
->options(Activity::CHANNELS)
|
||||||
|
->default(Activity::CHANNEL_YSD)
|
||||||
|
->help('券码核销的途径:亿时代是自己核销,银联是银联pos核销')
|
||||||
|
->required();
|
||||||
|
|
||||||
$form->switch('status', '状态')->default(1);
|
$form->switch('status', '状态')->default(1);
|
||||||
$form->switch('need_check', '多次校验')
|
$form->switch('need_check', '多次校验')
|
||||||
->default(1)
|
->default(1)
|
||||||
|
|||||||
@@ -10,6 +10,11 @@ class Activity extends Model
|
|||||||
|
|
||||||
use BelongsToUser;
|
use BelongsToUser;
|
||||||
|
|
||||||
|
protected $dates = [
|
||||||
|
'start_at',
|
||||||
|
'end_at',
|
||||||
|
];
|
||||||
|
|
||||||
const TYPE_EXTEND = 1;
|
const TYPE_EXTEND = 1;
|
||||||
const TYPE_SCOPE = 2;
|
const TYPE_SCOPE = 2;
|
||||||
const TYPES = [
|
const TYPES = [
|
||||||
@@ -24,9 +29,11 @@ class Activity extends Model
|
|||||||
self::STATUS_CLOSE => '关闭',
|
self::STATUS_CLOSE => '关闭',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $dates = [
|
const CHANNEL_YSD = 1;
|
||||||
'start_at',
|
const CHANNEL_UNION = 2;
|
||||||
'end_at',
|
const CHANNELS = [
|
||||||
|
self::CHANNEL_YSD => '亿时代',
|
||||||
|
self::CHANNEL_UNION => '银联',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -51,7 +58,7 @@ class Activity extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
//活动状态
|
//活动状态
|
||||||
public function getStatusTextAttribute()
|
public function getStatusTextAttribute(): string
|
||||||
{
|
{
|
||||||
return self::STATUS[$this->status] ?? '未知';
|
return self::STATUS[$this->status] ?? '未知';
|
||||||
}
|
}
|
||||||
@@ -100,7 +107,12 @@ class Activity extends Model
|
|||||||
{
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$code = 'YSD' . date('ymd') . mt_rand(100000, 999999);
|
//判断生成何种码
|
||||||
|
if ($this->channel == self::CHANNEL_UNION) {
|
||||||
|
$code = '66406' . date('ymdH') . mt_rand(1000000, 9999999);
|
||||||
|
} else {
|
||||||
|
$code = 'YSD' . date('ymd') . mt_rand(100000, 999999);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->type == SELF::TYPE_EXTEND) {
|
if ($this->type == SELF::TYPE_EXTEND) {
|
||||||
$start_at = now();
|
$start_at = now();
|
||||||
|
|||||||
Reference in New Issue
Block a user