From 212df4f357ea4c669cce156e33c5c473f816d99d Mon Sep 17 00:00:00 2001 From: liapples Date: Fri, 22 Oct 2021 00:59:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=90=86=E5=95=86=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=AE=B8=E5=8F=AF=E8=AF=81license?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MySQL_change.sql | 5 +++++ app/Admin/Controllers/AgentController.php | 15 +++++++------ app/AdminAgent/Forms/AgentInfo.php | 22 +++++++++---------- .../Controllers/AgentController.php | 6 +++-- app/AdminSupplier/Forms/SupplierInfo.php | 4 ++-- app/Models/Agent.php | 1 + resources/lang/zh_CN/agent.php | 3 +++ 7 files changed, 34 insertions(+), 22 deletions(-) diff --git a/MySQL_change.sql b/MySQL_change.sql index d702b59..bf9d1df 100644 --- a/MySQL_change.sql +++ b/MySQL_change.sql @@ -361,3 +361,8 @@ ALTER TABLE `statement` ALTER TABLE `suppliers` CHANGE COLUMN `license` `license` VARCHAR(1024) NOT NULL DEFAULT '' COMMENT '许可证' COLLATE 'utf8mb4_general_ci' AFTER `business_license`; +# 0:35 ‎2021/‎10/‎22 代理商增加license +ALTER TABLE `agents` + ADD COLUMN `license` VARCHAR(1024) NOT NULL DEFAULT '' COMMENT '许可证' COLLATE 'utf8mb4_general_ci' AFTER `business_license`, + ADD COLUMN `corporate_account` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '对公账号' COLLATE 'utf8mb4_general_ci' AFTER `license`, + ADD COLUMN `deposit_bank` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '开户行' COLLATE 'utf8mb4_general_ci' AFTER `corporate_account`; diff --git a/app/Admin/Controllers/AgentController.php b/app/Admin/Controllers/AgentController.php index e732566..b384537 100644 --- a/app/Admin/Controllers/AgentController.php +++ b/app/Admin/Controllers/AgentController.php @@ -37,7 +37,7 @@ class AgentController extends AdminController $grid->column('username'); $grid->column('type')->using(AgentType::array()); $grid->column('company_name'); - $grid->column('logo')->image('', 60, 60); + $grid->column('license')->image('', 60, 60); $grid->column('address'); $grid->column('business_license')->image('', 60, 60); $grid->column('director'); @@ -93,7 +93,7 @@ class AgentController extends AdminController $show->field('type')->using(AgentType::array()); $show->field('company_name'); $show->field('credit_codes'); - $show->field('logo')->image('', 80, 80); + $show->field('license')->image('', 80, 80); $show->field('address'); $show->field('business_license')->image('', 80, 80); $show->field('director'); @@ -104,17 +104,17 @@ class AgentController extends AdminController $show->field('agentInfo.about', '关于我们') ->unescape() ->as(function ($v) { - return preg_replace('/.*?<\/script>/is', '', $this->agentInfo->about); + return preg_replace('/.*?<\/script>/is', '', $this->agentInfo->about ?? ''); }); $show->field('agentInfo.reg_protocol', '注册协议') ->unescape() ->as(function ($v) { - return preg_replace('/.*?<\/script>/is', '', $this->agentInfo->reg_protocol); + return preg_replace('/.*?<\/script>/is', '', $this->agentInfo->reg_protocol ?? ''); }); $show->field('agentInfo.buy_protocol', '购买协议') ->unescape() ->as(function ($v) { - return preg_replace('/.*?<\/script>/is', '', $this->agentInfo->buy_protocol); + return preg_replace('/.*?<\/script>/is', '', $this->agentInfo->buy_protocol ?? ''); }); $show->field('created_at'); $show->field('updated_at'); @@ -156,9 +156,9 @@ class AgentController extends AdminController ->required(); $form->text('company_name')->required()->help('请正确填写,保持跟营业执照上的完全一致,如:海南易游天下供应链有限公司'); $form->text('credit_codes')->required()->help('请正确填写,保持跟营业执照上的完全一致,如:91440300577652919M'); + $form->text('address'); $form->distpicker(['province_id', 'city_id', 'area_id'], '请选择区域')->required(); - $form->image('logo')->removable(false)->uniqueName(); - $form->text('address'); + $form->multipleImage('license')->removable(false)->uniqueName(); $form->image('business_license')->removable(false)->uniqueName(); $form->text('director'); $form->text('contact_phone'); @@ -220,6 +220,7 @@ class AgentController extends AdminController 'status' => $form->model()->status, 'company_name' => $form->model()->company_name, 'logo' => $form->model()->logo, + 'license' => $form->model()->license, 'address' => $form->model()->address, 'business_license' => $form->model()->business_license, 'director' => $form->model()->director, diff --git a/app/AdminAgent/Forms/AgentInfo.php b/app/AdminAgent/Forms/AgentInfo.php index 8372a71..5a4d123 100644 --- a/app/AdminAgent/Forms/AgentInfo.php +++ b/app/AdminAgent/Forms/AgentInfo.php @@ -28,12 +28,12 @@ class AgentInfo extends Form //$model->address = $input['address']; $model->director = $input['director']; $model->contact_phone = $input['contact_phone']; - $model->logo = $input['logo']; +// $model->logo = $input['logo']; $model->avatar = $input['avatar']; //$model->business_license = $input['business_license']; //$model->legal_persona_name = $input['legal_persona_name']; $model->legal_persona_wechat = $input['legal_persona_wechat']; - $model->status = UserStatus::UNAUDITED; +// $model->status = UserStatus::UNAUDITED; $model->agentInfo->about = $input['agentInfo']['about']; $model->agentInfo->reg_protocol = $input['agentInfo']['reg_protocol']; @@ -51,18 +51,18 @@ class AgentInfo extends Form { Admin::translation('agent'); - $this->select('type')->options(AgentType::array())->disable(); + $this->display('type')->customFormat(fn() => AgentType::array()[$this->type] ?? ''); + $this->display('company_name')->required(); + $this->display('province.name','省份'); + $this->display('city.name','城市'); + $this->display('area.name','地区'); + $this->display('credit_codes')->required(); + $this->display('address')->required(); $this->text('name')->required(); - $this->text('company_name')->required()->disable(); - $this->text('province.name','省份')->disable(); - $this->text('city.name','城市')->disable(); - $this->text('area.name','地区')->disable(); - $this->text('credit_codes')->required()->disable(); - $this->text('address')->required()->disable(); $this->text('director')->required(); $this->text('contact_phone')->required(); - $this->image('logo')->required(); + $this->image('license')->required()->disable(); $this->image('avatar'); $this->image('business_license')->required()->disable(); $this->text('legal_persona_name')->required()->disable(); @@ -72,7 +72,7 @@ class AgentInfo extends Form $this->editor('agentInfo.reg_protocol')->required(); $this->editor('agentInfo.buy_protocol')->required(); - $this->confirm('编辑确认', '编辑内容需要管理员重新审核,确定要提交吗?'); +// $this->confirm('编辑确认', '编辑内容需要管理员重新审核,确定要提交吗?'); } /** diff --git a/app/AdminSettled/Controllers/AgentController.php b/app/AdminSettled/Controllers/AgentController.php index e317bd5..adb1426 100644 --- a/app/AdminSettled/Controllers/AgentController.php +++ b/app/AdminSettled/Controllers/AgentController.php @@ -71,10 +71,12 @@ class AgentController extends AdminController ->required(); $form->text('company_name')->required()->help('请正确填写,保持跟营业执照上的完全一致,如:海南易游天下供应链有限公司'); $form->text('credit_codes')->required()->help('请正确填写,保持跟营业执照上的完全一致,如:91440300577652919M'); + $form->text('address')->required(); $form->distpicker(['province_id', 'city_id', 'area_id'], '请选择区域')->required(); - $form->image('logo')->required()->removable(false)->uniqueName(); - $form->text('address')->required(); + $form->multipleImage('license')->required()->removable(false)->uniqueName(); $form->image('business_license')->required()->removable(false)->uniqueName(); + $form->text('corporate_account')->required(); + $form->text('deposit_bank')->required(); $form->text('director')->required(); $form->text('contact_phone')->required()->maxLength(13); $form->text('legal_persona_name')->required()->maxLength(20)->help('很重要,注册小程序时需要用到,用于实名认证'); diff --git a/app/AdminSupplier/Forms/SupplierInfo.php b/app/AdminSupplier/Forms/SupplierInfo.php index 9035005..6e51dfe 100644 --- a/app/AdminSupplier/Forms/SupplierInfo.php +++ b/app/AdminSupplier/Forms/SupplierInfo.php @@ -29,7 +29,7 @@ class SupplierInfo extends Form $model->avatar = $input['avatar']; // $model->license = $input['license']; //$model->business_license = $input['business_license']; - $model->status = UserStatus::UNAUDITED; +// $model->status = UserStatus::UNAUDITED; $model->save(); return $this->response()->success('保存成功')->refresh(); @@ -57,7 +57,7 @@ class SupplierInfo extends Form $this->multipleImage('license')->required()->disable(); $this->image('business_license')->required()->disable(); - $this->confirm('编辑确认', '编辑内容需要管理员重新审核,确定要提交吗?'); +// $this->confirm('编辑确认', '编辑内容需要管理员重新审核,确定要提交吗?'); } /** diff --git a/app/Models/Agent.php b/app/Models/Agent.php index ca20d5d..6a490b6 100644 --- a/app/Models/Agent.php +++ b/app/Models/Agent.php @@ -9,6 +9,7 @@ class Agent extends BaseModel { use HasFactory, SoftDeletes; + protected $casts = ['license' => 'json']; protected $table = 'agents'; public function agentInfo() diff --git a/resources/lang/zh_CN/agent.php b/resources/lang/zh_CN/agent.php index 031cf15..5dea2e3 100644 --- a/resources/lang/zh_CN/agent.php +++ b/resources/lang/zh_CN/agent.php @@ -21,6 +21,9 @@ return [ 'company_name' => '公司名称', 'credit_codes' => '统一社会信用代码', 'logo' => 'LOGO', + 'license' => '许可证', + 'corporate_account' => '对公账号', + 'deposit_bank' => '对公账号开户行', 'address' => '公司地址', 'business_license' => '营业执照', 'director' => '负责人',