|
|
|
@ -4,11 +4,13 @@ namespace App\AdminSettled\Controllers; |
|
|
|
|
|
|
|
use App\Admin\Repositories\Supplier; |
|
|
|
use App\Common\UserStatus; |
|
|
|
use App\Models\AdminSetting; |
|
|
|
use Dcat\Admin\Admin; |
|
|
|
use Dcat\Admin\Form; |
|
|
|
use Dcat\Admin\Http\Controllers\AdminController; |
|
|
|
use Dcat\Admin\Widgets\Alert; |
|
|
|
use Illuminate\Support\Facades\Config; |
|
|
|
use Illuminate\Support\Facades\Storage; |
|
|
|
|
|
|
|
class SupplierController extends AdminController |
|
|
|
{ |
|
|
|
@ -68,11 +70,28 @@ class SupplierController extends AdminController |
|
|
|
$form->text('deposit_bank')->required(); |
|
|
|
$form->text('director')->required(); |
|
|
|
$form->text('contact_phone')->required()->maxLength(13); |
|
|
|
|
|
|
|
$contract_template = Storage::disk('public')->url(AdminSetting::val('settled_supplier_contract')); |
|
|
|
$form->image('contract')->required() |
|
|
|
->help('请先 <a target="_blank" href="' . $contract_template . '" download="【易游天下】供应商入驻合同模板">下载入驻合同</a> 并打印,填写完毕之后盖好公章再上传。'); |
|
|
|
|
|
|
|
$agreement_template = Storage::disk('public')->url(AdminSetting::val('settled_supplier_agreement')); |
|
|
|
$form->checkbox('agreement', '')->required() |
|
|
|
->options([1 => '我已认真阅读并完全认同'])->customFormat(fn() => '1111111') |
|
|
|
->script('$(function(){ |
|
|
|
$(".field_agreement").parent().css("margin-right", 0).after(\'《<a target="_blank" href="'.$agreement_template.'" download="入驻协议">入驻协议</a>》\');
|
|
|
|
});'); |
|
|
|
})->saving(function (Form $form) { |
|
|
|
if ($form->isEditing()) { |
|
|
|
return $form->response()->error('服务器出错了~~'); |
|
|
|
} |
|
|
|
|
|
|
|
if (empty(array_filter($form->agreement))) { |
|
|
|
return $form->response()->error('你必须同意入驻协议才能入驻'); |
|
|
|
} |
|
|
|
|
|
|
|
$form->deleteInput('agreement'); |
|
|
|
|
|
|
|
//判断账号是否唯一
|
|
|
|
if ($form->repository()->model()->where('username', $form->username)->exists()) { |
|
|
|
return $form->response()->error($form->username . ' 的账号已经存在'); |
|
|
|
|