shish před 3 roky
rodič
revize
f28eb348ed
1 změnil soubory, kde provedl 14 přidání a 3 odebrání
  1. 14 3
      app-hd/controllers/CgRefundController.php

+ 14 - 3
app-hd/controllers/CgRefundController.php

@@ -54,10 +54,21 @@ class CgRefundController extends BaseController
         if ($cg->mainId != $this->mainId) {
             util::fail('没有权限操作');
         }
-        if ($cg->status != PurchaseClass::STATUS_COMPLETE) {
-            util::fail("完成的订单才能申请退货退款");
+        if ($cg->status == PurchaseClass::STATUS_UN_PAY) {
+            util::fail("订单未付款,不能申请售后");
+        }
+        if ($cg->status == PurchaseClass::STATUS_UN_SEND) {
+            util::fail("订单待发货,不能申请售后");
+        }
+        if ($cg->status == PurchaseClass::STATUS_SENDING) {
+            util::fail("订单配送中,不能申请售后");
+        }
+        if ($cg->status == PurchaseClass::STATUS_CANCEL) {
+            util::fail("订单已取消,不能申请售后");
+        }
+        if (isset($cg->clearId) && !empty($cg->clearId)) {
+            util::fail('订单已结账,不能申请售后');
         }
-
         $connection = Yii::$app->db;
         $transaction = $connection->beginTransaction();
         try {