From a05c1b00841287ed9111f8faedc2939d93dba5af Mon Sep 17 00:00:00 2001 From: liapples Date: Sun, 17 Oct 2021 21:00:01 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E9=87=91/=E5=AE=9A=E9=87=91=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E5=A4=A7=E4=BA=8E=E5=94=AE=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/IndustryProductController.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/AdminSupplier/Controllers/IndustryProductController.php b/app/AdminSupplier/Controllers/IndustryProductController.php index 132332d..1281d06 100644 --- a/app/AdminSupplier/Controllers/IndustryProductController.php +++ b/app/AdminSupplier/Controllers/IndustryProductController.php @@ -149,8 +149,12 @@ class IndustryProductController extends AdminController $form->editor('know'); $form->editor('content')->required(); $form->mobile('verify_mobile')->required(); - $form->decimal('deposit')->rules('numeric|min:0', ['*' => '请输入正确的金额']); - $form->decimal('earnest')->rules('numeric|min:0', ['*' => '请输入正确的金额']); + $form->decimal('deposit') + ->default(0)->help('输入0则表示不支持订金支付') + ->rules('numeric|min:0', ['*' => '请输入正确的金额']); + $form->decimal('earnest') + ->default(0)->help('输入0则表示不支持定金支付') + ->rules('numeric|min:0', ['*' => '请输入正确的金额']); //扩展字段 $publish_type = array_intersect_key( @@ -266,6 +270,13 @@ class IndustryProductController extends AdminController $form->original_price = min(array_column($spec, 'original_price')); $form->price = min(array_column($spec, 'price')); + //订金/定金不能大于售价 + if ($form->deposit && $form->deposit > $form->price) { + return $form->response()->error('订金不能大于产品售价' . $form->price); + } else if ($form->earnest && $form->earnest > $form->price) { + return $form->response()->error('定金不能大于产品售价' . $form->price); + } + //用户可编辑的状态 $user_status = [ProductStatus::SOLD_OUT, ProductStatus::ON_SALE];