Commit 1de5f431 by 杨树贤

查漏补缺页面

parent 944c38a1
......@@ -131,7 +131,9 @@ class SupplierApiController extends Controller
//先去表单验证
$validator = new SupplierValidator();
$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) {
$this->response(-1, $validateResult);
}
......@@ -141,9 +143,18 @@ class SupplierApiController extends Controller
$service = new SupplierService();
$result = $service->saveSupplier($channel);
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
$data = BatchTrim($data);
//先去表单验证
$validator = new SupplierContactValidator();
$validateResult = $validator->checkSave($request);
$requestData = $request->all();
$validateResult = $validator->checkSave($requestData);
if ($validateResult) {
$this->response(-1, $validateResult);
}
......
......@@ -39,7 +39,8 @@ class SupplierReceiptApiController extends Controller
{
//先去表单验证
$validator = new ReceiptValidator();
$validateResult = $validator->checkSave($request);
$requestData = $request->all();
$validateResult = $validator->checkSave($requestData);
if ($validateResult) {
$this->response(-1, $validateResult);
}
......
......@@ -25,6 +25,9 @@ class SupplierFilter
if (!empty($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'])) {
$query->where('supplier_name', 'like', "{$map['supplier_name']}%");
}
......
......@@ -10,16 +10,15 @@ class ReceiptValidator
{
//保存相关的验证,别问我为什么不用laravel自带的form-request类
//因为控制器那边已经被之前的人魔改的难用的一比,而且控制器那边还接收了一大堆统一变量
public function checkSave($request)
public function checkSave($data,$returnAllError = false)
{
$receipt = $data;
//整理下请求数据
$receipt = $request->all();
$rules = [
"bank_name" => "required",
"bank_adderss" => "required",
"account_no" => "required",
"receipt_type" => 'required',
// "account_name" => "required",
"certificate" => "required",
];
if ($receipt['receipt_type'] == 2) {
......@@ -30,20 +29,24 @@ class ReceiptValidator
//判断联系方式的表单验证
if ($validator->fails()) {
return $validator->errors()->first();
if ($returnAllError) {
return $validator->errors()->all();
}else{
return $validator->errors()->first();
}
}
}
private function messages()
{
return [
'receipt_type.required' => '开户名称不能为空',
'bank_name.required' => '类型不能为空',
'bank_adderss.required' => '开户行不能为空',
'receipt_type.required' => '开户名称 不能为空',
'bank_name.required' => '类型 不能为空',
'bank_adderss.required' => '开户行 不能为空',
'swift_code.required' => '电汇号码 Swift Code 不能为空',
'account_no.required' => '银行账号不能为空',
'account_name.required' => '账户名称不能为空',
'certificate.required' => '银行信息凭证不能为空',
'account_no.required' => '银行账号 不能为空',
'account_name.required' => '账户名称 不能为空',
'certificate.required' => '银行信息凭证 不能为空',
];
}
}
\ No newline at end of file
......@@ -33,10 +33,10 @@ class SupplierAttachmentValidator
private function messages()
{
return [
'field_name.required' => '附件类型不能为空',
'validity.required' => '有效期类型不能为空',
'file_url.required' => '上传文件不能为空',
'file_name.required' => '文件名不能为空',
'field_name.required' => '附件类型 不能为空',
'validity.required' => '有效期类型 不能为空',
'file_url.required' => '上传文件 不能为空',
'file_name.required' => '文件名 不能为空',
];
}
}
\ No newline at end of file
......@@ -9,10 +9,8 @@ use Validator;
class SupplierContactValidator
{
public function checkSave($request)
public function checkSave($data)
{
$data = $request->all();
$data = BatchTrim($data);
$rules = [
"supplier_consignee" => "required",
......@@ -57,13 +55,13 @@ class SupplierContactValidator
private function messages()
{
return [
'supplier_consignee.required' => '联系人不能为空',
'supplier_email.required' => '联系人邮箱不能为空',
'supplier_consignee.required' => '联系人 不能为空',
'supplier_email.required' => '联系人邮箱 不能为空',
'supplier_email.email' => '邮箱格式不对',
'supplier_mobile.required' => '联系人电话不能为空',
'supplier_telephone.required' => '联系人座机不能为空',
'supplier_position.required' => '联系人职位不能为空',
'can_check_uids.required' => '采购员不能为空',
'supplier_mobile.required' => '联系人电话 不能为空',
'supplier_telephone.required' => '联系人座机 不能为空',
'supplier_position.required' => '联系人职位 不能为空',
'can_check_uids.required' => '采购员 不能为空',
];
}
}
\ No newline at end of file
......@@ -205,19 +205,21 @@ return [
1 => '先款后货',
2 => '月结',
],
'FileNameMapping' => [
'business_license' => '营业执照',
'billing_information' => '开票资料',
'quality_assurance_agreement' => '品质保证协议',
'registration_certificate' => '商业登记证',
'cooperation_agreement' => '合作协议',
'proxy_certificate' => '代理证',
'incorporation_certificate' => '公司注册证',
'certification_notice' => '认证通知书',
'supplier_survey' => '供应商调查表',
'proxy_certificate' => '代理证',
'quality_assurance_agreement' => '品质保证协议',
'confidentiality_agreement' => '保密协议',
'cooperation_agreement' => '合作协议',
'other_attachment' => '其它附件',
],
//罗盘菜单对应id
'CompassMenuMap' => [
'total' => '全部',
......
......@@ -46,6 +46,7 @@
}
, accept: 'file'
, exts: 'jpg|png|bmp|jpeg|zip|pdf'
, size: 20000
, before: function (obj) {
layer.msg('加载中', {
icon: 16
......
......@@ -27,6 +27,7 @@
}
, accept: 'file'
, exts: 'jpg|png|bmp|jpeg|zip|pdf'
, size: 20000
, before: function (obj) {
layer.msg('加载中', {
icon: 16
......@@ -75,7 +76,6 @@
admin.closeThisTabs();
} else {
layer.msg(res.err_msg, {icon: 5});
//todo
}
}
return false;
......@@ -94,7 +94,12 @@
layer.msg(res.err_msg, {icon: 6});
admin.closeThisTabs();
} 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>
layui.use(['table', 'form', 'element', 'layer', 'admin', 'index', 'laydate', 'xmSelect'], function () {
let admin = layui.admin;
let index = layui.index;
let form = layui.form;
let table = layui.table;
......@@ -8,30 +9,51 @@
layer.load(1);
});
form.on('submit(updateSupplier)', function (data) {
let confirmMessage = '';
if (data.field.status === '-2') {
confirmMessage = '确定要重新入驻吗,该供应商就会再次进入审核阶段'
} else if (data.field.status === '-1') {
confirmMessage = '确定要提交新增供应商信息吗?一旦提交,该供应商就会进入待复审阶段,审核过程中无法进行信息修改'
}else if (data.field.status === '3') {
} else if (data.field.status === '3') {
confirmMessage = '确定要重新提交审核吗?一旦提交,该供应商就会再次进入审核中阶段,审核过程中无法进行信息修改';
} else {
//修改不需要进入审核了,有个单独提交审核的按钮
confirmMessage = '确定要修改供应商信息吗?<br>一旦修改关键字段,该供应商就会再次进入<b>待审核</b>状态,需要去列表页<b>提交申请审核</b>,送至主管审核';
updateSupplier(data);
return;
}
layer.confirm(confirmMessage, function (index) {
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 {
layer.msg(res.err_msg, {icon: 5})
}
updateSupplier(data);
});
})
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>
\ No newline at end of file
......@@ -39,20 +39,20 @@
page: {},
});
//新增银行弹窗
//新增附件弹窗
$("#add_attachment").click(function () {
layer.open({
type: 2,
content: '/supplier_attachment/AddSupplierAttachment?view=iframe&supplier_id=' + supplierId,
area: ['50%', '70%'],
title: '新增银行',
title: '新增附件',
end: function () {
table.reload('attachmentList');
}
});
})
//修改银行弹窗
//修改附件弹窗
$("#update_attachment").click(function () {
let checkStatus = table.checkStatus('attachmentList');
let data = checkStatus.data;
......
......@@ -22,16 +22,6 @@
}
});
// laydate.render({
// elem: '.validity_period',
// type: 'date',
// trigger: 'click',
// range: '~', //或 range: '~' 来自定义分割字符,
// value: '',
// });
form.on('select(validity_period_selector)', function (data) {
fileType = data.value;
let validityPeriodTimeSelector = $(this).parents('.layui-col-md7')
......@@ -45,8 +35,6 @@
}
});
upload.render({
elem: '#upload_button',
url: '{{config('website.UploadUrl')}}', //改成您自己的上传接口
......@@ -93,7 +81,7 @@
} else {
layer.msg('上传接口异常,请重试或者联系管理员 . ' + res.message);
}
lay('.validity_period').each(function(){
lay('.validity_period').each(function () {
console.log(this)
laydate.render({
elem: this,
......
......@@ -113,9 +113,12 @@
style="text-align: left;padding-left: 20px">{{$printData['ticket_time'] or ''}}</td>
</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"
style="text-align: left;padding-left: 20px">{{$printData['billing_period_detail'] or ''}}</td>
style="text-align: left;padding-left: 20px"></td>
</tr>
<tr>
<td width="20%" colspan="1">业务负责人</td>
......
......@@ -189,7 +189,7 @@
到票时间 :{{$supplier['ticket_time']}}
</div>
<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 class="layui-row" style="width: 700px">
......@@ -273,10 +273,14 @@
</div>
<hr/>
<blockquote class="layui-elem-quote layui-text">
<b>财务信息</b>
<b><span class="require">*</span>财务信息</b>
</blockquote>
@include('web.supplier.SupplierReceipt')
<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>
</blockquote>
<div class="layui-row">
......
......@@ -81,6 +81,9 @@
<button type="button" class="layui-btn layui-btn submit-loading" lay-submit
lay-filter="updateSupplier">确认修改供应商
</button>
<button type="button" class="layui-btn layui-btn submit-loading" lay-submit
lay-filter="applyAuditSupplier">申请审核
</button>
@endif
<a id="supplierDetailUrl"
href="/supplier/SupplierDetail?view=iframe&supplier_id={{$supplier['supplier_id']}}"
......
......@@ -199,14 +199,14 @@
value="{{$supplier['ticket_time'] or ''}}">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label"><span class="require">*</span>账期详情</label>
<div class="layui-input-block">
<input type="text" name="billing_period_detail" style="width: 470px" placeholder="请输入账期详情"
class="layui-input"
value="{{$supplier['billing_period_detail'] or ''}}">
</div>
</div>
{{-- <div class="layui-inline">--}}
{{-- <label class="layui-form-label"><span class="require">*</span>账期详情</label>--}}
{{-- <div class="layui-input-block">--}}
{{-- <input type="text" name="billing_period_detail" style="width: 470px" placeholder="请输入账期详情"--}}
{{-- class="layui-input"--}}
{{-- value="{{$supplier['billing_period_detail'] or ''}}">--}}
{{-- </div>--}}
{{-- </div>--}}
</div>
@if($operate!='add' && checkPerm('UpdateSupplierTags'))
<blockquote class="layui-elem-quote layui-text">
......
......@@ -53,7 +53,7 @@
</div>
<div class="layui-col-md7">
<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">
<option value="">请选择</option>
<option value="1">长期有效</option>
......
......@@ -177,7 +177,7 @@
<div class="layui-col-md3">
<div class="layui-inline">
@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]) !!}
</div>
</div>
......@@ -205,7 +205,7 @@
{{-- <input type="hidden" class="valueInput" name="pay_type_extra" value="%">--}}
{{-- </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">
<span class="require">*</span>月结 : &nbsp
<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