Commit 1de5f431 by 杨树贤

查漏补缺页面

parent 944c38a1
...@@ -131,7 +131,9 @@ class SupplierApiController extends Controller ...@@ -131,7 +131,9 @@ class SupplierApiController extends Controller
//先去表单验证 //先去表单验证
$validator = new SupplierValidator(); $validator = new SupplierValidator();
$data = $request->all(); $data = $request->all();
$validateResult = $validator->checkSave($data, false); $isAudit = (bool)$request->input('is_audit');
$supplierId = $request->input('supplier_id');
$validateResult = $validator->checkSave($data, $isAudit);
if ($validateResult) { if ($validateResult) {
$this->response(-1, $validateResult); $this->response(-1, $validateResult);
} }
...@@ -141,9 +143,18 @@ class SupplierApiController extends Controller ...@@ -141,9 +143,18 @@ class SupplierApiController extends Controller
$service = new SupplierService(); $service = new SupplierService();
$result = $service->saveSupplier($channel); $result = $service->saveSupplier($channel);
if (!$result) { if (!$result) {
$this->response(-1, '操作失败'); $this->response(-1, '修改失败');
} }
$this->response(0, '操作成功'); //如果是申请审核,还要去修改审核状态
if ($isAudit) {
$supplierService = new SupplierService();
$auditData[] = [
'supplier_id' => $supplierId,
'apply_audit_reason' => '申请审核',
];
$supplierService->batchApplyInReviewSupplier($auditData);
}
$this->response(0, $isAudit ? '申请审核成功' : '修改成功');
} }
......
...@@ -86,7 +86,8 @@ class SupplierContactApiController extends Controller ...@@ -86,7 +86,8 @@ class SupplierContactApiController extends Controller
$data = BatchTrim($data); $data = BatchTrim($data);
//先去表单验证 //先去表单验证
$validator = new SupplierContactValidator(); $validator = new SupplierContactValidator();
$validateResult = $validator->checkSave($request); $requestData = $request->all();
$validateResult = $validator->checkSave($requestData);
if ($validateResult) { if ($validateResult) {
$this->response(-1, $validateResult); $this->response(-1, $validateResult);
} }
......
...@@ -39,7 +39,8 @@ class SupplierReceiptApiController extends Controller ...@@ -39,7 +39,8 @@ class SupplierReceiptApiController extends Controller
{ {
//先去表单验证 //先去表单验证
$validator = new ReceiptValidator(); $validator = new ReceiptValidator();
$validateResult = $validator->checkSave($request); $requestData = $request->all();
$validateResult = $validator->checkSave($requestData);
if ($validateResult) { if ($validateResult) {
$this->response(-1, $validateResult); $this->response(-1, $validateResult);
} }
......
...@@ -25,6 +25,9 @@ class SupplierFilter ...@@ -25,6 +25,9 @@ class SupplierFilter
if (!empty($map['supplier_id'])) { if (!empty($map['supplier_id'])) {
$query->where('supplier_channel.supplier_id', $map['supplier_id']); $query->where('supplier_channel.supplier_id', $map['supplier_id']);
} }
if (!empty($map['supplier_type'])) {
$query->where('supplier_channel.supplier_type', $map['supplier_type']);
}
if (!empty($map['supplier_name'])) { if (!empty($map['supplier_name'])) {
$query->where('supplier_name', 'like', "{$map['supplier_name']}%"); $query->where('supplier_name', 'like', "{$map['supplier_name']}%");
} }
......
...@@ -10,16 +10,15 @@ class ReceiptValidator ...@@ -10,16 +10,15 @@ class ReceiptValidator
{ {
//保存相关的验证,别问我为什么不用laravel自带的form-request类 //保存相关的验证,别问我为什么不用laravel自带的form-request类
//因为控制器那边已经被之前的人魔改的难用的一比,而且控制器那边还接收了一大堆统一变量 //因为控制器那边已经被之前的人魔改的难用的一比,而且控制器那边还接收了一大堆统一变量
public function checkSave($request) public function checkSave($data,$returnAllError = false)
{ {
$receipt = $data;
//整理下请求数据 //整理下请求数据
$receipt = $request->all();
$rules = [ $rules = [
"bank_name" => "required", "bank_name" => "required",
"bank_adderss" => "required", "bank_adderss" => "required",
"account_no" => "required", "account_no" => "required",
"receipt_type" => 'required', "receipt_type" => 'required',
// "account_name" => "required",
"certificate" => "required", "certificate" => "required",
]; ];
if ($receipt['receipt_type'] == 2) { if ($receipt['receipt_type'] == 2) {
...@@ -30,20 +29,24 @@ class ReceiptValidator ...@@ -30,20 +29,24 @@ class ReceiptValidator
//判断联系方式的表单验证 //判断联系方式的表单验证
if ($validator->fails()) { if ($validator->fails()) {
return $validator->errors()->first(); if ($returnAllError) {
return $validator->errors()->all();
}else{
return $validator->errors()->first();
}
} }
} }
private function messages() private function messages()
{ {
return [ return [
'receipt_type.required' => '开户名称不能为空', 'receipt_type.required' => '开户名称 不能为空',
'bank_name.required' => '类型不能为空', 'bank_name.required' => '类型 不能为空',
'bank_adderss.required' => '开户行不能为空', 'bank_adderss.required' => '开户行 不能为空',
'swift_code.required' => '电汇号码 Swift Code 不能为空', 'swift_code.required' => '电汇号码 Swift Code 不能为空',
'account_no.required' => '银行账号不能为空', 'account_no.required' => '银行账号 不能为空',
'account_name.required' => '账户名称不能为空', 'account_name.required' => '账户名称 不能为空',
'certificate.required' => '银行信息凭证不能为空', 'certificate.required' => '银行信息凭证 不能为空',
]; ];
} }
} }
\ No newline at end of file
...@@ -33,10 +33,10 @@ class SupplierAttachmentValidator ...@@ -33,10 +33,10 @@ class SupplierAttachmentValidator
private function messages() private function messages()
{ {
return [ return [
'field_name.required' => '附件类型不能为空', 'field_name.required' => '附件类型 不能为空',
'validity.required' => '有效期类型不能为空', 'validity.required' => '有效期类型 不能为空',
'file_url.required' => '上传文件不能为空', 'file_url.required' => '上传文件 不能为空',
'file_name.required' => '文件名不能为空', 'file_name.required' => '文件名 不能为空',
]; ];
} }
} }
\ No newline at end of file
...@@ -9,10 +9,8 @@ use Validator; ...@@ -9,10 +9,8 @@ use Validator;
class SupplierContactValidator class SupplierContactValidator
{ {
public function checkSave($request) public function checkSave($data)
{ {
$data = $request->all();
$data = BatchTrim($data); $data = BatchTrim($data);
$rules = [ $rules = [
"supplier_consignee" => "required", "supplier_consignee" => "required",
...@@ -57,13 +55,13 @@ class SupplierContactValidator ...@@ -57,13 +55,13 @@ class SupplierContactValidator
private function messages() private function messages()
{ {
return [ return [
'supplier_consignee.required' => '联系人不能为空', 'supplier_consignee.required' => '联系人 不能为空',
'supplier_email.required' => '联系人邮箱不能为空', 'supplier_email.required' => '联系人邮箱 不能为空',
'supplier_email.email' => '邮箱格式不对', 'supplier_email.email' => '邮箱格式不对',
'supplier_mobile.required' => '联系人电话不能为空', 'supplier_mobile.required' => '联系人电话 不能为空',
'supplier_telephone.required' => '联系人座机不能为空', 'supplier_telephone.required' => '联系人座机 不能为空',
'supplier_position.required' => '联系人职位不能为空', 'supplier_position.required' => '联系人职位 不能为空',
'can_check_uids.required' => '采购员不能为空', 'can_check_uids.required' => '采购员 不能为空',
]; ];
} }
} }
\ No newline at end of file
...@@ -5,8 +5,10 @@ namespace App\Http\Validators; ...@@ -5,8 +5,10 @@ namespace App\Http\Validators;
use App\Http\Services\SupplierPayTypeService; use App\Http\Services\SupplierPayTypeService;
use App\Model\SupplierAttachmentModel; use App\Model\SupplierAttachmentModel;
use App\Model\SupplierAttachmentsModel;
use App\Model\SupplierChannelModel; use App\Model\SupplierChannelModel;
use App\Model\SupplierContactModel; use App\Model\SupplierContactModel;
use App\Model\SupplierReceiptModel;
use Validator; use Validator;
class SupplierValidator class SupplierValidator
...@@ -17,11 +19,12 @@ class SupplierValidator ...@@ -17,11 +19,12 @@ class SupplierValidator
{ {
//整理下请求数据 //整理下请求数据
$validateData = $this->transformRequestData($validateData); $validateData = $this->transformRequestData($validateData);
//这个supplierId是用来判断是新增还是修改的
$supplierId = array_get($validateData, 'supplier_id'); $supplierId = array_get($validateData, 'supplier_id');
//如果是修改直接提交,不是点申请审核的,只需要校验供应商名称是否存在即可 //如果是修改直接提交,不是点申请审核的,只需要校验供应商名称是否存在即可
if (!$isAudit) { if (!$isAudit) {
if (empty($validateData['supplier_name'])) { if (empty($validateData['supplier_name'])) {
return '供应商名称不能为空'; return '供应商名称 不能为空';
} }
if (empty($supplierId)) { if (empty($supplierId)) {
...@@ -43,6 +46,8 @@ class SupplierValidator ...@@ -43,6 +46,8 @@ class SupplierValidator
'legal_representative' => 'required', 'legal_representative' => 'required',
'stockup_type' => 'required', 'stockup_type' => 'required',
'main_brands' => 'required', 'main_brands' => 'required',
'pay_type' => 'required',
'settlement_type' => 'required',
'currency' => 'required', 'currency' => 'required',
'main_customers' => 'max:100', 'main_customers' => 'max:100',
'ticket_time' => 'max:20', 'ticket_time' => 'max:20',
...@@ -50,7 +55,7 @@ class SupplierValidator ...@@ -50,7 +55,7 @@ class SupplierValidator
'cn_delivery_time' => 'regex:/^\d+\-\d$/', 'cn_delivery_time' => 'regex:/^\d+\-\d$/',
'us_delivery_time' => 'regex:/^\d+\-\d$/', 'us_delivery_time' => 'regex:/^\d+\-\d$/',
'shipping_address' => 'max:100', 'shipping_address' => 'max:100',
'billing_period_detail' => 'required|max:100', //'billing_period_detail' => 'required|max:100',
'return_address' => 'max:100', 'return_address' => 'max:100',
'return_consignee' => 'max:50', 'return_consignee' => 'max:50',
'return_phone' => 'max:50', 'return_phone' => 'max:50',
...@@ -66,48 +71,84 @@ class SupplierValidator ...@@ -66,48 +71,84 @@ class SupplierValidator
'can_check_uids' => 'required', 'can_check_uids' => 'required',
]; ];
$errorMessageList = [];
/**
* --->>附件必填要求:
* 如果供应商类别为正式供应商,营业执照、开票资料必须上传,供应商性质为现货商,则品质保证协议必须上传;
* 如果供应商类别为临时供应商,营业执照、开票资料必须上传,品质保证协议不需要上传
**/
//只有在提交供应商是正式的时候,才会去校验附件 //只有在提交供应商是正式的时候,才会去校验附件
if ($validateData['supplier_type'] == 1) { //校验附件这块,新增和修改判断的逻辑不一样
if ($isAudit) { if (empty($supplierId)) {
//产品要把表单校验改成审核的时候才去校验,这个时候附件就要单独去取值了,要不然这个时候提交上来的肯定没有附件信息 $attachmentFields = $validateData['field_name'];
$attachments = SupplierAttachmentModel::where('supplier_id', $supplierId)->first(); } else {
$attachments = !empty($attachments) ? $attachments->toArray() : []; $attachmentFields = SupplierAttachmentsModel::where('supplier_id',
$validateData = array_merge($validateData, $attachments); $supplierId)->get()->pluck('field_name')->toArray();
} }
//校验附件,只要营业执照、商业登记证、公司注册证至少其中一个上传了附件,就判定已经上传了附件 if (!$attachmentFields) {
$attachmentValidateFields = [ $errorMessageList[] = '请上传附件';
'business_license', }
'registration_certificate', $attachmentFields = array_unique($attachmentFields);
'incorporation_certificate' //fixed.php FileNameMapping 可以知道所有对应关系
];
if (!$validateData['billing_information']) {
return '附件 : 请上传开票资料!';
}
$attachmentValidateFieldsExist = false; if (!in_array('business_license', $attachmentFields)) {
foreach ($attachmentValidateFields as $field) { $errorMessageList[] = '营业执照必须上传';
if (array_get($validateData, $field)) { }
$attachmentValidateFieldsExist = true;
break; if (!in_array('billing_information', $attachmentFields)) {
} $errorMessageList[] = '开票资料必须上传';
} }
if (!$attachmentValidateFieldsExist) {
return '附件里营业执照、商业登记证、公司注册证至少要上传一个'; if ($validateData['supplier_type'] == 1 && $validateData['supplier_group'] == 2) {
if (!in_array('quality_assurance_agreement', $attachmentFields)) {
$errorMessageList[] = '供应商为正式供应商,并且供应商类型是现货商,则品质保证协议必须上传';
} }
}
//如果供应商性质是现货商,那么品质协议也不能为空 //银行信息校验
if ($validateData['supplier_group'] == 2) { $receiptValidator = new ReceiptValidator();
if (empty($validateData['quality_assurance_agreement'])) { if (empty($supplierId)) {
return '该供应商为现货商,请上传品质协议!'; $receiptData = array_only($validateData, [
'receipt_type',
'bank_name',
'bank_adderss',
'account_no',
'account_name',
'account_adderss',
'certificate',
'swift_code',
]);
$receiptValidateResult = $receiptValidator->checkSave($receiptData, true);
if ($receiptValidateResult) {
$errorMessageList = array_merge($errorMessageList, $receiptValidateResult);
}
} else {
$receipts = SupplierReceiptModel::where('supplier_id', $supplierId)->get()->toArray();
if (!$receipts) {
$errorMessageList[] = '供应商至少有一个财务信息,请补全';
} else {
foreach ($receipts as $receipt) {
$receiptValidateResult = $receiptValidator->checkSave($receipt);
if ($receiptValidateResult) {
$errorMessageList[] = $receiptValidateResult;
}
} }
} }
} }
//第一次新增的时候,是要校验联系人的 //联系人校验
if (empty($validateData['supplier_id'])) { if (empty($supplierId)) {
$rules = array_merge($rules, $contactRuler); $rules = array_merge($rules, $contactRuler);
} else {
//修改的时候,还要去判断联系人是否有
//至少要有一个联系方式
$contactCount = SupplierContactModel::where('supplier_id', $supplierId)->count();
if (!$contactCount) {
$errorMessageList[] = "供应商至少要有一个联系人,请补全";
}
} }
//币种为人民币的话需要验证税号 //币种为人民币的话需要验证税号
...@@ -115,38 +156,43 @@ class SupplierValidator ...@@ -115,38 +156,43 @@ class SupplierValidator
$rules['tax_number'] = 'required'; $rules['tax_number'] = 'required';
} }
//新增的时候,渠道开发不能为空 //如果付款方式为账期,那么月结天数一定要选
if (empty($validateData['supplier_id'])) { if ($validateData['pay_type'] == 1) {
if (!$validateData['pay_type_value']) {
$errorMessageList[] = '付款方式选择账期,月结天数必须设置';
}
}
//新增的时候,渠道开发 不能为空
if (empty($supplierId)) {
$rules['purchase_uid'] = 'required'; $rules['purchase_uid'] = 'required';
} }
$messages = $this->messages(); $messages = $this->messages();
$validator = Validator::make($validateData, $rules, $messages); $validator = Validator::make($validateData, $rules, $messages);
if ($validator->fails()) { if ($validator->fails()) {
return $validator->errors()->first(); $errors = $validator->errors()->all();
$errorMessageList = array_merge($errors, $errorMessageList);
} }
//检验名称是否已经存在数据库 //检验名称是否已经存在数据库
$companyNameCount = 0; if (!empty($validateData['supplier_name'])) {
if (empty($supplierId)) { $companyNameCount = 0;
$count = SupplierChannelModel::where('supplier_name', $validateData['supplier_name'])->count(); if (empty($supplierId)) {
$companyNameCount = SupplierChannelModel::where('register_company_name', $count = SupplierChannelModel::where('supplier_name', $validateData['supplier_name'])->count();
$validateData['register_company_name'])->where('register_company_name', '!=', '')->count(); $companyNameCount = SupplierChannelModel::where('register_company_name',
} else { $validateData['register_company_name'])->where('register_company_name', '!=', '')->count();
$count = SupplierChannelModel::where('supplier_name', $validateData['supplier_name']) } else {
->where('supplier_id', '!=', $supplierId)->count(); $count = SupplierChannelModel::where('supplier_name', $validateData['supplier_name'])
//至少要有一个联系方式 ->where('supplier_id', '!=', $supplierId)->count();
$contactCount = SupplierContactModel::where('supplier_id', $supplierId)->count(); }
if (!$contactCount) { if ($count) {
return "供应商至少要有一个联系人,请补全"; $errorMessageList[] = "该供应商名称已经存在,请核验后再提交";
}
if ($companyNameCount) {
$errorMessageList[] = "该注册公司名已经存在,请核验后再提交";
} }
}
if ($count) {
return "该供应商名称已经存在,请核验后再提交";
}
if ($companyNameCount) {
return "该注册公司名已经存在,请核验后再提交";
} }
if (!empty($supplierId)) { if (!empty($supplierId)) {
...@@ -163,56 +209,63 @@ class SupplierValidator ...@@ -163,56 +209,63 @@ class SupplierValidator
})->get(); })->get();
$notCompleteContacts = !empty($notCompleteContacts) ? $notCompleteContacts->toArray() : []; $notCompleteContacts = !empty($notCompleteContacts) ? $notCompleteContacts->toArray() : [];
if ($notCompleteContacts) { if ($notCompleteContacts) {
return "存在和你相关的联系人没有完善,请先去完善相关联系人"; $errorMessageList[] = "存在和你相关的联系人没有完善,请先去完善相关联系人";
} }
} }
return implode('|', $errorMessageList);
} }
private function messages() private
function messages()
{ {
return [ return [
'supplier_type.required' => '供应商类别不能为空', 'supplier_type.required' => '供应商类别 不能为空',
'supplier_name.required' => '供应商名称不能为空', 'supplier_name.required' => '供应商名称 不能为空',
'currency.required' => '结算币种不能为空', 'currency.required' => '结算币种 不能为空',
'legal_representative.required' => '法人代表不能为空', 'legal_representative.required' => '法人代表 不能为空',
'stockup_type.required' => '合作类型不能为空', 'stockup_type.required' => '合作类型 不能为空',
'register_company_name.required' => '注册公司名不能为空', 'pay_type.required' => '付款方式 不能为空',
'supplier_group.required' => '公司性质不能为空', 'settlement_type.required' => '结算方式 不能为空',
'supplier_address.required' => '注册地址不能为空', 'register_company_name.required' => '注册公司名 不能为空',
'region.required' => '所在区域不能为空', 'supplier_group.required' => '公司性质 不能为空',
'purchase_uid.required' => '渠道开发员不能为空', 'supplier_address.required' => '注册地址 不能为空',
'region.required' => '所在区域 不能为空',
'purchase_uid.required' => '渠道开发员 不能为空',
'cn_ratio.min' => '人民币系数必须是大于1的浮点数', 'cn_ratio.min' => '人民币系数必须是大于1的浮点数',
'business_license.required' => '营业执照不能为空', 'business_license.required' => '营业执照 不能为空',
'established_time.required' => '成立时间不能为空', 'established_time.required' => '成立时间 不能为空',
'us_ratio.min' => '美金系数必须是大于1的浮点数', 'us_ratio.min' => '美金系数必须是大于1的浮点数',
'us_delivery_time.regex' => '香港货期格式不正确', 'us_delivery_time.regex' => '香港货期格式不正确',
'cn_delivery_time.regex' => '大陆货期格式不正确', 'cn_delivery_time.regex' => '大陆货期格式不正确',
'tax_number.required' => '如果选择币种为人民币,则公司税号不能为空', 'tax_number.required' => '如果选择币种为人民币,则公司税号 不能为空',
'supplier_consignee.required' => '联系方式的联系人不能为空', 'supplier_consignee.required' => '联系方式的联系人 不能为空',
'supplier_consignee.max' => '联系方式的联系人不能超过50个字符', 'supplier_consignee.max' => '联系方式的联系人不能超过50个字符',
'supplier_position.required' => '联系方式的职称不能为空', 'supplier_position.required' => '联系方式的职称 不能为空',
'supplier_position.max' => '联系方式的职称不能超过30个字符', 'supplier_position.max' => '联系方式的职称不能超过30个字符',
'supplier_telephone.required' => '联系方式的座机号不能为空', 'supplier_telephone.required' => '联系方式的座机号 不能为空',
'supplier_mobile.required' => '联系方式的手机号不能为空', 'supplier_mobile.required' => '联系方式的手机号 不能为空',
'supplier_mobile.max' => '联系方式的手机号不能超过30个字符', 'supplier_mobile.max' => '联系方式的手机号不能超过30个字符',
'supplier_email.required' => '联系方式的邮箱不能为空', 'supplier_email.required' => '联系方式的邮箱 不能为空',
'supplier_email.email' => '联系方式的邮箱格式不对', 'supplier_email.email' => '联系方式的邮箱格式不对',
'can_check_uids.required' => '联系方式对应的采购员不能为空', 'can_check_uids.required' => '联系方式对应的采购员 不能为空',
'shipping_address.required' => '发货地址不能为空', 'shipping_address.required' => '发货地址 不能为空',
'shipping_address.max' => '发货地址不能超过100个字符', 'shipping_address.max' => '发货地址不能超过100个字符',
'return_address.max' => '退货地址不能超过100个字符', 'return_address.max' => '退货地址不能超过100个字符',
'return_consignee.max' => '退货收货人不能超过50个字符', 'return_consignee.max' => '退货收货人不能超过50个字符',
'return_phone.max' => '退货收货人电话不能超过50个字符', 'return_phone.max' => '退货收货人电话不能超过50个字符',
'main_brands.required' => '主营品牌不能为空', 'main_brands.required' => '主营品牌 不能为空',
'main_customers.max' => '3-5家客户描述不能超过100个字符', 'main_customers.max' => '3-5家客户描述不能超过100个字符',
'ticket_time.max' => '到票时间不能超过20个字符', 'ticket_time.max' => '到票时间不能超过20个字符',
'billing_period_detail.required' => '账期详情不能为空', 'billing_period_detail.required' => '账期详情 不能为空',
'billing_period_detail.max' => '账期详情不能超过100个字符', 'billing_period_detail.max' => '账期详情不能超过100个字符',
]; ];
} }
public function transformRequestData($validateData) public
{ function transformRequestData(
$validateData
) {
foreach ($validateData as &$item) { foreach ($validateData as &$item) {
if (!is_array($item)) { if (!is_array($item)) {
$item = trim($item); $item = trim($item);
......
...@@ -205,19 +205,21 @@ return [ ...@@ -205,19 +205,21 @@ return [
1 => '先款后货', 1 => '先款后货',
2 => '月结', 2 => '月结',
], ],
'FileNameMapping' => [ 'FileNameMapping' => [
'business_license' => '营业执照', 'business_license' => '营业执照',
'billing_information' => '开票资料', 'billing_information' => '开票资料',
'quality_assurance_agreement' => '品质保证协议',
'registration_certificate' => '商业登记证', 'registration_certificate' => '商业登记证',
'cooperation_agreement' => '合作协议',
'proxy_certificate' => '代理证',
'incorporation_certificate' => '公司注册证', 'incorporation_certificate' => '公司注册证',
'certification_notice' => '认证通知书', 'certification_notice' => '认证通知书',
'supplier_survey' => '供应商调查表', 'supplier_survey' => '供应商调查表',
'proxy_certificate' => '代理证',
'quality_assurance_agreement' => '品质保证协议',
'confidentiality_agreement' => '保密协议', 'confidentiality_agreement' => '保密协议',
'cooperation_agreement' => '合作协议',
'other_attachment' => '其它附件', 'other_attachment' => '其它附件',
], ],
//罗盘菜单对应id //罗盘菜单对应id
'CompassMenuMap' => [ 'CompassMenuMap' => [
'total' => '全部', 'total' => '全部',
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
} }
, accept: 'file' , accept: 'file'
, exts: 'jpg|png|bmp|jpeg|zip|pdf' , exts: 'jpg|png|bmp|jpeg|zip|pdf'
, size: 20000
, before: function (obj) { , before: function (obj) {
layer.msg('加载中', { layer.msg('加载中', {
icon: 16 icon: 16
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
} }
, accept: 'file' , accept: 'file'
, exts: 'jpg|png|bmp|jpeg|zip|pdf' , exts: 'jpg|png|bmp|jpeg|zip|pdf'
, size: 20000
, before: function (obj) { , before: function (obj) {
layer.msg('加载中', { layer.msg('加载中', {
icon: 16 icon: 16
...@@ -75,7 +76,6 @@ ...@@ -75,7 +76,6 @@
admin.closeThisTabs(); admin.closeThisTabs();
} else { } else {
layer.msg(res.err_msg, {icon: 5}); layer.msg(res.err_msg, {icon: 5});
//todo
} }
} }
return false; return false;
...@@ -94,7 +94,12 @@ ...@@ -94,7 +94,12 @@
layer.msg(res.err_msg, {icon: 6}); layer.msg(res.err_msg, {icon: 6});
admin.closeThisTabs(); admin.closeThisTabs();
} else { } else {
layer.msg(res.err_msg, {icon: 5}); let errMsg = res.err_msg;
let msg = '';
$.each(errMsg.split('|'), function (index, value) {
msg += "<span>" + value + "</span><br>"
});
layer.msg(msg, {icon: 5})
} }
} }
}); });
......
<script> <script>
layui.use(['table', 'form', 'element', 'layer', 'admin', 'index', 'laydate', 'xmSelect'], function () { layui.use(['table', 'form', 'element', 'layer', 'admin', 'index', 'laydate', 'xmSelect'], function () {
let admin = layui.admin; let admin = layui.admin;
let index = layui.index;
let form = layui.form; let form = layui.form;
let table = layui.table; let table = layui.table;
...@@ -8,30 +9,51 @@ ...@@ -8,30 +9,51 @@
layer.load(1); layer.load(1);
}); });
form.on('submit(updateSupplier)', function (data) { form.on('submit(updateSupplier)', function (data) {
let confirmMessage = ''; let confirmMessage = '';
if (data.field.status === '-2') { if (data.field.status === '-2') {
confirmMessage = '确定要重新入驻吗,该供应商就会再次进入审核阶段' confirmMessage = '确定要重新入驻吗,该供应商就会再次进入审核阶段'
} else if (data.field.status === '-1') { } else if (data.field.status === '-1') {
confirmMessage = '确定要提交新增供应商信息吗?一旦提交,该供应商就会进入待复审阶段,审核过程中无法进行信息修改' confirmMessage = '确定要提交新增供应商信息吗?一旦提交,该供应商就会进入待复审阶段,审核过程中无法进行信息修改'
}else if (data.field.status === '3') { } else if (data.field.status === '3') {
confirmMessage = '确定要重新提交审核吗?一旦提交,该供应商就会再次进入审核中阶段,审核过程中无法进行信息修改'; confirmMessage = '确定要重新提交审核吗?一旦提交,该供应商就会再次进入审核中阶段,审核过程中无法进行信息修改';
} else { } else {
//修改不需要进入审核了,有个单独提交审核的按钮
confirmMessage = '确定要修改供应商信息吗?<br>一旦修改关键字段,该供应商就会再次进入<b>待审核</b>状态,需要去列表页<b>提交申请审核</b>,送至主管审核'; confirmMessage = '确定要修改供应商信息吗?<br>一旦修改关键字段,该供应商就会再次进入<b>待审核</b>状态,需要去列表页<b>提交申请审核</b>,送至主管审核';
updateSupplier(data);
return;
} }
layer.confirm(confirmMessage, function (index) { layer.confirm(confirmMessage, function (index) {
let res = ajax('/api/supplier/UpdateSupplier', data.field); updateSupplier(data);
if (res.err_code === 0) {
admin.putTempData("needFreshList", 1)
table.reload('receiptList')
location.href = "/supplier/SupplierDetail?view=iframe&supplier_id={{$supplier['supplier_id']}}"
layer.msg(res.err_msg, {icon: 6})
layer.close(index);
} else {
layer.msg(res.err_msg, {icon: 5})
}
}); });
}) })
form.on('submit(applyAuditSupplier)', function (data) {
let confirmMessage = '确定要修改供应商信息吗?<br>一旦修改关键字段,该供应商就会再次进入<b>审核中</b>状态,送至主管审核,期间不允许修改供应商信息';
layer.confirm(confirmMessage, function (index) {
data.field.is_audit = 1;
updateSupplier(data);
});
});
function updateSupplier(data) {
let res = ajax('/api/supplier/UpdateSupplier', data.field);
if (res.err_code === 0) {
admin.putTempData("needFreshList", 1)
table.reload('receiptList')
location.href = "/supplier/SupplierDetail?view=iframe&supplier_id={{$supplier['supplier_id']}}"
layer.msg(res.err_msg, {icon: 6})
layer.close(index);
} else {
let errMsg = res.err_msg;
let msg = '';
$.each(errMsg.split('|'), function (index, value) {
msg += "<span>" + value + "</span><br>"
});
layer.msg(msg, {icon: 5})
}
}
}); });
</script> </script>
\ No newline at end of file
...@@ -39,20 +39,20 @@ ...@@ -39,20 +39,20 @@
page: {}, page: {},
}); });
//新增银行弹窗 //新增附件弹窗
$("#add_attachment").click(function () { $("#add_attachment").click(function () {
layer.open({ layer.open({
type: 2, type: 2,
content: '/supplier_attachment/AddSupplierAttachment?view=iframe&supplier_id=' + supplierId, content: '/supplier_attachment/AddSupplierAttachment?view=iframe&supplier_id=' + supplierId,
area: ['50%', '70%'], area: ['50%', '70%'],
title: '新增银行', title: '新增附件',
end: function () { end: function () {
table.reload('attachmentList'); table.reload('attachmentList');
} }
}); });
}) })
//修改银行弹窗 //修改附件弹窗
$("#update_attachment").click(function () { $("#update_attachment").click(function () {
let checkStatus = table.checkStatus('attachmentList'); let checkStatus = table.checkStatus('attachmentList');
let data = checkStatus.data; let data = checkStatus.data;
......
...@@ -22,16 +22,6 @@ ...@@ -22,16 +22,6 @@
} }
}); });
// laydate.render({
// elem: '.validity_period',
// type: 'date',
// trigger: 'click',
// range: '~', //或 range: '~' 来自定义分割字符,
// value: '',
// });
form.on('select(validity_period_selector)', function (data) { form.on('select(validity_period_selector)', function (data) {
fileType = data.value; fileType = data.value;
let validityPeriodTimeSelector = $(this).parents('.layui-col-md7') let validityPeriodTimeSelector = $(this).parents('.layui-col-md7')
...@@ -45,8 +35,6 @@ ...@@ -45,8 +35,6 @@
} }
}); });
upload.render({ upload.render({
elem: '#upload_button', elem: '#upload_button',
url: '{{config('website.UploadUrl')}}', //改成您自己的上传接口 url: '{{config('website.UploadUrl')}}', //改成您自己的上传接口
...@@ -93,7 +81,7 @@ ...@@ -93,7 +81,7 @@
} else { } else {
layer.msg('上传接口异常,请重试或者联系管理员 . ' + res.message); layer.msg('上传接口异常,请重试或者联系管理员 . ' + res.message);
} }
lay('.validity_period').each(function(){ lay('.validity_period').each(function () {
console.log(this) console.log(this)
laydate.render({ laydate.render({
elem: this, elem: this,
......
...@@ -18,17 +18,18 @@ ...@@ -18,17 +18,18 @@
<div class="layui-card-body"> <div class="layui-card-body">
<style> <style>
.fix-button { .fix-button {
height: 110px; height: 40px;
margin-top: 0; margin-top: 0;
margin-left: -30px; margin-left: -90px;
padding: 10px 45px; padding: 10px 45px;
position: fixed; position: fixed;
bottom: 0; top: 0;
background: white; background: white;
width: 100%; width: 100%;
z-index: 10; z-index: 10;
} }
</style> </style>
<div style="height:40px"></div>
<blockquote class="layui-elem-quote layui-text"> <blockquote class="layui-elem-quote layui-text">
<b>基本信息</b> <b>基本信息</b>
</blockquote> </blockquote>
...@@ -177,7 +178,7 @@ ...@@ -177,7 +178,7 @@
<input type="hidden" name="stockup_type" <input type="hidden" name="stockup_type"
value="{{$supplier['stockup_type'] or ''}}"> value="{{$supplier['stockup_type'] or ''}}">
@foreach(config('fixed.StockupType') as $k=>$type) @foreach(config('fixed.StockupType') as $k=>$type)
<input type="checkbox" <input type="checkbox" name="stockup_type[{{$k}}]"
lay-skin="primary" lay-skin="primary"
title="{{$type}}"> title="{{$type}}">
@endforeach @endforeach
...@@ -193,7 +194,7 @@ ...@@ -193,7 +194,7 @@
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-inline" id="tax_number_div" <div class="layui-inline" id="tax_number_div"
style="display: none;" style="display: none;margin-top: 10px"
> >
<label class="layui-form-label"><span class="require">*</span>公司税号</label> <label class="layui-form-label"><span class="require">*</span>公司税号</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
...@@ -204,7 +205,6 @@ ...@@ -204,7 +205,6 @@
@include('web.supplier.SupplierPayType') @include('web.supplier.SupplierPayType')
<blockquote class="layui-elem-quote layui-text"> <blockquote class="layui-elem-quote layui-text">
<b>财务信息</b> <b>财务信息</b>
</blockquote> </blockquote>
...@@ -292,7 +292,7 @@ ...@@ -292,7 +292,7 @@
<b>联系人</b> <b>联系人</b>
</blockquote> </blockquote>
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-col-md5"> <div class="layui-col-md4">
<label class="layui-form-label"><span class="require">*</span>联系人</label> <label class="layui-form-label"><span class="require">*</span>联系人</label>
<div class="layui-input-block block-42"> <div class="layui-input-block block-42">
<input type="text" name="supplier_consignee" id="supplier_consignee" <input type="text" name="supplier_consignee" id="supplier_consignee"
...@@ -300,7 +300,7 @@ ...@@ -300,7 +300,7 @@
value=""> value="">
</div> </div>
</div> </div>
<div class="layui-col-md5"> <div class="layui-col-md4">
<label class="layui-form-label"><span class="require">*</span>职位</label> <label class="layui-form-label"><span class="require">*</span>职位</label>
<div class="layui-input-block block-42"> <div class="layui-input-block block-42">
<input type="text" name="supplier_position" id="supplier_position" <input type="text" name="supplier_position" id="supplier_position"
...@@ -308,11 +308,7 @@ ...@@ -308,11 +308,7 @@
value=""> value="">
</div> </div>
</div> </div>
<div class="layui-col-md2"> <div class="layui-col-md4">
</div>
</div>
<div class="layui-form-item">
<div class="layui-col-md5">
<label class="layui-form-label"><span class="require">*</span>邮箱</label> <label class="layui-form-label"><span class="require">*</span>邮箱</label>
<div class="layui-input-block block-42"> <div class="layui-input-block block-42">
<input type="text" name="supplier_email" id="supplier_email" <input type="text" name="supplier_email" id="supplier_email"
...@@ -320,7 +316,9 @@ ...@@ -320,7 +316,9 @@
value=""> value="">
</div> </div>
</div> </div>
<div class="layui-col-md5"> </div>
<div class="layui-form-item">
<div class="layui-col-md4">
<label class="layui-form-label"><span class="require">*</span>手机号</label> <label class="layui-form-label"><span class="require">*</span>手机号</label>
<div class="layui-input-block block-42"> <div class="layui-input-block block-42">
<input type="text" name="supplier_mobile" id="supplier_mobile" <input type="text" name="supplier_mobile" id="supplier_mobile"
...@@ -328,10 +326,7 @@ ...@@ -328,10 +326,7 @@
value=""> value="">
</div> </div>
</div> </div>
<div class="layui-col-md2"></div> <div class="layui-col-md4">
</div>
<div class="layui-form-item">
<div class="layui-col-md5">
<label class="layui-form-label"><span class="require">*</span>座机</label> <label class="layui-form-label"><span class="require">*</span>座机</label>
<div class="layui-input-block block-42"> <div class="layui-input-block block-42">
<input type="text" name="supplier_telephone" id="supplier_telephone" <input type="text" name="supplier_telephone" id="supplier_telephone"
...@@ -339,7 +334,7 @@ ...@@ -339,7 +334,7 @@
value=""> value="">
</div> </div>
</div> </div>
<div class="layui-col-md5"> <div class="layui-col-md4">
<label class="layui-form-label">QQ</label> <label class="layui-form-label">QQ</label>
<div class="layui-input-block block-42"> <div class="layui-input-block block-42">
<input type="text" name="supplier_qq" id="supplier_qq" <input type="text" name="supplier_qq" id="supplier_qq"
...@@ -347,10 +342,9 @@ ...@@ -347,10 +342,9 @@
value=""> value="">
</div> </div>
</div> </div>
<div class="layui-col-md2"></div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-col-md5"> <div class="layui-col-md4">
<label class="layui-form-label">传真</label> <label class="layui-form-label">传真</label>
<div class="layui-input-block block-42"> <div class="layui-input-block block-42">
<input type="text" name="supplier_fax" id="supplier_fax" <input type="text" name="supplier_fax" id="supplier_fax"
...@@ -358,54 +352,59 @@ ...@@ -358,54 +352,59 @@
value=""> value="">
</div> </div>
</div> </div>
<div class="layui-col-md5"> <div class="layui-col-md4">
@inject('statusPresenter','App\Presenters\StatusPresenter') @inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('can_check_uids','采购员','', {!! $statusPresenter->render('can_check_uids','采购员','',
$userCodes,['required'=>true]) !!} $userCodes,['required'=>true]) !!}
</div> </div>
<div class="layui-col-md2"></div> <div class="layui-col-md4"></div>
</div> </div>
<blockquote class="layui-elem-quote layui-text"> <blockquote class="layui-elem-quote layui-text">
<b>附件管理</b> <b>附件管理</b>
</blockquote> </blockquote>
@include('web.supplier.SupplierFile') @include('web.supplier.SupplierFile')
<div style="height: 100px"></div> <div class="layui-form-item" style="margin-top: 10px;margin-left: 10px">
{{-- <div class="fix-button">--}} <p>
<div> <b>特别说明:</b>
<div class="layui-row" style="width: 90%;"> </p>
<hr> <p>
<div class="layui-col-md7"> 1、在创建新的供应商前,请先查询该供应商是否已经存在。如果供应商已存在,则不允许新增。
<p> </p>
<b>特别说明:</b> <p>
</p> 2、附件上传支持小于20M的PDF/ZIP/JPG/PNG/BMP格式,每个类型允许上传多份;
<p> </p>
1.在创建新的供应商前,请先查询该供应商是否已经存在。如果供应商已存在,则不允许新增。 <P>
</p> 3、此处新增供应商基本信息以及配置跟进人,其他信息补全必须进入编辑页面;
<p> </P>
2.附件上传支持小于20M的PDF/ZIP/JPG/PNG/BMP格式,每个类型最多支持上传一个文件 <P>
</p> 4、正式供应商建档必须上传营业执照,开票资料,现货商类型必须上传品质协议;
<P> </P>
3.此处新增供应商基本信息以及配置跟进人,其他信息补全必须进入编辑页面 <P>
</P> 5、正式供应商建档必须维护至少一条银行信息;
</div> </P>
<div class="layui-col-md5" style="margin-top: 30px"> </div>
<div class="layui-row" style="text-align: right"> <div class="fix-button">
<button type="button" class="layui-btn layui-btn submit-loading" id="apply_audit_button" <div>
lay-submit lay-filter="addAndApplySupplier">申请审核 <div class="layui-row" style="width: 100%;padding-left: 50px" >
</button> <div class="layui-col-md12">
<button type="button" class="layui-btn layui-btn submit-loading" lay-submit <div class="layui-row" style="text-align: left">
lay-filter="addSupplier">确认 <button type="button" class="layui-btn layui-btn submit-loading" lay-submit
</button> lay-filter="addSupplier">保存
<button lay-filter="cancelAddSupplier" </button>
type="button" lay-submit <button type="button" class="layui-btn layui-btn submit-loading" id="apply_audit_button"
class="layui-btn layui-btn-primary">取消 lay-submit lay-filter="addAndApplySupplier">申请审核
</button> </button>
<button lay-filter="cancelAddSupplier"
type="button" lay-submit
class="layui-btn layui-btn-primary">取消
</button>
</div>
</div> </div>
</div> </div>
<hr>
</div> </div>
</div> </div>
</form> </form>
<hr/>
</div> </div>
</div> </div>
@include('script.supplier.SupplierBaseScript') @include('script.supplier.SupplierBaseScript')
......
...@@ -113,9 +113,12 @@ ...@@ -113,9 +113,12 @@
style="text-align: left;padding-left: 20px">{{$printData['ticket_time'] or ''}}</td> style="text-align: left;padding-left: 20px">{{$printData['ticket_time'] or ''}}</td>
</tr> </tr>
<tr> <tr>
<td width="20%" colspan="1">账期详情*</td> {{-- <td width="20%" colspan="1">账期详情*</td>--}}
<td width="20%" colspan="1"></td>
{{-- <td width="80%" colspan="5"--}}
{{-- style="text-align: left;padding-left: 20px">{{$printData['billing_period_detail'] or ''}}</td>--}}
<td width="80%" colspan="5" <td width="80%" colspan="5"
style="text-align: left;padding-left: 20px">{{$printData['billing_period_detail'] or ''}}</td> style="text-align: left;padding-left: 20px"></td>
</tr> </tr>
<tr> <tr>
<td width="20%" colspan="1">业务负责人</td> <td width="20%" colspan="1">业务负责人</td>
......
...@@ -189,7 +189,7 @@ ...@@ -189,7 +189,7 @@
到票时间 :{{$supplier['ticket_time']}} 到票时间 :{{$supplier['ticket_time']}}
</div> </div>
<div class="layui-col-md3"> <div class="layui-col-md3">
<span class="required_field">*</span> 账期详情 :{{$supplier['billing_period_detail']}} {{-- <span class="required_field">*</span> 账期详情 :{{$supplier['billing_period_detail']}}--}}
</div> </div>
</div> </div>
<div class="layui-row" style="width: 700px"> <div class="layui-row" style="width: 700px">
...@@ -273,10 +273,14 @@ ...@@ -273,10 +273,14 @@
</div> </div>
<hr/> <hr/>
<blockquote class="layui-elem-quote layui-text"> <blockquote class="layui-elem-quote layui-text">
<b>财务信息</b> <b><span class="require">*</span>财务信息</b>
</blockquote> </blockquote>
@include('web.supplier.SupplierReceipt') @include('web.supplier.SupplierReceipt')
<blockquote class="layui-elem-quote layui-text"> <blockquote class="layui-elem-quote layui-text">
<b><span class="require">*</span>附件管理</b>
</blockquote>
@include('web.supplier.SupplierAttachment')
<blockquote class="layui-elem-quote layui-text">
<b>运输信息</b> <b>运输信息</b>
</blockquote> </blockquote>
<div class="layui-row"> <div class="layui-row">
......
...@@ -81,6 +81,9 @@ ...@@ -81,6 +81,9 @@
<button type="button" class="layui-btn layui-btn submit-loading" lay-submit <button type="button" class="layui-btn layui-btn submit-loading" lay-submit
lay-filter="updateSupplier">确认修改供应商 lay-filter="updateSupplier">确认修改供应商
</button> </button>
<button type="button" class="layui-btn layui-btn submit-loading" lay-submit
lay-filter="applyAuditSupplier">申请审核
</button>
@endif @endif
<a id="supplierDetailUrl" <a id="supplierDetailUrl"
href="/supplier/SupplierDetail?view=iframe&supplier_id={{$supplier['supplier_id']}}" href="/supplier/SupplierDetail?view=iframe&supplier_id={{$supplier['supplier_id']}}"
......
...@@ -199,14 +199,14 @@ ...@@ -199,14 +199,14 @@
value="{{$supplier['ticket_time'] or ''}}"> value="{{$supplier['ticket_time'] or ''}}">
</div> </div>
</div> </div>
<div class="layui-inline"> {{-- <div class="layui-inline">--}}
<label class="layui-form-label"><span class="require">*</span>账期详情</label> {{-- <label class="layui-form-label"><span class="require">*</span>账期详情</label>--}}
<div class="layui-input-block"> {{-- <div class="layui-input-block">--}}
<input type="text" name="billing_period_detail" style="width: 470px" placeholder="请输入账期详情" {{-- <input type="text" name="billing_period_detail" style="width: 470px" placeholder="请输入账期详情"--}}
class="layui-input" {{-- class="layui-input"--}}
value="{{$supplier['billing_period_detail'] or ''}}"> {{-- value="{{$supplier['billing_period_detail'] or ''}}">--}}
</div> {{-- </div>--}}
</div> {{-- </div>--}}
</div> </div>
@if($operate!='add' && checkPerm('UpdateSupplierTags')) @if($operate!='add' && checkPerm('UpdateSupplierTags'))
<blockquote class="layui-elem-quote layui-text"> <blockquote class="layui-elem-quote layui-text">
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
</div> </div>
<div class="layui-col-md7"> <div class="layui-col-md7">
<label class="layui-form-label">有效期 : </label> <label class="layui-form-label">有效期 : </label>
<div class="layui-input-inline" style="width: 100px"> <div class="layui-input-inline" style="width: 100px">$attachmentFields
<select name="validity_type[]" lay-filter="validity_period_selector"> <select name="validity_type[]" lay-filter="validity_period_selector">
<option value="">请选择</option> <option value="">请选择</option>
<option value="1">长期有效</option> <option value="1">长期有效</option>
......
...@@ -177,7 +177,7 @@ ...@@ -177,7 +177,7 @@
<div class="layui-col-md3"> <div class="layui-col-md3">
<div class="layui-inline"> <div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter') @inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('pay_type','付款方式 : ', {!! $statusPresenter->render('pay_type','付款周期 : ',
isset($supplier['pay_type'])?$supplier['pay_type']:'',config('fixed.SupplierPayType'),['required'=>true]) !!} isset($supplier['pay_type'])?$supplier['pay_type']:'',config('fixed.SupplierPayType'),['required'=>true]) !!}
</div> </div>
</div> </div>
...@@ -205,7 +205,7 @@ ...@@ -205,7 +205,7 @@
{{-- <input type="hidden" class="valueInput" name="pay_type_extra" value="%">--}} {{-- <input type="hidden" class="valueInput" name="pay_type_extra" value="%">--}}
{{-- </div>--}} {{-- </div>--}}
</div> </div>
<div class="pay_type_1_div" style="display: none"> <div class="pay_type_1_div" style="display: none;margin-left: -100px">
<div class="layui-row"> <div class="layui-row">
<span class="require">*</span>月结 : &nbsp <span class="require">*</span>月结 : &nbsp
<div class="layui-input-inline" style="width: 80px;"> <div class="layui-input-inline" style="width: 80px;">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment