shish 2 ماه پیش
والد
کامیت
6a30149aed
1فایلهای تغییر یافته به همراه22 افزوده شده و 2 حذف شده
  1. 22 2
      app-ghs/controllers/OrderController.php

+ 22 - 2
app-ghs/controllers/OrderController.php

@@ -1268,9 +1268,29 @@ class OrderController extends BaseController
 
         $productJson = $post['product'] ?? '';
         if (empty($productJson)) {
-            util::fail('请选择花材');
+            //直接收款
+            $zjGathering = $post['zjGathering'] ?? 0;
+            if ($zjGathering == 1) {
+                $gatheringPrice = $post['gatheringPrice'] ?? 0;
+                if (!is_numeric($gatheringPrice) || $gatheringPrice <= 0) {
+                    util::fail('请填写价格');
+                }
+                //直接收款不需要打印小票
+                $post['needPrint'] = 2;
+                $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);
+                $zjGatheringItem = !empty($ext) ? $ext->zjGatheringItem : 0;
+                if (empty($zjGatheringItem)) {
+                    util::fail('请设置收款的商品');
+                }
+                $zjGatheringItemInfo = ProductClass::getById($zjGatheringItem, true);
+                if (empty($zjGatheringItemInfo)) {
+                    util::fail('请设置收款的商品呢');
+                }
+                $productList = [['productId' => $zjGatheringItem, 'bigNum' => 1, 'smallNum' => 0, 'classId' => 0, 'price' => $gatheringPrice]];
+            }
+        } else {
+            $productList = json_decode($productJson, true);
         }
-        $productList = json_decode($productJson, true);
         if (empty($productList)) {
             util::fail('请选择花材');
         }