From 9f9c0c5329eeb9a3eceb5d827ebbf6508df215b3 Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Thu, 1 Feb 2024 16:08:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AE=A2=E5=8D=95=E8=B4=A2?= =?UTF-8?q?=E5=8A=A1=E6=B5=81=E6=B0=B4=E5=86=99=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dao/system/financial/FinancialDao.php | 2 +- .../store/order/StoreOrderRepository.php | 87 ++----------------- .../system/merchant/MerchantRepository.php | 2 +- 3 files changed, 7 insertions(+), 84 deletions(-) diff --git a/app/common/dao/system/financial/FinancialDao.php b/app/common/dao/system/financial/FinancialDao.php index 4779abb1..9d4e120e 100755 --- a/app/common/dao/system/financial/FinancialDao.php +++ b/app/common/dao/system/financial/FinancialDao.php @@ -146,7 +146,7 @@ class FinancialDao extends BaseDao 'financial_pm' => $pm, 'type' => $type, 'number' => $number, - 'mer_id' => !empty($merId) ? $merId : $this->order->mer_id, + 'mer_id' => $merId !== '' ? $merId : $this->order->mer_id, 'financial_record_sn' => $this->financeSn . ($this->index++) ]; } diff --git a/app/common/repositories/store/order/StoreOrderRepository.php b/app/common/repositories/store/order/StoreOrderRepository.php index 3631dbc9..b6e904fb 100755 --- a/app/common/repositories/store/order/StoreOrderRepository.php +++ b/app/common/repositories/store/order/StoreOrderRepository.php @@ -221,7 +221,6 @@ class StoreOrderRepository extends BaseRepository $userMerchantRepository = app()->make(UserMerchantRepository::class); $storeOrderProfitsharingRepository = app()->make(StoreOrderProfitsharingRepository::class); $uid = $groupOrder->uid; - $i = 0; // $isVipCoupon = app()->make(StoreGroupOrderRepository::class)->isVipCoupon($groupOrder); //订单记录 $storeOrderStatusRepository = app()->make(StoreOrderStatusRepository::class); @@ -305,16 +304,17 @@ class StoreOrderRepository extends BaseRepository $financeDao->order = $order; $financeDao->user = $groupOrder->user; $financialType = $presell ? 'order_presell' : 'order'; - // 商户流水账单数据 - $financeDao->setData($order->pay_price, $financialType, 1, $presell ? 2 : 1); + // 平台订单收入流水账单数据 + $financeDao->platformIn($order->total_price, $financialType, 0); + $financeDao->platformOut($order->consumption_money, 'platform_consumption', 0); if ($order->source == 103) { $_payPrice = $order->procure_price; - $financeDao->publicOut($_payPrice, 'supply_chain'); //市级供应链 $product_mer_id = Db::name('store_order_product')->where('order_id', $order->order_id)->value('product_mer_id'); + // 平台支付市供应链流水账单数据 + $financeDao->platformOut($_payPrice, 'supply_chain', $product_mer_id); if ($product_mer_id) { - $financeDao->publicOut($_payPrice, 'order', $product_mer_id); //市级供应链押金计算 if ($_payPrice > 0) { /** @var MerchantRepository $merchantRepo */ @@ -324,92 +324,15 @@ class StoreOrderRepository extends BaseRepository [$_payCityPrice, $financeDao] = $merchantRepo->deductDeposit($_payPrice, $order, $financeDao); } if (isset($_payCityPrice)) { - $financeDao->platformOut($_payCityPrice, 'order_true', $product_mer_id); if (!$is_combine) { app()->make(MerchantRepository::class)->addLockMoney($product_mer_id, 'order', $order->order_id, $_payCityPrice); } } } - - //计算手续费 - $_order_rate = bcsub($order->pay_price, $_payPrice, 2); - - //计算镇级供应链云仓实际获得金额 - // 服务团队佣金统一由新供销平台结算 -// if ($_order_rate > 0) { -// $commission_rate = bcdiv(12, 100, 2); -// $_payPrice = bcmul($_order_rate, $commission_rate, 2); -// } else { -// $_payPrice = 0; -// } } else { $_payPrice = $order->pay_price; - $_order_rate = 0; - - //平台手续费 - if ($order['commission_rate'] > 0) { - - $commission_rate = ($order['commission_rate'] / 100); - - $_order_rate = bcmul($_payPrice, $commission_rate, 2); - - $_payPrice = bcsub($_payPrice, $_order_rate, 2); - // 结算各镇 小组佣金 - // event('order.paySuccessOrder', compact('order', '_order_rate')); - } } - // bcsub($order->pay_price, bcadd($order['extension_one'], $order['extension_two'], 3), 2); - // if ($presell) { - // if (isset($order->orderProduct[0]['cart_info']['presell_extension_one']) && $order->orderProduct[0]['cart_info']['presell_extension_one'] > 0) { - // $_payPrice = bcadd($_payPrice, $order->orderProduct[0]['cart_info']['presell_extension_one'], 2); - // } - // if (isset($order->orderProduct[0]['cart_info']['presell_extension_two']) && $order->orderProduct[0]['cart_info']['presell_extension_two'] > 0) { - // $_payPrice = bcadd($_payPrice, $order->orderProduct[0]['cart_info']['presell_extension_two'], 2); - // } - // } - - - - if (!$presell) { - if ($order['commission_rate'] > 0 || $order->source == 103) { - //支出手续费 - $financeDao->publicOut($_order_rate, 'order_charge'); - } - //押金计算 - if ($_payPrice > 0) { - /** @var MerchantRepository $merchantRepo */ - $merchantRepo = app()->make(MerchantRepository::class); - $merchantRepo->merId = $order->mer_id; - $merchantRepo->forceMargin = false; - [$_payCityPrice, $financeDao] = $merchantRepo->deductDeposit($_payPrice, $order, $financeDao); - } - if ($order->source == 103) { - $financeDao->publicOut($_payPrice, 'commission_to_cloud_warehouse'); - } else { - $financeDao->platformOut($_payPrice, 'order_true'); - } - - - // if ($order->platform_coupon_price > 0) { - // $finance[] = [ - // 'order_id' => $order->order_id, - // 'order_sn' => $order->order_sn, - // 'user_info' => $groupOrder->user->nickname, - // 'user_id' => $uid, - // 'financial_type' => $isVipCoupon ? 'order_svip_coupon' : 'order_platform_coupon', - // 'financial_pm' => 0, - // 'type' => 1, - // 'number' => $order->platform_coupon_price, - // 'mer_id' => $order->mer_id, - // 'financial_record_sn' => $financeSn . ($i++) - // ]; - // $_payPrice = bcadd($_payPrice, $order->platform_coupon_price, 2); - // } - if (!$is_combine) { - app()->make(MerchantRepository::class)->addLockMoney($order->mer_id, 'order', $order->order_id, $_payPrice); - } - } if ($is_combine) { $profitsharing[] = [ 'profitsharing_sn' => $storeOrderProfitsharingRepository->getOrderSn(), diff --git a/app/common/repositories/system/merchant/MerchantRepository.php b/app/common/repositories/system/merchant/MerchantRepository.php index 5232b4ce..aee226c3 100755 --- a/app/common/repositories/system/merchant/MerchantRepository.php +++ b/app/common/repositories/system/merchant/MerchantRepository.php @@ -776,7 +776,7 @@ class MerchantRepository extends BaseRepository // if ($margin <= 0) { // return [$income, $financeDao]; // } - $financeDao->publicOut($margin, 'auto_margin', $this->merId); + $financeDao->platformIn($margin, 'auto_margin', $this->merId); if(bcadd($merchant['paid_margin'],$margin)>=$merchant['margin']){ $is_margin=10; }else{