Commit a9b20556 by 杨树贤

供应商临时转正式需要进行复审

parent 50f2a90b
...@@ -19,7 +19,7 @@ class SupplierAuditService ...@@ -19,7 +19,7 @@ class SupplierAuditService
//先找出原来供应商的状态 //先找出原来供应商的状态
$supplierModel = new SupplierChannelModel(); $supplierModel = new SupplierChannelModel();
$supplier = $supplierModel->where('supplier_id', $supplierId)->first()->toArray(); $supplier = $supplierModel->where('supplier_id', $supplierId)->first()->toArray();
//如果需要复审并且审核状态为审核中,则代表这次审核为第一次审核 //如果需要复审并且审核状态为审核中,则代表这次审核为第一次审核或者供应商类型从临时修改为正式
if ($supplier['status'] == SupplierChannelModel::STATUS_IN_REVIEW && $supplier['need_review'] == 1) { if ($supplier['status'] == SupplierChannelModel::STATUS_IN_REVIEW && $supplier['need_review'] == 1) {
//第一次审核,通过是将审核状态置为待复审 //第一次审核,通过是将审核状态置为待复审
//通过 //通过
......
...@@ -160,19 +160,24 @@ class SupplierService ...@@ -160,19 +160,24 @@ class SupplierService
//这里有个逻辑,就是如果供应商类型是临时,那么要打上临时供应商的标签,如果不是,那么就要去掉这个标签 //这里有个逻辑,就是如果供应商类型是临时,那么要打上临时供应商的标签,如果不是,那么就要去掉这个标签
if ($channel['supplier_type'] == SupplierChannelModel::SUPPLIER_TYPE_TEMPORARY) { if ($channel['supplier_type'] == SupplierChannelModel::SUPPLIER_TYPE_TEMPORARY) {
$channel['system_tags'] = explode(',' , $channel['system_tags']); $channel['system_tags'] = explode(',', $channel['system_tags']);
if (!in_array('临时供应商',$channel['system_tags'])) { if (!in_array('临时供应商', $channel['system_tags'])) {
$channel['system_tags'][] = '临时供应商'; $channel['system_tags'][] = '临时供应商';
} }
} else { } else {
$channel['system_tags'] = explode(',' , $channel['system_tags']); $channel['system_tags'] = explode(',', $channel['system_tags']);
foreach ($channel['system_tags'] as $key=>$tag) { foreach ($channel['system_tags'] as $key => $tag) {
if ($tag == '临时供应商') { if ($tag == '临时供应商') {
unset($channel['system_tags'][$key]); unset($channel['system_tags'][$key]);
} }
} }
} }
$channel['system_tags'] = trim(implode(',', $channel['system_tags']),','); //还有个逻辑就是,如果是临时供应商修改成正式供应商,就又要走一次复审
if ($channel['supplier_type'] == SupplierChannelModel::SUPPLIER_TYPE_OFFICIAL &&
$oldSupplier['supplier_type'] == SupplierChannelModel::SUPPLIER_TYPE_TEMPORARY) {
$channel['need_review'] = 1;
}
$channel['system_tags'] = trim(implode(',', $channel['system_tags']), ',');
$model->where('supplier_id', $supplierId)->update($channel); $model->where('supplier_id', $supplierId)->update($channel);
//保存地址 //保存地址
......
...@@ -9,6 +9,7 @@ class SingleSelectPresenter ...@@ -9,6 +9,7 @@ class SingleSelectPresenter
public function render($name, $text, $value = null, $data = [0 => '禁用', 1 => '启用'], $option = []) public function render($name, $text, $value = null, $data = [0 => '禁用', 1 => '启用'], $option = [])
{ {
$isRequired = array_get($option, 'required', false); $isRequired = array_get($option, 'required', false);
$disable = array_get($option, 'disable', false);
$requiredHtml = $isRequired ? '<span style="color: red">*</span>' : ""; $requiredHtml = $isRequired ? '<span style="color: red">*</span>' : "";
$html = <<<EOF $html = <<<EOF
<label class="layui-form-label"> <label class="layui-form-label">
...@@ -16,21 +17,22 @@ class SingleSelectPresenter ...@@ -16,21 +17,22 @@ class SingleSelectPresenter
$text $text
</label> </label>
<div class="layui-input-block"> <div class="layui-input-block">
{$this->itemRender($data,$name, $value)} {$this->itemRender($data, $name, $value, $disable)}
</div> </div>
EOF; EOF;
return $html; return $html;
} }
public function itemRender($data,$name, $value) public function itemRender($data, $name, $value, $disable)
{ {
$checked = ''; $checked = '';
$itemsHtml = ''; $itemsHtml = '';
$disabled = $disable ? 'disabled' : '';
foreach ($data as $v => $item) { foreach ($data as $v => $item) {
if ($value !== null) { if ($value !== null) {
$checked = ($v == $value) ? "checked" : ''; $checked = ($v == $value) ? "checked" : '';
} }
$itemsHtml = $itemsHtml . "<input type='radio' lay-filter='${name}' name='${name}' value='${v}' title='${item}' $checked>"; $itemsHtml = $itemsHtml . "<input type='radio' lay-filter='${name}' name='${name}' value='${v}' title='${item}' $checked $disabled>";
} }
return $itemsHtml; return $itemsHtml;
} }
......
...@@ -17,9 +17,16 @@ ...@@ -17,9 +17,16 @@
@if($operate=='add') @if($operate=='add')
<form class="layui-form" action=""> <form class="layui-form" action="">
@endif @endif
<?php
$option = ['required' => true];
//正式供应商不允许修改供应商类型了
if (!empty($supplier) && $supplier['supplier_type'] == \App\Model\SupplierChannelModel::SUPPLIER_TYPE_OFFICIAL) {
$option['disable'] = true;
}
?>
<div class="layui-form-item"> <div class="layui-form-item">
@inject('singleSelectPresenter','App\Presenters\SingleSelectPresenter') @inject('singleSelectPresenter','App\Presenters\SingleSelectPresenter')
{!! $singleSelectPresenter->render('supplier_type','供应商类别',!empty($supplier)?array_get($supplier,'supplier_type',0):'1',config('field.SupplierType'),['required'=>true]) !!} {!! $singleSelectPresenter->render('supplier_type','供应商类别',!empty($supplier)?array_get($supplier,'supplier_type',0):'1',config('field.SupplierType'),$option) !!}
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label"><span class="require">*</span>供应商名称 : </label> <label class="layui-form-label"><span class="require">*</span>供应商名称 : </label>
......
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