Commit 0ca7b31c by 杨树贤

区分

parent 8d60a8e8
......@@ -257,7 +257,6 @@ class SupplierApiController extends Controller
public function DisableSupplier($request)
{
//禁用不是直接修改为无法交易,而是改为审核中,然后审核通过后,变成无法交易
$supplierId = $request->get('supplier_id');
$disableReason = trim($request->get('disable_reason'));
if (empty($disableReason)) {
......@@ -271,7 +270,7 @@ class SupplierApiController extends Controller
$result = $model->where('supplier_id', $supplierId)->update([
'update_time' => time(),
'status' => $model::STATUS_DISABLE,
'disable_reason' => $disableReason,
'disable_reason' => '人工禁用:' . $disableReason,
]);
if ($result) {
//写日志
......@@ -811,4 +810,17 @@ class SupplierApiController extends Controller
}
$this->response(0, '修改供应商名称成功,请等待一体化再次审核');
}
//清空线上采购员
public function resetYunxinChannelUser($request)
{
$supplierId = $request->get('supplier_id');
$supplierService = new SupplierService();
$result = $supplierService->resetYunxinChannelUser($supplierId);
if ($result) {
$this->response(0, '清空线上采购员成功');
} else {
$this->response(-1, '清空线上采购员失败');
}
}
}
......@@ -983,4 +983,17 @@ class SupplierService
}
return $data;
}
//清空线上采购员
public function resetYunxinChannelUser($supplierId)
{
$result = SupplierChannelModel::where('supplier_id', $supplierId)->update([
'yunxin_channel_uid' => '',
'update_time' => time(),
]);
//还要记录日志
$logService = new LogService();
$logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '清空线上采购员', '清空线上采购员');
return $result;
}
}
......@@ -296,6 +296,13 @@ class SyncSupplierService
foreach ($suppliers as $supplier) {
//判断是否是同名多供应商,如果是的话,如果是之前已经禁用的,则直接跳过
if (count($suppliers) > 1) {
//判断是否是人工禁用的,是的话,也跳过
//线上数据,实体名单状态为普通,且供应商状态为禁止交易的,全部为手动禁用;
if (strpos($supplier['disable_reason'], '人工禁用:') !== false || ($supplier['status'] == SupplierChannelModel::STATUS_DISABLE && $supplier['is_entity'] != SupplierChannelModel::IS_ENTITY_FALSE)) {
Log::warning("检测到同名供应商并且属于禁用(人工禁用)状态,跳过,供应商id为 : " . $supplier['supplier_id']);
continue;
}
if ($supplier['status'] == SupplierChannelModel::STATUS_DISABLE && $supplier['is_entity'] != SupplierChannelModel::IS_ENTITY_NEED_CONFIRM) {
Log::warning("检测到同名供应商并且属于禁用(实体名单不为待处理)状态,跳过,供应商id为 : " . $supplier['supplier_id']);
continue;
......
......@@ -4,6 +4,49 @@
let form = layui.form;
let table = layui.table
let element = layui.element;
$(document).on('click', '.reset-yunxin-channel-user', function() {
var that = $(this);
var index = layer.confirm('确定要清空该供应商的线上采购员吗?', {
btn: ['确定', '取消'] //按钮
}, function() {
admin.showLoading({
type: 3
});
let supplierId = that.attr('data-id');
let url = '/api/supplier/ResetYunxinChannelUser?supplier_id=' + supplierId;
$.ajax({
url: url
, type: 'GET'
, async: true
, dataType: 'json'
, timeout: 20000
, success: function(res) {
admin.removeLoading();
if (res.err_code === 0) {
parent.layer.msg(res.err_msg, {
icon: 6
});
window.location.reload();
} else {
parent.layer.msg(res.err_msg, {
icon: 5
});
}
}
, error: function() {
admin.removeLoading();
parent.layer.msg('网络错误', {
icon: 5
});
}
});
return false;
});
});
form.on('submit(allocate)', function (data) {
admin.showLoading({
type: 3
......@@ -37,4 +80,4 @@
admin.closeThisDialog();
});
});
</script>
\ No newline at end of file
</script>
......@@ -37,7 +37,7 @@
<colgroup>
<col width="300">
<col width="500">
<col width="100">
<col width="120">
<col>
</colgroup>
<thead>
......@@ -52,7 +52,11 @@
<tr>
<td>{{$supplier['supplier_name']}}</td>
<td>{{$supplier['channel_username']}}</td>
<td>{{$supplier['yunxin_channel_username']}} <button class="layui-btn layui-btn-xs" lay-submit lay-filter="delete">清空</button></td>
<td>{{$supplier['yunxin_channel_username']}}
@if($supplier['yunxin_channel_username'] != '')
<button class="layui-btn layui-btn-xs reset-yunxin-channel-user" data-id="{{$supplier['supplier_id']}}" style="float: right;">清空</button>
@endif
</td>
</tr>
@endforeach
</tbody>
......
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