From 51a44f81051048d430ab2033549432d20d4d961a Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sun, 23 Jun 2024 19:37:34 +0800 Subject: [PATCH] =?UTF-8?q?feat(store=5Forder):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=94=AF=E4=BB=98=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E4=BC=9A=E5=91=98=E4=BB=B7=E5=92=8C?= =?UTF-8?q?=E5=95=86=E6=88=B7=E4=BB=B7=E6=A0=BC=E8=AE=A1=E7=AE=97=E9=94=99?= =?UTF-8?q?=E8=AF=AF=EF=BC=8C=E5=B9=B6=E4=BC=98=E5=8C=96=E4=BA=86=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E4=BB=A3=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/store/StoreController.php | 2 +- app/api/lists/order/CartList.php | 24 ++++++++--------- app/api/lists/product/ProductLists.php | 2 +- app/api/logic/order/OrderLogic.php | 28 ++++++++++---------- app/common/logic/PayNotifyLogic.php | 6 ++++- 5 files changed, 33 insertions(+), 29 deletions(-) diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index 9d23fd0f..6a2b2705 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -80,7 +80,7 @@ class StoreController extends BaseApiController 'uid'=>$find['id'], 'staff_id'=>0, 'order_id'=>getNewOrderId('CZ'), - 'price'=>0.01, + 'price'=>1000, 'recharge_type'=>'INDUSTRYMEMBERS', ]; $order = UserRecharge::create($data); diff --git a/app/api/lists/order/CartList.php b/app/api/lists/order/CartList.php index 652c9eed..c10cff8d 100644 --- a/app/api/lists/order/CartList.php +++ b/app/api/lists/order/CartList.php @@ -65,22 +65,22 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists foreach ($list as $key => &$item) { $find = StoreBranchProduct::where(['product_id' => $item['product_id'],'store_id' => $item['store_id']]) - ->field('product_id,image,price,cost,store_name,unit,delete_time,vip_price') + ->field('product_id,image,cost price,cost,store_name,unit,delete_time,vip_price') ->withTrashed() ->find(); if ($find) { - if ($user && $user['user_ship'] == 1) { - //更新 会员为1的时候原价减去会员价 - $deduction_price_count=bcmul(bcsub($find['price'], $find['vip_price'], 2),$item['cart_num'],2); - $this->activity_price = bcadd($this->activity_price, $deduction_price_count, 2); - }elseif ($user && $user['user_ship'] == 4) { - //更新 为4商户的时候减去商户价格 - $deduction_price_count=bcmul(bcsub($find['price'], $find['cost'], 2),$item['cart_num'],2); - $this->activity_price = bcadd( $this->activity_price, $deduction_price_count, 2); - }else{ - $this->activity_price =0; - } + // if ($user && $user['user_ship'] == 1) { + // //更新 会员为1的时候原价减去会员价 + // $deduction_price_count=bcmul(bcsub($find['price'], $find['vip_price'], 2),$item['cart_num'],2); + // $this->activity_price = bcadd($this->activity_price, $deduction_price_count, 2); + // }elseif ($user && $user['user_ship'] == 4) { + // //更新 为4商户的时候减去商户价格 + // $deduction_price_count=bcmul(bcsub($find['price'], $find['cost'], 2),$item['cart_num'],2); + // $this->activity_price = bcadd( $this->activity_price, $deduction_price_count, 2); + // }else{ + // $this->activity_price =0; + // } $item['goods_total_price'] = bcmul($item['cart_num'], $find['price'], 2); $this->total_price = bcadd($this->total_price, $item['goods_total_price'], 2); $item['imgs'] = $find['image']; diff --git a/app/api/lists/product/ProductLists.php b/app/api/lists/product/ProductLists.php index f8e21993..1adf1ba6 100644 --- a/app/api/lists/product/ProductLists.php +++ b/app/api/lists/product/ProductLists.php @@ -106,7 +106,7 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L $this->searchWhere[] = ['status', '=', 1]; $this->searchWhere[] = ['stock', '>', 0]; return StoreBranchProduct::where($this->searchWhere) - ->field(['id', 'product_id', 'cate_id', 'store_name', 'cost', 'store_id','vip_price','purchase', 'price', 'bar_code', 'image', 'sales', 'store_info', 'delete_time', 'unit', 'batch']) + ->field(['id', 'product_id', 'cate_id', 'store_name', 'cost', 'store_id','vip_price','purchase', 'cost price', 'bar_code', 'image', 'sales', 'store_info', 'delete_time', 'unit', 'batch']) ->with(['className', 'unitName']) ->limit($this->limitOffset, $this->limitLength) ->order($this->sortOrder) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index f918c51d..5385eed1 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -74,7 +74,7 @@ class OrderLogic extends BaseLogic /** 计算价格 */ foreach ($cart_select as $k => $v) { - $find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field('id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase,product_id')->withTrashed()->find(); + $find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field('id branch_product_id,store_name,image,unit,cost price,vip_price,cost,purchase,product_id')->withTrashed()->find(); if (!$find) { continue; } @@ -85,19 +85,19 @@ class OrderLogic extends BaseLogic $cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价 $cart_select[$k]['deduction_price'] =self::$activity_price;//抵扣金额 $cart_select[$k]['vip'] = 0; - if ($user && $user['user_ship'] == 1) { - //更新 会员为1的时候原价减去会员价 - $deduction_price_count=bcmul(bcsub($find['price'], $find['vip_price'], 2),$v['cart_num'],2); - $cart_select[$k]['deduction_price'] =$deduction_price_count; - self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); - $cart_select[$k]['vip'] =1; - } - if ($user && $user['user_ship'] == 4) { - //更新 为4商户的时候减去商户价格 - $deduction_price_count=bcmul(bcsub($find['price'], $find['cost'], 2),$v['cart_num'],2); - $cart_select[$k]['deduction_price'] =$deduction_price_count; - self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); - } + // if ($user && $user['user_ship'] == 1) { + // //更新 会员为1的时候原价减去会员价 + // $deduction_price_count=bcmul(bcsub($find['price'], $find['vip_price'], 2),$v['cart_num'],2); + // $cart_select[$k]['deduction_price'] =$deduction_price_count; + // self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); + // $cart_select[$k]['vip'] =1; + // } + // if ($user && $user['user_ship'] == 4) { + // //更新 为4商户的时候减去商户价格 + // $deduction_price_count=bcmul(bcsub($find['price'], $find['cost'], 2),$v['cart_num'],2); + // $cart_select[$k]['deduction_price'] =$deduction_price_count; + // self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); + // } //利润 // $cart_select[$k]['profit'] = bcmul($v['cart_num'], $onePrice, 2); //利润 diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index bfd362fd..b2c1ea59 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -389,7 +389,11 @@ class PayNotifyLogic extends BaseLogic public static function afterPay($order, $transaction_id = 0) { $financeLogic = new StoreFinanceFlowLogic(); - $user_sing = new UserSign(); + // $user_sing = new UserSign(); + $financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::USER_ORDER_PAY, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //用户订单支付 + $financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); + $financeLogic->out($transaction_id,$order['pay_price'], OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); + return false; $vipFen = 0; if ($order['uid'] > 0) { // 结算金额 要支付的钱减去冻结得钱去走后面得逻辑 发得兑换券也要去减去