shish 4 anni fa
parent
commit
dd07c450e1

+ 3 - 3
app-ghs/controllers/OrderController.php

@@ -818,15 +818,15 @@ class OrderController extends BaseController
         $post = Yii::$app->request->post();
         $id = $post['orderId'] ?? 0;
         if (empty($id)) {
-            util::fail('没有找到订单');
+            util::fail('请选择订单');
         }
         $order = OrderClass::getById($id, true);
         if (empty($order)) {
-            util::fail('请选择订单');
+            util::fail('请选择订单...');
         }
         OrderClass::valid($order, $this->shopId);
         if (isset($order->status) == false || $order->status != 1) {
-            util::fail('不是待付款订单,无法取消');
+            util::fail('不是待付款状态,无法取消');
         }
         $purchaseId = $order->purchaseId ?? 0;
         $purchase = PurchaseClass::getById($purchaseId);

+ 20 - 0
app-hd/controllers/PurchaseController.php

@@ -103,6 +103,14 @@ class PurchaseController extends BaseController
         $orderSn = $get['orderSn'] ?? 0;
         $info = PurchaseClass::getByCondition(['orderSn' => $orderSn], true);
         PurchaseService::valid($info, $this->shopId);
+
+        if ($info->status == 5) {
+            util::fail('订单已取消');
+        }
+        if ($info->status == 1) {
+            util::fail('订单不是待付款状态');
+        }
+
         $ghsId = $info->ghsId;
         $ghs = GhsClass::getGhsInfo($ghsId);
         $customId = $ghs['customId'] ?? 0;
@@ -150,6 +158,12 @@ class PurchaseController extends BaseController
         if (empty($info)) {
             util::fail('没有找到采购单');
         }
+        if ($info->status == 5) {
+            util::fail('订单已取消');
+        }
+        if ($info->status == 1) {
+            util::fail('订单不是待付款状态');
+        }
         PurchaseService::valid($info, $this->shopId);
         $connection = Yii::$app->db;//事务处理
         $transaction = $connection->beginTransaction();
@@ -238,6 +252,12 @@ class PurchaseController extends BaseController
         if (empty($order)) {
             util::fail('订单号无效');
         }
+        if ($order->status == 5) {
+            util::fail('订单已取消');
+        }
+        if ($order->status == 1) {
+            util::fail('订单不是待付款状态');
+        }
         $id = $order->id;
         $order->changePrice = 2;
         $order->save();