Kirin 3 سال پیش
والد
کامیت
1812a380e7
1فایلهای تغییر یافته به همراه24 افزوده شده و 24 حذف شده
  1. 24 24
      app/models/store/StoreOrder.php

+ 24 - 24
app/models/store/StoreOrder.php

@@ -331,6 +331,30 @@ class StoreOrder extends BaseModel
                 $payPostage = self::getOrderPriceGroup($cartInfo, $addr)['storePostage'];
                 $payPostageSh = self::getOrderPriceGroup($cartInfo, $addr, $storeId)['storePostageSh'];
             }
+
+            $cartIds = [];
+            $totalNum = 0;
+            $gainIntegral = 0;
+            foreach ($cartInfo as $cart) {
+                $cartIds[] = $cart['id'];
+                $totalNum += $cart['cart_num'];
+                if (!$seckill_id) $seckill_id = $cart['seckill_id'];
+                if (!$bargain_id) $bargain_id = $cart['bargain_id'];
+                if (!$combinationId) $combinationId = $cart['combination_id'];
+                if (!$integral_id) $integral_id = $cart['integral_id'];
+                if (!$exchange_id) $exchange_id = $cart['exchange_id'];
+                $cartInfoGainIntegral = isset($cart['productInfo']['give_integral']) ? bcmul($cart['cart_num'], $cart['productInfo']['give_integral'], 2) : 0;
+                $gainIntegral = bcadd($gainIntegral, $cartInfoGainIntegral, 2);
+            }
+            $deduction = $seckill_id || $bargain_id || $combinationId || $integral_id || $exchange_id;
+            if ($deduction) {
+                $couponId = 0;
+                $useIntegral = false;
+                if (!$test) {
+                    unset(self::$payType['offline']);
+                    if (!array_key_exists($payType, self::$payType)) return self::setErrorInfo('营销产品不能使用线下支付!', true);
+                }
+            }
             if ($shipping_type === 1) {
                 if (!$test && !$addressId) return self::setErrorInfo('请选择收货地址!', true);
                 if (!$test && (!UserAddress::be(['uid' => $uid, 'id' => $addressId, 'is_del' => 0]) || !($addressInfo = UserAddress::find($addressId))))
@@ -354,32 +378,8 @@ class StoreOrder extends BaseModel
                 $addressInfo['district'] = '';
                 $addressInfo['detail'] = '';
             }
-
             if (!$storeId && !$test && !$free_check && !$exchange_id) return self::setErrorInfo('请选择下单门店!', true);
             if (!SystemStore::verificWhere()->find($storeId) && !$test && !$free_check && !$exchange_id) return self::setErrorInfo('请选择正确的下单门店!', true);
-            $cartIds = [];
-            $totalNum = 0;
-            $gainIntegral = 0;
-            foreach ($cartInfo as $cart) {
-                $cartIds[] = $cart['id'];
-                $totalNum += $cart['cart_num'];
-                if (!$seckill_id) $seckill_id = $cart['seckill_id'];
-                if (!$bargain_id) $bargain_id = $cart['bargain_id'];
-                if (!$combinationId) $combinationId = $cart['combination_id'];
-                if (!$integral_id) $integral_id = $cart['integral_id'];
-                if (!$exchange_id) $exchange_id = $cart['exchange_id'];
-                $cartInfoGainIntegral = isset($cart['productInfo']['give_integral']) ? bcmul($cart['cart_num'], $cart['productInfo']['give_integral'], 2) : 0;
-                $gainIntegral = bcadd($gainIntegral, $cartInfoGainIntegral, 2);
-            }
-            $deduction = $seckill_id || $bargain_id || $combinationId || $integral_id || $exchange_id;
-            if ($deduction) {
-                $couponId = 0;
-                $useIntegral = false;
-                if (!$test) {
-                    unset(self::$payType['offline']);
-                    if (!array_key_exists($payType, self::$payType)) return self::setErrorInfo('营销产品不能使用线下支付!', true);
-                }
-            }
 //使用优惠劵
             $res1 = true;
             if ($couponId) {