添加商品管理修改
parent
d0b5730c62
commit
a6b0bb31f6
|
|
@ -14,39 +14,15 @@ class ArticleList extends RowAction
|
|||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected $title = 'Title';
|
||||
protected $title = '<i class="feather icon-list grid-action-icon"></i>';
|
||||
|
||||
public function title()
|
||||
{
|
||||
if ($this->title) {
|
||||
return $this->title;
|
||||
return $this->title.' '.__('admin.list');
|
||||
}
|
||||
|
||||
return '<i class="feather icon-list grid-action-icon"></i> '.__('admin.list').' ';
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the action request.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function handle(Request $request)
|
||||
{
|
||||
// dump($this->getKey());
|
||||
|
||||
return $this->response()
|
||||
// ->success('Processed successfully: '.$this->getKey())
|
||||
->redirect(admin_route('articles.index', ['category' =>$this->getKey()]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|array|void
|
||||
*/
|
||||
public function confirm()
|
||||
{
|
||||
// return ['Confirm?', 'contents'];
|
||||
return __('admin.list');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -60,10 +36,16 @@ class ArticleList extends RowAction
|
|||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* Handle the action request.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
protected function parameters()
|
||||
public function handle(Request $request)
|
||||
{
|
||||
return [];
|
||||
return $this->response()
|
||||
// ->success('Processed successfully: '.$this->getKey())
|
||||
->redirect(admin_route('articles.index', ['category' =>$this->getKey()]));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,6 @@ namespace App\Admin\Actions\Grid;
|
|||
use App\Models\ProductSku;
|
||||
use Dcat\Admin\Actions\Response;
|
||||
use Dcat\Admin\Grid\RowAction;
|
||||
use Dcat\Admin\Traits\HasPermissions;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Throwable;
|
||||
|
|
@ -17,7 +14,26 @@ class ReleaseCancel extends RowAction
|
|||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected $title = '取消上架申请';
|
||||
protected $title = '<i class="feather icon-corner-up-left grid-action-icon"></i>';
|
||||
|
||||
public function title()
|
||||
{
|
||||
if ($this->title) {
|
||||
return $this->title.' '.__('admin_message.actions.grid.release_cancel');
|
||||
}
|
||||
|
||||
return __('admin_message.actions.grid.release_cancel');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model|Authenticatable|HasPermissions|null $user
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorize($user): bool
|
||||
{
|
||||
return $user->can('dcat.admin.product_skus.release_cancel');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the action request.
|
||||
|
|
@ -47,22 +63,4 @@ class ReleaseCancel extends RowAction
|
|||
{
|
||||
return ['确认当前商品取消上架申请?'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model|Authenticatable|HasPermissions|null $user
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorize($user): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function parameters()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,6 @@ namespace App\Admin\Actions\Grid;
|
|||
use App\Models\ProductSku;
|
||||
use Dcat\Admin\Actions\Response;
|
||||
use Dcat\Admin\Grid\RowAction;
|
||||
use Dcat\Admin\Traits\HasPermissions;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Throwable;
|
||||
|
|
@ -17,7 +14,26 @@ class ReleaseDown extends RowAction
|
|||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected $title = '下架商品';
|
||||
protected $title = '<i class="feather icon-arrow-down grid-action-icon"></i>';
|
||||
|
||||
public function title()
|
||||
{
|
||||
if ($this->title) {
|
||||
return $this->title.' '.__('admin_message.actions.grid.release_down');
|
||||
}
|
||||
|
||||
return __('admin_message.actions.grid.release_down');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model|Authenticatable|HasPermissions|null $user
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorize($user): bool
|
||||
{
|
||||
return $user->can('dcat.admin.product_skus.release_down');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the action request.
|
||||
|
|
@ -47,22 +63,4 @@ class ReleaseDown extends RowAction
|
|||
{
|
||||
return ['确认当前商品下架?'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model|Authenticatable|HasPermissions|null $user
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorize($user): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function parameters()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,6 @@ namespace App\Admin\Actions\Grid;
|
|||
use App\Models\ProductSku;
|
||||
use Dcat\Admin\Actions\Response;
|
||||
use Dcat\Admin\Grid\RowAction;
|
||||
use Dcat\Admin\Traits\HasPermissions;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Throwable;
|
||||
|
|
@ -17,7 +14,26 @@ class ReleaseUp extends RowAction
|
|||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected $title = '上架申请';
|
||||
protected $title = '<i class="feather icon-arrow-up grid-action-icon"></i>';
|
||||
|
||||
public function title()
|
||||
{
|
||||
if ($this->title) {
|
||||
return $this->title.' '.__('admin_message.actions.grid.release_up');
|
||||
}
|
||||
|
||||
return __('admin_message.actions.grid.release_up');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model|Authenticatable|HasPermissions|null $user
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorize($user): bool
|
||||
{
|
||||
return $user->can('dcat.admin.product_skus.release_up');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the action request.
|
||||
|
|
@ -47,22 +63,4 @@ class ReleaseUp extends RowAction
|
|||
{
|
||||
return ['确认当前商品提交上架申请?'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model|Authenticatable|HasPermissions|null $user
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorize($user): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function parameters()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,6 @@ namespace App\Admin\Actions\Grid;
|
|||
|
||||
use Dcat\Admin\Actions\Response;
|
||||
use Dcat\Admin\Grid\RowAction;
|
||||
use Dcat\Admin\Traits\HasPermissions;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SkuList extends RowAction
|
||||
|
|
@ -14,15 +11,25 @@ class SkuList extends RowAction
|
|||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected $title = 'Title';
|
||||
protected $title = '<i class="feather icon-list grid-action-icon"></i>';
|
||||
|
||||
public function title()
|
||||
{
|
||||
if ($this->title) {
|
||||
return $this->title;
|
||||
return $this->title.' '.__('admin.list');
|
||||
}
|
||||
|
||||
return '<i class="feather icon-list grid-action-icon"></i> '.__('admin.list').' ';
|
||||
return __('admin.list');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model|Authenticatable|HasPermissions|null $user
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorize($user): bool
|
||||
{
|
||||
return $user->can('dcat.admin.product_skus.index');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -40,30 +47,4 @@ class SkuList extends RowAction
|
|||
// ->success('Processed successfully: '.$this->getKey())
|
||||
->redirect(admin_route('product_spus.list', ['spu' =>$this->getKey()]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|array|void
|
||||
*/
|
||||
public function confirm()
|
||||
{
|
||||
// return ['Confirm?', 'contents'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model|Authenticatable|HasPermissions|null $user
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorize($user): bool
|
||||
{
|
||||
return $user->can('dcat.admin.product_skus.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function parameters()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,6 @@ namespace App\Admin\Actions\Grid;
|
|||
use App\Models\ProductSku;
|
||||
use Dcat\Admin\Actions\Response;
|
||||
use Dcat\Admin\Grid\RowAction;
|
||||
use Dcat\Admin\Traits\HasPermissions;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Throwable;
|
||||
|
|
@ -17,7 +14,26 @@ class SkuSyncSpu extends RowAction
|
|||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected $title = '同步主商品';
|
||||
protected $title = '<i class="feather icon-rotate-cw grid-action-icon"></i>';
|
||||
|
||||
public function title()
|
||||
{
|
||||
if ($this->title) {
|
||||
return $this->title.' '.__('admin_message.actions.grid.sku_sync_spu');
|
||||
}
|
||||
|
||||
return __('admin_message.actions.grid.sku_sync_spu');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model|Authenticatable|HasPermissions|null $user
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorize($user): bool
|
||||
{
|
||||
return $user->can('dcat.admin.product_skus.sku_sync_spu');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the action request.
|
||||
|
|
@ -47,22 +63,4 @@ class SkuSyncSpu extends RowAction
|
|||
{
|
||||
return ['确认当前商品同步主商品信息?'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model|Authenticatable|HasPermissions|null $user
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorize($user): bool
|
||||
{
|
||||
return $user->can('dcat.admin.product_skus.sku_sync_spu');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function parameters()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,26 +4,22 @@ namespace App\Admin\Actions\Grid;
|
|||
|
||||
use App\Admin\Forms\SkuVerify as SkuVerifyForm;
|
||||
use Dcat\Admin\Grid\RowAction;
|
||||
use Dcat\Admin\Traits\HasPermissions;
|
||||
use Dcat\Admin\Widgets\Modal;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SkuVerify extends RowAction
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected $title = '审核商品';
|
||||
protected $title = '<i class="feather icon-shuffle grid-action-icon"></i>';
|
||||
|
||||
public function render()
|
||||
public function title()
|
||||
{
|
||||
$form = SkuVerifyForm::make()->payload(['id'=>$this->getKey()]);
|
||||
return Modal::make()
|
||||
->lg()
|
||||
->title($this->title)
|
||||
->body($form)
|
||||
->button($this->title);
|
||||
if ($this->title) {
|
||||
return $this->title.' '.__('admin_message.actions.grid.sku_verify');
|
||||
}
|
||||
|
||||
return __('admin_message.actions.grid.sku_verify');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -35,4 +31,14 @@ class SkuVerify extends RowAction
|
|||
{
|
||||
return $user->can('dcat.admin.product_sku_verifies.verify');
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$form = SkuVerifyForm::make()->payload(['id'=>$this->getKey()]);
|
||||
return Modal::make()
|
||||
->lg()
|
||||
->title($this->title)
|
||||
->body($form)
|
||||
->button($this->title);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class ArticleCategoryController extends AdminController
|
|||
$grid->actions(function (Grid\Displayers\Actions $actions) {
|
||||
$actions->disableDelete(Admin::user()->cannot('dcat.admin.article_categories.destroy'));
|
||||
if (Admin::user()->can('dcat.admin.articles.index')) {
|
||||
$actions->prepend(new ArticleList(__('admin.list')));
|
||||
$actions->prepend(new ArticleList());
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -79,15 +79,15 @@ class ProductSkuController extends AdminController
|
|||
if (Admin::user()->can('dcat.admin.product_skus.release_up')) {
|
||||
$actions->append(new ReleaseUp());
|
||||
}
|
||||
if (Admin::user()->can('dcat.admin.product_skus.sku_sync_spu')) {
|
||||
$actions->append(new SkuSyncSpu());
|
||||
}
|
||||
}
|
||||
if ($actions->row->verify_state == 1) {
|
||||
if (Admin::user()->can('dcat.admin.product_skus.release_cancel')) {
|
||||
$actions->append(new ReleaseCancel());
|
||||
}
|
||||
}
|
||||
if (Admin::user()->can('dcat.admin.product_skus.sku_sync_spu')) {
|
||||
$actions->append(new SkuSyncSpu());
|
||||
}
|
||||
}
|
||||
if ($actions->row->release_at) {//已上架
|
||||
if (Admin::user()->can('dcat.admin.product_skus.release_down')) {
|
||||
|
|
@ -177,6 +177,12 @@ class ProductSkuController extends AdminController
|
|||
$form->divider();
|
||||
$form->select('attr_group')->options(ProductGroup::all()->pluck('name', 'id'));
|
||||
$form->selectAttr('attrs')->listen('attr_group');
|
||||
$form->hidden('verify_state');
|
||||
$form->saving(function (Form $form) {
|
||||
$form->verify_state = 0;
|
||||
});
|
||||
|
||||
|
||||
|
||||
$form->ignore(['attr_group']);
|
||||
$form->display('created_at');
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ class ProductSpuController extends AdminController
|
|||
$actions->disableEdit(Admin::user()->cannot('dcat.admin.product_spus.edit'));
|
||||
$actions->disableDelete(Admin::user()->cannot('dcat.admin.product_spus.destroy'));
|
||||
if (Admin::user()->can('dcat.admin.product_spus.list')) {
|
||||
$actions->prepend(new SkuList(__('admin.list')));
|
||||
$actions->prepend(new SkuList());
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -253,15 +253,15 @@ class ProductSpuController extends AdminController
|
|||
if (Admin::user()->can('dcat.admin.product_skus.release_up')) {
|
||||
$actions->append(new ReleaseUp());
|
||||
}
|
||||
if (Admin::user()->can('dcat.admin.product_skus.sku_sync_spu')) {
|
||||
$actions->append(new SkuSyncSpu());
|
||||
}
|
||||
}
|
||||
if ($actions->row->verify_state == 1) {
|
||||
if (Admin::user()->can('dcat.admin.product_skus.release_cancel')) {
|
||||
$actions->append(new ReleaseCancel());
|
||||
}
|
||||
}
|
||||
if (Admin::user()->can('dcat.admin.product_skus.sku_sync_spu')) {
|
||||
$actions->append(new SkuSyncSpu());
|
||||
}
|
||||
}
|
||||
if ($actions->row->release_at) {//已上架
|
||||
if (Admin::user()->can('dcat.admin.product_skus.release_down')) {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,19 @@ use Throwable;
|
|||
|
||||
class BatchReleaseCancel extends BatchAction
|
||||
{
|
||||
protected $title = '取消上架审核';
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected $title = '<i class="feather icon-corner-up-left grid-action-icon"></i>';
|
||||
|
||||
public function title()
|
||||
{
|
||||
if ($this->title) {
|
||||
return $this->title.' '.__('admin_message.extensions.grid.batch.release_cancel');
|
||||
}
|
||||
|
||||
return __('admin_message.extensions.grid.batch.release_cancel');
|
||||
}
|
||||
|
||||
protected function authorize($user): bool
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,19 @@ use Throwable;
|
|||
|
||||
class BatchReleaseDown extends BatchAction
|
||||
{
|
||||
protected $title = '下架操作';
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected $title = '<i class="feather icon-arrow-down grid-action-icon"></i>';
|
||||
|
||||
public function title()
|
||||
{
|
||||
if ($this->title) {
|
||||
return $this->title.' '.__('admin_message.extensions.grid.batch.release_down');
|
||||
}
|
||||
|
||||
return __('admin_message.extensions.grid.batch.release_down');
|
||||
}
|
||||
|
||||
protected function authorize($user): bool
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,19 @@ use Throwable;
|
|||
|
||||
class BatchReleaseUp extends BatchAction
|
||||
{
|
||||
protected $title = '上架审核';
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected $title = '<i class="feather icon-arrow-up grid-action-icon"></i>';
|
||||
|
||||
public function title()
|
||||
{
|
||||
if ($this->title) {
|
||||
return $this->title.' '.__('admin_message.extensions.grid.batch.release_up');
|
||||
}
|
||||
|
||||
return __('admin_message.extensions.grid.batch.release_up');
|
||||
}
|
||||
|
||||
protected function authorize($user): bool
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,19 @@ use Throwable;
|
|||
|
||||
class BatchSkuSyncSpu extends BatchAction
|
||||
{
|
||||
protected $title = '同步主商品';
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected $title = '<i class="feather icon-rotate-cw grid-action-icon"></i>';
|
||||
|
||||
public function title()
|
||||
{
|
||||
if ($this->title) {
|
||||
return $this->title.' '.__('admin_message.extensions.grid.batch.sku_sync_spu');
|
||||
}
|
||||
|
||||
return __('admin_message.extensions.grid.batch.sku_sync_spu');
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否有权限判断.
|
||||
|
|
|
|||
|
|
@ -8,7 +8,19 @@ use Dcat\Admin\Widgets\Modal;
|
|||
|
||||
class BatchSkuVerify extends BatchAction
|
||||
{
|
||||
protected $title = '批量审核';
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected $title = '<i class="feather icon-shuffle grid-action-icon"></i>';
|
||||
|
||||
public function title()
|
||||
{
|
||||
if ($this->title) {
|
||||
return $this->title.' '.__('admin_message.extensions.grid.batch.sku_verify');
|
||||
}
|
||||
|
||||
return __('admin_message.extensions.grid.batch.sku_verify');
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否有权限判断.
|
||||
|
|
|
|||
|
|
@ -31,6 +31,13 @@ return [
|
|||
'init_sku_by_specs'=>'初始化SKU',
|
||||
'add_sku'=>'添加SKU',
|
||||
],
|
||||
'batch'=>[
|
||||
'release_up'=>'批量上架申请',
|
||||
'release_down'=>'批量商品下架',
|
||||
'release_cancel'=>'批量取消申请',
|
||||
'sku_sync_spu'=>'批量同步主商品',
|
||||
'sku_verify'=>'批量审核',
|
||||
],
|
||||
'init_sku_by_specs'=>[
|
||||
'confirm'=>[
|
||||
'title'=>'初始化SKU',
|
||||
|
|
@ -55,4 +62,13 @@ return [
|
|||
],
|
||||
],
|
||||
],
|
||||
'actions'=>[
|
||||
'grid' =>[
|
||||
'release_cancel'=>'取消上架申请',
|
||||
'release_down'=>'商品下架',
|
||||
'release_up'=>'申请上架',
|
||||
'sku_sync_spu'=>'同步主商品',
|
||||
'sku_verify'=>'商品审核',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue