소스 검색

Merge branch 'master' into dev

shish 3 달 전
부모
커밋
01eb49a91f
1개의 변경된 파일22개의 추가작업 그리고 2개의 파일을 삭제
  1. 22 2
      app-ghs/controllers/OrderController.php

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

@@ -1267,9 +1267,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('请选择花材');
         }