|
|
@@ -82,6 +82,7 @@ class HdRefundService extends BaseService
|
|
|
}
|
|
|
$goodsInfoList = [];
|
|
|
$itemInfoList = [];
|
|
|
+ $calcAmount = 0;
|
|
|
foreach ($postProduct as $current) {
|
|
|
$property = $current['property'] ?? 0;
|
|
|
if ($property == 0) {
|
|
|
@@ -89,7 +90,16 @@ class HdRefundService extends BaseService
|
|
|
} else {
|
|
|
$itemInfoList[] = $current;
|
|
|
}
|
|
|
+ $calcNum = $current['num'] ?? 0;
|
|
|
+ $calcUnitPrice = $current['unitPrice'] ?? 0;
|
|
|
+ $calcPrice = bcmul($calcNum, $calcUnitPrice, 2);
|
|
|
+ $calcAmount = bcadd($calcAmount, $calcPrice, 2);
|
|
|
}
|
|
|
+
|
|
|
+ if (floatval($refundPrice) != floatval($calcAmount)) {
|
|
|
+ util::fail('数量与单价的总乘积,与退款金额不一致');
|
|
|
+ }
|
|
|
+
|
|
|
if (!empty($itemInfoList)) {
|
|
|
$ids = array_column($itemInfoList, 'productId');
|
|
|
$productInfo = ProductClass::getByids($ids, null, 'id');
|
|
|
@@ -185,7 +195,6 @@ class HdRefundService extends BaseService
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
$data['customId'] = $order->customId ?? 0;
|
|
|
$data['remark'] = $post['remark'] ?? '';
|
|
|
$data['refundPrice'] = $refundPrice;
|
|
|
@@ -288,25 +297,8 @@ class HdRefundService extends BaseService
|
|
|
|
|
|
CustomClass::refundDebtAmountReduce($custom, $refundPrice, $refund);
|
|
|
|
|
|
- } else {
|
|
|
- //部分欠款的订单,付了订金的订单
|
|
|
- if ($order->remainDebtPrice > 0) {
|
|
|
- if ($refundPrice > $order->remainDebtPrice) {
|
|
|
- CustomClass::refundDebtAmountReduce($custom, $order->remainDebtPrice, $refund);
|
|
|
- $order->remainDebtPrice = 0;
|
|
|
- $order->debt = 0;
|
|
|
- $order->save();
|
|
|
- } else {
|
|
|
- CustomClass::refundDebtAmountReduce($custom, $refundPrice, $refund);
|
|
|
- $currentRemain = bcsub($order->remainDebtPrice, $refundPrice, 2);
|
|
|
- $order->remainDebtPrice = $currentRemain;
|
|
|
- if ($currentRemain <= 0) {
|
|
|
- $order->debt = 0;
|
|
|
- }
|
|
|
- $order->save();
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
+
|
|
|
if ($payWay == dict::getDict('payWay', 'cash')) {
|
|
|
$moneyData = [
|
|
|
'shopId' => $shopId,
|
|
|
@@ -316,7 +308,6 @@ class HdRefundService extends BaseService
|
|
|
];
|
|
|
ShopMoneyClass::hdRefundSkOutAmount($moneyData, $main);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
return $refund;
|
|
|
}
|