调整订单财务流水
This commit is contained in:
parent
ca9a081bf5
commit
74bee7bf69
@ -305,7 +305,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
$financeDao->user = $groupOrder->user;
|
||||
$financialType = $presell ? 'order_presell' : 'order';
|
||||
// 公共收入流水账单数据
|
||||
$financeDao->publicIn($order->total_price, $financialType);
|
||||
$financeDao->platformIn($order->total_price, $financialType);
|
||||
if ($order->consumption_money > 0) {
|
||||
// 平台支出优惠金额
|
||||
$financeDao->platformOut($order->consumption_money, 'platform_consumption');
|
||||
@ -313,14 +313,6 @@ class StoreOrderRepository extends BaseRepository
|
||||
|
||||
$_payPrice = bcsub($order->pay_price, bcadd($order['extension_one'], $order['extension_two'], 3), 2);
|
||||
|
||||
// 平台收入手续费
|
||||
if ($order['commission_rate'] > 0) {
|
||||
$commission_rate = bcdiv((string)$order['commission_rate'],'100',6);
|
||||
$platformCommission = bcmul($_payPrice, (string)$commission_rate, 2);
|
||||
$financeDao->platformIn($platformCommission, 'commission_to_platform');
|
||||
$_payPrice = bcsub($_payPrice, $platformCommission, 2);
|
||||
}
|
||||
|
||||
// 平台支出推广费
|
||||
$promoter = $order->merchant->promoter();
|
||||
if (!empty($promoter)) {
|
||||
@ -328,6 +320,17 @@ class StoreOrderRepository extends BaseRepository
|
||||
$financeDao->platformOut($promoterCommission, 'commission_to_promoter');
|
||||
}
|
||||
|
||||
// 平台收入手续费
|
||||
if ($order['commission_rate'] > 0) {
|
||||
$commission_rate = bcdiv((string)$order['commission_rate'],'100',6);
|
||||
$platformCommission = bcmul($_payPrice, (string)$commission_rate, 2);
|
||||
if (isset($promoterCommission) && $promoterCommission > 0) {
|
||||
$platformCommission = bcsub($platformCommission, $promoterCommission, 2);
|
||||
}
|
||||
$financeDao->platformIn($platformCommission, 'commission_to_platform', $order['mer_id']);
|
||||
$_payPrice = bcsub($_payPrice, $platformCommission, 2);
|
||||
}
|
||||
|
||||
if ($_payPrice > 0) {
|
||||
/** @var MerchantRepository $merchantRepo */
|
||||
$merchantRepo = app()->make(MerchantRepository::class);
|
||||
@ -337,7 +340,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
}
|
||||
|
||||
// 商户收入金额
|
||||
$financeDao->merchantIn($_payPrice, 'merchant_order', $order['mer_id']);
|
||||
$financeDao->platformOut($_payPrice, 'merchant_order', $order['mer_id']);
|
||||
|
||||
if ($is_combine) {
|
||||
$profitsharing[] = [
|
||||
|
@ -34,7 +34,31 @@ class FinancialRecordRepository extends BaseRepository
|
||||
'order', 'order_presell', 'order_refund', 'brokerage_one', 'brokerage_two', 'refund_brokerage_one', 'refund_brokerage_two', 'refund_order','order_platform_coupon',
|
||||
'order_svip_coupon','commission_to_service_team','commission_to_service_team_refund','commission_to_platform','commission_to_platform_refund','commission_to_village','commission_to_village_refund','commission_to_town','commission_to_town_refund'
|
||||
,'commission_to_entry_merchant','commission_to_entry_merchant_refund'
|
||||
,'commission_to_cloud_warehouse','commission_to_cloud_warehouse_refund', 'commission_to_store', 'commission_to_courier', 'commission_to_promoter', 'commission_to_store_refund', 'commission_to_courier_refund', 'commission_to_promoter_refund', 'auto_margin', 'auto_margin_refund', 'supply_chain', 'supply_chain_refund', 'platform_consumption', 'platform_consumption_refund'
|
||||
,'commission_to_cloud_warehouse','commission_to_cloud_warehouse_refund', 'commission_to_store', 'commission_to_courier', 'commission_to_promoter', 'commission_to_store_refund', 'commission_to_courier_refund', 'commission_to_promoter_refund', 'auto_margin', 'auto_margin_refund', 'supply_chain', 'supply_chain_refund', 'platform_consumption', 'platform_consumption_refund', 'merchant_order', 'merchant_order_refund'
|
||||
];
|
||||
|
||||
public $typeCnMap = [
|
||||
'order' => '订单支付',
|
||||
'order_presell' => '预售订单支付',
|
||||
'order_refund' => '订单退款',
|
||||
'brokerage_one' => '一级分销佣金',
|
||||
'brokerage_two' => '二级分销佣金',
|
||||
'refund_brokerage_one' => '一级分销佣金退款',
|
||||
'refund_brokerage_two' => '二级分销佣金退款',
|
||||
'refund_order' => '订单退款',
|
||||
'order_platform_coupon' => '平台优惠券抵扣',
|
||||
'order_svip_coupon' => '超级会员优惠券抵扣',
|
||||
'commission_to_service_team' => '服务队佣金',
|
||||
'commission_to_platform' => '平台佣金',
|
||||
'commission_to_platform_refund' => '平台佣金退款',
|
||||
'platform_consumption' => '平台优惠',
|
||||
'platform_consumption_refund' => '平台优惠退款',
|
||||
'commission_to_promoter' => '推广人佣金',
|
||||
'commission_to_promoter_refund' => '推广人佣金退款',
|
||||
'auto_margin' => '商户保证金',
|
||||
'auto_margin_refund' => '商户保证金退款',
|
||||
'merchant_order' => '商户订单',
|
||||
'merchant_order_refund' => '商户订单退款',
|
||||
];
|
||||
|
||||
public function __construct(FinancialRecordDao $dao)
|
||||
@ -60,6 +84,7 @@ class FinancialRecordRepository extends BaseRepository
|
||||
if (!empty($where['mer_id'])) {
|
||||
$item['financial_pm'] = $item['financial_pm'] == 0 ? 1 : 0;
|
||||
}
|
||||
$item['financial_type_cn'] = $this->getFinancialTypeCn($item['financial_type']);
|
||||
}
|
||||
return compact('count', 'list');
|
||||
}
|
||||
@ -782,4 +807,10 @@ class FinancialRecordRepository extends BaseRepository
|
||||
|
||||
return compact('count', 'number');
|
||||
}
|
||||
|
||||
public function getFinancialTypeCn($type)
|
||||
{
|
||||
return $this->typeCnMap[$type] ?? '';
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user