Parcourir la source

开历史订单

shish il y a 2 ans
Parent
commit
c8a30658b5

+ 13 - 0
app-ghs/controllers/OrderController.php

@@ -1011,6 +1011,19 @@ class OrderController extends BaseController
             }
             }
         }
         }
 
 
+        $orderDate = $post['orderDate'] ?? '';
+        if (!empty($orderDate)) {
+            if ($book == 1) {
+                util::fail('预订单不能选订单日期');
+            }
+            if ($hasPay == 0) {
+                util::fail('扫码付不能选订单日期');
+            }
+            if (strtotime($orderDate) > strtotime(date("Y-m-d"))) {
+                util::fail('订单日期只能选历史时间');
+            }
+        }
+
         //4秒内不允许重复开单
         //4秒内不允许重复开单
         $staffId = $this->shopAdminId ?? 0;
         $staffId = $this->shopAdminId ?? 0;
         $cacheKey = 'ghs_create_order_' . $staffId . '_' . $customId;
         $cacheKey = 'ghs_create_order_' . $staffId . '_' . $customId;

+ 9 - 0
biz-ghs/order/services/OrderService.php

@@ -278,6 +278,15 @@ class OrderService extends BaseService
             PurchaseService::payAfter($purchase, $payWay);
             PurchaseService::payAfter($purchase, $payWay);
             self::payAfter($returnOrder, $payWay);
             self::payAfter($returnOrder, $payWay);
 
 
+            //开历史订单
+            $orderDate = $data['orderDate'] ?? '';
+            if (!empty($orderDate)) {
+                $purchase->payTime = $orderDate . ' 12:00:00';
+                $purchase->save();
+                $returnOrder->payTime = $orderDate . ' 12:00:00';
+                $returnOrder->save();
+            }
+
             //不是预订单,并且采购人没有开批发店,供货商不是源花汇、小明鲜花、淄博花超、石头花艺,则订单直接完成掉。是预订单,则确认发货时直接完成掉。有多个地方要修改,请搜索关键词zjFinish
             //不是预订单,并且采购人没有开批发店,供货商不是源花汇、小明鲜花、淄博花超、石头花艺,则订单直接完成掉。是预订单,则确认发货时直接完成掉。有多个地方要修改,请搜索关键词zjFinish
             if (isset($returnOrder->book) && $returnOrder->book == 0) {
             if (isset($returnOrder->book) && $returnOrder->book == 0) {
                 $ghsShopId = $ghs['shopId'] ?? 0;
                 $ghsShopId = $ghs['shopId'] ?? 0;