|
|
@@ -62,8 +62,6 @@ class PurchaseClass extends BaseClass
|
|
|
}
|
|
|
$sjId = $data['sjId'] ?? 0;
|
|
|
$shopId = $data['shopId'] ?? 0;
|
|
|
- $mainId = $data['mainId'] ?? 0;
|
|
|
-
|
|
|
//product [{"productId":"3674","num":0,"price":1}]
|
|
|
$product = $data['product'] ?? '';
|
|
|
if (empty($product)) {
|
|
|
@@ -85,8 +83,6 @@ class PurchaseClass extends BaseClass
|
|
|
$price = $product[$productId]['price'] ?? 0;
|
|
|
$totalPrice = bcmul($num, $price, 2);
|
|
|
$itemPrice = bcadd($itemPrice, $totalPrice, 2);
|
|
|
- $ratio = $val->ratio ?? 20;
|
|
|
- $ptItemId = $val->itemId ?? 0;
|
|
|
$val->price = $price;
|
|
|
$val->itemNum = $num;
|
|
|
$val->preTotalPrice = $totalPrice;
|
|
|
@@ -106,27 +102,11 @@ class PurchaseClass extends BaseClass
|
|
|
$smallNum = 0;
|
|
|
if ($unitType == dict::getDict('unitType', 'big')) {
|
|
|
$bigNum = $num;
|
|
|
- $totalNum = $num;
|
|
|
} else {
|
|
|
$smallNum = $num;
|
|
|
- $totalNum = bcdiv($num, $ratio, 2);
|
|
|
}
|
|
|
//增加库存
|
|
|
- $stockRespond = StockClass::purchaseItem($orderSn, $sjId, $shopId, $productId, $bigNum, $smallNum);
|
|
|
-
|
|
|
- //增加记录
|
|
|
- $recordData = [];
|
|
|
- $recordData['sjId'] = $sjId;
|
|
|
- $recordData['mainId'] = $mainId;
|
|
|
- $recordData['shopId'] = $shopId;
|
|
|
- $recordData['itemId'] = $ptItemId;
|
|
|
- $recordData['itemNum'] = $totalNum;
|
|
|
- $recordData['oldStock'] = $stockRespond['oldStock'];
|
|
|
- $recordData['newStock'] = $stockRespond['newStock'];
|
|
|
- $recordData['productId'] = $productId;
|
|
|
- $recordData['orderSn'] = $orderSn;
|
|
|
- StockRecordClass::addPurchaseOrderRecord($recordData);
|
|
|
-
|
|
|
+ StockClass::purchaseItem($orderSn, $sjId, $shopId, $productId, $bigNum, $smallNum);
|
|
|
}
|
|
|
|
|
|
$cg->itemPrice = $itemPrice;
|
|
|
@@ -196,7 +176,7 @@ class PurchaseClass extends BaseClass
|
|
|
$sjId = $cg->sjId ?? 0;
|
|
|
$shopId = $cg->shopId ?? 0;
|
|
|
$ghsName = $cg->ghsName ?? '';
|
|
|
- $event = "预订单多付退款({$ghsName})";
|
|
|
+ $event = "预订单多退少补({$ghsName})";
|
|
|
$capitalData = [
|
|
|
'capitalType' => $currentType,
|
|
|
'io' => 1,
|