修改订单财务流水的错误

This commit is contained in:
luofei 2024-03-02 16:48:43 +08:00
parent c01be333bf
commit 52c6e4ca5d

View File

@ -312,37 +312,37 @@ class StoreOrderRepository extends BaseRepository
$financeDao->platformOut($order->consumption_money, 'platform_consumption');
}
$_payPrice = bcsub($order->total_price, bcadd($order['extension_one'], $order['extension_two'], 3), 2);
$_payPrice = bcsub($_payPrice, $order->consumption_money, 2);
$_payPrice = bcsub($order->pay_price, bcadd($order['extension_one'], $order['extension_two'], 3), 2);
$orderValidAmount = bcsub($order->total_price, bcadd($order['extension_one'], $order['extension_two'], 3), 2);
// 平台支出推广费
$promoter = $order->merchant->promoter();
$promoterCommission = bcmul($_payPrice, 0.003, 2);
$promoterCommission = bcmul($orderValidAmount, 0.003, 2);
if (!empty($promoter) && $promoterCommission > 0) {
$financeDao->platformOut($promoterCommission, 'commission_to_promoter');
}
// 平台收入手续费
$commission_rate = bcdiv((string)$order['commission_rate'],'100',6);
$platformCommission = bcmul($_payPrice, (string)$commission_rate, 2);
$platformCommission = bcmul($orderValidAmount, (string)$commission_rate, 2);
if ($commission_rate > 0 && $platformCommission > 0) {
$_payPrice = bcsub($_payPrice, $platformCommission, 2);
$orderValidAmount = bcsub($orderValidAmount, $platformCommission, 2);
if ($promoterCommission > 0) {
$platformCommission = bcsub($platformCommission, $promoterCommission, 2);
}
$financeDao->platformIn($platformCommission, 'commission_to_platform', $order['mer_id']);
}
if ($_payPrice > 0) {
if ($orderValidAmount > 0) {
/** @var MerchantRepository $merchantRepo */
$merchantRepo = app()->make(MerchantRepository::class);
$merchantRepo->merId = $order['mer_id'];
$merchantRepo->forceMargin = false;
[$_payPrice, $financeDao] = $merchantRepo->deductDeposit($_payPrice, $order, $financeDao);
[$orderValidAmount, $financeDao] = $merchantRepo->deductDeposit($orderValidAmount, $order, $financeDao);
}
// 商户收入金额
$financeDao->platformOut($_payPrice, 'merchant_order', $order['mer_id']);
$financeDao->platformOut($orderValidAmount, 'merchant_order', $order['mer_id']);
if ($is_combine) {
$profitsharing[] = [