diff --git a/app/Admin/Actions/Grid/ArticleList.php b/app/Admin/Actions/Grid/ArticleList.php index dca2c26e..ba32f9e4 100644 --- a/app/Admin/Actions/Grid/ArticleList.php +++ b/app/Admin/Actions/Grid/ArticleList.php @@ -56,7 +56,7 @@ class ArticleList extends RowAction */ protected function authorize($user): bool { - return true; + return $user->can('dcat.admin.articles.index'); } /** diff --git a/app/Admin/Actions/Grid/ReleaseCancel.php b/app/Admin/Actions/Grid/ReleaseCancel.php new file mode 100644 index 00000000..5e4897a4 --- /dev/null +++ b/app/Admin/Actions/Grid/ReleaseCancel.php @@ -0,0 +1,68 @@ +getKey()]); + DB::commit(); + } catch (Throwable $th) { + DB::rollBack(); + return $this->response()->error('操作失败,'.$th->getMessage())->refresh(); + } + + return $this->response()->success('操作成功')->refresh(); + } + + /** + * @return string|array|void + */ + public function confirm() + { + return ['确认当前商品取消上架申请?']; + } + + /** + * @param Model|Authenticatable|HasPermissions|null $user + * + * @return bool + */ + protected function authorize($user): bool + { + return true; + } + + /** + * @return array + */ + protected function parameters() + { + return []; + } +} diff --git a/app/Admin/Actions/Grid/ReleaseDown.php b/app/Admin/Actions/Grid/ReleaseDown.php new file mode 100644 index 00000000..36d51152 --- /dev/null +++ b/app/Admin/Actions/Grid/ReleaseDown.php @@ -0,0 +1,68 @@ +getKey()]); + DB::commit(); + } catch (Throwable $th) { + DB::rollBack(); + return $this->response()->error('操作失败,'.$th->getMessage())->refresh(); + } + + return $this->response()->success('操作成功')->refresh(); + } + + /** + * @return string|array|void + */ + public function confirm() + { + return ['确认当前商品下架?']; + } + + /** + * @param Model|Authenticatable|HasPermissions|null $user + * + * @return bool + */ + protected function authorize($user): bool + { + return true; + } + + /** + * @return array + */ + protected function parameters() + { + return []; + } +} diff --git a/app/Admin/Actions/Grid/ReleaseUp.php b/app/Admin/Actions/Grid/ReleaseUp.php new file mode 100644 index 00000000..941cfe85 --- /dev/null +++ b/app/Admin/Actions/Grid/ReleaseUp.php @@ -0,0 +1,68 @@ +getKey()]); + DB::commit(); + } catch (Throwable $th) { + DB::rollBack(); + return $this->response()->error('操作失败,'.$th->getMessage())->refresh(); + } + + return $this->response()->success('申请成功')->refresh(); + } + + /** + * @return string|array|void + */ + public function confirm() + { + return ['确认当前商品提交上架申请?']; + } + + /** + * @param Model|Authenticatable|HasPermissions|null $user + * + * @return bool + */ + protected function authorize($user): bool + { + return true; + } + + /** + * @return array + */ + protected function parameters() + { + return []; + } +} diff --git a/app/Admin/Actions/Grid/SkuList.php b/app/Admin/Actions/Grid/SkuList.php index 3c908e82..e2ba8a2f 100644 --- a/app/Admin/Actions/Grid/SkuList.php +++ b/app/Admin/Actions/Grid/SkuList.php @@ -56,7 +56,7 @@ class SkuList extends RowAction */ protected function authorize($user): bool { - return true; + return $user->can('dcat.admin.product_skus.index'); } /** diff --git a/app/Admin/Actions/Grid/SkuSyncSpu.php b/app/Admin/Actions/Grid/SkuSyncSpu.php new file mode 100644 index 00000000..f54cc722 --- /dev/null +++ b/app/Admin/Actions/Grid/SkuSyncSpu.php @@ -0,0 +1,68 @@ +getKey()); + DB::commit(); + } catch (Throwable $th) { + DB::rollBack(); + return $this->response()->error('操作失败,'.$th->getMessage())->refresh(); + } + + return $this->response()->success('同步成功')->refresh(); + } + + /** + * @return string|array|void + */ + public function confirm() + { + 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 []; + } +} diff --git a/app/Admin/Actions/Grid/SkuVerify.php b/app/Admin/Actions/Grid/SkuVerify.php new file mode 100644 index 00000000..0bd620a6 --- /dev/null +++ b/app/Admin/Actions/Grid/SkuVerify.php @@ -0,0 +1,38 @@ +payload(['id'=>$this->getKey()]); + return Modal::make() + ->lg() + ->title($this->title) + ->body($form) + ->button($this->title); + } + + /** + * @param Model|Authenticatable|HasPermissions|null $user + * + * @return bool + */ + protected function authorize($user): bool + { + return $user->can('dcat.admin.product_sku_verifies.verify'); + } +} diff --git a/app/Admin/Controllers/ProductCategoryController.php b/app/Admin/Controllers/ProductCategoryController.php index 6fb47e0b..035739e9 100644 --- a/app/Admin/Controllers/ProductCategoryController.php +++ b/app/Admin/Controllers/ProductCategoryController.php @@ -131,7 +131,7 @@ class ProductCategoryController extends AdminController return parent::destroy($id); } - public function list(Request $request) + public function categories(Request $request) { $parent_id = (int) $request->input('q'); $query = ProductCategoryModel::select('id', 'name as text'); diff --git a/app/Admin/Controllers/ProductSkuController.php b/app/Admin/Controllers/ProductSkuController.php index 5baa4781..9bcd67b9 100644 --- a/app/Admin/Controllers/ProductSkuController.php +++ b/app/Admin/Controllers/ProductSkuController.php @@ -2,11 +2,24 @@ namespace App\Admin\Controllers; +use App\Admin\Actions\Grid\ReleaseCancel; +use App\Admin\Actions\Grid\ReleaseDown; +use App\Admin\Actions\Grid\ReleaseUp; +use App\Admin\Actions\Grid\SkuSyncSpu; +use App\Admin\Extensions\Grid\Tools\Product\BatchReleaseCancel; +use App\Admin\Extensions\Grid\Tools\Product\BatchReleaseDown; +use App\Admin\Extensions\Grid\Tools\Product\BatchReleaseUp; use App\Admin\Repositories\ProductSku; +use App\Models\ProductBuynote; +use App\Models\ProductGroup; +use App\Models\ProductSku as ProductSkuModel; +use Carbon\Carbon; +use Dcat\Admin\Admin; use Dcat\Admin\Form; use Dcat\Admin\Grid; use Dcat\Admin\Http\Controllers\AdminController; use Dcat\Admin\Show; +use Illuminate\Http\Request; class ProductSkuController extends AdminController { @@ -17,31 +30,74 @@ class ProductSkuController extends AdminController */ protected function grid() { - return Grid::make(new ProductSku(), function (Grid $grid) { + $builder = ProductSku::with('category'); + return Grid::make($builder, function (Grid $grid) { + $grid->showRowSelector(); + $grid->batchActions(function ($batch) { + //批量下架 + if (Admin::user()->can('dcat.admin.product_skus.batch_release_down')) { + $batch->add(new BatchReleaseDown()); + } + //批量上架 + if (Admin::user()->can('dcat.admin.product_skus.batch_release_up')) { + $batch->add(new BatchReleaseUp()); + } + //批量取消审核 + if (Admin::user()->can('dcat.admin.product_skus.batch_release_cancel')) { + $batch->add(new BatchReleaseCancel()); + } + }); $grid->column('id')->sortable(); - $grid->column('spu_id'); + // $grid->column('spu_id'); $grid->column('name'); $grid->column('subtitle'); - $grid->column('category_id'); - $grid->column('cover'); - $grid->column('images'); - $grid->column('description'); - $grid->column('sell_price'); - $grid->column('market_price'); - $grid->column('cost_price'); - $grid->column('vip_price'); - $grid->column('media'); + $grid->column('category.name'); + $grid->column('specs')->label(); + $grid->column('sell_price')->prepend('¥'); + $grid->column('market_price')->prepend('¥'); + $grid->column('cost_price')->prepend('¥'); + $grid->column('vip_price')->prepend('¥'); $grid->column('weight'); - $grid->column('attrs'); - $grid->column('specs'); $grid->column('stock'); $grid->column('sales'); + $grid->column('verify_state') + ->using([0=>'正常', 1=>'审核中', 2=>'审核失败']) + ->dot([ + 0 => 'success', + 1 => 'primary', + 2 => 'danger', + ]); $grid->column('release_at'); - $grid->column('created_at'); - $grid->column('updated_at')->sortable(); + $grid->model()->orderBy('created_at', 'desc'); + $grid->model()->orderBy('release_at', 'desc'); + $grid->actions(function (Grid\Displayers\Actions $actions) { + if (is_null($actions->row->release_at) || $actions->row->verify_state == 1) {//未上架或者审核未通过 + $actions->disableEdit(Admin::user()->cannot('dcat.admin.product_skus.edit')); + $actions->disableDelete(Admin::user()->cannot('dcat.admin.product_skus.destroy')); + if ($actions->row->verify_state == 0) { + if (Admin::user()->can('dcat.admin.product_skus.release_up')) { + $actions->append(new ReleaseUp()); + } + } + if ($actions->row->verify_state == 1) { + if (Admin::user()->can('dcat.admin.product_skus.release_cancel')) { + $actions->append(new ReleaseCancel()); + } + } + } + if ($actions->row->release_at) {//已上架 + if (Admin::user()->can('dcat.admin.product_skus.release_down')) { + $actions->append(new ReleaseDown()); + } + if (Admin::user()->can('dcat.admin.product_skus.sku_sync_spu')) { + $actions->append(new SkuSyncSpu()); + } + } + }); $grid->filter(function (Grid\Filter $filter) { - $filter->equal('id'); + $filter->panel(); + $filter->equal('name')->width(3); }); }); } @@ -89,27 +145,50 @@ class ProductSkuController extends AdminController { return Form::make(new ProductSku(), function (Form $form) { $form->display('id'); - $form->text('spu_id'); - $form->text('name'); + $form->text('name')->required(); $form->text('subtitle'); - $form->text('category_id'); - $form->text('cover'); - $form->text('images'); - $form->text('description'); - $form->text('sell_price'); - $form->text('market_price'); - $form->text('cost_price'); - $form->text('vip_price'); - $form->text('media'); - $form->text('weight'); - $form->text('attrs'); - $form->text('specs'); - $form->text('stock'); - $form->text('sales'); - $form->text('release_at'); + $form->divider(); + $form->image('cover') + ->move('product-skus/cover/'.Carbon::now()->toDateString()) + ->saveFullUrl() + ->removable(false) + ->autoUpload(); + $form->multipleImage('images') + ->move('product-skus/'.Carbon::now()->toDateString()) + ->saveFullUrl() + ->removable(false) + ->autoUpload(); + $form->file('media')->chunked() + ->accept('mp4', 'mp4/*') + ->move('prduct-sku-medias/'.Carbon::now()->toDateString()) + ->saveFullUrl() + ->removable(false) + ->autoUpload(); + $form->editor('description'); + $form->select('buynote_id')->options(ProductBuynote::all()->pluck('name', 'id')); + $form->number('weight'); + $form->number('stock'); + $form->divider(); + $form->currency('sell_price')->symbol('¥')->default(0); + $form->currency('market_price')->symbol('¥')->default(0); + $form->currency('cost_price')->symbol('¥')->default(0); + $form->currency('vip_price')->symbol('¥'); + $form->divider(); + $form->select('attr_group')->options(ProductGroup::all()->pluck('name', 'id')); + $form->selectAttr('attrs')->listen('attr_group'); + $form->ignore(['attr_group']); $form->display('created_at'); $form->display('updated_at'); }); } + + public function skus(Request $request) + { + $name = $request->input('q'); + $query = ProductSkuModel::select('id', 'name as text')->where('name', 'like', "%$name%"); + + $data = $query->get(); + return response()->json($data); + } } diff --git a/app/Admin/Controllers/ProductSkuVerifyController.php b/app/Admin/Controllers/ProductSkuVerifyController.php new file mode 100644 index 00000000..c1345b64 --- /dev/null +++ b/app/Admin/Controllers/ProductSkuVerifyController.php @@ -0,0 +1,116 @@ +showRowSelector(); + $grid->rowSelector()->disable(function ($row) { + return $row->status !== 0; + }); + $grid->batchActions(function ($batch) { + if (Admin::user()->can('dcat.admin.product_sku_verifies.batch_verify')) { + $batch->add(new BatchSkuVerify()); + } + }); + $grid->column('id')->sortable(); + $grid->column('sku.name'); + // $grid->column('type'); + $grid->column('status') + ->using([ + 0=>'未处理', + 1=>'成功', + 2=>'拒绝', + 3=>'已取消', + ]) + ->dot([ + 0 => 'danger', + 1 => 'success', + 2 => 'primary', + ]); + $grid->column('remarks'); + $grid->column('created_at')->sortable(); + $grid->model()->orderBy('status', 'asc'); + $grid->model()->orderBy('created_at', 'desc'); + // $grid->column('updated_at')->sortable(); + // //修改 + // $grid->showQuickEditButton(Admin::user()->can('dcat.admin.product_sku_verifies.edit')); + //删除以及自定义操作 + $grid->actions(function (Grid\Displayers\Actions $actions) { + if ($actions->row->status === 0) { + if (Admin::user()->can('dcat.admin.product_sku_verifies.verify')) { + $actions->append(new SkuVerify()); + } + } else { + $actions->disableDelete(Admin::user()->cannot('dcat.admin.product_sku_verifies.destroy')); + } + }); + + $grid->filter(function (Grid\Filter $filter) { + $filter->panel(); + $filter->equal('sku_id')->select(admin_route('api.product_skus'))->width('3'); + }); + }); + } + + /** + * Make a show builder. + * + * @param mixed $id + * + * @return Show + */ + protected function detail($id) + { + return Show::make($id, new ProductSkuVerify(), function (Show $show) { + $show->field('id'); + $show->field('sku_id'); + $show->field('type'); + $show->field('status'); + $show->field('remarks'); + $show->field('created_at'); + $show->field('updated_at'); + }); + } + + /** + * Make a form builder. + * + * @return Form + */ + protected function form() + { + $builder = ProductSkuVerify::with('sku'); + return Form::make($builder, function (Form $form) { + $form->display('id'); + $form->text('sku.name')->disable(); + // $form->text('type'); + $form->radio('status')->options([ + 1 => '成功', + 2 => '拒绝', + ])->default(1); + $form->text('remarks'); + + $form->display('created_at'); + $form->display('updated_at'); + }); + } +} diff --git a/app/Admin/Controllers/ProductSpuController.php b/app/Admin/Controllers/ProductSpuController.php index c79d478f..19ea33f8 100644 --- a/app/Admin/Controllers/ProductSpuController.php +++ b/app/Admin/Controllers/ProductSpuController.php @@ -2,8 +2,16 @@ namespace App\Admin\Controllers; +use App\Admin\Actions\Grid\ReleaseCancel; +use App\Admin\Actions\Grid\ReleaseDown; +use App\Admin\Actions\Grid\ReleaseUp; use App\Admin\Actions\Grid\SkuList; +use App\Admin\Actions\Grid\SkuSyncSpu; use App\Admin\Extensions\Grid\Tools\Product\AddSku; +use App\Admin\Extensions\Grid\Tools\Product\BatchReleaseCancel; +use App\Admin\Extensions\Grid\Tools\Product\BatchReleaseDown; +use App\Admin\Extensions\Grid\Tools\Product\BatchReleaseUp; +use App\Admin\Extensions\Grid\Tools\Product\BatchSkuSyncSpu; use App\Admin\Extensions\Grid\Tools\Product\InitSkuBySpecs; use App\Admin\Extensions\Grid\Tools\Product\SettingSpecs; use App\Admin\Repositories\ProductSpu; @@ -170,16 +178,40 @@ class ProductSpuController extends AdminController return $content->header(__('product-spu.labels.ProductSpu')) ->description($spu->name) ->body(Grid::make(ProductSku::where('spu_id', $spu->id), function ($grid) use ($spu) { + $grid->showRowSelector(); + $grid->setResource('product-skus'); $grid->id(); - $grid->disableRowSelector(false); $grid->tools(function (Grid\Tools $tools) use ($spu) { //设置规格 - $tools->append(new SettingSpecs($spu->id)); - + if (Admin::user()->can('dcat.admin.product_spus.setting_specs')) { + $tools->append(new SettingSpecs($spu->id)); + } if ($spu->hasSku()) { //下面有sku,手动创建sku - $tools->append(new AddSku($spu->id)); + if (Admin::user()->can('dcat.admin.product_spus.add_sku')) { + $tools->append(new AddSku($spu->id)); + } } else {//下面无sku,根据规格自动生成sku - $tools->append(new InitSkuBySpecs($spu->id)); + if (Admin::user()->can('dcat.admin.product_spus.init_sku_by_specs')) { + $tools->append(new InitSkuBySpecs($spu->id)); + } + } + }); + $grid->batchActions(function ($batch) { + //批量下架 + if (Admin::user()->can('dcat.admin.product_skus.batch_release_down')) { + $batch->add(new BatchReleaseDown()); + } + //批量上架 + if (Admin::user()->can('dcat.admin.product_skus.batch_release_up')) { + $batch->add(new BatchReleaseUp()); + } + //批量取消审核 + if (Admin::user()->can('dcat.admin.product_skus.batch_release_cancel')) { + $batch->add(new BatchReleaseCancel()); + } + //批量同步主商品 + if (Admin::user()->can('dcat.admin.product_skus.batch_sku_sync_spu')) { + $batch->add(new BatchSkuSyncSpu()); } }); $grid->column('name'); @@ -190,6 +222,41 @@ class ProductSpuController extends AdminController $grid->column('cost_price')->prepend('¥'); $grid->column('vip_price')->prepend('¥'); $grid->column('weight'); + $grid->column('stock'); + $grid->column('sales'); + $grid->column('verify_state') + ->using([0=>'正常', 1=>'审核中', 2=>'审核失败']) + ->dot([ + 0 => 'success', + 1 => 'primary', + 2 => 'danger', + ]); + $grid->column('release_at'); + + $grid->actions(function (Grid\Displayers\Actions $actions) { + if (is_null($actions->row->release_at) || $actions->row->verify_state == 1) {//未上架或者审核未通过 + $actions->disableEdit(Admin::user()->cannot('dcat.admin.product_skus.edit')); + $actions->disableDelete(Admin::user()->cannot('dcat.admin.product_skus.destroy')); + if ($actions->row->verify_state == 0) { + if (Admin::user()->can('dcat.admin.product_skus.release_up')) { + $actions->append(new ReleaseUp()); + } + } + if ($actions->row->verify_state == 1) { + if (Admin::user()->can('dcat.admin.product_skus.release_cancel')) { + $actions->append(new ReleaseCancel()); + } + } + } + if ($actions->row->release_at) {//已上架 + if (Admin::user()->can('dcat.admin.product_skus.release_down')) { + $actions->append(new ReleaseDown()); + } + if (Admin::user()->can('dcat.admin.product_skus.sku_sync_spu')) { + $actions->append(new SkuSyncSpu()); + } + } + }); })); } } diff --git a/app/Admin/Extensions/Grid/Tools/Product/AddSku.php b/app/Admin/Extensions/Grid/Tools/Product/AddSku.php index 489f4277..2ab8f363 100644 --- a/app/Admin/Extensions/Grid/Tools/Product/AddSku.php +++ b/app/Admin/Extensions/Grid/Tools/Product/AddSku.php @@ -13,6 +13,12 @@ class AddSku extends AbstractTool parent::__construct($title); $this->setKey($spu_id); } + + protected function authorize($user): bool + { + return $user->can('dcat.admin.product_spus.add_sku'); + } + /** * 按钮样式定义,默认 btn btn-white waves-effect * diff --git a/app/Admin/Extensions/Grid/Tools/Product/BatchReleaseCancel.php b/app/Admin/Extensions/Grid/Tools/Product/BatchReleaseCancel.php new file mode 100644 index 00000000..7f8ab5c0 --- /dev/null +++ b/app/Admin/Extensions/Grid/Tools/Product/BatchReleaseCancel.php @@ -0,0 +1,52 @@ +can('dcat.admin.product_skus.batch_release_cancel'); + } + + // 确认弹窗信息 + public function confirm() + { + return '您确定操作已选中的商品吗?'; + } + + // 处理请求 + public function handle(Request $request) + { + // 获取选中的skuID数组 + $keys = $this->getKey(); + $query = ProductSku::query()->whereIn('id', $keys)->where('verify_state', 1)->whereNull('release_at'); + + $list = $query->get(); + if ($list->count() != count($keys)) { + return $this->response()->error('操作失败,所选商品含有不能操作项')->refresh(); + } + + $message = '操作成功'; + try { + DB::beginTransaction(); + + ProductSku::releaseCancel($keys); + + DB::commit(); + } catch (Throwable $th) { + DB::rollBack(); + return $this->response()->error('操作失败,'.$th->getMessage())->refresh(); + } + + return $this->response()->success($message)->refresh(); + } +} diff --git a/app/Admin/Extensions/Grid/Tools/Product/BatchReleaseDown.php b/app/Admin/Extensions/Grid/Tools/Product/BatchReleaseDown.php new file mode 100644 index 00000000..d72ddafe --- /dev/null +++ b/app/Admin/Extensions/Grid/Tools/Product/BatchReleaseDown.php @@ -0,0 +1,53 @@ +can('dcat.admin.product_skus.batch_release_down'); + } + + // 确认弹窗信息 + public function confirm() + { + return '您确定操作已选中的商品吗?'; + } + + // 处理请求 + public function handle(Request $request) + { + // 获取选中的skuID数组 + $keys = $this->getKey(); + + $query = ProductSku::query()->whereIn('id', $keys)->where('verify_state', 0)->whereNotNull('release_at'); + + $list = $query->get(); + if ($list->count() != count($keys)) { + return $this->response()->error('操作失败,所选商品含有不能操作项')->refresh(); + } + + $message = '下架成功'; + try { + DB::beginTransaction(); + + ProductSku::skuDown($keys); + + DB::commit(); + } catch (Throwable $th) { + DB::rollBack(); + return $this->response()->error('操作失败,'.$th->getMessage())->refresh(); + } + + return $this->response()->success($message)->refresh(); + } +} diff --git a/app/Admin/Extensions/Grid/Tools/Product/BatchReleaseUp.php b/app/Admin/Extensions/Grid/Tools/Product/BatchReleaseUp.php new file mode 100644 index 00000000..7d4dbae1 --- /dev/null +++ b/app/Admin/Extensions/Grid/Tools/Product/BatchReleaseUp.php @@ -0,0 +1,54 @@ +can('dcat.admin.product_skus.batch_release_up'); + } + + // 确认弹窗信息 + public function confirm() + { + return '您确定操作已选中的商品吗?'; + } + + // 处理请求 + public function handle(Request $request) + { + $nowTime = now(); + // 获取选中的skuID数组 + $keys = $this->getKey(); + + $query = ProductSku::query()->whereIn('id', $keys)->where('verify_state', 0)->whereNull('release_at'); + + $list = $query->get(); + if ($list->count() != count($keys)) { + return $this->response()->error('操作失败,所选商品含有不能操作项')->refresh(); + } + + $message = '操作成功'; + try { + DB::beginTransaction(); + + ProductSku::skuUp($keys); + + DB::commit(); + } catch (Throwable $th) { + DB::rollBack(); + return $this->response()->error('操作失败,'.$th->getMessage())->refresh(); + } + + return $this->response()->success($message)->refresh(); + } +} diff --git a/app/Admin/Extensions/Grid/Tools/Product/BatchSkuSyncSpu.php b/app/Admin/Extensions/Grid/Tools/Product/BatchSkuSyncSpu.php new file mode 100644 index 00000000..75eec8ed --- /dev/null +++ b/app/Admin/Extensions/Grid/Tools/Product/BatchSkuSyncSpu.php @@ -0,0 +1,67 @@ +can('dcat.admin.batch.sku_sync_spu'); + } + + // 确认弹窗信息 + public function confirm() + { + return '您确定操作已选中的商品吗?'; + } + + // 处理请求 + public function handle(Request $request) + { + // 获取选中的skuID数组 + $keys = $this->getKey(); + + $query = ProductSku::with('spu')->whereIn('id', $keys)->where(function ($query) { + $query->where('verify_state', 0)->orWhere('verify_state', 2); + })->whereNull('release_at'); + + $list = $query->get(); + if ($list->count() != count($keys)) { + return $this->response()->error('操作失败,所选商品含有不能操作项')->refresh(); + } + try { + DB::beginTransaction(); + foreach ($list as $sku) { + ProductSku::skuSyncSpu($sku); + } + DB::commit(); + } catch (Throwable $th) { + DB::rollBack(); + } + + $message = '操作成功'; + + return $this->response()->success($message)->refresh(); + } + + // 设置请求参数 + public function parameters() + { + return [ + ]; + } +} diff --git a/app/Admin/Extensions/Grid/Tools/Product/BatchSkuVerify.php b/app/Admin/Extensions/Grid/Tools/Product/BatchSkuVerify.php new file mode 100644 index 00000000..0f10f80a --- /dev/null +++ b/app/Admin/Extensions/Grid/Tools/Product/BatchSkuVerify.php @@ -0,0 +1,49 @@ +can('dcat.admin.product_sku_verifies.batch_verify'); + } + + public function render() + { + // 实例化表单类 + $form = SkuVerifyBatch::make(); + + return Modal::make() + ->lg() + ->title($this->title) + ->body($form) + // 因为此处使用了表单异步加载功能,所以一定要用 onLoad 方法 + // 如果是非异步方式加载表单,则需要改成 onShow 方法 + ->onLoad($this->getModalScript()) + ->button($this->title); + } + + protected function getModalScript() + { + // 弹窗显示后往隐藏的id表单中写入批量选中的行ID + return <<getSelectedKeysScript()} + +$('#verify-sku-id').val(key); +JS; + } +} diff --git a/app/Admin/Extensions/Grid/Tools/Product/InitSkuBySpecs.php b/app/Admin/Extensions/Grid/Tools/Product/InitSkuBySpecs.php index 9505f6c6..743c88ab 100644 --- a/app/Admin/Extensions/Grid/Tools/Product/InitSkuBySpecs.php +++ b/app/Admin/Extensions/Grid/Tools/Product/InitSkuBySpecs.php @@ -15,6 +15,12 @@ class InitSkuBySpecs extends AbstractTool parent::__construct($title); $this->setKey($spu_id); } + + protected function authorize($user): bool + { + return $user->can('dcat.admin.product_spus.init_sku_by_specs'); + } + /** * 按钮样式定义,默认 btn btn-white waves-effect * @@ -74,7 +80,7 @@ class InitSkuBySpecs extends AbstractTool } $insertData[] = [ 'spu_id' => $spu->id, - 'name' => $spu->name, + 'name' => trim($spu->name.' '.implode(' ', $_skuSpecs)), 'subtitle' => $spu->subtitle, 'category_id' => $spu->category_id, 'cover' => $spu->cover, diff --git a/app/Admin/Extensions/Grid/Tools/Product/SettingSpecs.php b/app/Admin/Extensions/Grid/Tools/Product/SettingSpecs.php index 6d2fe648..09b2c553 100644 --- a/app/Admin/Extensions/Grid/Tools/Product/SettingSpecs.php +++ b/app/Admin/Extensions/Grid/Tools/Product/SettingSpecs.php @@ -13,6 +13,12 @@ class SettingSpecs extends AbstractTool parent::__construct($title); $this->setKey($spu_id); } + + protected function authorize($user): bool + { + return $user->can('dcat.admin.product_spus.setting_specs'); + } + /** * 按钮样式定义,默认 btn btn-white waves-effect * diff --git a/app/Admin/Forms/AddSku.php b/app/Admin/Forms/AddSku.php index 41cf3d47..2b92564a 100644 --- a/app/Admin/Forms/AddSku.php +++ b/app/Admin/Forms/AddSku.php @@ -46,7 +46,7 @@ class AddSku extends Form implements LazyRenderable $spu = ProductSpu::findOrFail($spuId); ProductSku::create([ 'spu_id' => $spu->id, - 'name' => $spu->name, + 'name' => trim($spu->name.' '.implode(' ', $_skuSpecs)), 'subtitle' => $spu->subtitle, 'category_id' => $spu->category_id, 'cover' => $spu->cover, diff --git a/app/Admin/Forms/SkuVerify.php b/app/Admin/Forms/SkuVerify.php new file mode 100644 index 00000000..3912183a --- /dev/null +++ b/app/Admin/Forms/SkuVerify.php @@ -0,0 +1,58 @@ +response()->error('操作失败:'.$th->getMessage()); + } + + return $this->response() + ->success(__('admin.update_succeeded')) + ->refresh(); + } + + /** + * Build a form here. + */ + public function form() + { + $id = $this->payload['id'] ?? 0; + $verify = ProductSkuVerify::with('sku')->findOrFail($id); + + $this->text('name')->value($verify->sku->name)->disable(); + + $this->radio('status')->options([ + 1 => '成功', + 2 => '拒绝', + ])->default(1); + $this->text('remarks'); + + $this->hidden('sku_id')->value($verify->sku_id); + } +} diff --git a/app/Admin/Forms/SkuVerifyBatch.php b/app/Admin/Forms/SkuVerifyBatch.php new file mode 100644 index 00000000..3c543aa5 --- /dev/null +++ b/app/Admin/Forms/SkuVerifyBatch.php @@ -0,0 +1,56 @@ +pluck('sku_id')->toArray(); + try { + DB::beginTransaction(); + ProductSku::skuVerify($skuIds, (int) $input['status'], $input['remarks']); + DB::commit(); + } catch (Throwable $th) { + DB::rollBack(); + return $this->response()->error('操作失败:'.$th->getMessage()); + } + + return $this->response() + ->success(__('admin.update_succeeded')) + ->refresh(); + } + + /** + * Build a form here. + */ + public function form() + { + $this->radio('status')->options([ + 1 => '成功', + 2 => '拒绝', + ])->default(1); + $this->text('remarks'); + + // 设置隐藏表单,传递用户id + $this->hidden('id')->attribute('id', 'verify-sku-id'); + } +} diff --git a/app/Admin/Repositories/ProductSkuVerify.php b/app/Admin/Repositories/ProductSkuVerify.php new file mode 100644 index 00000000..fb354c4d --- /dev/null +++ b/app/Admin/Repositories/ProductSkuVerify.php @@ -0,0 +1,16 @@ +get('product-spus/{spu}/list', 'ProductSpuController@list')->name('product_spus.list'); $router->resource('product-skus', 'ProductSkuController')->only([ - 'index', + 'index', 'edit', 'update', 'destroy', ])->names('product_skus'); + $router->resource('product-sku-verifies', 'ProductSkuVerifyController')->only([ + 'index', 'edit', 'update', 'destroy', + ])->names('product_sku_verifies'); /** api接口 **/ - $router->get('api/product-categories', 'ProductCategoryController@list')->name('api.product_categories'); + $router->get('api/product-categories', 'ProductCategoryController@categories')->name('api.product_categories'); $router->get('api/product-group-details', 'ProductGroupController@details')->name('api.product_group_details'); + $router->get('api/product-skus', 'ProductSkuController@skus')->name('api.product_skus'); }); diff --git a/app/Models/ProductSku.php b/app/Models/ProductSku.php index d07cf80b..012ba74c 100644 --- a/app/Models/ProductSku.php +++ b/app/Models/ProductSku.php @@ -4,6 +4,7 @@ namespace App\Models; use App\Casts\JsonArray; use App\Casts\Price; +use App\Traits\Release; use Dcat\Admin\Traits\HasDateTimeFormatter; use EloquentFilter\Filterable; use Illuminate\Database\Eloquent\Model; @@ -12,6 +13,7 @@ class ProductSku extends Model { use Filterable; use HasDateTimeFormatter; + use Release; public const STATUS_INVALID = -1; // 无效的 public const STATUS_ONLINE = 1; // 已上架 diff --git a/app/Models/ProductSkuVerify.php b/app/Models/ProductSkuVerify.php new file mode 100644 index 00000000..7ebd5575 --- /dev/null +++ b/app/Models/ProductSkuVerify.php @@ -0,0 +1,18 @@ +belongsTo(ProductSku::class, 'sku_id'); + } +} diff --git a/app/Traits/Release.php b/app/Traits/Release.php new file mode 100644 index 00000000..c39e877f --- /dev/null +++ b/app/Traits/Release.php @@ -0,0 +1,161 @@ +id; + } + $query = ProductSku::query()->whereIn('id', $ids)->where('verify_state', 0)->whereNull('release_at'); + + //执行上架审核动作 + $query->update([ + 'verify_state'=> 1, + ]); + ProductSkuVerify::query()->insert(array_map(function ($key) use ($nowTime) { + return [ + 'sku_id' => $key, + 'created_at' => $nowTime, + 'updated_at' => $nowTime, + ]; + }, $ids)); + } + + /** + * SKU下架操作 + * + * @param array|ProductSku $ids + * @return void + */ + public static function skuDown(array|ProductSku $ids) + { + if ($ids instanceof ProductSku) { + $ids[] = $ids->id; + } + + $query = ProductSku::query()->whereIn('id', $ids)->where('verify_state', 0)->whereNotNull('release_at'); + //执行下架动作 + $query->update([ + 'release_at'=> null, + ]); + } + + /** + * 取消SKU上架申请 + * + * @param array|ProductSku $ids + * @return void + */ + public static function releaseCancel(array|ProductSku $ids) + { + if ($ids instanceof ProductSku) { + $ids[] = $ids->id; + } + $query = ProductSku::query()->whereIn('id', $ids)->where('verify_state', 1)->whereNull('release_at'); + + //执行取消上架申请 + $query->update([ + 'verify_state'=> 0, + ]); + ProductSkuVerify::whereIn('sku_id', $ids)->where('status', 0)->update(['status'=>3]); + } + + /** + * 审核SKU + * + * @param array $ids + * @param integer $status + * @param string $remarks + * @return void + */ + public static function skuVerify(array $ids, int $status, ?string $remarks) + { + //获得审核中商品 + $query = ProductSku::query()->whereIn('id', $ids)->where('verify_state', 1)->whereNull('release_at'); + + switch ($status) { + case 1://成功 + $query->update([ + 'verify_state'=> 0, + 'release_at'=>now(), + ]); + break; + case 2://失败 + $query->update([ + 'verify_state'=> 2, + ]); + break; + default: + break; + } + + ProductSkuVerify::whereIn('sku_id', $ids)->where('status', 0)->update([ + 'status'=>$status, + 'remarks'=>$remarks, + ]); + + return; + } + + /** + * 通过ID同步SPU + * + * @param integer $id + * @return void + */ + public static function skuSyncSpuById(int $id) + { + static::skuSyncSpu(ProductSku::with('spu')->findOrFail($id)); + } + + /** + * 同步spu的基本信息 + * + * @param ProductSku $sku + * @return void + */ + public static function skuSyncSpu(ProductSku $sku) + { + $_price = 0; + foreach ($sku->specs as $id => $value) { + $spuSpec = $sku->spu->specs->first(function ($item) use ($id) { + return $item->id == $id; + }); + foreach ($spuSpec->items as $item) { + if ($item['name'] == $value) { + $_price += $item['value']; + } + } + } + $sku->update( + [ + 'name' => trim($sku->spu->name.' '.implode(',', $sku->specs)), + 'subtitle'=> $sku->spu->subtitle, + 'cover' => $sku->spu->cover, + // 'images' => $sku->spu->images, + 'description' => $sku->spu->description, + 'sell_price' => bcadd($sku->spu->sell_price, $_price), + 'market_price' => $sku->spu->market_price, + 'cost_price' => $sku->spu->cost_price, + 'vip_price' => !is_null($sku->spu->vip_price) ? bcadd($sku->spu->vip_price, $_price) : null, + 'media' => $sku->spu->media, + 'weight' => $sku->spu->weight, + 'attrs' => $sku->spu->attrs, + 'verify_state' => 0, //默认调整为正常 + ] + ); + } +} diff --git a/database/migrations/2021_12_01_153027_create_product_sku_verifies_table.php b/database/migrations/2021_12_01_153027_create_product_sku_verifies_table.php new file mode 100644 index 00000000..665d3b03 --- /dev/null +++ b/database/migrations/2021_12_01_153027_create_product_sku_verifies_table.php @@ -0,0 +1,35 @@ +id(); + $table->unsignedBigInteger('sku_id')->comment('sku_id'); + $table->tinyInteger('type')->unsigned()->default(1)->comment('审核类别:1上架审核,2修改审核'); + $table->tinyInteger('status')->unsigned()->default(0)->comment('结果:0未处理,1通过,2拒绝, 3取消'); + $table->string('remarks')->nullable()->comment('备注'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('product_sku_verifies'); + } +} diff --git a/database/seeders/AdminPermissionSeeder.php b/database/seeders/AdminPermissionSeeder.php index 4f871ebb..7c7ca261 100644 --- a/database/seeders/AdminPermissionSeeder.php +++ b/database/seeders/AdminPermissionSeeder.php @@ -62,6 +62,74 @@ class AdminPermissionSeeder extends Seeder 'name'=>'文章分类', 'curd' => ['index', 'create', 'store', 'edit', 'update', 'destroy'], ], + 'articles'=>[ + 'name'=>'文章', + 'curd' => true, + ], + 'product_categories'=>[ + 'name' =>'商品分类', + 'curd'=>['index', 'create', 'store', 'edit', 'update', 'destroy'], + ], + 'product_groups'=>[ + 'name' =>'商品分组', + 'curd'=>['index', 'create', 'store', 'edit', 'update', 'destroy'], + ], + 'product_features'=>[ + 'name' =>'商品特点', + 'curd' =>['index', 'create', 'store', 'edit', 'update', 'destroy'], + ], + 'product_buynotes'=>[ + 'name' =>'商品购买须知', + 'curd'=>['index', 'create', 'store', 'edit', 'update', 'destroy'], + ], + 'product_spus'=>[ + 'name' =>'主商品', + 'curd'=> true, + 'children'=>[ + 'list'=>[ + 'name'=>'子商品列表', + ], + 'setting_specs'=>[ + 'name'=>'设置规格', + ], + 'init_sku_by_specs'=>[ + 'name' =>'初始化SKU', + ], + 'add_sku'=>[ + 'name' =>'添加子商品', + ], + ], + ], + 'product_skus'=>[ + 'name' =>'子商品', + 'curd' =>['index', 'edit', 'update', 'destroy'], + 'children'=>[ + 'batch_release_up' => [ + 'name'=>'批量上架申请', + ], + 'batch_release_down'=>[ + 'name' =>'批量下架', + ], + 'batch_release_cacel'=>[ + 'name' =>'批量取消申请', + ], + 'batch_sku_sync_spu'=>[ + 'name' =>'批量同步主商品', + ], + ], + ], + 'product_sku_verifies'=>[ + 'name' =>'商品审核', + 'curd'=>['index', 'destroy'], + 'children' => [ + 'verify'=>[ + 'name' =>'审核商品', + ], + 'batch_verify'=>[ + 'name' =>'批量审核', + ], + ], + ], ]; try { DB::begintransaction(); diff --git a/dcat_admin_ide_helper.php b/dcat_admin_ide_helper.php index 0bc4fabd..67c771bb 100644 --- a/dcat_admin_ide_helper.php +++ b/dcat_admin_ide_helper.php @@ -12,183 +12,183 @@ namespace Dcat\Admin { /** * @property Grid\Column|Collection id - * @property Grid\Column|Collection key - * @property Grid\Column|Collection name + * @property Grid\Column|Collection created_at * @property Grid\Column|Collection dimensions * @property Grid\Column|Collection is_show - * @property Grid\Column|Collection created_at + * @property Grid\Column|Collection key + * @property Grid\Column|Collection name * @property Grid\Column|Collection updated_at + * @property Grid\Column|Collection detail * @property Grid\Column|Collection type * @property Grid\Column|Collection version - * @property Grid\Column|Collection detail * @property Grid\Column|Collection is_enabled - * @property Grid\Column|Collection parent_id - * @property Grid\Column|Collection order - * @property Grid\Column|Collection icon - * @property Grid\Column|Collection uri * @property Grid\Column|Collection extension - * @property Grid\Column|Collection permission_id + * @property Grid\Column|Collection icon + * @property Grid\Column|Collection order + * @property Grid\Column|Collection parent_id + * @property Grid\Column|Collection uri * @property Grid\Column|Collection menu_id - * @property Grid\Column|Collection slug + * @property Grid\Column|Collection permission_id * @property Grid\Column|Collection http_method * @property Grid\Column|Collection http_path + * @property Grid\Column|Collection slug * @property Grid\Column|Collection role_id * @property Grid\Column|Collection user_id * @property Grid\Column|Collection value - * @property Grid\Column|Collection username - * @property Grid\Column|Collection password * @property Grid\Column|Collection avatar + * @property Grid\Column|Collection password * @property Grid\Column|Collection remember_token + * @property Grid\Column|Collection username * @property Grid\Column|Collection address_id * @property Grid\Column|Collection image - * @property Grid\Column|Collection sort - * @property Grid\Column|Collection jump_type * @property Grid\Column|Collection jump_link - * @property Grid\Column|Collection is_recommend + * @property Grid\Column|Collection jump_type + * @property Grid\Column|Collection sort * @property Grid\Column|Collection _lft * @property Grid\Column|Collection _rgt - * @property Grid\Column|Collection category_id + * @property Grid\Column|Collection is_recommend * @property Grid\Column|Collection author_name - * @property Grid\Column|Collection subtitle - * @property Grid\Column|Collection cover + * @property Grid\Column|Collection category_id * @property Grid\Column|Collection content - * @property Grid\Column|Collection uuid + * @property Grid\Column|Collection cover + * @property Grid\Column|Collection subtitle * @property Grid\Column|Collection connection - * @property Grid\Column|Collection queue - * @property Grid\Column|Collection payload * @property Grid\Column|Collection exception * @property Grid\Column|Collection failed_at - * @property Grid\Column|Collection tokenable_type - * @property Grid\Column|Collection tokenable_id - * @property Grid\Column|Collection token + * @property Grid\Column|Collection payload + * @property Grid\Column|Collection queue + * @property Grid\Column|Collection uuid * @property Grid\Column|Collection abilities * @property Grid\Column|Collection last_used_at + * @property Grid\Column|Collection token + * @property Grid\Column|Collection tokenable_id + * @property Grid\Column|Collection tokenable_type * @property Grid\Column|Collection remarks * @property Grid\Column|Collection attrs * @property Grid\Column|Collection specs * @property Grid\Column|Collection part_id * @property Grid\Column|Collection sku_id - * @property Grid\Column|Collection spu_id - * @property Grid\Column|Collection images - * @property Grid\Column|Collection sell_price - * @property Grid\Column|Collection market_price - * @property Grid\Column|Collection cost_price - * @property Grid\Column|Collection vip_price - * @property Grid\Column|Collection media - * @property Grid\Column|Collection weight - * @property Grid\Column|Collection stock - * @property Grid\Column|Collection sales - * @property Grid\Column|Collection release_at - * @property Grid\Column|Collection feature_id - * @property Grid\Column|Collection product_spu_id - * @property Grid\Column|Collection items - * @property Grid\Column|Collection is_sell + * @property Grid\Column|Collection status * @property Grid\Column|Collection buynote_id - * @property Grid\Column|Collection phone + * @property Grid\Column|Collection cost_price + * @property Grid\Column|Collection images + * @property Grid\Column|Collection market_price + * @property Grid\Column|Collection media + * @property Grid\Column|Collection release_at + * @property Grid\Column|Collection sales + * @property Grid\Column|Collection sell_price + * @property Grid\Column|Collection spu_id + * @property Grid\Column|Collection stock + * @property Grid\Column|Collection verify_state + * @property Grid\Column|Collection vip_price + * @property Grid\Column|Collection weight + * @property Grid\Column|Collection feature_id + * @property Grid\Column|Collection items + * @property Grid\Column|Collection product_spu_id * @property Grid\Column|Collection code - * @property Grid\Column|Collection is_use * @property Grid\Column|Collection expires_at + * @property Grid\Column|Collection is_use + * @property Grid\Column|Collection phone + * @property Grid\Column|Collection birthday + * @property Grid\Column|Collection gender * @property Grid\Column|Collection inviter_id * @property Grid\Column|Collection nickname - * @property Grid\Column|Collection gender - * @property Grid\Column|Collection birthday - * @property Grid\Column|Collection phone_verified_at * @property Grid\Column|Collection email * @property Grid\Column|Collection email_verified_at - * @property Grid\Column|Collection last_login_ip * @property Grid\Column|Collection last_login_at + * @property Grid\Column|Collection last_login_ip + * @property Grid\Column|Collection phone_verified_at * @property Grid\Column|Collection register_ip - * @property Grid\Column|Collection status * @property Grid\Column|Collection status_remark * * @method Grid\Column|Collection id(string $label = null) - * @method Grid\Column|Collection key(string $label = null) - * @method Grid\Column|Collection name(string $label = null) + * @method Grid\Column|Collection created_at(string $label = null) * @method Grid\Column|Collection dimensions(string $label = null) * @method Grid\Column|Collection is_show(string $label = null) - * @method Grid\Column|Collection created_at(string $label = null) + * @method Grid\Column|Collection key(string $label = null) + * @method Grid\Column|Collection name(string $label = null) * @method Grid\Column|Collection updated_at(string $label = null) + * @method Grid\Column|Collection detail(string $label = null) * @method Grid\Column|Collection type(string $label = null) * @method Grid\Column|Collection version(string $label = null) - * @method Grid\Column|Collection detail(string $label = null) * @method Grid\Column|Collection is_enabled(string $label = null) - * @method Grid\Column|Collection parent_id(string $label = null) - * @method Grid\Column|Collection order(string $label = null) - * @method Grid\Column|Collection icon(string $label = null) - * @method Grid\Column|Collection uri(string $label = null) * @method Grid\Column|Collection extension(string $label = null) - * @method Grid\Column|Collection permission_id(string $label = null) + * @method Grid\Column|Collection icon(string $label = null) + * @method Grid\Column|Collection order(string $label = null) + * @method Grid\Column|Collection parent_id(string $label = null) + * @method Grid\Column|Collection uri(string $label = null) * @method Grid\Column|Collection menu_id(string $label = null) - * @method Grid\Column|Collection slug(string $label = null) + * @method Grid\Column|Collection permission_id(string $label = null) * @method Grid\Column|Collection http_method(string $label = null) * @method Grid\Column|Collection http_path(string $label = null) + * @method Grid\Column|Collection slug(string $label = null) * @method Grid\Column|Collection role_id(string $label = null) * @method Grid\Column|Collection user_id(string $label = null) * @method Grid\Column|Collection value(string $label = null) - * @method Grid\Column|Collection username(string $label = null) - * @method Grid\Column|Collection password(string $label = null) * @method Grid\Column|Collection avatar(string $label = null) + * @method Grid\Column|Collection password(string $label = null) * @method Grid\Column|Collection remember_token(string $label = null) + * @method Grid\Column|Collection username(string $label = null) * @method Grid\Column|Collection address_id(string $label = null) * @method Grid\Column|Collection image(string $label = null) - * @method Grid\Column|Collection sort(string $label = null) - * @method Grid\Column|Collection jump_type(string $label = null) * @method Grid\Column|Collection jump_link(string $label = null) - * @method Grid\Column|Collection is_recommend(string $label = null) + * @method Grid\Column|Collection jump_type(string $label = null) + * @method Grid\Column|Collection sort(string $label = null) * @method Grid\Column|Collection _lft(string $label = null) * @method Grid\Column|Collection _rgt(string $label = null) - * @method Grid\Column|Collection category_id(string $label = null) + * @method Grid\Column|Collection is_recommend(string $label = null) * @method Grid\Column|Collection author_name(string $label = null) - * @method Grid\Column|Collection subtitle(string $label = null) - * @method Grid\Column|Collection cover(string $label = null) + * @method Grid\Column|Collection category_id(string $label = null) * @method Grid\Column|Collection content(string $label = null) - * @method Grid\Column|Collection uuid(string $label = null) + * @method Grid\Column|Collection cover(string $label = null) + * @method Grid\Column|Collection subtitle(string $label = null) * @method Grid\Column|Collection connection(string $label = null) - * @method Grid\Column|Collection queue(string $label = null) - * @method Grid\Column|Collection payload(string $label = null) * @method Grid\Column|Collection exception(string $label = null) * @method Grid\Column|Collection failed_at(string $label = null) - * @method Grid\Column|Collection tokenable_type(string $label = null) - * @method Grid\Column|Collection tokenable_id(string $label = null) - * @method Grid\Column|Collection token(string $label = null) + * @method Grid\Column|Collection payload(string $label = null) + * @method Grid\Column|Collection queue(string $label = null) + * @method Grid\Column|Collection uuid(string $label = null) * @method Grid\Column|Collection abilities(string $label = null) * @method Grid\Column|Collection last_used_at(string $label = null) + * @method Grid\Column|Collection token(string $label = null) + * @method Grid\Column|Collection tokenable_id(string $label = null) + * @method Grid\Column|Collection tokenable_type(string $label = null) * @method Grid\Column|Collection remarks(string $label = null) * @method Grid\Column|Collection attrs(string $label = null) * @method Grid\Column|Collection specs(string $label = null) * @method Grid\Column|Collection part_id(string $label = null) * @method Grid\Column|Collection sku_id(string $label = null) - * @method Grid\Column|Collection spu_id(string $label = null) - * @method Grid\Column|Collection images(string $label = null) - * @method Grid\Column|Collection sell_price(string $label = null) - * @method Grid\Column|Collection market_price(string $label = null) - * @method Grid\Column|Collection cost_price(string $label = null) - * @method Grid\Column|Collection vip_price(string $label = null) - * @method Grid\Column|Collection media(string $label = null) - * @method Grid\Column|Collection weight(string $label = null) - * @method Grid\Column|Collection stock(string $label = null) - * @method Grid\Column|Collection sales(string $label = null) - * @method Grid\Column|Collection release_at(string $label = null) - * @method Grid\Column|Collection feature_id(string $label = null) - * @method Grid\Column|Collection product_spu_id(string $label = null) - * @method Grid\Column|Collection items(string $label = null) - * @method Grid\Column|Collection is_sell(string $label = null) + * @method Grid\Column|Collection status(string $label = null) * @method Grid\Column|Collection buynote_id(string $label = null) - * @method Grid\Column|Collection phone(string $label = null) + * @method Grid\Column|Collection cost_price(string $label = null) + * @method Grid\Column|Collection images(string $label = null) + * @method Grid\Column|Collection market_price(string $label = null) + * @method Grid\Column|Collection media(string $label = null) + * @method Grid\Column|Collection release_at(string $label = null) + * @method Grid\Column|Collection sales(string $label = null) + * @method Grid\Column|Collection sell_price(string $label = null) + * @method Grid\Column|Collection spu_id(string $label = null) + * @method Grid\Column|Collection stock(string $label = null) + * @method Grid\Column|Collection verify_state(string $label = null) + * @method Grid\Column|Collection vip_price(string $label = null) + * @method Grid\Column|Collection weight(string $label = null) + * @method Grid\Column|Collection feature_id(string $label = null) + * @method Grid\Column|Collection items(string $label = null) + * @method Grid\Column|Collection product_spu_id(string $label = null) * @method Grid\Column|Collection code(string $label = null) - * @method Grid\Column|Collection is_use(string $label = null) * @method Grid\Column|Collection expires_at(string $label = null) + * @method Grid\Column|Collection is_use(string $label = null) + * @method Grid\Column|Collection phone(string $label = null) + * @method Grid\Column|Collection birthday(string $label = null) + * @method Grid\Column|Collection gender(string $label = null) * @method Grid\Column|Collection inviter_id(string $label = null) * @method Grid\Column|Collection nickname(string $label = null) - * @method Grid\Column|Collection gender(string $label = null) - * @method Grid\Column|Collection birthday(string $label = null) - * @method Grid\Column|Collection phone_verified_at(string $label = null) * @method Grid\Column|Collection email(string $label = null) * @method Grid\Column|Collection email_verified_at(string $label = null) - * @method Grid\Column|Collection last_login_ip(string $label = null) * @method Grid\Column|Collection last_login_at(string $label = null) + * @method Grid\Column|Collection last_login_ip(string $label = null) + * @method Grid\Column|Collection phone_verified_at(string $label = null) * @method Grid\Column|Collection register_ip(string $label = null) - * @method Grid\Column|Collection status(string $label = null) * @method Grid\Column|Collection status_remark(string $label = null) */ class Grid {} @@ -197,183 +197,183 @@ namespace Dcat\Admin { /** * @property Show\Field|Collection id - * @property Show\Field|Collection key - * @property Show\Field|Collection name + * @property Show\Field|Collection created_at * @property Show\Field|Collection dimensions * @property Show\Field|Collection is_show - * @property Show\Field|Collection created_at + * @property Show\Field|Collection key + * @property Show\Field|Collection name * @property Show\Field|Collection updated_at + * @property Show\Field|Collection detail * @property Show\Field|Collection type * @property Show\Field|Collection version - * @property Show\Field|Collection detail * @property Show\Field|Collection is_enabled - * @property Show\Field|Collection parent_id - * @property Show\Field|Collection order - * @property Show\Field|Collection icon - * @property Show\Field|Collection uri * @property Show\Field|Collection extension - * @property Show\Field|Collection permission_id + * @property Show\Field|Collection icon + * @property Show\Field|Collection order + * @property Show\Field|Collection parent_id + * @property Show\Field|Collection uri * @property Show\Field|Collection menu_id - * @property Show\Field|Collection slug + * @property Show\Field|Collection permission_id * @property Show\Field|Collection http_method * @property Show\Field|Collection http_path + * @property Show\Field|Collection slug * @property Show\Field|Collection role_id * @property Show\Field|Collection user_id * @property Show\Field|Collection value - * @property Show\Field|Collection username - * @property Show\Field|Collection password * @property Show\Field|Collection avatar + * @property Show\Field|Collection password * @property Show\Field|Collection remember_token + * @property Show\Field|Collection username * @property Show\Field|Collection address_id * @property Show\Field|Collection image - * @property Show\Field|Collection sort - * @property Show\Field|Collection jump_type * @property Show\Field|Collection jump_link - * @property Show\Field|Collection is_recommend + * @property Show\Field|Collection jump_type + * @property Show\Field|Collection sort * @property Show\Field|Collection _lft * @property Show\Field|Collection _rgt - * @property Show\Field|Collection category_id + * @property Show\Field|Collection is_recommend * @property Show\Field|Collection author_name - * @property Show\Field|Collection subtitle - * @property Show\Field|Collection cover + * @property Show\Field|Collection category_id * @property Show\Field|Collection content - * @property Show\Field|Collection uuid + * @property Show\Field|Collection cover + * @property Show\Field|Collection subtitle * @property Show\Field|Collection connection - * @property Show\Field|Collection queue - * @property Show\Field|Collection payload * @property Show\Field|Collection exception * @property Show\Field|Collection failed_at - * @property Show\Field|Collection tokenable_type - * @property Show\Field|Collection tokenable_id - * @property Show\Field|Collection token + * @property Show\Field|Collection payload + * @property Show\Field|Collection queue + * @property Show\Field|Collection uuid * @property Show\Field|Collection abilities * @property Show\Field|Collection last_used_at + * @property Show\Field|Collection token + * @property Show\Field|Collection tokenable_id + * @property Show\Field|Collection tokenable_type * @property Show\Field|Collection remarks * @property Show\Field|Collection attrs * @property Show\Field|Collection specs * @property Show\Field|Collection part_id * @property Show\Field|Collection sku_id - * @property Show\Field|Collection spu_id - * @property Show\Field|Collection images - * @property Show\Field|Collection sell_price - * @property Show\Field|Collection market_price - * @property Show\Field|Collection cost_price - * @property Show\Field|Collection vip_price - * @property Show\Field|Collection media - * @property Show\Field|Collection weight - * @property Show\Field|Collection stock - * @property Show\Field|Collection sales - * @property Show\Field|Collection release_at - * @property Show\Field|Collection feature_id - * @property Show\Field|Collection product_spu_id - * @property Show\Field|Collection items - * @property Show\Field|Collection is_sell + * @property Show\Field|Collection status * @property Show\Field|Collection buynote_id - * @property Show\Field|Collection phone + * @property Show\Field|Collection cost_price + * @property Show\Field|Collection images + * @property Show\Field|Collection market_price + * @property Show\Field|Collection media + * @property Show\Field|Collection release_at + * @property Show\Field|Collection sales + * @property Show\Field|Collection sell_price + * @property Show\Field|Collection spu_id + * @property Show\Field|Collection stock + * @property Show\Field|Collection verify_state + * @property Show\Field|Collection vip_price + * @property Show\Field|Collection weight + * @property Show\Field|Collection feature_id + * @property Show\Field|Collection items + * @property Show\Field|Collection product_spu_id * @property Show\Field|Collection code - * @property Show\Field|Collection is_use * @property Show\Field|Collection expires_at + * @property Show\Field|Collection is_use + * @property Show\Field|Collection phone + * @property Show\Field|Collection birthday + * @property Show\Field|Collection gender * @property Show\Field|Collection inviter_id * @property Show\Field|Collection nickname - * @property Show\Field|Collection gender - * @property Show\Field|Collection birthday - * @property Show\Field|Collection phone_verified_at * @property Show\Field|Collection email * @property Show\Field|Collection email_verified_at - * @property Show\Field|Collection last_login_ip * @property Show\Field|Collection last_login_at + * @property Show\Field|Collection last_login_ip + * @property Show\Field|Collection phone_verified_at * @property Show\Field|Collection register_ip - * @property Show\Field|Collection status * @property Show\Field|Collection status_remark * * @method Show\Field|Collection id(string $label = null) - * @method Show\Field|Collection key(string $label = null) - * @method Show\Field|Collection name(string $label = null) + * @method Show\Field|Collection created_at(string $label = null) * @method Show\Field|Collection dimensions(string $label = null) * @method Show\Field|Collection is_show(string $label = null) - * @method Show\Field|Collection created_at(string $label = null) + * @method Show\Field|Collection key(string $label = null) + * @method Show\Field|Collection name(string $label = null) * @method Show\Field|Collection updated_at(string $label = null) + * @method Show\Field|Collection detail(string $label = null) * @method Show\Field|Collection type(string $label = null) * @method Show\Field|Collection version(string $label = null) - * @method Show\Field|Collection detail(string $label = null) * @method Show\Field|Collection is_enabled(string $label = null) - * @method Show\Field|Collection parent_id(string $label = null) - * @method Show\Field|Collection order(string $label = null) - * @method Show\Field|Collection icon(string $label = null) - * @method Show\Field|Collection uri(string $label = null) * @method Show\Field|Collection extension(string $label = null) - * @method Show\Field|Collection permission_id(string $label = null) + * @method Show\Field|Collection icon(string $label = null) + * @method Show\Field|Collection order(string $label = null) + * @method Show\Field|Collection parent_id(string $label = null) + * @method Show\Field|Collection uri(string $label = null) * @method Show\Field|Collection menu_id(string $label = null) - * @method Show\Field|Collection slug(string $label = null) + * @method Show\Field|Collection permission_id(string $label = null) * @method Show\Field|Collection http_method(string $label = null) * @method Show\Field|Collection http_path(string $label = null) + * @method Show\Field|Collection slug(string $label = null) * @method Show\Field|Collection role_id(string $label = null) * @method Show\Field|Collection user_id(string $label = null) * @method Show\Field|Collection value(string $label = null) - * @method Show\Field|Collection username(string $label = null) - * @method Show\Field|Collection password(string $label = null) * @method Show\Field|Collection avatar(string $label = null) + * @method Show\Field|Collection password(string $label = null) * @method Show\Field|Collection remember_token(string $label = null) + * @method Show\Field|Collection username(string $label = null) * @method Show\Field|Collection address_id(string $label = null) * @method Show\Field|Collection image(string $label = null) - * @method Show\Field|Collection sort(string $label = null) - * @method Show\Field|Collection jump_type(string $label = null) * @method Show\Field|Collection jump_link(string $label = null) - * @method Show\Field|Collection is_recommend(string $label = null) + * @method Show\Field|Collection jump_type(string $label = null) + * @method Show\Field|Collection sort(string $label = null) * @method Show\Field|Collection _lft(string $label = null) * @method Show\Field|Collection _rgt(string $label = null) - * @method Show\Field|Collection category_id(string $label = null) + * @method Show\Field|Collection is_recommend(string $label = null) * @method Show\Field|Collection author_name(string $label = null) - * @method Show\Field|Collection subtitle(string $label = null) - * @method Show\Field|Collection cover(string $label = null) + * @method Show\Field|Collection category_id(string $label = null) * @method Show\Field|Collection content(string $label = null) - * @method Show\Field|Collection uuid(string $label = null) + * @method Show\Field|Collection cover(string $label = null) + * @method Show\Field|Collection subtitle(string $label = null) * @method Show\Field|Collection connection(string $label = null) - * @method Show\Field|Collection queue(string $label = null) - * @method Show\Field|Collection payload(string $label = null) * @method Show\Field|Collection exception(string $label = null) * @method Show\Field|Collection failed_at(string $label = null) - * @method Show\Field|Collection tokenable_type(string $label = null) - * @method Show\Field|Collection tokenable_id(string $label = null) - * @method Show\Field|Collection token(string $label = null) + * @method Show\Field|Collection payload(string $label = null) + * @method Show\Field|Collection queue(string $label = null) + * @method Show\Field|Collection uuid(string $label = null) * @method Show\Field|Collection abilities(string $label = null) * @method Show\Field|Collection last_used_at(string $label = null) + * @method Show\Field|Collection token(string $label = null) + * @method Show\Field|Collection tokenable_id(string $label = null) + * @method Show\Field|Collection tokenable_type(string $label = null) * @method Show\Field|Collection remarks(string $label = null) * @method Show\Field|Collection attrs(string $label = null) * @method Show\Field|Collection specs(string $label = null) * @method Show\Field|Collection part_id(string $label = null) * @method Show\Field|Collection sku_id(string $label = null) - * @method Show\Field|Collection spu_id(string $label = null) - * @method Show\Field|Collection images(string $label = null) - * @method Show\Field|Collection sell_price(string $label = null) - * @method Show\Field|Collection market_price(string $label = null) - * @method Show\Field|Collection cost_price(string $label = null) - * @method Show\Field|Collection vip_price(string $label = null) - * @method Show\Field|Collection media(string $label = null) - * @method Show\Field|Collection weight(string $label = null) - * @method Show\Field|Collection stock(string $label = null) - * @method Show\Field|Collection sales(string $label = null) - * @method Show\Field|Collection release_at(string $label = null) - * @method Show\Field|Collection feature_id(string $label = null) - * @method Show\Field|Collection product_spu_id(string $label = null) - * @method Show\Field|Collection items(string $label = null) - * @method Show\Field|Collection is_sell(string $label = null) + * @method Show\Field|Collection status(string $label = null) * @method Show\Field|Collection buynote_id(string $label = null) - * @method Show\Field|Collection phone(string $label = null) + * @method Show\Field|Collection cost_price(string $label = null) + * @method Show\Field|Collection images(string $label = null) + * @method Show\Field|Collection market_price(string $label = null) + * @method Show\Field|Collection media(string $label = null) + * @method Show\Field|Collection release_at(string $label = null) + * @method Show\Field|Collection sales(string $label = null) + * @method Show\Field|Collection sell_price(string $label = null) + * @method Show\Field|Collection spu_id(string $label = null) + * @method Show\Field|Collection stock(string $label = null) + * @method Show\Field|Collection verify_state(string $label = null) + * @method Show\Field|Collection vip_price(string $label = null) + * @method Show\Field|Collection weight(string $label = null) + * @method Show\Field|Collection feature_id(string $label = null) + * @method Show\Field|Collection items(string $label = null) + * @method Show\Field|Collection product_spu_id(string $label = null) * @method Show\Field|Collection code(string $label = null) - * @method Show\Field|Collection is_use(string $label = null) * @method Show\Field|Collection expires_at(string $label = null) + * @method Show\Field|Collection is_use(string $label = null) + * @method Show\Field|Collection phone(string $label = null) + * @method Show\Field|Collection birthday(string $label = null) + * @method Show\Field|Collection gender(string $label = null) * @method Show\Field|Collection inviter_id(string $label = null) * @method Show\Field|Collection nickname(string $label = null) - * @method Show\Field|Collection gender(string $label = null) - * @method Show\Field|Collection birthday(string $label = null) - * @method Show\Field|Collection phone_verified_at(string $label = null) * @method Show\Field|Collection email(string $label = null) * @method Show\Field|Collection email_verified_at(string $label = null) - * @method Show\Field|Collection last_login_ip(string $label = null) * @method Show\Field|Collection last_login_at(string $label = null) + * @method Show\Field|Collection last_login_ip(string $label = null) + * @method Show\Field|Collection phone_verified_at(string $label = null) * @method Show\Field|Collection register_ip(string $label = null) - * @method Show\Field|Collection status(string $label = null) * @method Show\Field|Collection status_remark(string $label = null) */ class Show {} diff --git a/resources/lang/zh_CN/product-sku-verify.php b/resources/lang/zh_CN/product-sku-verify.php new file mode 100644 index 00000000..a511c0b3 --- /dev/null +++ b/resources/lang/zh_CN/product-sku-verify.php @@ -0,0 +1,19 @@ + [ + 'ProductSkuVerify' => '商品审核', + 'product-sku-verifies' => '商品审核', + ], + 'fields' => [ + 'sku'=>[ + 'name'=>'商品名称', + ], + 'sku_id' => '子商品', + 'type' => '审核类别', + 'status' => '状态', + 'remarks' => '备注', + ], + 'options' => [ + ], +]; diff --git a/resources/lang/zh_CN/product-sku.php b/resources/lang/zh_CN/product-sku.php index 7bbc41a1..b80f8257 100644 --- a/resources/lang/zh_CN/product-sku.php +++ b/resources/lang/zh_CN/product-sku.php @@ -1,28 +1,39 @@ - [ - 'ProductSku' => 'ProductSku', - 'product-sku' => 'ProductSku', + 'ProductSku' => '子商品列表', + 'product-skus' => '子商品列表', ], 'fields' => [ + 'spu'=>[ + 'name'=>'主商品名称', + ], + 'category'=>[ + 'name'=>'商品分类', + ], 'spu_id' => '主商品ID', 'name' => '商品名称', 'subtitle' => '商品副标题', 'category_id' => '商品分类', 'cover' => '封面图', 'images' => '商品图片', + 'features' => '商品特点', 'description' => '商品详情', - 'sell_price' => '销售价格:分', - 'market_price' => '市场价格:分', - 'cost_price' => '成本价格:分', - 'vip_price' => '会员价格:分', + 'buynote_id'=>'购买须知模板', + 'sell_price' => '销售价格', + 'market_price' => '市场价格', + 'cost_price' => '成本价格', + 'vip_price' => '会员价格', 'media' => '媒体地址', 'weight' => '重量:g', 'attrs' => '属性文本', 'specs' => '规格属性', 'stock' => '库存', 'sales' => '销量', + 'verify_state'=>'状态', 'release_at' => '上架时间', + 'attr_group'=>'商品分组', ], 'options' => [ ], diff --git a/resources/lang/zh_CN/product-spu.php b/resources/lang/zh_CN/product-spu.php index 2ed76de7..d7b45cff 100644 --- a/resources/lang/zh_CN/product-spu.php +++ b/resources/lang/zh_CN/product-spu.php @@ -23,9 +23,12 @@ return [ 'media' => '媒体地址', 'weight' => '重量:g', 'stock' => '库存', + 'sales'=>'销量', 'attrs' => '属性文本', 'specs' => '规格属性', 'attr_group'=>'商品分组', + 'verify_state'=>'状态', + 'release_at'=>'上架时间', ], 'options' => [ ],