WIN-2308041133\Administrator 6 месяцев назад
Родитель
Сommit
3c9144bdf8
1 измененных файлов с 23 добавлено и 0 удалено
  1. 23 0
      app/common/repositories/store/order/StoreOrderCreateRepository.php

+ 23 - 0
app/common/repositories/store/order/StoreOrderCreateRepository.php

@@ -83,6 +83,10 @@ class StoreOrderCreateRepository extends StoreOrderRepository
         $order_total_postage = 0;
         $orderDeliveryStatus = true;
         $order_svip_discount = 0;
+//        判断是否有节能油商品的对象
+        $jny = false;
+        $lb = false;
+        $pt = false;
         // 循环计算每个店铺的订单数据
         foreach ($merchantCartList as &$merchantCart) {
             //运费计算规则
@@ -117,6 +121,25 @@ class StoreOrderCreateRepository extends StoreOrderRepository
             $product_cart = [];
 
             foreach ($merchantCart['list'] as $k => $cart) {
+//                判断是否同时存在普通商品,节能油商品和礼包商品
+                if ($merchantCart['list'][$k]['product']['type']==5){
+                    $jny=true;
+                }elseif ($merchantCart['list'][$k]['product']['type']==6){
+                    $lb=true;
+                }else{
+                    $pt=true;
+                }
+                if ($jny&&$pt){
+                    return ['code' => 0, 'data' => '不能同时存在普通商品和节能油商品'];
+                }
+                if ($lb&&$pt){
+                    return ['code' => 0, 'data' => '不能同时存在普通商品和礼包商品'];
+                }
+                if ($jny&&$lb){
+                    return ['code' => 0, 'data' => '不能同时存在节能油商品和礼包商品'];
+                }
+
+
                 $productTaks = $_merTake;
                 $productDelivery = $_merDelivery;
                 //如果商品有配送方式信息