修复问题

This commit is contained in:
mkm 2023-05-25 09:48:32 +08:00
parent f530fe181f
commit 182409e47e
2 changed files with 21 additions and 8 deletions

View File

@ -300,6 +300,8 @@ class StoreOrderRepository extends BaseRepository
$_order_rate = bcmul($_payPrice, $commission_rate, 2);
$_payPrice = bcsub($_payPrice, $_order_rate, 2);
event('order.paySuccessOrder', compact('order','_order_rate'));
}
if (!$presell) {
@ -347,6 +349,9 @@ class StoreOrderRepository extends BaseRepository
'financial_record_sn' => $financeSn . ($i++)
];
}
if ($_payPrice > 0) {
$this->autoMargin($_payPrice, $order, $finance, $financeSn, $i);
}
$finance[] = [
'order_id' => $order->order_id,
'order_sn' => $order->order_sn,
@ -375,11 +380,6 @@ class StoreOrderRepository extends BaseRepository
];
$_payPrice = bcadd($_payPrice, $order->platform_coupon_price, 2);
}
if ($_payPrice > 0) {
$this->autoMargin($_payPrice, $order, $finance, $financeSn, $i);
}
if (!$is_combine) {
app()->make(MerchantRepository::class)->addLockMoney($order->mer_id, 'order', $order->order_id, $_payPrice);
}
@ -479,8 +479,8 @@ class StoreOrderRepository extends BaseRepository
'user_info' => $order->user->nickname,
'user_id' => $order->uid,
'financial_type' => 'auto_margin',
'financial_pm' => FinancialRecordDao::Outlay,
'type' => FinancialRecordDao::TypePlatform,
'financial_pm' => 0,
'type' => 1,
'number' => $margin,
'mer_id' => $order->mer_id,
'financial_record_sn' => $financeSn . $index

View File

@ -434,6 +434,12 @@ class FinancialRecordRepository extends BaseRepository
bcsub($expend['number_order_charge'],$expend['number_charge'],2) .'元',
$expend['count_charge']+$expend['count_order_charge'].'笔'
],
[
'店铺保证金',
$expend['number_auto_margin'] .'元',
$expend['count_auto_margin'].'笔'
],
[
'佣金',
bcsub($expend['number_brokerage'],$expend['number_refund_brokerage'],2) .'元',
@ -558,6 +564,10 @@ class FinancialRecordRepository extends BaseRepository
$financialType = ['order_charge','presell_charge'];
[$data['count_order_charge'],$data['number_order_charge']] = $this->dao->getDataByType($type, $where, $date, $financialType);
//商户保证金
$financialType = ['auto_margin'];
[$data['count_auto_margin'],$data['number_auto_margin']] = $this->dao->getDataByType($type, $where, $date, $financialType);
//退回佣金
$financialType = ['refund_brokerage_two','refund_brokerage_one'];
[$data['count_refund_brokerage'],$data['number_refund_brokerage']] = $this->dao->getDataByType($type, $where, $date, $financialType);
@ -578,8 +588,11 @@ class FinancialRecordRepository extends BaseRepository
//退回收入 refund_order + 退回佣金
$number_2 = bcadd(bcadd($data['number_refund'],$data['number_coupon'],2),$data['number_svipcoupon'],2);
$data['count'] = $data['count_brokerage'] + $data['count_refund'] + $data['count_order_charge'] + $data['count_refund'] + $data['count_refund_brokerage'] + $data['count_svipcoupon'];
$data['count'] = $data['count_brokerage'] + $data['count_refund'] + $data['count_order_charge'] + $data['count_refund'] + $data['count_refund_brokerage'] + $data['count_svipcoupon']+$data['count_auto_margin'];
$data['number'] =bcadd(bcadd($number_2,$number,3),$number_1,2);
if ($data['number_auto_margin'] > 0) {
$data['number'] = bcadd($data['number'],$data['number_auto_margin'],2);
}
}else{ //平台的
// 退回 订单实际获得金额