diff --git a/app/common/repositories/user/UserLabelRepository.php b/app/common/repositories/user/UserLabelRepository.php index 4f79b1a..d05ef5e 100644 --- a/app/common/repositories/user/UserLabelRepository.php +++ b/app/common/repositories/user/UserLabelRepository.php @@ -83,6 +83,45 @@ class UserLabelRepository extends BaseRepository ])->setTitle($isCreate ? '添加用户标签' : '编辑用户标签')->formData($formData); } + public function form2($id = null, array $formData = []) + { + $isCreate = is_null($id); + $action = Route::buildUrl($isCreate ? 'systemUserLabelCreate' : 'systemUserLabelUpdate', $isCreate ? [] : compact('id'))->build(); + + $area = [ + ['value' => '', 'label' => '全部'], + ['value' => 1, 'label' => '自营'], + ['value' => 0, 'label' => '非自营'], + ]; + + return Elm::createForm($action, [ + + Elm::input('name', '角色名称')->required(), + Elm::input('ratio', '分润比例')->required(), + + Elm::select('area_id', '区域')->options($area), + + Elm::switches('status', '是否开启区域限制', 1)->activeValue(1) + ->inactiveValue(0)->inactiveText('关')->activeText('开'), + + Elm::radio('type', '角色代理类型', 1)->options([ + ['value' => 1, 'label' => '全部'], + ['value' => 2, 'label' => '社区'], + ['value' => 3, 'label' => '品牌'], + ['value' => 4, 'label' => '行业'], + ]), + + + Elm::input('max_role_num', '角色最高设置人数')->required(), + + Elm::input('brand_id', '品牌')->required(), + Elm::input('trade_id', '行业')->required(), + + + + ])->setTitle($isCreate ? '添加合作人' : '编辑合作人')->formData($formData); + } + /** * @param $id * @return Form diff --git a/app/controller/admin/user/UserLabel.php b/app/controller/admin/user/UserLabel.php index 6d8fd28..5c9c9d7 100644 --- a/app/controller/admin/user/UserLabel.php +++ b/app/controller/admin/user/UserLabel.php @@ -74,6 +74,13 @@ class UserLabel extends BaseController return app('json')->success(formToData($this->repository->form())); } + public function createForm2() + { + $list = formToData($this->repository->form2()); + + return app('json')->success($list); + } + /** * @param UserLabelValidate $validate * @return mixed diff --git a/route/admin/user.php b/route/admin/user.php index 53e8c49..8470ba6 100644 --- a/route/admin/user.php +++ b/route/admin/user.php @@ -30,6 +30,11 @@ Route::group(function () { '_auth' => false, '_form' => 'systemUserLabelCreate', ]); + Route::get('form2', '/createForm2')->name('systemUserLabelCreateForm2')->option([ + '_alias' => '添加合伙人用户角色', + '_auth' => false, + '_form' => 'systemUserLabelCreate2', + ]); Route::delete(':id', '/delete')->name('systemUserLabelDelete')->option([ '_alias' => '用户标签删除', ]);