Commit cfdd2850 by mushishixian

解决bug

parent e93195ff
...@@ -418,6 +418,9 @@ class SupplierApiController extends Controller ...@@ -418,6 +418,9 @@ class SupplierApiController extends Controller
if (empty($blockReason)) { if (empty($blockReason)) {
$this->response(-1, '必须填写拉黑原因'); $this->response(-1, '必须填写拉黑原因');
} }
if (mb_strlen($blockReason)>200) {
$this->response(-1, '拉黑原因不能超过200字');
}
$channelModel = new SupplierChannelModel(); $channelModel = new SupplierChannelModel();
$result = $channelModel->where('supplier_id', $supplierId)->update([ $result = $channelModel->where('supplier_id', $supplierId)->update([
'block_reason' => $request->get('block_reason'), 'block_reason' => $request->get('block_reason'),
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace App\Http\Controllers\Api; namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Services\DepartmentService;
use App\Http\Services\SupplierShareApplyService; use App\Http\Services\SupplierShareApplyService;
use App\Model\SupplierChannelModel; use App\Model\SupplierChannelModel;
use Illuminate\Http\Request; use Illuminate\Http\Request;
...@@ -33,10 +34,16 @@ class SupplierShareApplyApiController extends Controller ...@@ -33,10 +34,16 @@ class SupplierShareApplyApiController extends Controller
$supplierModel = new SupplierChannelModel(); $supplierModel = new SupplierChannelModel();
$supplier = $supplierModel->where('supplier_name', $supplierName)->first(); $supplier = $supplierModel->where('supplier_name', $supplierName)->first();
if (empty($supplier)) { if (empty($supplier)) {
$this->response(-1, '没有匹配到存在的供应商'); $this->response(-1, '该供应商名称不存在,请输入正确供应商名称');
} }
$applyService = new SupplierShareApplyService(); $applyService = new SupplierShareApplyService();
$departments = $applyService->getApplyCanUseDepartments($supplier); $departments = $applyService->getApplyCanUseDepartments($supplier);
//获取当前人的部门id,如果部门列表里面包含自己的部门,则提示该供应商属于自己部门,请找主管分配
$departmentService = new DepartmentService();
$department = $departmentService->getTopDepartmentByUserId($request->user->userId);
if (in_array($department, $departments)) {
$this->response(-1, '该供应商属于自己部门,请找主管分配');
}
if (empty($departments)) { if (empty($departments)) {
$this->response(-1, '该供应商不存在相关联的部门'); $this->response(-1, '该供应商不存在相关联的部门');
} }
......
...@@ -19,7 +19,7 @@ class SupplierFilter ...@@ -19,7 +19,7 @@ class SupplierFilter
$query = $this->defaultFilter($query, $map['source_type']); $query = $this->defaultFilter($query, $map['source_type']);
//判断筛选参数 //判断筛选参数
if (!empty($map['supplier_id'])) { if (!empty($map['supplier_id'])) {
$query->where('supplier_id', $map['supplier_id']); $query->where('supplier_channel.supplier_id', $map['supplier_id']);
} }
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']}%");
...@@ -136,9 +136,11 @@ class SupplierFilter ...@@ -136,9 +136,11 @@ class SupplierFilter
$inUserIdSql = "(" . $inUserIdSql . ")"; $inUserIdSql = "(" . $inUserIdSql . ")";
if ($subordinateCodeIds) { if ($subordinateCodeIds) {
if ($canViewFakeSupplier) { if ($canViewFakeSupplier) {
$query->whereRaw(DB::raw("(create_uid in $inUserIdSql or purchase_uid in $inCodeIdSql or channel_uid REGEXP '$likeSqlRaw' or is_type = 1) ")); $query->whereRaw(DB::raw("(create_uid in $inUserIdSql or purchase_uid in $inCodeIdSql
or channel_uid REGEXP '$likeSqlRaw' or is_type = 1) "));
} else { } else {
$query->whereRaw(DB::raw("(create_uid in $inUserIdSql or purchase_uid in $inCodeIdSql or channel_uid REGEXP '$likeSqlRaw') ")); $query->whereRaw(DB::raw("(create_uid in $inUserIdSql or purchase_uid in $inCodeIdSql
or channel_uid REGEXP '$likeSqlRaw') "));
} }
} else { } else {
if ($canViewFakeSupplier) { if ($canViewFakeSupplier) {
...@@ -234,21 +236,21 @@ class SupplierFilter ...@@ -234,21 +236,21 @@ class SupplierFilter
}); });
break; break;
//附件里面缺少品质协议的 //附件里面缺少品质协议的
// case "no_quality_assurance_agreement":
// $query->leftjoin('supplier_attachment', 'supplier_channel.supplier_id', '=',
// 'supplier_attachment.supplier_id')
// ->selectRaw('lie_supplier_channel.*,
// lie_supplier_attachment.quality_assurance_agreement,lie_supplier_attachment.supplier_id')
// ->where(function ($q) {
// $q->where('supplier_attachment.quality_assurance_agreement', '')
// ->orWhereNull('supplier_attachment.supplier_id');
// });
// break;
case "no_quality_assurance_agreement": case "no_quality_assurance_agreement":
$query->whereHas('attachment', function ($q) { $query->leftjoin('supplier_attachment', 'supplier_channel.supplier_id', '=',
$q->where('quality_assurance_agreement', '')->orWhereNull('supplier_id'); 'supplier_attachment.supplier_id')
->selectRaw('lie_supplier_channel.*,
lie_supplier_attachment.quality_assurance_agreement,lie_supplier_attachment.supplier_id')
->where(function ($q) {
$q->where('supplier_attachment.quality_assurance_agreement', '')
->orWhereNull('supplier_attachment.supplier_id');
}); });
break; break;
// case "no_quality_assurance_agreement":
// $query->whereHas('attachment', function ($q) {
// $q->where('quality_assurance_agreement1', '')->orWhereNull('supplier_id');
// });
// break;
//联系人待完善 //联系人待完善
case "contact_no_complete": case "contact_no_complete":
$query->whereHas('contact', function ($q) { $query->whereHas('contact', function ($q) {
......
...@@ -40,18 +40,29 @@ class DataService ...@@ -40,18 +40,29 @@ class DataService
} }
} }
unset($file); unset($file);
$business_license = array_get($files, 'business_license');
$billing_information = array_get($files, 'billing_information');
$registration_certificate = array_get($files, 'registration_certificate');
$incorporation_certificate = array_get($files, 'incorporation_certificate');
$certification_notice = array_get($files, 'certification_notice');
$supplier_survey = array_get($files, 'supplier_survey');
$proxy_certificate = array_get($files, 'proxy_certificate');
$quality_assurance_agreement = array_get($files, 'quality_assurance_agreement');
$confidentiality_agreement = array_get($files, 'confidentiality_agreement');
$cooperation_agreement = array_get($files, 'cooperation_agreement');
$other_attachment = array_get($files, 'other_attachment');
$attachment = [ $attachment = [
'business_license' => array_get($files, 'business_license'), 'business_license' => $business_license?[$business_license]:'',
'billing_information' => array_get($files, 'billing_information'), 'billing_information' => $billing_information?[$billing_information]:'',
'registration_certificate' => array_get($files, 'registration_certificate'), 'registration_certificate' => $registration_certificate?[$registration_certificate]:'',
'incorporation_certificate' => array_get($files, 'incorporation_certificate'), 'incorporation_certificate' => $incorporation_certificate?[$incorporation_certificate]:'',
'certification_notice' => array_get($files, 'certification_notice'), 'certification_notice' => $certification_notice?[$certification_notice]:'',
'supplier_survey' => array_get($files, 'supplier_survey'), 'supplier_survey' => $supplier_survey?[$supplier_survey]:'',
'proxy_certificate' => array_get($files, 'proxy_certificate'), 'proxy_certificate' => $proxy_certificate?[$proxy_certificate]:'',
'quality_assurance_agreement' => array_get($files, 'quality_assurance_agreement'), 'quality_assurance_agreement' => $quality_assurance_agreement?[$quality_assurance_agreement]:'',
'confidentiality_agreement' => array_get($files, 'confidentiality_agreement'), 'confidentiality_agreement' => $confidentiality_agreement?[$confidentiality_agreement]:'',
'cooperation_agreement' => array_get($files, 'cooperation_agreement'), 'cooperation_agreement' => $cooperation_agreement?[$cooperation_agreement]:'',
'other_attachment' => array_get($files, 'other_attachment'), 'other_attachment' => $other_attachment?[$other_attachment]:'',
'create_time' => time(), 'create_time' => time(),
'update_time' => time(), 'update_time' => time(),
'supplier_id' => $supplierId, 'supplier_id' => $supplierId,
......
...@@ -50,4 +50,20 @@ class SupplierAddressService ...@@ -50,4 +50,20 @@ class SupplierAddressService
return $result; return $result;
} }
//保存发货地址
public function saveShippingAddress($supplierId,$address)
{
$supplierModel = new SupplierChannelModel();
$supplierCode = $supplierModel->where('supplier_id', $supplierId)->value('supplier_code');
//组装成两条数据(鬼知道以前为啥存两条)
$shippingData = [
'supplier_id' => $supplierId,
'supplier_code' => $supplierCode,
'address' => $address,
'address_type' => 1,
];
$addressModel = new SupplierAddressModel();
$addressModel->insert($shippingData);
}
} }
\ No newline at end of file
...@@ -73,7 +73,7 @@ class SupplierService ...@@ -73,7 +73,7 @@ class SupplierService
]; ];
$address = array_only($channel, $address = array_only($channel,
['supplier_id', 'shipping_address', 'return_address', 'return_consignee', 'return_phone']); ['supplier_id', 'shipping_address', 'return_address', 'return_consignee', 'return_phone']);
$shippingAddress = array_get($channel, 'shipping_address');
$attachment = $channel['attachment']; $attachment = $channel['attachment'];
unset($channel['hk'], $channel['cn'], $channel['return_phone'], $channel['return_address'], unset($channel['hk'], $channel['cn'], $channel['return_phone'], $channel['return_address'],
$channel['return_consignee'], $channel['shipping_address'], $channel['cn_delivery_time_period'], $channel['return_consignee'], $channel['shipping_address'], $channel['cn_delivery_time_period'],
...@@ -119,11 +119,16 @@ class SupplierService ...@@ -119,11 +119,16 @@ class SupplierService
$contact['admin_id'] = request()->user->userId; $contact['admin_id'] = request()->user->userId;
$contactModel = new SupplierContactModel(); $contactModel = new SupplierContactModel();
$contactModel->insert($contact); $contactModel->insert($contact);
//保存生成的内部编码
$this->saveSupplierCode($supplierId);
//新增的时候也要去添加地址了
$supplierAddressService = new SupplierAddressService();
$supplierAddressService->saveShippingAddress($supplierId, $shippingAddress);
} else { } else {
$supplierId = $this->newSupplierId = $channel['supplier_id']; $supplierId = $this->newSupplierId = $channel['supplier_id'];
//要做进一步判断,部分字段修改不需要审核 //要做进一步判断,部分字段修改不需要审核
$auditService = new SupplierAuditService(); $auditService = new SupplierAuditService();
$needAudit = $auditService->checkNeedAudit($supplierId, $channel,$attachment); $needAudit = $auditService->checkNeedAudit($supplierId, $channel, $attachment);
if ($needAudit) { if ($needAudit) {
$channel['status'] = SupplierChannelModel::STATUS_IN_REVIEW; $channel['status'] = SupplierChannelModel::STATUS_IN_REVIEW;
} }
...@@ -151,8 +156,6 @@ class SupplierService ...@@ -151,8 +156,6 @@ class SupplierService
//保存附件 //保存附件
$attachmentService = new SupplierAttachmentService(); $attachmentService = new SupplierAttachmentService();
$attachmentService->saveAttachment($supplierId, $attachment); $attachmentService->saveAttachment($supplierId, $attachment);
//保存生成的内部编码
$this->saveSupplierCode($supplierId);
//重新生成外部显示的编码 //重新生成外部显示的编码
$this->generateSupplierSn($supplierId, $channel['supplier_group']); $this->generateSupplierSn($supplierId, $channel['supplier_group']);
return true; return true;
......
...@@ -105,7 +105,7 @@ class SupplierShareApplyService ...@@ -105,7 +105,7 @@ class SupplierShareApplyService
//当要判断申请者申请的部门的时候,要复审人为空,因为复审这一步是被申请部门的人审核的 //当要判断申请者申请的部门的时候,要复审人为空,因为复审这一步是被申请部门的人审核的
$q->where('apply_department_id', $departmentId)->where('review_uid', 0)->where('audit_uid', '!=', 0); $q->where('apply_department_id', $departmentId)->where('review_uid', 0)->where('audit_uid', '!=', 0);
})->orderBy('id', 'desc'); })->orderBy('id', 'desc');
$limit = request()->get('limit', 10); $limit = request()->get('limit', 20);
$list = $query->paginate($limit)->toArray(); $list = $query->paginate($limit)->toArray();
$transformer = new SupplierShareApplyTransformer(); $transformer = new SupplierShareApplyTransformer();
$list['data'] = $transformer->transformList($list['data']); $list['data'] = $transformer->transformList($list['data']);
......
...@@ -87,7 +87,7 @@ class SupplierStatisticsService ...@@ -87,7 +87,7 @@ class SupplierStatisticsService
$model = new SupplierChannelModel(); $model = new SupplierChannelModel();
//显示默认的数据(有权限逻辑) //显示默认的数据(有权限逻辑)
$filter = new SupplierFilter(); $filter = new SupplierFilter();
$model = $model->where('supplier_id', '>', 0); $model = $model->where('supplier_code', '!=', '');
return $filter->defaultFilter($model, $type)->count(); return $filter->defaultFilter($model, $type)->count();
} }
} }
\ No newline at end of file
...@@ -45,5 +45,5 @@ Route::group(['middleware' => ['web'], 'namespace' => 'Api'], function () { ...@@ -45,5 +45,5 @@ Route::group(['middleware' => ['web'], 'namespace' => 'Api'], function () {
Route::match(['get', 'post'], '/test', function () { Route::match(['get', 'post'], '/test', function () {
$service = new \App\Http\Services\DataService(); $service = new \App\Http\Services\DataService();
// $service->initSystemTag(); // $service->initSystemTag();
$service->replaceStandardBrandId(); $service->transferFileData();
}); });
...@@ -41,6 +41,14 @@ ...@@ -41,6 +41,14 @@
.layui-table-click { .layui-table-click {
background-color: #ddf2e9 !important; background-color: #ddf2e9 !important;
} }
.list-href {
color: dodgerblue;
}
.list-href:hover {
color: #1417F4;
}
</style> </style>
<body> <body>
<!-- 正文开始 --> <!-- 正文开始 -->
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
, url: '/api/supplier_share_apply/GetAuditSupplierShareApplyList' , url: '/api/supplier_share_apply/GetAuditSupplierShareApplyList'
, method: 'post' , method: 'post'
, size: 'sm' , size: 'sm'
, limit: 10 , limit: 20
, cellMinWidth: 80 //全局定义常规单元格的最小宽度 , cellMinWidth: 80 //全局定义常规单元格的最小宽度
, where: {} , where: {}
, loading: true , loading: true
......
...@@ -168,6 +168,7 @@ ...@@ -168,6 +168,7 @@
parent.layer.msg(res.err_msg, {icon: 6}); parent.layer.msg(res.err_msg, {icon: 6});
} else { } else {
parent.layer.msg(res.err_msg, {icon: 5}); parent.layer.msg(res.err_msg, {icon: 5});
//todo
} }
} }
return false; return false;
......
...@@ -7,8 +7,11 @@ ...@@ -7,8 +7,11 @@
<div class="layui-card-body"> <div class="layui-card-body">
<form class="layui-form" action=""> <form class="layui-form" action="">
<input type="hidden" name="supplier_id" value="{{$supplier['supplier_id']}}"> <input type="hidden" name="supplier_id" value="{{$supplier['supplier_id']}}">
<blockquote class="layui-elem-quote layui-text">
<b>基本信息</b>
</blockquote>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">基本信息 : </label> <label class="layui-form-label">供应商名称 : </label>
<div class="layui-input-block block-42" style="padding-top: 7px"> <div class="layui-input-block block-42" style="padding-top: 7px">
{{$supplier['supplier_name']}} {{$supplier['supplier_name']}}
<a style="color: dodgerblue;margin-left: 20px" <a style="color: dodgerblue;margin-left: 20px"
...@@ -17,8 +20,13 @@ ...@@ -17,8 +20,13 @@
>{{$supplier['supplier_code']}}</a> >{{$supplier['supplier_code']}}</a>
</div> </div>
</div> </div>
<blockquote class="layui-elem-quote layui-text">
<b>注意</b>
<br>
对应供应商设为黑名单后,猎芯将无法与其进行交易,如要再次启用,则须再次走审核流程。
</blockquote>
<div class="layui-form-item layui-form-text"> <div class="layui-form-item layui-form-text">
<label class="layui-form-label">原因说明 : </label> <label class="layui-form-label"><span class="require">*</span> 原因说明 : </label>
<div class="layui-input-block"> <div class="layui-input-block">
<textarea name="block_reason" required placeholder="请填写拉黑原因" class="layui-textarea"></textarea> <textarea name="block_reason" required placeholder="请填写拉黑原因" class="layui-textarea"></textarea>
</div> </div>
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
width: 100%; width: 100%;
z-index: 10; z-index: 10;
} }
.required_field { .required_field {
color: red; color: red;
margin-right: 5px; margin-right: 5px;
...@@ -182,8 +183,8 @@ ...@@ -182,8 +183,8 @@
@endif @endif
{{array_get(config('fixed.FileNameMapping'),$key)}} : {{array_get(config('fixed.FileNameMapping'),$key)}} :
@foreach($item as $k=>$v) @foreach($item as $k=>$v)
<a href="{{$v['url']}}" style="color: dodgerblue" <a href="{{array_get($v,'url')}}" style="color: dodgerblue"
target="_blank">{{$v['file_name']}}</a> | target="_blank">{{array_get($v,'file_name')}}</a> |
@endforeach @endforeach
</div> </div>
@endif @endif
......
...@@ -66,6 +66,16 @@ ...@@ -66,6 +66,16 @@
value="{{$supplier['supplier_address'] or ''}}"> value="{{$supplier['supplier_address'] or ''}}">
</div> </div>
</div> </div>
@if($operate=='add')
<div class="layui-col-md12">
<label class="layui-form-label">发货地址 : </label>
<div class="layui-input-block">
<input type="text" name="shipping_address" id="shipping_address"
placeholder="请输入发货地址" class="layui-input"
value="{{$address['shipping_address'] or ''}}">
</div>
</div>
@endif
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
...@@ -80,7 +90,7 @@ ...@@ -80,7 +90,7 @@
</div> </div>
</div> </div>
<div class="layui-col-md8"> <div class="layui-col-md8">
<label class="layui-form-label" style="width: 80px">成立时间 : <label class="layui-form-label" style="width: 80px"><span class="require">*</span>成立时间 :
</label> </label>
<div class="layui-input-block" style="width: 150px"> <div class="layui-input-block" style="width: 150px">
<input type="text" id="established_time" name="established_time" <input type="text" id="established_time" name="established_time"
......
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