修改转账订单
This commit is contained in:
parent
5396dde520
commit
1c6517ee20
@ -346,7 +346,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
$financeDao->order = $order;
|
||||
$financeDao->user = $groupOrder->user;
|
||||
$financialType = $presell ? 'order_presell' : 'order';
|
||||
// 公共收入流水账单数据
|
||||
// 平台收入流水账单数据
|
||||
$financeDao->platformIn($order->total_price, $financialType);
|
||||
if ($order->consumption_money > 0) {
|
||||
// 平台支出优惠金额
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace app\common\repositories\store\order;
|
||||
|
||||
use app\common\dao\store\order\StoreOrderOtherDao;
|
||||
use app\common\dao\system\financial\FinancialDao;
|
||||
use app\common\model\store\order\StoreGroupOrderOther;
|
||||
use app\common\model\store\order\StoreOrderInterestOther;
|
||||
use app\common\model\store\order\StoreOrderOther;
|
||||
@ -171,6 +172,7 @@ class StoreOtherOrderRepository extends BaseRepository
|
||||
//订单记录
|
||||
$storeOrderStatusRepository = app()->make(StoreOrderStatusOtherRepository::class);
|
||||
$svipDiscount = 0;
|
||||
$financeDao = new FinancialDao();
|
||||
foreach ($groupOrder->orderList as $_k => $order) {
|
||||
if($groupOrder->order_extend){
|
||||
if($order->order_extend){
|
||||
@ -205,21 +207,18 @@ class StoreOtherOrderRepository extends BaseRepository
|
||||
'user_type' => $storeOrderStatusRepository::U_TYPE_USER,
|
||||
];
|
||||
|
||||
// 商户流水账单数据
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'user_info' => $groupOrder->user->nickname,
|
||||
'user_id' => $uid,
|
||||
'financial_type' => $presell ? 'order_presell' : 'order',
|
||||
'financial_pm' => 1,
|
||||
'type' => $presell ? 2 : 1,
|
||||
'number' => $order->pay_price,
|
||||
'mer_id' => $order->mer_id,
|
||||
'financial_record_sn' => $financeSn . ($i++)
|
||||
];
|
||||
$financeDao->order = $order;
|
||||
$financeDao->user = $groupOrder->user;
|
||||
$financialType = $presell ? 'order_presell' : 'order';
|
||||
// 平台收入流水账单数据
|
||||
$financeDao->platformIn($order->total_price, $financialType);
|
||||
if ($order->consumption_money > 0) {
|
||||
// 平台支出优惠金额
|
||||
$financeDao->platformOut($order->consumption_money, 'platform_consumption');
|
||||
}
|
||||
|
||||
$_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);
|
||||
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);
|
||||
@ -229,72 +228,39 @@ class StoreOtherOrderRepository extends BaseRepository
|
||||
}
|
||||
}
|
||||
|
||||
$_order_rate = 0;
|
||||
// 平台支出推广费
|
||||
$promoter = $order->merchant->promoter();
|
||||
$promoterCommission = bcmul($orderValidAmount, 0.003, 2);
|
||||
if (!empty($promoter) && $promoterCommission > 0) {
|
||||
$financeDao->platformOut($promoterCommission, 'commission_to_promoter');
|
||||
}
|
||||
|
||||
//平台手续费
|
||||
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.paySuccessOrderOther', compact('order', '_order_rate'));
|
||||
// 平台收入手续费
|
||||
$commission_rate = bcdiv((string)$order['commission_rate'],'100',6);
|
||||
$platformCommission = bcmul($orderValidAmount, (string)$commission_rate, 2);
|
||||
if ($commission_rate > 0 && $platformCommission > 0) {
|
||||
$orderValidAmount = bcsub($orderValidAmount, $platformCommission, 2);
|
||||
if ($promoterCommission > 0 && !empty($promoter)) {
|
||||
$platformCommission = bcsub($platformCommission, $promoterCommission, 2);
|
||||
}
|
||||
$financeDao->platformIn($platformCommission, 'commission_to_platform', $order['mer_id']);
|
||||
}
|
||||
|
||||
if (!$presell) {
|
||||
|
||||
if ($order['commission_rate'] > 0) {
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'user_info' => $groupOrder->user->nickname,
|
||||
'user_id' => $uid,
|
||||
'financial_type' => 'order_charge',
|
||||
'financial_pm' => 0,
|
||||
'type' => 1,
|
||||
'number' => $_order_rate,
|
||||
'mer_id' => $order->mer_id,
|
||||
'financial_record_sn' => $financeSn . ($i++)
|
||||
];
|
||||
}
|
||||
//押金计算
|
||||
if ($_payPrice > 0) {
|
||||
if ($orderValidAmount > 0) {
|
||||
/** @var MerchantRepository $merchantRepo */
|
||||
$merchantRepo = app()->make(MerchantRepository::class);
|
||||
$merchantRepo->merId = $order->mer_id;
|
||||
$merchantRepo->merId = $order['mer_id'];
|
||||
$merchantRepo->forceMargin = false;
|
||||
[$_payPrice, $finance, $increase] = $merchantRepo->autoMargin($_payPrice, $order, $finance, $financeSn, $i++);
|
||||
[$orderValidAmount, $financeDao] = $merchantRepo->deductDeposit($orderValidAmount, $order, $financeDao);
|
||||
}
|
||||
// 商户收入金额
|
||||
$financeDao->platformOut($orderValidAmount, 'merchant_order', $order['mer_id']);
|
||||
if (!$is_combine) {
|
||||
app()->make(MerchantRepository::class)->addLockMoney($order->mer_id, 'order', $order->order_id, $orderValidAmount);
|
||||
}
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'user_info' => $groupOrder->user->nickname,
|
||||
'user_id' => $uid,
|
||||
'financial_type' => 'order_true',
|
||||
'financial_pm' => 0,
|
||||
'type' => 2,
|
||||
'number' => $_payPrice,
|
||||
'mer_id' => $order->mer_id,
|
||||
'financial_record_sn' => $financeSn . ($i++)
|
||||
];
|
||||
|
||||
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);
|
||||
// }
|
||||
|
Loading…
x
Reference in New Issue
Block a user