diff --git a/MySQL_change.sql b/MySQL_change.sql
index 8988562..5e9b3ce 100644
--- a/MySQL_change.sql
+++ b/MySQL_change.sql
@@ -230,4 +230,5 @@ ALTER TABLE `suppliers`
ADD COLUMN `license` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '许可证' AFTER `business_license`,
ADD COLUMN `credit_codes` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '统一社会信用代码' COLLATE 'utf8_general_ci' AFTER `license`,
ADD COLUMN `corporate_account` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '对公账号' AFTER `credit_codes`,
- ADD COLUMN `deposit_bank` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '开户行' AFTER `corporate_account`;
+ ADD COLUMN `deposit_bank` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '开户行' AFTER `corporate_account`,
+ ADD COLUMN `contract` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '入驻合同' AFTER `deposit_bank`;
diff --git a/app/Admin/Forms/Setting.php b/app/Admin/Forms/Setting.php
index 93951bf..b26032e 100644
--- a/app/Admin/Forms/Setting.php
+++ b/app/Admin/Forms/Setting.php
@@ -28,7 +28,12 @@ class Setting extends Form
*/
public function form()
{
- $this->tab('支付小程序配置', function () {
+ $this->tab('入驻配置', function () {
+ $this->file('settled_supplier_contract', '供应商入驻合同')->uniqueName()->autoUpload()->required()
+ ->help('建议为doc/docx/pdf格式,供应商可在入驻页面下载后打印');
+ $this->file('settled_supplier_agreement', '供应商入驻协议')->uniqueName()->autoUpload()->required()
+ ->help('建议为doc/docx/pdf格式,供应商可在入驻页面下载后查看');
+ })->tab('支付小程序配置', function () {
$this->text('payee_appid', '收款小程序APPID')->required();
$this->text('payee_appsecret', '收款小程序APP_SECRET')->required();
$this->text('payee_mchid', '收款小程序MCH_ID')->required();
diff --git a/app/AdminSettled/Controllers/SupplierController.php b/app/AdminSettled/Controllers/SupplierController.php
index 6932e35..3d6d2d8 100644
--- a/app/AdminSettled/Controllers/SupplierController.php
+++ b/app/AdminSettled/Controllers/SupplierController.php
@@ -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('请先 下载入驻合同 并打印,填写完毕之后盖好公章再上传。');
+
+ $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(\'《入驻协议》\');
+ });');
})->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 . ' 的账号已经存在');
diff --git a/resources/lang/zh_CN/supplier.php b/resources/lang/zh_CN/supplier.php
index 61aa364..3e0f740 100644
--- a/resources/lang/zh_CN/supplier.php
+++ b/resources/lang/zh_CN/supplier.php
@@ -21,6 +21,7 @@ return [
'credit_codes' => '统一社会信用代码',
'corporate_account' => '对公账号',
'deposit_bank' => '对公账号开户行',
+ 'contract' => '入驻合同',
],
'options' => [
],