6
0
Fork 0
release
vine_liutk 2022-03-03 16:56:24 +08:00
parent ac018ea132
commit 372158ed76
2 changed files with 16 additions and 7 deletions

View File

@ -5,6 +5,7 @@ namespace App\Admin\Renderable;
use App\Models\SalesValueLog; use App\Models\SalesValueLog;
use Dcat\Admin\Grid; use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable; use Dcat\Admin\Grid\LazyRenderable;
use Illuminate\Support\Facades\Request;
class UserSalesValueLogSimpleTable extends LazyRenderable class UserSalesValueLogSimpleTable extends LazyRenderable
{ {
@ -14,6 +15,12 @@ class UserSalesValueLogSimpleTable extends LazyRenderable
$builder = SalesValueLog::query(); $builder = SalesValueLog::query();
return Grid::make($builder, function (Grid $grid) use ($userId) { return Grid::make($builder, function (Grid $grid) use ($userId) {
$grid->model()->where('user_id', $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([ $grid->column('type')->using([
1=>'个人', 1=>'个人',
2=>'团队', 2=>'团队',
@ -46,10 +53,8 @@ class UserSalesValueLogSimpleTable extends LazyRenderable
return "<div style='padding: 10px;'>个人消费值:".$salesValue1.' <br> 团队消费值:'.$salesValue2.'</div>'; return "<div style='padding: 10px;'>个人消费值:".$salesValue1.' <br> 团队消费值:'.$salesValue2.'</div>';
}); });
$grid->filter(function (Grid\Filter $filter) { $grid->filter(function (Grid\Filter $filter) {
$filter->between('created_at', '时间')->date()->default([ $filter->expand(false);
'start'=>now()->subDays(30)->toDateString(), $filter->between('created_at', '时间')->date();
'end'=>now()->toDateString(),
]);
}); });
}); });
} }

View File

@ -38,6 +38,10 @@ class AfterSaleService
throw new BizException('赠品不能发起退款/退款退货操作'); 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); $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])) { if ($amount == 0 && in_array($params['type'], [AfterSale::TYPE_REFUND])) {
@ -275,7 +279,7 @@ class AfterSaleService
* @param string $remarks * @param string $remarks
* @return void * @return void
*/ */
public function shippingFail(AfterSale $afterSale, $remarks ='仓库验收未通过') public function shippingFail(AfterSale $afterSale, $remarks = '仓库验收未通过')
{ {
if ($this->isWaitShipping($afterSale)) { if ($this->isWaitShipping($afterSale)) {
$afterSale->update([ $afterSale->update([
@ -324,7 +328,7 @@ class AfterSaleService
* @param string $remarks * @param string $remarks
* @return void * @return void
*/ */
public function shipping(AfterSale $afterSale, $remarks ='仓库验收通过') public function shipping(AfterSale $afterSale, $remarks = '仓库验收通过')
{ {
if ($this->isWaitShipping($afterSale)) { if ($this->isWaitShipping($afterSale)) {
$afterSale->update([ $afterSale->update([
@ -346,7 +350,7 @@ class AfterSaleService
* *
* @return void * @return void
*/ */
public function finance(AfterSale $afterSale, $remarks ='退款成功') public function finance(AfterSale $afterSale, $remarks = '退款成功')
{ {
if ($this->isWaitFinance($afterSale)) { if ($this->isWaitFinance($afterSale)) {
$order = $afterSale->order; $order = $afterSale->order;