更新支付

This commit is contained in:
mkm 2024-01-06 09:37:36 +08:00
parent 9870729a88
commit d347c5b78f
2 changed files with 107 additions and 91 deletions

View File

@ -225,7 +225,6 @@ class StoreOrderCreateRepository extends StoreOrderRepository
}
$svip_discount = 0;
$realPrice = $this->cartByPrice($cart);
$procure = $this->cartByPrice($cart,1);
if (in_array($source, [9, 10, 11, 12, 13])) {
if ($realPrice == 0) {
throw new ValidateException('价格必须大于0');
@ -235,8 +234,6 @@ class StoreOrderCreateRepository extends StoreOrderRepository
$cart['productAttr']['stock'] = $cart['cart_num'];
}
$price = bcmul($cart['cart_num'], $realPrice, 2);
$procure_price = bcmul($cart['cart_num'], $procure, 2);
$cart['procure_price'] = $procure_price;
$cart['total_price'] = $price;
$cart['postage_price'] = 0;
$cart['svip_discount'] = 0;
@ -419,6 +416,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
$cart['coupon_price'] = bcsub($_cartTotalPrice, $cartTotalPrice, 2);
$cart['true_price'] = $cartTotalPrice;
}
$procure = $this->cartByPrice($cart, 1);
$procure_price = bcmul($cart['cart_num'], $procure, 2);
unset($cart, $_k);
$total_true_price = bcadd($_pay_price, $total_true_price, 2);
if (count($merchantCartList) > 1 || count($merchantCart['list']) > 1) {
@ -444,6 +443,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
'delivery_status' => $deliveryStatus,
'svip_discount' => $total_svip_discount,
'use_svip' => $use_svip,
'procure_price' => $procure_price
];
$order_total_postage = bcadd($order_total_postage, $postage_price, 2);
$order_svip_discount = bcadd($total_svip_discount, $order_svip_discount, 2);
@ -546,6 +546,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
$merchantCart['order']['org_price'] = $org_price;
$merchantCart['order']['pay_price'] = $pay_price;
$merchantCart['order']['coupon_price'] = $coupon_price;
$merchantCart['order']['postage_price'] = $merchantCart['order']['postage_price'];
$merchantCart['order']['procure_price'] = $merchantCart['order']['procure_price'];
$order_price = bcadd($order_price, $pay_price, 2);
$order_total_price = bcadd($order_total_price, $total_price, 2);
@ -802,7 +804,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
'mark' => $mark[$merchantCart['mer_id']] ?? '',
'coupon_price' => bcadd($merchantCart['order']['coupon_price'], $merchantCart['order']['platform_coupon_price'], 2),
'platform_coupon_price' => $merchantCart['order']['platform_coupon_price'],
'pay_type' => $pay_type
'pay_type' => $pay_type,
'procure_price' => $merchantCart['order']['procure_price'],
];
$allUseCoupon = array_merge($allUseCoupon, $merchantCart['order']['useCouponIds']);
$orderList[] = $_order;

View File

@ -311,16 +311,12 @@ class StoreOrderRepository extends BaseRepository
'financial_record_sn' => $financeSn . ($i++)
];
$_payPrice = 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($order->source==103){
$_payPrice = $order->procure_price;
//计算手续费
$_order_rate=bcsub($order->pay_price,$_payPrice,2);
}else{
$_payPrice = $order->pay_price;
$_order_rate = 0;
//平台手续费
@ -332,8 +328,21 @@ class StoreOrderRepository extends BaseRepository
$_payPrice = bcsub($_payPrice, $_order_rate, 2);
// 结算各镇 小组佣金
event('order.paySuccessOrder', compact('order', '_order_rate'));
// 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) {
@ -371,21 +380,21 @@ class StoreOrderRepository extends BaseRepository
'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 ($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);
}
@ -576,7 +585,11 @@ class StoreOrderRepository extends BaseRepository
return $cart['productAttr']['price'];
}
} else {
if($type==0){
return $cart['productAttr']['price'];
}else{
return $cart['productAttr']['procure_price'];
}
}
}