diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 31a6a40fd..7372c242d 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -99,6 +99,7 @@ class OrderLogic extends BaseLogic $cart_select[$k]['price'] = $price; $cart_select[$k]['cost'] = $find['cost']; $cart_select[$k]['vip'] = 0; + $cart_select[$k]['unit_name'] = StoreProductUnit::where(['id' => $find['unit']])->value('name')??''; //单位名称 //利润 // $cart_select[$k]['profit'] = bcmul($v['cart_num'], $onePrice, 2); //利润 @@ -114,9 +115,17 @@ class OrderLogic extends BaseLogic $cart_select[$k]['old_cart_id'] = $v['id']; $cart_select[$k]['cart_num'] = $v['cart_num']; $cart_select[$k]['verify_code'] = $params['verify_code'] ?? ''; - //vip1待返回金额 - $cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'], $cart_select[$k]['vip_price'], 2); - + $cart_select[$k]['vip_frozen_price']=0; + //会员待返回金额 + if ($user && $off_activity==0){ + if($user['user_ship']==4){ + //商户 + $cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'], $cart_select[$k]['purchase'], 2); + }else{ + //其他会员 + $cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'],$cart_select[$k]['vip_price'], 2); + } + } // d($cart_select[$k]['pay_price'],$cart_select[$k]['store_price'],$cart_select[$k]['vip_price'] ); $cartInfo = $cart_select[$k]; $cartInfo['name'] = $find['store_name']; @@ -136,17 +145,12 @@ class OrderLogic extends BaseLogic // self::$profit = bcadd(self::$profit, $cart_select[$k]['profit'], 2); } //加支付方式限制 - $pay_type = isset($params['pay_type']) ? $params['pay_type'] : 0; - if ($user && $user['user_ship'] == 1 && $pay_type != 17) { - $pay_price = self::$pay_price; - } else { + // $pay_type = isset($params['pay_type']) ? $params['pay_type'] : 0; + // if ($user && $user['user_ship'] == 1 && $pay_type != 17) { + // $pay_price = self::$pay_price; + // } else { $pay_price = bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额 - } - - // if($pay_price < 500){ - // throw new Exception('金额低于500'); - // } - + // } //成本价 收益 $order = [ 'create_time' => time(), diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index dec69583f..36d359a7e 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -744,11 +744,8 @@ class PayNotifyLogic extends BaseLogic return false; } - //纯在分销关系的时候要去判断分销出来的用户的采购款的额度 (只有会员按照这个逻辑拆分,其余的还是按照正常的支付金额) - if ($user_ship== 1 && $order['pay_type'] != PayEnum::CASH_PAY) { - $vipFrozenAmount = self::dealFrozenPrice($order['id']); - //为1的时候要去减活动价 - $order['pay_price'] = bcsub($order['pay_price'], $vipFrozenAmount, 2); + //如果是会员需要返回会员金额 + if ($user_ship>0 && $order['pay_type'] != PayEnum::CASH_PAY) { self::dealVipAmount($order, $order['pay_type']); } if ($order['spread_uid'] > 0 || $user_ship > 0) {