|
|
@@ -373,15 +373,19 @@ class ProductController extends BaseController
|
|
|
$arrIds = json_decode($costChangeIds, true);
|
|
|
$costIds = is_array($arrIds) ? $arrIds : [];
|
|
|
if (!empty($costIds) && in_array($id, $costIds)) {
|
|
|
- $newAddPrice = bcsub($val, $product->cost, 2);
|
|
|
- $qtDiff = bcsub($product->addPrice, $product->skAddPrice, 2);
|
|
|
- $newSkAddPrice = bcsub($newAddPrice, $qtDiff, 2);
|
|
|
+ $currentAddPrice = bcsub($val, $product->cost, 2);
|
|
|
+
|
|
|
+ $skDiff = bcsub($product->skAddPrice, $product->addPrice, 2);
|
|
|
+ $newSkAddPrice = bcsub($currentAddPrice, $skDiff, 2);
|
|
|
+
|
|
|
$hjDiff = bcsub($product->addPrice, $product->hjAddPrice, 2);
|
|
|
- $newHjAddPrice = bcsub($newAddPrice, $hjDiff, 2);
|
|
|
+ $newHjAddPrice = bcsub($currentAddPrice, $hjDiff, 2);
|
|
|
+
|
|
|
$zsDiff = bcsub($product->addPrice, $product->zsAddPrice, 2);
|
|
|
- $newZsAddPrice = bcsub($newAddPrice, $zsDiff, 2);
|
|
|
+ $newZsAddPrice = bcsub($currentAddPrice, $zsDiff, 2);
|
|
|
+
|
|
|
$params = [];
|
|
|
- $params['addPrice'] = $newAddPrice;
|
|
|
+ $params['addPrice'] = $currentAddPrice;
|
|
|
$params['skAddPrice'] = $newSkAddPrice;
|
|
|
$params['hjAddPrice'] = $newHjAddPrice;
|
|
|
$params['zsAddPrice'] = $newZsAddPrice;
|