创建订单

This commit is contained in:
liu 2024-06-08 18:13:58 +08:00
parent 98c464048f
commit 2f3e571112

View File

@ -78,6 +78,7 @@ class OrderLogic extends BaseLogic
$cart_select[$k]['cost'] = bcmul($v['cart_num'], $productBase['cost'], 2) ?? 0; $cart_select[$k]['cost'] = bcmul($v['cart_num'], $productBase['cost'], 2) ?? 0;
$cart_select[$k]['total'] = bcmul($v['cart_num'], $find['price'], 2);//钱 $cart_select[$k]['total'] = bcmul($v['cart_num'], $find['price'], 2);//钱
$cart_select[$k]['price'] = $find['price']; $cart_select[$k]['price'] = $find['price'];
$cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2);//钱
$cart_select[$k]['product_id'] = $v['goods']; $cart_select[$k]['product_id'] = $v['goods'];
$cart_select[$k]['old_cart_id'] = $v['id']; $cart_select[$k]['old_cart_id'] = $v['id'];
$cart_select[$k]['cart_num'] = $v['cart_num']; $cart_select[$k]['cart_num'] = $v['cart_num'];
@ -111,7 +112,7 @@ class OrderLogic extends BaseLogic
$discountRate = bcdiv($discountRate, '10', 2); $discountRate = bcdiv($discountRate, '10', 2);
$pay_price = bcdiv(bcmul($pay_price, $discountRate, 4), '1', 2); $pay_price = bcdiv(bcmul($pay_price, $discountRate, 4), '1', 2);
} else { } else {
$userVip = User::where('id', \request()->userId)->value('user_ship'); /* $userVip = User::where('id', \request()->userId)->value('user_ship');
if ($userVip) { if ($userVip) {
switch ($userVip) { switch ($userVip) {
case UserShipEnum::VIP1: case UserShipEnum::VIP1:
@ -134,7 +135,7 @@ class OrderLogic extends BaseLogic
} }
$discountRate = bcdiv($discountRate, '100', 2); $discountRate = bcdiv($discountRate, '100', 2);
$pay_price = bcdiv(bcmul($pay_price, $discountRate, 4), '1', 2); $pay_price = bcdiv(bcmul($pay_price, $discountRate, 4), '1', 2);
} }*/
} }
if (!empty(self::$total) && !empty($pay_price)) { if (!empty(self::$total) && !empty($pay_price)) {
bcscale(2); bcscale(2);
@ -152,7 +153,7 @@ class OrderLogic extends BaseLogic
'vip_price' => $vipPrice, 'vip_price' => $vipPrice,
'total_num' => count($cart_select),//总数 'total_num' => count($cart_select),//总数
'pay_type' => $params['pay_type'] ?? 0, 'pay_type' => $params['pay_type'] ?? 0,
'reservation_time' => $params['reservation_time'] ?? '', 'reservation_time' => $params['reservation_time'] ?? null,
'cart_id' => implode(',', $cartId), 'cart_id' => implode(',', $cartId),
'store_id' => $params['store_id'] ?? 0, 'store_id' => $params['store_id'] ?? 0,
'shipping_type' => $params['shipping_type'] ?? 1//配送方式 1=快递 2=门店自提 'shipping_type' => $params['shipping_type'] ?? 1//配送方式 1=快递 2=门店自提
@ -189,7 +190,7 @@ class OrderLogic extends BaseLogic
$_order['pay_type'] = $orderInfo['order']['pay_type']; $_order['pay_type'] = $orderInfo['order']['pay_type'];
$_order['verify_code'] = $verify_code; $_order['verify_code'] = $verify_code;
$_order['reservation_time'] = null; $_order['reservation_time'] = null;
if (isset($params['reservation_time'])) { if (isset($params['reservation_time']) && $params['reservation_time']) {
$_order['reservation_time'] = $params['reservation_time']; $_order['reservation_time'] = $params['reservation_time'];
$_order['reservation'] = YesNoEnum::YES; $_order['reservation'] = YesNoEnum::YES;
} }