Commit 0a415adc by 杨树贤

供应商小需求

parent c827b662
...@@ -27,29 +27,7 @@ class SupplierContactValidator ...@@ -27,29 +27,7 @@ class SupplierContactValidator
if ($validator->fails()) { if ($validator->fails()) {
return $validator->errors()->first(); return $validator->errors()->first();
} }
return true;
$contactModel = new SupplierContactModel();
//如果是原厂或者代理商性质的供应商,联系人不能重复
$supplierModel = new SupplierChannelModel();
$supplier = $supplierModel->where('supplier_id', $data['supplier_id'])->first()->toArray();
if ($supplier['supplier_group'] == 1 || $supplier['supplier_group'] == 4) {
$query = $contactModel->where('supplier_id', $data['supplier_id'])
->where(function ($q) use ($data) {
$q->where('supplier_email', $data['supplier_email'])
->orWhere('supplier_mobile', $data['supplier_mobile']);
});
//新增
if (empty($data['contact_id'])) {
$count = $query->count();
} else {
//修改
$count = $query->where('contact_id', '!=', $data['contact_id'])->count();
}
if ($count) {
return '原厂或者代理商性质的供应商不允许重复的联系人,<br>该供应商已经存在手机号或者邮箱一样的联系人,请联系管理人员查看具体详情';
}
}
} }
private function messages() private function messages()
......
...@@ -128,6 +128,7 @@ ...@@ -128,6 +128,7 @@
//监听所在区域变化,中国才显示省市选择 //监听所在区域变化,中国才显示省市选择
//而且有值+新增供应商操作 才能修改供应商名字和税号 //而且有值+新增供应商操作 才能修改供应商名字和税号
//如果区域是海外(非中国),就去掉税号的必填星号 //如果区域是海外(非中国),就去掉税号的必填星号
//如果选择区域为国内,那么成立时间disabled
form.on('select(region)', function (data) { form.on('select(region)', function (data) {
@if(empty($supplier)) @if(empty($supplier))
let supplierNameObj = $('#supplier_name'); let supplierNameObj = $('#supplier_name');
...@@ -148,10 +149,17 @@ ...@@ -148,10 +149,17 @@
$('#tax_number_required_span').show(); $('#tax_number_required_span').show();
$('#tax_number_div').show(); $('#tax_number_div').show();
$('.city-div').show(); $('.city-div').show();
//同时还要判断权限,有忽略公司校验权限的,成立时间可以不disabled
if (!ignoreCompanyCheck) {
$('#established_time').attr('disabled', true);
$('#established_time').addClass('layui-disabled');
}
} else { } else {
$('#tax_number_required_span').hide(); $('#tax_number_required_span').hide();
$('#tax_number_div').hide(); $('#tax_number_div').hide();
$('.city-div').hide(); $('.city-div').hide();
$('#established_time').attr('disabled', false);
$('#established_time').removeClass('layui-disabled');
} }
}); });
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
</div> </div>
<div class="layui-col-md3"> <div class="layui-col-md3">
<span title="{{$supplier['channel_username']}}"> <span title="{{$supplier['channel_username']}}">
采购员 : {{str_limit($supplier['channel_username'],50,'...')}} 采购员 : {{str_limit($supplier['channel_username'],30,'...')}}
</span> </span>
</div> </div>
<div class="layui-col-md3"></div> <div class="layui-col-md3"></div>
......
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