|
@@ -1367,6 +1367,14 @@ class ProductClass extends BaseClass
|
|
|
util::fail('预售花材不能做特价');
|
|
util::fail('预售花材不能做特价');
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ $hjDiscountPrice = isset($data['hjDiscountPrice']) && is_numeric($data['hjDiscountPrice']) ? $data['hjDiscountPrice'] : 0;
|
|
|
|
|
+ $skDiscountPrice = isset($data['skDiscountPrice']) && is_numeric($data['skDiscountPrice']) ? $data['skDiscountPrice'] : 0;
|
|
|
|
|
+ if ($hjDiscountPrice > $discountPrice) {
|
|
|
|
|
+ util::fail('会员特价不能大于批发特价');
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($discountPrice > $skDiscountPrice) {
|
|
|
|
|
+ util::fail('批发特价不能大于零售特价');
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
$cost = $data['cost'] ?? 0;
|
|
$cost = $data['cost'] ?? 0;
|
|
|
$price = $data['price'] ?? 0;
|
|
$price = $data['price'] ?? 0;
|
|
@@ -1773,6 +1781,22 @@ class ProductClass extends BaseClass
|
|
|
}
|
|
}
|
|
|
$catName = $cat->name ?? '';
|
|
$catName = $cat->name ?? '';
|
|
|
|
|
|
|
|
|
|
+ if (isset($data['discountPrice']) && is_numeric($data['discountPrice'])) {
|
|
|
|
|
+ $discountPrice = $data['discountPrice'] ?? 0;
|
|
|
|
|
+ $currentPrice = $data['price'] ?? 0;
|
|
|
|
|
+ if ($discountPrice >= $currentPrice) {
|
|
|
|
|
+ util::fail('特价要小于售价');
|
|
|
|
|
+ }
|
|
|
|
|
+ $hjDiscountPrice = isset($data['hjDiscountPrice']) && is_numeric($data['hjDiscountPrice']) ? $data['hjDiscountPrice'] : 0;
|
|
|
|
|
+ $skDiscountPrice = isset($data['skDiscountPrice']) && is_numeric($data['skDiscountPrice']) ? $data['skDiscountPrice'] : 0;
|
|
|
|
|
+ if ($hjDiscountPrice > $discountPrice) {
|
|
|
|
|
+ util::fail('会员特价不能大于批发特价');
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($discountPrice > $skDiscountPrice) {
|
|
|
|
|
+ util::fail('批发特价不能大于零售特价');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
$connection = Yii::$app->db;
|
|
$connection = Yii::$app->db;
|
|
|
$transaction = $connection->beginTransaction();
|
|
$transaction = $connection->beginTransaction();
|
|
|
try {
|
|
try {
|