|
|
@@ -64,9 +64,6 @@ class RefundOrderService extends BaseService
|
|
|
if (empty($postProduct)) {
|
|
|
util::fail('没有退款花材');
|
|
|
}
|
|
|
- $ids = array_column($postProduct, 'productId');
|
|
|
- $productInfo = ProductClass::getByids($ids, null, 'id');
|
|
|
-
|
|
|
$saleOrderSn = $order->orderSn ?? '';
|
|
|
$orderItemData = OrderItemClass::getAllByCondition(['orderSn' => $saleOrderSn], null, '*', 'productId', true);
|
|
|
if (empty($orderItemData)) {
|
|
|
@@ -75,6 +72,15 @@ class RefundOrderService extends BaseService
|
|
|
|
|
|
foreach ($postProduct as $currentProduct) {
|
|
|
$id = $currentProduct['productId'] ?? 0;
|
|
|
+ if (isset($orderItemData[$id]) == false) {
|
|
|
+ util::fail('没有找到退款的花材');
|
|
|
+ }
|
|
|
+ $currentInfo = $orderItemData[$id];
|
|
|
+ $name = $currentInfo->name;
|
|
|
+ $ptItemId = $currentInfo->itemId;
|
|
|
+ $ratio = $currentInfo->ratio;
|
|
|
+ $itemCost = $currentInfo->cost;
|
|
|
+
|
|
|
$num = $currentProduct['num'] ?? 0;
|
|
|
$xhUnitName = $currentProduct['unitName'] ?? '';
|
|
|
$xhUnitPrice = $currentProduct['unitPrice'] ?? '';
|
|
|
@@ -82,15 +88,6 @@ class RefundOrderService extends BaseService
|
|
|
|
|
|
$xhPrice = bcmul($num, $xhUnitPrice, 2);
|
|
|
|
|
|
- $name = $productInfo[$id]['name'] ?? '';
|
|
|
- $ptItemId = $productInfo[$id]['itemId'] ?? 0;
|
|
|
- $itemCost = $productInfo[$id]['cost'] ?? 0;
|
|
|
- $ratio = $productInfo[$id]['ratio'] ?? 0;
|
|
|
-
|
|
|
- if (isset($orderItemData[$id]) == false) {
|
|
|
- util::fail('没有找到退款的花材');
|
|
|
- }
|
|
|
-
|
|
|
$itemNum = $num;
|
|
|
if ($unitType == dict::getDict('unitType', 'small')) {
|
|
|
$itemNum = bcdiv($num, $ratio, 2);
|