Commit 81e404f5 by 杨树贤

禁用理由

parent 31cd327c
...@@ -218,6 +218,10 @@ class SupplierApiController extends Controller ...@@ -218,6 +218,10 @@ class SupplierApiController extends Controller
{ {
//禁用不是直接修改为无法交易,而是改为审核中,然后审核通过后,变成无法交易 //禁用不是直接修改为无法交易,而是改为审核中,然后审核通过后,变成无法交易
$supplierId = $request->get('supplier_id'); $supplierId = $request->get('supplier_id');
$disableReason = $request->get('disable_reason');
if (empty($disableReason)) {
$this->response(-1, '禁用理由必填');
}
$model = new SupplierChannelModel(); $model = new SupplierChannelModel();
//先保存原来的状态 //先保存原来的状态
$supplier = $model->where('supplier_id', $supplierId)->first()->toArray(); $supplier = $model->where('supplier_id', $supplierId)->first()->toArray();
...@@ -226,6 +230,7 @@ class SupplierApiController extends Controller ...@@ -226,6 +230,7 @@ class SupplierApiController extends Controller
$result = $model->where('supplier_id', $supplierId)->update([ $result = $model->where('supplier_id', $supplierId)->update([
'update_time' => time(), 'update_time' => time(),
'status' => $model::STATUS_DISABLE, 'status' => $model::STATUS_DISABLE,
'disable_reason' => $disableReason,
]); ]);
if ($result) { if ($result) {
//写日志 //写日志
......
...@@ -330,6 +330,16 @@ class SupplierController extends Controller ...@@ -330,6 +330,16 @@ class SupplierController extends Controller
return $this->view('加入黑名单'); return $this->view('加入黑名单');
} }
//禁用供应商
public function DisableSupplier($request)
{
$supplierId = $request->get('supplier_id');
$supplierModel = new SupplierChannelModel();
$supplier = $supplierModel->where('supplier_id', $supplierId)->first()->toArray();
$this->data['supplier'] = $supplier;
return $this->view('禁用供应商');
}
//导出供应商详情表格 //导出供应商详情表格
public function PrintSupplier($request) public function PrintSupplier($request)
{ {
......
...@@ -88,9 +88,8 @@ class SupplierContactService ...@@ -88,9 +88,8 @@ class SupplierContactService
$newContact = $model->where('contact_id', $contactId)->first()->toArray(); $newContact = $model->where('contact_id', $contactId)->first()->toArray();
if ($result) { if ($result) {
//如果修改的只是qq和传真,则不需要转成审核
$needAudit = $this->checkNeedAudit($oldContact, $newContact); $needAudit = $this->checkNeedAudit($oldContact, $newContact);
if ($needAudit || empty($contact['contact_id'])) { if ($needAudit) {
//修改供应商为审核状态 //修改供应商为审核状态
$supplierModel->where('supplier_id', $contact['supplier_id'])->update([ $supplierModel->where('supplier_id', $contact['supplier_id'])->update([
'update_time' => time(), 'update_time' => time(),
...@@ -138,6 +137,7 @@ class SupplierContactService ...@@ -138,6 +137,7 @@ class SupplierContactService
return false; return false;
} }
$diff = array_merge(array_diff($oldContact, $newContact), array_diff($newContact, $oldContact)); $diff = array_merge(array_diff($oldContact, $newContact), array_diff($newContact, $oldContact));
unset($diff['update_time']); unset($diff['update_time']);
$changeField = array_keys($diff); $changeField = array_keys($diff);
......
...@@ -5,21 +5,32 @@ ...@@ -5,21 +5,32 @@
let table = layui.table let table = layui.table
let element = layui.element; let element = layui.element;
form.on('submit(auditSupplier)', function (data) { form.on('submit(auditSupplier)', function (data) {
admin.btnLoading('.submit-loading'); admin.showLoading({
type: 3
});
let supplierIds = getQueryVariable('supplier_ids'); let supplierIds = getQueryVariable('supplier_ids');
let url = '/api/supplier/BatchAllocatePurchaseUser?supplier_ids=' + supplierIds; let url = '/api/supplier/BatchAllocatePurchaseUser?supplier_ids=' + supplierIds;
let res = ajax(url, data.field); $.ajax({
if (!res) { url: url,
layer.msg('网络错误,请重试', {icon: 6}); type: 'GET',
} else { async: true,
if (res.err_code === 0) { data: data.field,
admin.closeThisDialog(); dataType: 'json',
parent.layer.msg(res.err_msg, {icon: 6}); timeout: 20000,
} else { success: function (res) {
admin.btnLoading('.submit-loading',false); admin.removeLoading();
parent.layer.msg(res.err_msg, {icon: 5}); if (res.err_code === 0) {
admin.closeThisDialog();
parent.layer.msg(res.err_msg, {icon: 6});
} else {
parent.layer.msg(res.err_msg, {icon: 5});
}
},
error: function () {
admin.removeLoading();
parent.layer.msg('网络错误', {icon: 5});
} }
} });
return false; return false;
}); });
form.on('submit(cancel)', function (data) { form.on('submit(cancel)', function (data) {
......
<script>
layui.use(['table', 'form', 'element', 'layer','admin'], function () {
let admin = layui.admin;
let form = layui.form;
form.on('submit(blockSupplier)', function (data) {
let supplierId = getQueryVariable('supplier_id');
let url = '/api/supplier/DisableSupplier?supplier_id=' + supplierId;
let res = ajax(url, data.field);
if (!res) {
layer.msg('网络错误,请重试', {icon: 6});
} else {
if (res.err_code === 0) {
admin.closeThisDialog();
parent.layer.msg(res.err_msg, {icon: 6});
} else {
parent.layer.msg(res.err_msg, {icon: 5});
}
}
return false;
});
form.on('submit(cancel)', function (data) {
admin.closeThisDialog();
});
});
</script>
\ No newline at end of file
...@@ -155,6 +155,9 @@ ...@@ -155,6 +155,9 @@
} else { } else {
return data.status_name; return data.status_name;
} }
switch (data.status){
case 3:
}
} }
}, },
{field: 'channel_username', title: '采购员', align: 'center', width: 130}, {field: 'channel_username', title: '采购员', align: 'center', width: 130},
...@@ -492,17 +495,16 @@ ...@@ -492,17 +495,16 @@
return; return;
} }
if ((status === 3 || status === 2 || status === 0) && !hasSku) { if ((status === 3 || status === 2 || status === 0) && !hasSku) {
layer.confirm('确定要禁用该供应商吗?', function (index) { let supplierId = data[0].supplier_id;
let supplierId = data[0].supplier_id; layer.open({
let res = ajax('/api/supplier/DisableSupplier', {supplier_id: supplierId}) type: 2,
if (res.err_code === 0) { content: '/supplier/DisableSupplier?view=iframe&supplier_id=' + supplierId,
area: ['700px', '70%'],
title: '禁用供应商',
end: function () {
saveRefreshData('detail', supplierId) saveRefreshData('detail', supplierId)
table.reload('list') table.reload('list');
supplierStatistics(); supplierStatistics();
layer.closeAll();
layer.msg(res.err_msg, {icon: 6})
} else {
layer.msg(res.err_msg, {icon: 5})
} }
}); });
} else { } else {
......
<style>
.layui-form-item {
margin-bottom: 5px;
}
</style>
<div class="layui-card">
<div class="layui-card-body">
<form class="layui-form" action="">
<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">
<label class="layui-form-label">供应商名称 : </label>
<div class="layui-input-block block-42" style="padding-top: 7px">
{{$supplier['supplier_name']}}
<a style="color: dodgerblue;margin-left: 20px"
ew-href="/supplier/SupplierDetail?view=iframe&supplier_id={{$supplier['supplier_id']}}"
ew-title='供应商详情 - {{$supplier['supplier_code']}}'
>{{$supplier['supplier_code']}}</a>
</div>
</div>
<blockquote class="layui-elem-quote layui-text">
<b>注意</b>
<br>
对应供应商设为禁用后,猎芯将无法与其进行交易,如要再次启用,则须再次走审核流程。
</blockquote>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label"><span class="require">*</span> 原因说明 : </label>
<div class="layui-input-block">
<textarea name="disable_reason" required placeholder="请填写禁用原因" class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item">
<div align="center" style="margin-top: 20px;text-align: right">
<button type="button" class="layui-btn layui-btn-sm layui-btn-info submit-loading" lay-submit
lay-filter="blockSupplier">确认
</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" lay-submit
lay-filter="cancel">取消
</button>
</div>
</div>
</form>
</div>
</div>
\ No newline at end of file
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