|
|
@@ -69,20 +69,21 @@ class OrderService extends BaseService
|
|
|
if (isset($val['property']) == false) {
|
|
|
util::fail('没有找到产品属性');
|
|
|
}
|
|
|
- $currentPrice = $val['price'] ?? 0;
|
|
|
- $goodsPrice = bcadd($goodsPrice, $currentPrice, 2);
|
|
|
$property = $val['property'];
|
|
|
- $unitPrice = $val['unitPrice'] ?? 0;
|
|
|
$unitType = $val['unitType'] ?? 0;
|
|
|
$currentId = $val['productId'] ?? 0;
|
|
|
$num = $val['num'] ?? 0;
|
|
|
+ $currentPrice = 0;
|
|
|
+ $unitPrice = 0;
|
|
|
if ($property == dict::getDict('property', 'goods')) {
|
|
|
$name = $goodsInfo[$currentId]['name'] ?? '';
|
|
|
$cover = $goodsInfo[$currentId]['cover'] ?? '';
|
|
|
if (!empty($groupCover)) {
|
|
|
$groupCover = $cover;
|
|
|
}
|
|
|
+ $currentPrice = $goodsInfo[$currentId]['price'] ?? 0;
|
|
|
$currentMainId = $goodsInfo[$currentId]['mainId'] ?? 0;
|
|
|
+ $unitPrice = $currentPrice;
|
|
|
if ($currentMainId != $mainId) {
|
|
|
util::fail('不是您的商品');
|
|
|
}
|
|
|
@@ -111,6 +112,7 @@ class OrderService extends BaseService
|
|
|
}
|
|
|
$ratio = $itemInfo[$currentId]['ratio'] ?? 20;
|
|
|
$currentMainId = $itemInfo[$currentId]['mainId'] ?? 0;
|
|
|
+ $currentPrice = $itemInfo[$currentId]['skPrice'] ?? 0;
|
|
|
if ($currentMainId != $mainId) {
|
|
|
util::fail('不是您的花材' . $mainId . ' ' . $currentMainId);
|
|
|
}
|
|
|
@@ -118,10 +120,14 @@ class OrderService extends BaseService
|
|
|
$unitName = $itemInfo[$currentId]['bigUnit'] ?? '';
|
|
|
$unitId = $itemInfo[$currentId]['bigUnitId'] ?? 0;
|
|
|
$totalNum = $num;
|
|
|
+ $unitPrice = $currentPrice;
|
|
|
} else {
|
|
|
$unitName = $itemInfo[$currentId]['smallUnit'] ?? '';
|
|
|
$unitId = $itemInfo[$currentId]['smallUnitId'] ?? 0;
|
|
|
$totalNum = bcdiv($num, $ratio, 2);
|
|
|
+ $div = bcdiv($currentPrice, $ratio, 2);
|
|
|
+ $smallRatio = $itemInfo[$currentId]['smallRatio'] ?? 0;
|
|
|
+ $unitPrice = bcmul($div, $smallRatio, 2);
|
|
|
}
|
|
|
$ptItemId = $itemInfo[$currentId]['itemId'] ?? 0;
|
|
|
$currentItemData = [
|
|
|
@@ -148,6 +154,9 @@ class OrderService extends BaseService
|
|
|
//库存变化在这里
|
|
|
OrderItemClass::addData($currentItemData, $custom);
|
|
|
}
|
|
|
+
|
|
|
+ $goodsPrice = bcadd($goodsPrice, bcmul($unitPrice, $num, 2), 2);
|
|
|
+
|
|
|
}
|
|
|
$sendCost = $data['sendCost'] ?? 0;
|
|
|
$totalPrice = bcadd($goodsPrice, $sendCost, 2);
|