|
@@ -145,6 +145,16 @@ class CouponManagementController extends AdminController
|
|
{
|
|
{
|
|
$form = new Form(new Coupon());
|
|
$form = new Form(new Coupon());
|
|
$form->hidden('id', __('id'));
|
|
$form->hidden('id', __('id'));
|
|
|
|
+ $form->editing(function ($f){
|
|
|
|
+ $f->model()->max_reduce_amount /=100;
|
|
|
|
+ $f->model()->min_consume_amount /=100;
|
|
|
|
+ $f->model()->money /=100;
|
|
|
|
+ });
|
|
|
|
+ $type = request('type');
|
|
|
|
+ if (isset($type))
|
|
|
|
+ {
|
|
|
|
+ admin_toastr('最低消费金额不能小于满减的优惠钱数', 'error');
|
|
|
|
+ }
|
|
$form->text('name', __('优惠券名称'));
|
|
$form->text('name', __('优惠券名称'));
|
|
$form->text('title', __('券标题'));
|
|
$form->text('title', __('券标题'));
|
|
$form->text('desc', __('使用说明'));
|
|
$form->text('desc', __('使用说明'));
|
|
@@ -205,7 +215,20 @@ class CouponManagementController extends AdminController
|
|
$form->start_time = strtotime($form->start_time);
|
|
$form->start_time = strtotime($form->start_time);
|
|
$form->end_time = strtotime($form->end_time);
|
|
$form->end_time = strtotime($form->end_time);
|
|
$form->money = $form->money*100;
|
|
$form->money = $form->money*100;
|
|
|
|
+ $form->min_consume_amount = $form->min_consume_amount*100;
|
|
$form->max_reduce_amount = $form->max_reduce_amount*100;
|
|
$form->max_reduce_amount = $form->max_reduce_amount*100;
|
|
|
|
+ if ($form->money >$form->min_consume_amount)
|
|
|
|
+ {
|
|
|
|
+ if ($form->isEditing)
|
|
|
|
+ {
|
|
|
|
+ $arr = request()->route()->parameters;
|
|
|
|
+ return redirect('admin/coupons/'.$arr['coupon'].'/edit?type=1');
|
|
|
|
+ }else
|
|
|
|
+ {
|
|
|
|
+ return redirect('admin/coupons/create?type=1');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
});
|
|
});
|
|
});
|
|
});
|
|
return $form;
|
|
return $form;
|