|
|
|
@ -25,7 +25,7 @@ class CouponTimeForm extends Form implements LazyRenderable |
|
|
|
{ |
|
|
|
// 获取外部传递参数
|
|
|
|
$id = $input['id']; |
|
|
|
|
|
|
|
$inventory = $input['inventory'] ?? 0; |
|
|
|
$start_time = $input['start_time'] ?? ''; |
|
|
|
$end_time = $input['end_time'] ?? ''; |
|
|
|
$usable_start_time = $input['usable_start_time'] ?? ''; |
|
|
|
@ -40,10 +40,22 @@ class CouponTimeForm extends Form implements LazyRenderable |
|
|
|
case 0: |
|
|
|
case 1: |
|
|
|
case 3: |
|
|
|
$coupon->start_time = $start_time; |
|
|
|
$coupon->end_time = $end_time; |
|
|
|
$coupon->usable_start_time = $usable_start_time; |
|
|
|
$coupon->usable_end_time = $usable_end_time; |
|
|
|
if(!empty($inventory)){ |
|
|
|
$coupon->inventory = $inventory; |
|
|
|
} |
|
|
|
if(!empty($inventory)){ |
|
|
|
$coupon->start_time = $start_time; |
|
|
|
} |
|
|
|
if(!empty($inventory)){ |
|
|
|
$coupon->end_time = $end_time; |
|
|
|
} |
|
|
|
if(!empty($inventory)){ |
|
|
|
$coupon->usable_start_time = $usable_start_time; |
|
|
|
} |
|
|
|
if(!empty($inventory)){ |
|
|
|
$coupon->usable_end_time = $usable_end_time; |
|
|
|
} |
|
|
|
|
|
|
|
if($coupon->save()){ |
|
|
|
return $this->success('修改成功','/coupon'); |
|
|
|
} |
|
|
|
@ -65,7 +77,7 @@ class CouponTimeForm extends Form implements LazyRenderable |
|
|
|
{ |
|
|
|
$id = $this->payload['id'] ?? 0; |
|
|
|
$title = $this->payload['title'] ?? ''; |
|
|
|
$status = $this->payload['status'] ?? -1; |
|
|
|
$inventory = $this->payload['inventory'] ?? 0; |
|
|
|
|
|
|
|
$start_time = $this->payload['start_time'] ?? ''; |
|
|
|
$end_time = $this->payload['end_time'] ?? ''; |
|
|
|
@ -75,6 +87,8 @@ class CouponTimeForm extends Form implements LazyRenderable |
|
|
|
$this->hidden('id')->value($id); |
|
|
|
$this->display('title','标题')->value($title); |
|
|
|
|
|
|
|
$this->number('inventory','发放数量')->required()->type('number')->attribute('min', 1)->value($inventory)->default(1); |
|
|
|
|
|
|
|
$this->datetime('start_time','活动开始时间')->required() |
|
|
|
->customFormat(function () use($start_time){ |
|
|
|
return date('Y-m-d H:i:s',$start_time); |
|
|
|
|