|
|
@@ -283,6 +283,14 @@ class HdRefundService extends BaseService
|
|
|
util::fail('此支付方式暂不支持退款');
|
|
|
}
|
|
|
} else {
|
|
|
+
|
|
|
+ //客户欠款金额减少
|
|
|
+ $customId = $order->customId ?? 0;
|
|
|
+ $custom = CustomClass::getLockById($customId);
|
|
|
+ if (empty($custom)) {
|
|
|
+ util::fail('没有找到客户');
|
|
|
+ }
|
|
|
+
|
|
|
if ($payWay == dict::getDict('payWay', 'debtPay')) {
|
|
|
|
|
|
$settleId = $order->settleId;
|
|
|
@@ -294,12 +302,6 @@ class HdRefundService extends BaseService
|
|
|
$order->remainDebtPrice = $currentRemain;
|
|
|
$order->save();
|
|
|
|
|
|
- //客户欠款金额减少
|
|
|
- $customId = $order->customId ?? 0;
|
|
|
- $custom = CustomClass::getLockById($customId);
|
|
|
- if (empty($custom)) {
|
|
|
- util::fail('没有找到客户');
|
|
|
- }
|
|
|
CustomClass::refundDebtAmountReduce($custom, $refundPrice, $refund);
|
|
|
|
|
|
} else {
|
|
|
@@ -307,11 +309,14 @@ class HdRefundService extends BaseService
|
|
|
if ($order->remainDebtPrice > 0) {
|
|
|
if ($refundPrice > $order->remainDebtPrice) {
|
|
|
$order->remainDebtPrice = 0;
|
|
|
+ $order->debt = 0;
|
|
|
$order->save();
|
|
|
+ CustomClass::refundDebtAmountReduce($custom, $order->remainDebtPrice, $refund);
|
|
|
} else {
|
|
|
$currentRemain = bcsub($order->remainDebtPrice, $refundPrice, 2);
|
|
|
$order->remainDebtPrice = $currentRemain;
|
|
|
$order->save();
|
|
|
+ CustomClass::refundDebtAmountReduce($custom, $refundPrice, $refund);
|
|
|
}
|
|
|
}
|
|
|
}
|