调整红包使用逻辑
This commit is contained in:
parent
fe05e30fda
commit
16e3f3c565
@ -595,34 +595,6 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$pay_price =2; ;
|
||||
$this->balance = 0;
|
||||
$consumption_coupon_id=100;
|
||||
} else {
|
||||
if ($consumption_id > 0) {
|
||||
if ($this->store_consumption_user) {
|
||||
if ($this->store_consumption_user['type'] == 2 && $pay_price >= 6 && $this->payType != 'balance') {
|
||||
$a = bcdiv($pay_price, 6);
|
||||
if ($this->balance > $a) {
|
||||
$pay_price = bcsub($pay_price, $a, 2);
|
||||
$this->consumption_money = bcadd($this->consumption_money, $a, 2);
|
||||
$this->balance = bcsub($this->balance, $a, 2);
|
||||
} else {
|
||||
$pay_price = bcsub($pay_price, $this->balance, 2);
|
||||
$this->consumption_money = bcadd($this->consumption_money, $this->balance, 2);
|
||||
$this->balance = 0;
|
||||
}
|
||||
}
|
||||
if ($this->store_consumption_user['type'] == 1) {
|
||||
if ($pay_price > $this->balance) {
|
||||
$pay_price = bcsub($pay_price, $this->balance, 2);
|
||||
$this->consumption_money = bcadd($this->consumption_money, $this->balance, 2);
|
||||
$this->balance = 0;
|
||||
} else {
|
||||
$this->consumption_money = $pay_price;
|
||||
$this->balance = bcsub($this->balance, $pay_price, 2);
|
||||
$pay_price = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -642,7 +614,6 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$merchantCart['order']['postage_price'] = $merchantCart['order']['postage_price'];
|
||||
$merchantCart['order']['procure_price'] = $merchantCart['order']['procure_price'];
|
||||
$merchantCart['order']['consumption_id'] = $consumption_id;
|
||||
$merchantCart['order']['consumption_money'] = $this->consumption_money;
|
||||
|
||||
$order_price = bcadd($order_price, $pay_price, 2);
|
||||
$order_total_price = bcadd($order_total_price, $total_price, 2);
|
||||
@ -653,11 +624,33 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$allow_no_address = false;
|
||||
}
|
||||
|
||||
foreach ($merchantCartList as &$merchantCart) {
|
||||
$consumptionTotal = 0;
|
||||
if ($consumption_id > 0 && $this->store_consumption_user && $source == 103) {
|
||||
if ($this->store_consumption_user['type'] == 2 && $order_total_price >= 6 && $this->payType != 'balance') {
|
||||
$consumptionTotal = bcdiv($order_total_price, 6, 2);
|
||||
}
|
||||
if ($this->store_consumption_user['type'] == 1) {
|
||||
$consumptionTotal = min($order_total_price, $this->balance);
|
||||
}
|
||||
$consumptionTotal = min($consumptionTotal, $this->balance);
|
||||
}
|
||||
foreach ($merchantCartList as $k => &$merchantCart) {
|
||||
$isLast = count($merchantCartList) == $k + 1;
|
||||
$merchantPrice = 0;
|
||||
foreach ($merchantCart['list'] as &$cart) {
|
||||
$cart['total_price'] = bcadd($cart['total_price'], $cart['svip_discount'], 2);
|
||||
if ($consumptionTotal) {
|
||||
$rate = bcdiv($cart['total_price'], $order_total_price, 6);
|
||||
$useAmount = $isLast ? bcsub($consumptionTotal, $this->consumption_money, 2) : bcmul($consumptionTotal, $rate, 2);
|
||||
$merchantProductPrice = bcsub($cart['total_price'], $useAmount, 2);
|
||||
$merchantPrice = bcadd($merchantPrice, $merchantProductPrice, 2);
|
||||
$this->consumption_money = bcadd($this->consumption_money, $useAmount, 2);
|
||||
$this->balance = bcsub($this->balance, $useAmount, 2);
|
||||
}
|
||||
}
|
||||
unset($cart);
|
||||
$merchantCart['order']['consumption_money'] = $useAmount ?? '0.00';
|
||||
$merchantCart['order']['real_price'] = $merchantPrice;
|
||||
$merchantCart['order']['total_price'] = bcadd($merchantCart['order']['total_price'], $merchantCart['order']['svip_discount'], 2);
|
||||
$order_total_price = bcadd($order_total_price, $merchantCart['order']['svip_discount'], 2);
|
||||
}
|
||||
@ -665,6 +658,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$status = ($address || $order_model || $allow_no_address) ? ($noDeliver ? 'noDeliver' : 'finish') : 'noAddress';
|
||||
$order = $merchantCartList;
|
||||
$consumption_money = $this->consumption_money;
|
||||
$order_total_price = bcsub($order_total_price, $this->consumption_money, 2);
|
||||
$total_price = $order_total_price;
|
||||
$openIntegral = $merIntegralFlag && !$order_type && $sysIntegralConfig['integral_status'] && $sysIntegralConfig['integral_money'] > 0;
|
||||
$total_coupon = bcadd($order_svip_discount, bcadd(bcadd($total_platform_coupon_price, $order_coupon_price, 2), $order_total_integral_price, 2), 2);
|
||||
|
@ -110,7 +110,10 @@ class StoreActivity extends BaseController
|
||||
*/
|
||||
public function product(StoreActivityDao $dao)
|
||||
{
|
||||
$userId = $this->request->uid();
|
||||
$userId = 0;
|
||||
if ($this->request->isLogin()) {
|
||||
$userId = $this->request->uid();
|
||||
}
|
||||
$location = $this->request->get('location');
|
||||
$streetCode = $this->request->get('street_code');
|
||||
$activityId = $this->request->get('activity_id', 2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user