Explorar el Código

预订时不能选择预售花材

shish hace 3 años
padre
commit
6bb6761e48
Se han modificado 1 ficheros con 19 adiciones y 15 borrados
  1. 19 15
      app-hd/controllers/PurchaseController.php

+ 19 - 15
app-hd/controllers/PurchaseController.php

@@ -124,22 +124,26 @@ class PurchaseController extends BaseController
                     $presell = $currentInfo['presell'] ?? 0;
                     $presellData[] = $presell;
                     if ($presell == 1) {
-                        if (isset($post['sendTimeWant']) == false || empty($post['sendTimeWant'])) {
-                            util::fail('预售花材,请选择配送日期');
+                        if ($book == 1) {
+                            util::fail('预订时不能选择预售花材');
+                        } else {
+                            if (isset($post['sendTimeWant']) == false || empty($post['sendTimeWant'])) {
+                                util::fail('预售花材,请选择配送日期');
+                            }
+                            $sendTimeWant = $post['sendTimeWant'];
+                            if (strtotime($sendTimeWant) < $nowTime) {
+                                util::fail('不能选择过去时间');
+                            }
+                            $hasDateStr = $currentInfo['presellDate'] ?? [];
+                            $hasDate = explode(',', trim($hasDateStr));
+                            if (empty($hasDate)) {
+                                util::fail('预售日期有问题,请提醒门店');
+                            }
+                            if (in_array(strtotime($sendTimeWant), $hasDate) == false) {
+                                util::fail("{$currentName} 在{$sendTimeWant}没有预售");
+                            }
+                            $post['presell'] = 1;
                         }
-                        $sendTimeWant = $post['sendTimeWant'];
-                        if (strtotime($sendTimeWant) < $nowTime) {
-                            util::fail('不能选择过去时间');
-                        }
-                        $hasDateStr = $currentInfo['presellDate'] ?? [];
-                        $hasDate = explode(',', trim($hasDateStr));
-                        if (empty($hasDate)) {
-                            util::fail('预售日期有问题,请提醒门店');
-                        }
-                        if (in_array(strtotime($sendTimeWant), $hasDate) == false) {
-                            util::fail("{$currentName} 在{$sendTimeWant}没有预售");
-                        }
-                        $post['presell'] = 1;
                     }
                 }
                 if (count($productInfoList) != count($ids)) {