Ver código fonte

应收应付

shish 5 anos atrás
pai
commit
5fec2c41a6

+ 5 - 1
biz-ghs/order/services/RefundOrderService.php

@@ -81,6 +81,7 @@ class RefundOrderService extends BaseService
             if (empty($shop)) {
                 util::fail('没有找到门店');
             }
+            //总支出增加
             $currentTotalExpend = bcadd($shop->totalExpend, $refundPrice, 2);
             $shop->totalExpend = $currentTotalExpend;
             $shop->save();
@@ -88,7 +89,6 @@ class RefundOrderService extends BaseService
             //支出流水
             $thisType = dict::getDict('capitalType', 'saleRefund', 'id');
             $sjId = $order->sjId ?? 0;
-            $shopId = $order->shopId ?? 0;
             $event = '销售退款';
             $capitalData = [
                 'capitalType' => $thisType,
@@ -129,6 +129,10 @@ class RefundOrderService extends BaseService
                 }
                 $custom->debtAmount = $currentDebtAmount;
                 $custom->save();
+                if ($currentDebtAmount == 0) {
+                    $shop->mayGatheringNum -= 1;
+                    $shop->save();
+                }
 
             } elseif ($payWay == dict::getDict('payWay', 'balancePay')) {
                 //门店余额减少

+ 4 - 0
biz-hd/cg/services/CgRefundService.php

@@ -127,6 +127,10 @@ class CgRefundService extends BaseService
             }
             $ghs->debtAmount = $currentDebtAmount;
             $ghs->save();
+            if ($currentDebtAmount == 0) {
+                $shop->mayPayNum -= 1;
+                $shop->save();
+            }
 
         } elseif ($payWay == dict::getDict('payWay', 'balancePay')) {