Ver código fonte

红包 采购退款

shish 4 anos atrás
pai
commit
b246362222

+ 9 - 7
biz-hd/cg/services/CgRefundService.php

@@ -122,6 +122,13 @@ class CgRefundService extends BaseService
         $cg->refund = PurchaseClass::REFUND_YES;
         $cg->refund = PurchaseClass::REFUND_YES;
         $cg->save();
         $cg->save();
 
 
+        $ghsId = $cg->ghsId;
+        $ghs = GhsClass::getLockById($ghsId);
+        if (empty($ghs)) {
+            util::fail('没有找到供应商');
+        }
+        $ghsName = $ghs->name ?? '';
+
         if ($payWay == dict::getDict('payWay', 'wxPay')) {
         if ($payWay == dict::getDict('payWay', 'wxPay')) {
 
 
             //微信收款的原路退回
             //微信收款的原路退回
@@ -214,12 +221,7 @@ class CgRefundService extends BaseService
             $shop->mayPay = $currentMayPay;
             $shop->mayPay = $currentMayPay;
             $shop->save();
             $shop->save();
 
 
-            //门店应付供应商款减少
-            $ghsId = $cg->ghsId;
-            $ghs = GhsClass::getLockById($ghsId);
-            if (empty($ghs)) {
-                util::fail('没有找到供应商');
-            }
+            //应付供应商款减少
             $currentDebtAmount = bcsub($ghs->debtAmount, $refundPrice, 2);
             $currentDebtAmount = bcsub($ghs->debtAmount, $refundPrice, 2);
             if ($currentDebtAmount < 0) {
             if ($currentDebtAmount < 0) {
                 util::fail('供应商欠款有问题!');
                 util::fail('供应商欠款有问题!');
@@ -242,7 +244,7 @@ class CgRefundService extends BaseService
 
 
         $sjId = $cg->sjId ?? 0;
         $sjId = $cg->sjId ?? 0;
         $shopId = $cg->shopId ?? 0;
         $shopId = $cg->shopId ?? 0;
-        $event = '采购退款';
+        $event = "采购退款({$ghsName})";
         $capitalData = [
         $capitalData = [
             'capitalType' => $currentType,
             'capitalType' => $currentType,
             'io' => 1,
             'io' => 1,

+ 3 - 2
biz/shop/classes/ShopClass.php

@@ -409,7 +409,7 @@ class ShopClass extends BaseClass
     }
     }
 
 
     //零售采购退款
     //零售采购退款
-    public static function cgRefundAddBalance($shop, $refundPrice, $cgRefund)
+    public static function cgRefundAddBalance($shop, $refundPrice, $cgRefund, $ghs)
     {
     {
         //客户余额增加
         //客户余额增加
         $currentBalance = bcadd($shop->balance, $refundPrice, 2);
         $currentBalance = bcadd($shop->balance, $refundPrice, 2);
@@ -422,6 +422,7 @@ class ShopClass extends BaseClass
         $sjId = $shop->sjId;
         $sjId = $shop->sjId;
         $shopId = $shop->id;
         $shopId = $shop->id;
         $tx = dict::getDict('yeTx', 'canNot');
         $tx = dict::getDict('yeTx', 'canNot');
+        $ghsName = $ghs->name ?? '';
         $change = [
         $change = [
             'relateId' => $id,
             'relateId' => $id,
             'capitalType' => $currentType,
             'capitalType' => $currentType,
@@ -430,7 +431,7 @@ class ShopClass extends BaseClass
             'txBalance' => $currentTxBalance,
             'txBalance' => $currentTxBalance,
             'io' => 1,
             'io' => 1,
             'payWay' => 0,
             'payWay' => 0,
-            'event' => "采购退款",
+            'event' => "采购退款({$ghsName})",
             'sjId' => $sjId,
             'sjId' => $sjId,
             'shopId' => $shopId,
             'shopId' => $shopId,
             'tx' => $tx,
             'tx' => $tx,