mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-30 14:31:04 +00:00
增加使用实际金额返佣的开关
This commit is contained in:
parent
76ecfb5aa7
commit
239d143a71
@ -488,10 +488,8 @@ class StoreOrderCreateServices extends BaseServices
|
||||
$cart['coupon_price'] = 0.00;
|
||||
}
|
||||
try {
|
||||
[$cartInfo, $spread_ids] = $this->computeOrderProductBrokerage($uid, $cartInfo, $orderInfo);
|
||||
$cartInfo = $this->computeOrderProductCoupon($cartInfo, $priceData);
|
||||
$cartInfo = $this->computeOrderProductIntegral($cartInfo, $priceData);
|
||||
// $cartInfo = $this->computeOrderProductPostage($cartInfo, $priceData, $addressId);
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('订单商品结算失败,File:' . $e->getFile() . ',Line:' . $e->getLine() . ',Message:' . $e->getMessage());
|
||||
throw new ApiException(410248);
|
||||
@ -513,6 +511,12 @@ class StoreOrderCreateServices extends BaseServices
|
||||
$cart['truePrice'] = $cart['truePrice'] > $uni_integral_price ? bcsub((string)$cart['truePrice'], $uni_integral_price, 2) : 0;
|
||||
}
|
||||
}
|
||||
try {
|
||||
[$cartInfo, $spread_ids] = $this->computeOrderProductBrokerage($uid, $cartInfo, $orderInfo);
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('订单商品结算失败,File:' . $e->getFile() . ',Line:' . $e->getLine() . ',Message:' . $e->getMessage());
|
||||
throw new ApiException(410248);
|
||||
}
|
||||
return [$cartInfo, $spread_ids];
|
||||
}
|
||||
|
||||
@ -794,12 +798,19 @@ class StoreOrderCreateServices extends BaseServices
|
||||
$productInfo = $cart['productInfo'];
|
||||
|
||||
//计算商品金额
|
||||
if (isset($productInfo['attrInfo'])) {
|
||||
$price = bcmul((string)($productInfo['attrInfo']['price'] ?? '0'), $cartNum, 4);
|
||||
if (sys_config('user_brokerage_type') == 1) {
|
||||
//按照实际支付价格返佣
|
||||
$price = bcmul((string)$cart['truePrice'], $cartNum, 4);
|
||||
} else {
|
||||
$price = bcmul((string)($productInfo['price'] ?? '0'), $cartNum, 4);
|
||||
//按照商品价格返佣
|
||||
if (isset($productInfo['attrInfo'])) {
|
||||
$price = bcmul((string)($productInfo['attrInfo']['price'] ?? '0'), $cartNum, 4);
|
||||
} else {
|
||||
$price = bcmul((string)($productInfo['price'] ?? '0'), $cartNum, 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$staffBrokerage = bcmul((string)$price, (string)bcdiv($staffPercent, 100, 4), 2);
|
||||
$agentBrokerage = bcmul((string)$price, (string)bcdiv($agentPercent, 100, 4), 2);
|
||||
$divisionBrokerage = bcmul((string)$price, (string)bcdiv($divisionPercent, 100, 4), 2);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user