Bläddra i källkod

app 结账方式优化

shish 4 år sedan
förälder
incheckning
48e4a53c4a
2 ändrade filer med 16 tillägg och 30 borttagningar
  1. 7 30
      app-ghs/controllers/OrderController.php
  2. 9 0
      common/components/dict.php

+ 7 - 30
app-ghs/controllers/OrderController.php

@@ -363,37 +363,15 @@ class OrderController extends BaseController
         $post['expressId'] = $post['expressId'] ?? 0;
         $post['sendCost'] = $post['sendCost'] ?? '0.00';
 
-        //PC端开单
-        if (isset($post['clearType'])) {
-            $clearType = $post['clearType'];
-            if ($clearType == OrderClass::CLEAR_DEBT) {
-                $post['debt'] = OrderClass::DEBT_YES;
-                $post['payWay'] = dict::getDict('payWay', 'debtPay');
-            } else {
-                $post['debt'] = OrderClass::DEBT_NO;
-            }
+        $hasPay = $post['hasPay'] ?? dict::getDict('hasPay', 'unPay');
+        if ($hasPay == dict::getDict('hasPay', 'debt')) {
+            $post['debt'] = OrderClass::DEBT_YES;
         }
 
-        $debt = $post['debt'] ?? OrderClass::DEBT_YES;
-
-        //PC端开单
-        if (isset($post['getType'])) {
-            util::fail('PC端开单未开放');
-            $getType = $post['getType'];
-            //自取
-            if ($getType == 1) {
-                $post['sendType'] = OrderClass::SEND_TYPE_NO;
-            } else {
-                //选择配送时,在发货时让商家自己再确认一下用什么方式
-                $post['sendType'] = OrderClass::SEND_TYPE_UNKNOWN;
-            }
-        }
-
-        //员工不能开已收款订单
-        if ($debt == OrderClass::DEBT_NO) {
-            $shopAdmin = $this->shopAdmin;
-            if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
-                util::fail('只能开欠款单');
+        $shopAdmin = $this->shopAdmin;
+        if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
+            if ($hasPay == dict::getDict('hasPay', 'payed')) {
+                util::fail('没有权限');
             }
         }
 
@@ -416,7 +394,6 @@ class OrderController extends BaseController
             $validTime = dict::getDict('kd_order_valid');
             $current = time() + $validTime;
             $post['deadline'] = date("Y-m-d H:i:s", $current);
-            $hasPay = $post['hasPay'] ?? 1;
             $return = OrderService::createOrder($post, $custom, $hasPay);
             $transaction->commit();
             util::success($return);

+ 9 - 0
common/components/dict.php

@@ -14,6 +14,15 @@ class dict
             'noNeed' => 2,
         ],
 
+        'hasPay' =>[
+            'unPay'=>0,
+            'payed'=>1,
+            'debt'=>2,
+        ],
+        'hasPayMap'=>[
+
+        ],
+
         //批发店囤货时显示给零售库存的最高值
         'showMaxStock' => 260,