shish 3 лет назад
Родитель
Сommit
f1b67d6b21
2 измененных файлов с 23 добавлено и 35 удалено
  1. 12 17
      biz-ghs/order/services/RefundOrderService.php
  2. 11 18
      biz-hd/cg/services/CgRefundService.php

+ 12 - 17
biz-ghs/order/services/RefundOrderService.php

@@ -186,16 +186,15 @@ class RefundOrderService extends BaseService
             //退款流程
             if ($payWay == dict::getDict('payWay', 'wxPay')) {
 
-                $currentRefund = bcadd($order->refundPrice, $refundPrice, 2);
-                $order->refundPrice = $currentRefund;
+                $order->refundPrice = $refundPrice;
                 $currentActPrice = bcsub($order->actPrice, $refundPrice, 2);
                 if ($currentActPrice < 0) {
-                    util::fail('退款金额有问题!');
+                    util::fail('可退款金额不足');
                 }
                 $order->actPrice = $currentActPrice;
                 $currentRealPrice = bcsub($order->realPrice, $refundPrice, 2);
                 if ($currentRealPrice < 0) {
-                    util::fail('退款金额有问题');
+                    util::fail('可退款金额不足哦');
                 }
                 $order->realPrice = $currentRealPrice;
                 $order->save();
@@ -221,19 +220,17 @@ class RefundOrderService extends BaseService
                 $main->mayGathering = $currentMayGathering;
                 $main->save();
 
-                //订单总金额需要减掉退款部分
-                $currentRefund = bcadd($order->refundPrice, $refundPrice, 2);
-                $order->refundPrice = $currentRefund;
+                $order->refundPrice = $refundPrice;
 
                 $currentActPrice = bcsub($order->actPrice, $refundPrice, 2);
                 if ($currentActPrice < 0) {
-                    util::fail('退款金额有问题!');
+                    util::fail('可退款金额不足');
                 }
                 $order->actPrice = $currentActPrice;
 
                 $currentRealPrice = bcsub($order->realPrice, $refundPrice, 2);
                 if ($currentRealPrice < 0) {
-                    util::fail('退款金额有问题,请排查');
+                    util::fail('可退款金额不足哈');
                 }
                 $order->realPrice = $currentRealPrice;
 
@@ -261,15 +258,14 @@ class RefundOrderService extends BaseService
 
                 util::fail('余额支付暂不支持退款');
 
-                $currentRefund = bcadd($order->refundPrice, $refundPrice, 2);
-                $order->refundPrice = $currentRefund;
+                $order->refundPrice = $refundPrice;
                 $currentActPrice = bcsub($order->actPrice, $refundPrice, 2);
                 if ($currentActPrice < 0) {
-                    util::fail('退款金额有问题!');
+                    util::fail('可退款金额已不足了');
                 }
                 $currentRealPrice = bcsub($order->realPrice, $refundPrice, 2);
                 if ($currentRealPrice < 0) {
-                    util::fail('退款金额有问题');
+                    util::fail('可退款金额已不足');
                 }
                 $order->actPrice = $currentActPrice;
                 $order->realPrice = $currentRealPrice;
@@ -279,16 +275,15 @@ class RefundOrderService extends BaseService
                 ShopClass::saleRefundReduceBalance($main, $shop, $refund, $refundPrice);
             } else {
                 //其它线下退款直接完成
-                $currentRefund = bcadd($order->refundPrice, $refundPrice, 2);
-                $order->refundPrice = $currentRefund;
+                $order->refundPrice = $refundPrice;
                 $currentActPrice = bcsub($order->actPrice, $refundPrice, 2);
                 if ($currentActPrice < 0) {
-                    util::fail('退款金额有问题!');
+                    util::fail('可退款金额已不足。');
                 }
                 $order->actPrice = $currentActPrice;
                 $currentRealPrice = bcsub($order->realPrice, $refundPrice, 2);
                 if ($currentRealPrice < 0) {
-                    util::fail('退款金额有问题');
+                    util::fail('可退款金额不足那');
                 }
                 $order->realPrice = $currentRealPrice;
                 $order->save();

+ 11 - 18
biz-hd/cg/services/CgRefundService.php

@@ -192,17 +192,15 @@ class CgRefundService extends BaseService
                 $cgRefund->thirdRefundNo = $wxRefundId;
                 $cgRefund->save();
 
-                //采购单总金额还要减去退款
-                $currentRefund = bcadd($cg->refundPrice, $refundPrice, 2);
-                $cg->refundPrice = $currentRefund;
+                $cg->refundPrice = $refundPrice;
                 $currentActPrice = bcsub($cg->actPrice, $refundPrice, 2);
                 if ($currentActPrice < 0) {
-                    util::fail('退款金额有问题!');
+                    util::fail('可退款金额不足!!');
                 }
                 $cg->actPrice = $currentActPrice;
                 $currentRealPrice = bcsub($cg->realPrice, $refundPrice, 2);
                 if ($currentRealPrice < 0) {
-                    util::fail('退款金额有问题,请排查');
+                    util::fail('可退款金额不足,请排查。');
                 }
                 $cg->realPrice = $currentRealPrice;
                 $cg->save();
@@ -222,25 +220,23 @@ class CgRefundService extends BaseService
                     util::fail('订单已经结帐,无法再发起退款');
                 }
 
-                //采购单总金额还要减去退款
-                $currentRefund = bcadd($cg->refundPrice, $refundPrice, 2);
-                $cg->refundPrice = $currentRefund;
+                $cg->refundPrice = $refundPrice;
 
                 $currentActPrice = bcsub($cg->actPrice, $refundPrice, 2);
                 if ($currentActPrice < 0) {
-                    util::fail('退款金额有问题!');
+                    util::fail('可退款金额不足');
                 }
                 $cg->actPrice = $currentActPrice;
 
                 $currentRealPrice = bcsub($cg->realPrice, $refundPrice, 2);
                 if ($currentRealPrice < 0) {
-                    util::fail('退款金额有问题,请排查');
+                    util::fail('可退款金额不足,请排查');
                 }
                 $cg->realPrice = $currentRealPrice;
 
                 $currentRemainDebt = bcsub($cg->remainDebtPrice, $refundPrice, 2);
                 if ($currentRemainDebt < 0) {
-                    util::fail('退款金额有问题哦');
+                    util::fail('可退款金额不足哦');
                 }
                 if ($currentRemainDebt == 0) {
                     $cg->debt = PurchaseClass::DEBT_NO;
@@ -264,8 +260,7 @@ class CgRefundService extends BaseService
                 util::fail('余额支付暂不支持退款');
 
                 //采购单总金额还要减去退款
-                $currentRefund = bcadd($cg->refundPrice, $refundPrice, 2);
-                $cg->refundPrice = $currentRefund;
+                $cg->refundPrice = $refundPrice;
                 $currentActPrice = bcsub($cg->actPrice, $refundPrice, 2);
                 if ($currentActPrice < 0) {
                     util::fail('退款金额有问题!');
@@ -282,17 +277,15 @@ class CgRefundService extends BaseService
                 ShopClass::cgRefundAddBalance($main, $shop, $refundPrice, $cgRefund, $ghs);
             } else {
                 //其它线下退款直接完成
-                //采购单总金额还要减去退款
-                $currentRefund = bcadd($cg->refundPrice, $refundPrice, 2);
-                $cg->refundPrice = $currentRefund;
+                $cg->refundPrice = $refundPrice;
                 $currentActPrice = bcsub($cg->actPrice, $refundPrice, 2);
                 if ($currentActPrice < 0) {
-                    util::fail('退款金额有问题!');
+                    util::fail('可退款金额不足...');
                 }
                 $cg->actPrice = $currentActPrice;
                 $currentRealPrice = bcsub($cg->realPrice, $refundPrice, 2);
                 if ($currentRealPrice < 0) {
-                    util::fail('退款金额有问题,请排查');
+                    util::fail('可退款金额不足,请确认');
                 }
                 $cg->realPrice = $currentRealPrice;
                 $cg->save();