shish 6 rokov pred
rodič
commit
54d23bd0e0
1 zmenil súbory, kde vykonal 5 pridanie a 3 odobranie
  1. 5 3
      biz/order/services/OrderService.php

+ 5 - 3
biz/order/services/OrderService.php

@@ -182,10 +182,11 @@ class OrderService extends BaseService
 		$sourceType = isset($params['sourceType']) ? $params['sourceType'] : 0;
 		$discountAmount = 0;
 		$discountType = 0;
+		$discountPrice = $price;
 		//使用优惠券
 		if (!empty($couponId)) {
 			$discountAmount = CouponService::valid($couponId, $price, $userId);
-			$price = stringUtil::calcSub($price, $discountAmount);
+			$discountPrice = stringUtil::calcSub($price, $discountAmount);
 			$discountType = 1;
 		}
 		//使用会员
@@ -196,6 +197,7 @@ class OrderService extends BaseService
 			$newPrice = substr(sprintf("%.3f", $currentPrice), 0, -2);
 			$discountType = 2;
 			$discountAmount = stringUtil::calcSub($price, $newPrice);
+			$discountPrice = $newPrice;
 		}
 		
 		//使用随机优惠 shish 2019.9.12
@@ -206,11 +208,11 @@ class OrderService extends BaseService
 			if ($env == 'local' || $env == 'test') {
 				$discountAmount = 0.01;
 			}
-			$price = stringUtil::calcSub($price, $discountAmount);
+			$discountPrice = stringUtil::calcSub($price, $discountAmount);
 			$discountType = 3;
 		}
 		$discountType = $discountAmount <= 0 ? 0 : $discountType;
-		return ['price' => $price, 'discountType' => $discountType, 'discountAmount' => $discountAmount];
+		return ['price' => $discountPrice, 'discountType' => $discountType, 'discountAmount' => $discountAmount];
 	}
 
 }