shish 3 vuotta sitten
vanhempi
commit
b1400b9c52
1 muutettua tiedostoa jossa 27 lisäystä ja 8 poistoa
  1. 27 8
      app-hd/controllers/PurchaseController.php

+ 27 - 8
app-hd/controllers/PurchaseController.php

@@ -240,14 +240,6 @@ class PurchaseController extends BaseController
             $post['product'] = $productList;
 
             $sendType = $post['sendType'] ?? 0;
-            if ($sendType == 0) {
-                //杭州斗南不支持免费送货
-                if (getenv('YII_ENV') == 'production') {
-                    if ($ghsShopId == 4608) {
-                        util::fail('请选择到店自取或跑腿');
-                    }
-                }
-            }
 
             $sendCost = 0;
 
@@ -269,6 +261,33 @@ class PurchaseController extends BaseController
             $post['packCost'] = $packCost;
 
             $respond = PurchaseService::createPurchase($post, $ghsInfo);
+
+            if ($sendType == 0) {
+                if (getenv('YII_ENV') == 'production') {
+                    //杭州斗南鲜花批发部,满500,10公里内免费配送,满1000,20公里免费配送
+                    if ($ghsShopId == 4608) {
+                        if ($respond->actPrice < 500) {
+                            $transaction->rollBack();
+                            util::fail('满500元才有免费配送');
+                        }
+                    }
+                    //叶上花,满500元市区免费配送
+                    if ($ghsShopId == 4804) {
+                        if ($respond->actPrice < 500) {
+                            $transaction->rollBack();
+                            util::fail('满500元才有免费配送');
+                        }
+                    }
+                } else {
+                    if ($ghsShopId == 36523) {
+                        if ($respond->actPrice < 100) {
+                            $transaction->rollBack();
+                            util::fail('满100元才有免费配送');
+                        }
+                    }
+                }
+            }
+
             $transaction->commit();
 
             util::success($respond);