|
|
@@ -123,10 +123,11 @@ class ProductController extends BaseController
|
|
|
//获取该花材的每扎成本价和每扎加价
|
|
|
//自动调价=每扎成本价+每扎加价
|
|
|
$itemData = ItemClass::getItemData($itemId, $this->sjId);
|
|
|
- if (!$itemData) {
|
|
|
- util::fail("出错拉");
|
|
|
- }
|
|
|
- $price = bcadd($itemData['cost'], $itemData['addPrice'], 2);
|
|
|
+// if (!$itemData) {
|
|
|
+// util::fail("出错拉");
|
|
|
+// }
|
|
|
+// $price = bcadd($itemData['cost'], $itemData['addPrice'], 2);
|
|
|
+ $price = bcadd($productData['cost'], $productData['addPrice'], 2);
|
|
|
ProductClass::changePrice($productId, $this->shopId, $price, ProductClass::PRICE_LABEL_AUTO);
|
|
|
}
|
|
|
util::success(['price'=>$price]);
|
|
|
@@ -140,17 +141,33 @@ class ProductController extends BaseController
|
|
|
if (!$productData) {
|
|
|
util::fail("花材不存在");
|
|
|
}
|
|
|
- $itemId = $productData['itemId'];
|
|
|
+ //$itemId = $productData['itemId'];
|
|
|
//获取该花材的每扎成本价和每扎加价
|
|
|
//自动调价=每扎成本价+每扎加价
|
|
|
- $itemData = ItemClass::getItemData($itemId, $this->sjId);
|
|
|
- if (!$itemData) {
|
|
|
- util::fail("出错拉");
|
|
|
- }
|
|
|
- $price = bcadd($itemData['cost'], $itemData['addPrice'], 2);
|
|
|
+// $itemData = ItemClass::getItemData($itemId, $this->sjId);
|
|
|
+// if (!$itemData) {
|
|
|
+// util::fail("出错拉");
|
|
|
+// }
|
|
|
+ //2021.04.06改为用product中的成本价+加价
|
|
|
+ $price = bcadd($productData['cost'], $productData['addPrice'], 2);
|
|
|
ProductClass::changePrice($productId, $this->shopId, $price, ProductClass::PRICE_LABEL_AUTO);
|
|
|
util::complete("操作成功");
|
|
|
}
|
|
|
|
|
|
|
|
|
+ //修改加价
|
|
|
+ public function actionChangeAddPrice()
|
|
|
+ {
|
|
|
+ $productId = Yii::$app->request->post('productId', 0);
|
|
|
+ $addPrice = Yii::$app->request->post('addPrice', '');
|
|
|
+ if($addPrice < 0 ){
|
|
|
+ util::fail("加价不能小于0");
|
|
|
+ }
|
|
|
+ $productData = ProductClass::getProductData($productId, $this->shopId);
|
|
|
+ if (!$productData) {
|
|
|
+ util::fail("花材不存在");
|
|
|
+ }
|
|
|
+ ProductClass::changeAddPrice($productId,$addPrice);
|
|
|
+ util::complete();
|
|
|
+ }
|
|
|
}
|