diff --git a/app/Admin/Renderable/UserSalesValueLogSimpleTable.php b/app/Admin/Renderable/UserSalesValueLogSimpleTable.php index 5d44c41e..b4450197 100644 --- a/app/Admin/Renderable/UserSalesValueLogSimpleTable.php +++ b/app/Admin/Renderable/UserSalesValueLogSimpleTable.php @@ -5,6 +5,7 @@ namespace App\Admin\Renderable; use App\Models\SalesValueLog; use Dcat\Admin\Grid; use Dcat\Admin\Grid\LazyRenderable; +use Illuminate\Support\Facades\Request; class UserSalesValueLogSimpleTable extends LazyRenderable { @@ -14,6 +15,12 @@ class UserSalesValueLogSimpleTable extends LazyRenderable $builder = SalesValueLog::query(); return Grid::make($builder, function (Grid $grid) use ($userId) { $grid->model()->where('user_id', $userId); + // $start = now()->subDays(30)->toDateString(); + // $end = now()->toDateString(); + // $timeZone = Request::get('app-admin-renderable-usersalesvaluelogsimpletable_created_at', []); + // if (empty($timeZone)) { + // $grid->model()->whereBetween('created_at', [$start, $end]); + // } $grid->column('type')->using([ 1=>'个人', 2=>'团队', @@ -46,10 +53,8 @@ class UserSalesValueLogSimpleTable extends LazyRenderable return "
个人消费值:".$salesValue1.'
团队消费值:'.$salesValue2.'
'; }); $grid->filter(function (Grid\Filter $filter) { - $filter->between('created_at', '时间')->date()->default([ - 'start'=>now()->subDays(30)->toDateString(), - 'end'=>now()->toDateString(), - ]); + $filter->expand(false); + $filter->between('created_at', '时间')->date(); }); }); } diff --git a/app/Services/AfterSaleService.php b/app/Services/AfterSaleService.php index f3eca310..d8058d96 100644 --- a/app/Services/AfterSaleService.php +++ b/app/Services/AfterSaleService.php @@ -38,6 +38,10 @@ class AfterSaleService throw new BizException('赠品不能发起退款/退款退货操作'); } + if ($orderProduct->order->total_amount == 0 && in_array($params['type'], [AfterSale::TYPE_REFUND, Aftersale::TYPE_REFUND_AND_RETURN])) { + throw new BizException('订单支付金额为0的商品不能发起退款/退款退货操作'); + } + $amount = ($num == $orderProduct->quantity) ? $orderProduct->total_amount : bcmul(bcdiv($orderProduct->total_amount, $orderProduct->quantity), $num); if ($amount == 0 && in_array($params['type'], [AfterSale::TYPE_REFUND])) { @@ -275,7 +279,7 @@ class AfterSaleService * @param string $remarks * @return void */ - public function shippingFail(AfterSale $afterSale, $remarks ='仓库验收未通过') + public function shippingFail(AfterSale $afterSale, $remarks = '仓库验收未通过') { if ($this->isWaitShipping($afterSale)) { $afterSale->update([ @@ -324,7 +328,7 @@ class AfterSaleService * @param string $remarks * @return void */ - public function shipping(AfterSale $afterSale, $remarks ='仓库验收通过') + public function shipping(AfterSale $afterSale, $remarks = '仓库验收通过') { if ($this->isWaitShipping($afterSale)) { $afterSale->update([ @@ -346,7 +350,7 @@ class AfterSaleService * * @return void */ - public function finance(AfterSale $afterSale, $remarks ='退款成功') + public function finance(AfterSale $afterSale, $remarks = '退款成功') { if ($this->isWaitFinance($afterSale)) { $order = $afterSale->order;