Commit 64cb897c by mushishixian

取消禁用

parent 8b6d97e4
...@@ -147,20 +147,17 @@ class SupplierApiController extends Controller ...@@ -147,20 +147,17 @@ class SupplierApiController extends Controller
//禁用不是直接修改为无法交易,而是改为审核中,然后审核通过后,变成无法交易 //禁用不是直接修改为无法交易,而是改为审核中,然后审核通过后,变成无法交易
$supplierId = $request->get('supplier_id'); $supplierId = $request->get('supplier_id');
$model = new SupplierChannelModel(); $model = new SupplierChannelModel();
$redis = new RedisModel();
//存到redis做数据对比
$redis->hset('audit_disable_supplier_list', $supplierId, 1);
$result = $model->where('supplier_id', $supplierId)->update([ $result = $model->where('supplier_id', $supplierId)->update([
'update_time' => time(), 'update_time' => time(),
'status' => $model::STATUS_IN_REVIEW, 'status' => $model::STATUS_DISABLE,
]); ]);
if ($result) { if ($result) {
//写日志 //写日志
$logService = new LogService(); $logService = new LogService();
$logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '禁用', '禁用供应商'); $logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '禁用', '禁用供应商');
$this->response(0, '操作成功,进入审核状态'); $this->response(0, '禁用成功');
} else { } else {
$this->response(-1, '操作失败,进入审核状态'); $this->response(-1, '禁用失败');
} }
} }
...@@ -446,4 +443,22 @@ class SupplierApiController extends Controller ...@@ -446,4 +443,22 @@ class SupplierApiController extends Controller
$this->response(-1, '取消拉黑操作失败'); $this->response(-1, '取消拉黑操作失败');
} }
} }
//取消禁用供应商
public function CancelDisableSupplier($request)
{
$supplierId = $request->get('supplier_id');
$channelModel = new SupplierChannelModel();
$result = $channelModel->where('supplier_id', $supplierId)->update([
'status' => 2,
'update_time' => time(),
]);
if ($result) {
$logService = new LogService();
$logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '取消禁用', '取消禁用供应商');
$this->response(0, '取消禁用成功');
} else {
$this->response(-1, '取消禁用操作失败');
}
}
} }
...@@ -13,19 +13,6 @@ class SupplierAuditService ...@@ -13,19 +13,6 @@ class SupplierAuditService
public function auditSupplier($supplierId, $status, $rejectReason) public function auditSupplier($supplierId, $status, $rejectReason)
{ {
$model = new SupplierChannelModel(); $model = new SupplierChannelModel();
//判断当前要审核的供应商是不是想要被禁用的
//因为想要禁用,需要审核后才能禁用的,不能直接修改成禁用
//要找个地方存起来是不是想要禁用
$redis = new RedisModel();
$disableExist = $redis->hget('audit_disable_supplier_list', $supplierId);
if ($disableExist) {
if ($status == SupplierChannelModel::STATUS_PASSED) {
$status = SupplierChannelModel::STATUS_DISABLE;
} else {
//因为只有通过状态的供应商才能发起禁用审核,所以拒绝禁用申请,自然会变回启用状态
$status = SupplierChannelModel::STATUS_PASSED;
}
}
//先找出原来供应商的状态 //先找出原来供应商的状态
$supplierModel = new SupplierChannelModel(); $supplierModel = new SupplierChannelModel();
...@@ -73,22 +60,14 @@ class SupplierAuditService ...@@ -73,22 +60,14 @@ class SupplierAuditService
]); ]);
} }
if ($disableExist) {
$redis->hdel('audit_disable_supplier_list', $supplierId);
}
$action = '审核供应商'; $action = '审核供应商';
if ($result) { if ($result) {
//记录日志 //如果状态是复审
if ($disableExist) { if ($supplier['status'] == SupplierChannelModel::STATUS_NEED_REVIEW) {
$auditStatus = $status == SupplierChannelModel::STATUS_DISABLE ? '审核通过,禁用供应商' : '审核不通过,原因是 : ' . $rejectReason; $auditStatus = $status == SupplierChannelModel::STATUS_PASSED ? '复审通过' : '复审不通过,原因是 : ' . $rejectReason;
$action = '复审供应商';
} else { } else {
//如果状态是复审 $auditStatus = $status == SupplierChannelModel::STATUS_PASSED ? '审核通过' : '审核不通过,原因是 : ' . $rejectReason;
if ($supplier['status'] == SupplierChannelModel::STATUS_NEED_REVIEW) {
$auditStatus = $status == SupplierChannelModel::STATUS_PASSED ? '复审通过' : '复审不通过,原因是 : ' . $rejectReason;
$action = '复审供应商';
} else {
$auditStatus = $status == SupplierChannelModel::STATUS_PASSED ? '审核通过' : '审核不通过,原因是 : ' . $rejectReason;
}
} }
$logService = new LogService(); $logService = new LogService();
$content = $auditStatus; $content = $auditStatus;
......
...@@ -29,6 +29,21 @@ ...@@ -29,6 +29,21 @@
}); });
}); });
//取消禁用
$('#cancel_disable_supplier').click(function () {
layer.confirm('确定要取消禁用当前供应商吗?', function (index) {
let supplierId = getQueryVariable('supplier_id');
let res = ajax('/api/supplier/CancelDisableSupplier', {supplier_id: supplierId, is_type: 0})
if (res.err_code === 0) {
layer.closeAll();
layer.msg(res.err_msg, {icon: 6})
location.reload();
} else {
layer.msg(res.err_msg, {icon: 5})
}
});
});
{{--index.setTabTitle('供应商详情 - {{$supplier['supplier_code'] or ''}}');--}} {{--index.setTabTitle('供应商详情 - {{$supplier['supplier_code'] or ''}}');--}}
function openLogView() { function openLogView() {
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
{field: 'has_sku', title: 'SKU上传', align: 'center', width: 80}, {field: 'has_sku', title: 'SKU上传', align: 'center', width: 80},
{ {
field: 'status_name', title: '状态', align: 'center', width: 70, templet: function (data) { field: 'status_name', title: '状态', align: 'center', width: 80, templet: function (data) {
if (data.status === 3) { if (data.status === 3) {
return "<span style='color: red' title='" + data.reject_reason + "'>" + data.status_name + "</span>" return "<span style='color: red' title='" + data.reject_reason + "'>" + data.status_name + "</span>"
} else if (data.status === -3) { } else if (data.status === -3) {
...@@ -378,7 +378,7 @@ ...@@ -378,7 +378,7 @@
return; return;
} }
if ((status === 3 || status === 2) && !hasSku) { if ((status === 3 || status === 2) && !hasSku) {
layer.confirm('对应供应商设为禁用并且审核通过后,猎芯将无法与其进行交易,如要再次启用,则须再次走入驻流程,是否执行当前操作?', function (index) { layer.confirm('确定要禁用该供应商吗?', function (index) {
let supplierId = data[0].supplier_id; let supplierId = data[0].supplier_id;
let res = ajax('/api/supplier/DisableSupplier', {supplier_id: supplierId}) let res = ajax('/api/supplier/DisableSupplier', {supplier_id: supplierId})
if (res.err_code === 0) { if (res.err_code === 0) {
......
...@@ -63,9 +63,11 @@ ...@@ -63,9 +63,11 @@
style="margin-bottom: 25px;margin-top: 5px" class="layui-btn layui-btn">修改</a> style="margin-bottom: 25px;margin-top: 5px" class="layui-btn layui-btn">修改</a>
@endif @endif
@if($supplier['status']==\App\Model\SupplierChannelModel::STATUS_DISABLE) @if($supplier['status']==\App\Model\SupplierChannelModel::STATUS_DISABLE)
<a id="updateSupplierUrl" @if (checkPerm('CancelDisableSupplier'))
href="/supplier/UpdateSupplier?view=iframe&supplier_id={{$supplier['supplier_id']}}" <button id="cancel_disable_supplier"
style="margin-bottom: 25px;margin-top: 5px" class="layui-btn layui-btn">申请重新入驻</a> style="margin-bottom: 25px;margin-top: 5px" class="layui-btn layui-btn">取消禁用</button>
@endif
@endif @endif
@if($supplier['status']==\App\Model\SupplierChannelModel::STATUS_IN_REVIEW) @if($supplier['status']==\App\Model\SupplierChannelModel::STATUS_IN_REVIEW)
<button type="button" style="margin-bottom: 25px;margin-top: 5px" <button type="button" style="margin-bottom: 25px;margin-top: 5px"
......
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