From 704287d550a4ed878201f458d90faa27c8517bf5 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Wed, 13 Apr 2022 11:45:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=A0=8D=E4=BB=B7=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/BargainOrderController.php | 19 +++---------------- app/Admin/Services/OrderService.php | 3 +++ app/Services/BargainService.php | 4 +++- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/app/Admin/Controllers/BargainOrderController.php b/app/Admin/Controllers/BargainOrderController.php index 373cb282..e78b311f 100644 --- a/app/Admin/Controllers/BargainOrderController.php +++ b/app/Admin/Controllers/BargainOrderController.php @@ -83,28 +83,15 @@ class BargainOrderController extends AdminController */ protected function detail($id) { - // return Show::make($id, new BargainOrder(), function (Show $show) { - // $show->field('id'); - // $show->field('activity_id'); - // $show->field('user_id'); - // $show->field('sku_id'); - // $show->field('sku_price'); - // $show->field('bargain_price'); - // $show->field('status'); - // $show->field('expire_at'); - // $show->field('order_id'); - // $show->field('remark'); - // $show->field('created_at'); - // $show->field('updated_at'); - // }); - return function (Row $row) use ($id) { $order = BargainOrderModel::with(['activity', 'user', 'userInfo', 'mallOrder', 'sku'])->find($id); $row->column(6, function ($column) use ($order) { $column->row(Show::make($order, function (Show $show) { $show->row(function (Show\Row $show) { $show->field('id')->width(10, 1); - $show->width(6)->field('activity.name'); + $show->width(6)->field('user.phone'); + $show->field('user_info.nickname', '昵称'); + $show->field('activity.name'); $show->field('sku.name'); $show->field('sku_price')->as(function ($v) { return bcdiv($v, 100, 2); diff --git a/app/Admin/Services/OrderService.php b/app/Admin/Services/OrderService.php index 966b2a88..fd2b78b1 100644 --- a/app/Admin/Services/OrderService.php +++ b/app/Admin/Services/OrderService.php @@ -26,6 +26,9 @@ class OrderService if ($res === 0) { throw new BizException('订单已发生改变'); } + + //更新订单商品优惠金额-todo + OrderLog::create([ 'order_id'=>$order->id, 'content'=> '调整订单支付价格为:¥'.bcdiv($reduceAmount, 100, 2), diff --git a/app/Services/BargainService.php b/app/Services/BargainService.php index ec62fc6d..48ad9eea 100644 --- a/app/Services/BargainService.php +++ b/app/Services/BargainService.php @@ -96,7 +96,9 @@ class BargainService $order->logs()->save($log); $order->bargain_price += $log->bargain_amount; - if ($activity->times > 0 && $activity->times <= ($nowBargainCount ++)) { + $nowBargainCount ++; + + if ($activity->times > 0 && $nowBargainCount >= $activity->times) { $order->status = BargainOrder::ORDER_STATUS_FINISHED; } $order->save();