|
|
@@ -366,6 +366,39 @@ class ProductController extends BaseController
|
|
|
if (empty($val)) {
|
|
|
continue;
|
|
|
}
|
|
|
+
|
|
|
+ //成本价需要修改的花材id
|
|
|
+ $costChangeIds = Yii::$app->request->post('costChangeIds', []);
|
|
|
+ $arrIds = json_decode($costChangeIds, true);
|
|
|
+ $costIds = is_array($arrIds) ? $arrIds : [];
|
|
|
+ if (in_array($id, $costIds)) {
|
|
|
+ $newAddPrice = bcsub($val, $product->cost, 2);
|
|
|
+ $qtDiff = bcsub($product->addPrice, $product->qtAddPrice, 2);
|
|
|
+ $newQtAddPrice = bcsub($newAddPrice, $qtDiff, 2);
|
|
|
+ $byDiff = bcsub($product->addPrice, $product->byAddPrice, 2);
|
|
|
+ $newByAddPrice = bcsub($newAddPrice, $byDiff, 2);
|
|
|
+ $hjDiff = bcsub($product->addPrice, $product->hjAddPrice, 2);
|
|
|
+ $newHjAddPrice = bcsub($newAddPrice, $hjDiff, 2);
|
|
|
+ $zsDiff = bcsub($product->addPrice, $product->zsAddPrice, 2);
|
|
|
+ $newZsAddPrice = bcsub($newAddPrice, $zsDiff, 2);
|
|
|
+ $params = [];
|
|
|
+ $params['addPrice'] = $newAddPrice;
|
|
|
+ $params['qtAddPrice'] = $newQtAddPrice;
|
|
|
+ $params['byAddPrice'] = $newByAddPrice;
|
|
|
+ $params['hjAddPrice'] = $newHjAddPrice;
|
|
|
+ $params['zsAddPrice'] = $newZsAddPrice;
|
|
|
+
|
|
|
+ $sjId = $product->sjId ?? 0;
|
|
|
+ $shopAll = ShopClass::getAllShop($sjId);
|
|
|
+ if ($shopAll) {
|
|
|
+ foreach ($shopAll as $shop) {
|
|
|
+ $currentId = $shop['id'] ?? 0;
|
|
|
+ $itemId = $product->itemId ?? 0;
|
|
|
+ ProductClass::updateByCondition(['shopId' => $currentId, 'itemId' => $itemId], $params);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
ProductClass::changePrice($product, $val, ProductClass::PRICE_LABEL_CHANGE);
|
|
|
continue;
|
|
|
}
|