|
|
@@ -622,11 +622,25 @@ class ProductClass extends BaseClass
|
|
|
$discountPrice = $product['discountPrice'] ?? 0;
|
|
|
if ($discountPrice > 0) {
|
|
|
if ($level == 0) {
|
|
|
- $currentAddPrice = $product['skMore'] ?? 0;
|
|
|
- $price = bcadd($discountPrice, $currentAddPrice, 2);
|
|
|
- } else {
|
|
|
$price = $discountPrice;
|
|
|
}
|
|
|
+ if ($level == 1) {
|
|
|
+ $price = $discountPrice;
|
|
|
+ }
|
|
|
+ if ($level == 2) {
|
|
|
+ $hjAddPrice = $product['hjAddPrice'] ?? 0;
|
|
|
+ $addPrice = $product['addPrice'] ?? 0;
|
|
|
+ $diff = bcsub($addPrice, $hjAddPrice, 2);
|
|
|
+ if ($diff > 0) {
|
|
|
+ if ($discountPrice > $diff) {
|
|
|
+ $price = bcsub($discountPrice, $diff, 2);
|
|
|
+ } else {
|
|
|
+ $price = 0.01;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $price = $discountPrice;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
return $price;
|
|
|
}
|
|
|
@@ -1032,7 +1046,7 @@ class ProductClass extends BaseClass
|
|
|
if (empty($productInfo)) {
|
|
|
return false;
|
|
|
}
|
|
|
- if(empty($price)){
|
|
|
+ if (empty($price)) {
|
|
|
util::fail('没有批发价');
|
|
|
}
|
|
|
$productInfo->price = $price;
|