调整优惠券金额字段
parent
791b9a3268
commit
9b44ab18aa
|
|
@ -29,7 +29,7 @@ class CouponController extends AdminController
|
||||||
1 =>'抵扣券',
|
1 =>'抵扣券',
|
||||||
2 =>'折扣券',
|
2 =>'折扣券',
|
||||||
])->label();
|
])->label();
|
||||||
$grid->column('value')->display(function ($value) {
|
$grid->column('amount')->display(function ($value) {
|
||||||
if ($this->type == 1) {
|
if ($this->type == 1) {
|
||||||
return $value.'元';
|
return $value.'元';
|
||||||
} elseif ($this->type == 2) {
|
} elseif ($this->type == 2) {
|
||||||
|
|
@ -82,7 +82,7 @@ class CouponController extends AdminController
|
||||||
$show->field('id');
|
$show->field('id');
|
||||||
$show->field('name');
|
$show->field('name');
|
||||||
$show->field('type');
|
$show->field('type');
|
||||||
$show->field('value');
|
$show->field('amount');
|
||||||
$show->field('threshold');
|
$show->field('threshold');
|
||||||
$show->field('limit');
|
$show->field('limit');
|
||||||
$show->field('sent');
|
$show->field('sent');
|
||||||
|
|
@ -105,29 +105,29 @@ class CouponController extends AdminController
|
||||||
$form->display('id');
|
$form->display('id');
|
||||||
$form->text('name')->required();
|
$form->text('name')->required();
|
||||||
$form->radio('type')
|
$form->radio('type')
|
||||||
->when(1, function (Form $form) {
|
->when(1, function (Form $form) {
|
||||||
$form->currency('value1')->symbol('¥')->help('例:100.00表示优惠100元。')->value($form->model()->value);
|
$form->currency('amount1')->symbol('¥')->help('例:100.00表示优惠100元。')->value($form->model()->amount);
|
||||||
})
|
})
|
||||||
->when(2, function (Form $form) {
|
->when(2, function (Form $form) {
|
||||||
$form->currency('value2')->symbol('%')->help('例:0.95表示95折。')->value($form->model()->value);
|
$form->currency('amount2')->symbol('%')->help('例:0.95表示95折。')->value($form->model()->amount);
|
||||||
})
|
})
|
||||||
->options([
|
->options([
|
||||||
1 =>'抵扣券',
|
1 =>'抵扣券',
|
||||||
2 =>'折扣券',
|
2 =>'折扣券',
|
||||||
])->default(1);
|
])->default(1);
|
||||||
|
|
||||||
$form->currency('threshold')->symbol('¥')->default(0);
|
$form->currency('threshold')->symbol('¥')->default(0);
|
||||||
$form->number('limit')->default(0);
|
$form->number('limit')->default(0);
|
||||||
$form->number('use_day')->default(0)->help('单位:天;指领取后几天内有效。');
|
$form->number('use_day')->default(0)->help('单位:天;指领取后几天内有效。');
|
||||||
$form->datetimeRange('use_start_at', 'use_end_at', '使用时间')->help('设置时间后,期限字段失效。');
|
$form->datetimeRange('use_start_at', 'use_end_at', '使用时间')->help('设置时间后,期限字段失效。');
|
||||||
$form->hidden('value');
|
$form->hidden('amount');
|
||||||
|
|
||||||
$form->saving(function (Form $form) {
|
$form->saving(function (Form $form) {
|
||||||
$value = 'value'.$form->type;
|
$amount = 'amount'.$form->type;
|
||||||
$form->value = $form->$value;
|
$form->amount = $form->$amount;
|
||||||
|
|
||||||
$form->deleteInput('value1');
|
$form->deleteInput('amount1');
|
||||||
$form->deleteInput('value2');
|
$form->deleteInput('amount2');
|
||||||
});
|
});
|
||||||
|
|
||||||
$form->display('created_at');
|
$form->display('created_at');
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ class Coupon extends Model
|
||||||
use HasDateTimeFormatter;
|
use HasDateTimeFormatter;
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'value' => Price::class,
|
'amount' => Price::class,
|
||||||
'threshold'=>Price::class,
|
'threshold'=>Price::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class CreateCouponsTable extends Migration
|
||||||
$table->string('name')->comment('优惠券名称');
|
$table->string('name')->comment('优惠券名称');
|
||||||
$table->text('description')->nullable()->comment('优惠券说明');
|
$table->text('description')->nullable()->comment('优惠券说明');
|
||||||
$table->tinyInteger('type')->default(0)->unsigned()->comment('优惠券类型:1抵扣券,2折扣券');
|
$table->tinyInteger('type')->default(0)->unsigned()->comment('优惠券类型:1抵扣券,2折扣券');
|
||||||
$table->unsignedInteger('value')->default(0)->comment('抵扣金额:分/折扣(100)');
|
$table->unsignedInteger('amount')->default(0)->comment('抵扣金额:分/折扣(100)');
|
||||||
$table->unsignedBigInteger('threshold')->default(0)->comment('使用门槛金额:分');
|
$table->unsignedBigInteger('threshold')->default(0)->comment('使用门槛金额:分');
|
||||||
$table->unsignedInteger('limit')->default(0)->comment('限量');
|
$table->unsignedInteger('limit')->default(0)->comment('限量');
|
||||||
$table->unsignedInteger('sent')->default(0)->comment('已送数量');
|
$table->unsignedInteger('sent')->default(0)->comment('已送数量');
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,9 @@ return [
|
||||||
],
|
],
|
||||||
'name' => '名称',
|
'name' => '名称',
|
||||||
'type' => '券类型',
|
'type' => '券类型',
|
||||||
'value' => '力度',
|
'amount' => '力度',
|
||||||
'value1'=>'抵扣金额',
|
'amount1'=>'抵扣金额',
|
||||||
'value2'=>'折扣',
|
'amount2'=>'折扣',
|
||||||
'threshold' => '使用门槛',
|
'threshold' => '使用门槛',
|
||||||
'limit' => '限量',
|
'limit' => '限量',
|
||||||
'sent' => '已发',
|
'sent' => '已发',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue