Commit 105b40a5 by mushishixian

自动转正

parent 6640143b
...@@ -298,6 +298,7 @@ class SupplierApiController extends Controller ...@@ -298,6 +298,7 @@ class SupplierApiController extends Controller
} }
//批量修改渠道开发员 //批量修改渠道开发员
//修改后自动触发转正,资料不完善,进入待审核
public function BatchAllocatePurchaseUser($request) public function BatchAllocatePurchaseUser($request)
{ {
$purchaseUid = $request->get('purchase_uid'); $purchaseUid = $request->get('purchase_uid');
......
...@@ -107,7 +107,7 @@ class SupplierFilter ...@@ -107,7 +107,7 @@ class SupplierFilter
$canViewAllSupplier = checkPerm('ViewAllSupplier'); $canViewAllSupplier = checkPerm('ViewAllSupplier');
$canViewSubordinateSupplier = checkPerm('ViewSubordinateSupplier'); $canViewSubordinateSupplier = checkPerm('ViewSubordinateSupplier');
$canViewFakeSupplier = checkPerm('ViewFakeSupplier'); $canViewFakeSupplier = checkPerm('ViewFakeSupplier');
//现在普通采购也能看到竞调供应商了(与他有关的)
if (!$canViewFakeSupplier) { if (!$canViewFakeSupplier) {
$query->where('is_type', 0); $query->where('is_type', 0);
} }
...@@ -189,11 +189,13 @@ class SupplierFilter ...@@ -189,11 +189,13 @@ class SupplierFilter
case "no_purchase_uid": case "no_purchase_uid":
//没有渠道开发 //没有渠道开发
$query->where('status', '!=', SupplierChannelModel::STATUS_DISABLE) $query->where('status', '!=', SupplierChannelModel::STATUS_DISABLE)
->where('status', '!=', SupplierChannelModel::STATUS_BLOCK)
->where('purchase_uid', ''); ->where('purchase_uid', '');
break; break;
case "no_channel_uid": case "no_channel_uid":
//没有渠道开发 //没有采购员
$query->where('status', '!=', SupplierChannelModel::STATUS_DISABLE) $query->where('status', '!=', SupplierChannelModel::STATUS_DISABLE)
->where('status', '!=', SupplierChannelModel::STATUS_BLOCK)
->where('channel_uid', ''); ->where('channel_uid', '');
break; break;
case "invalid_channel_uid": case "invalid_channel_uid":
...@@ -250,12 +252,14 @@ class SupplierFilter ...@@ -250,12 +252,14 @@ class SupplierFilter
//联系人待完善 //联系人待完善
case "contact_no_complete": case "contact_no_complete":
$query->whereHas('contact', function ($q) { $query->whereHas('contact', function ($q) {
$q->where('supplier_consignee', '') $q->where('can_check_uids', request()->user->codeId)->where(function ($subQuery) {
$subQuery->where('supplier_consignee', '')
->orWhere('supplier_position', '') ->orWhere('supplier_position', '')
->orWhere('supplier_email', '') ->orWhere('supplier_email', '')
->orWhere('supplier_mobile', '') ->orWhere('supplier_mobile', '')
->orWhere('supplier_telephone', ''); ->orWhere('supplier_telephone', '');
}); });
});
break; break;
} }
return $query; return $query;
......
...@@ -251,6 +251,7 @@ class SupplierService ...@@ -251,6 +251,7 @@ class SupplierService
//分配开发员 //分配开发员
public function allocatePurchaseUser($supplierId, $purchaseUid) public function allocatePurchaseUser($supplierId, $purchaseUid)
{ {
$result = DB::connection('web')->transaction(function () use ($supplierId, $purchaseUid) {
$model = new SupplierChannelModel(); $model = new SupplierChannelModel();
$supplier = $model->where('supplier_id', $supplierId)->first(); $supplier = $model->where('supplier_id', $supplierId)->first();
$supplier = $supplier ? $supplier->toArray() : []; $supplier = $supplier ? $supplier->toArray() : [];
...@@ -269,6 +270,8 @@ class SupplierService ...@@ -269,6 +270,8 @@ class SupplierService
'to_follow_up' => 1, 'to_follow_up' => 1,
]); ]);
} }
//判断是否是非正式供应商,如果是,自动转正,并且修改为待审核状态
$this->autoChangeIsType($supplier);
} }
//还要去记录日志 //还要去记录日志
...@@ -282,6 +285,8 @@ class SupplierService ...@@ -282,6 +285,8 @@ class SupplierService
$logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '分配渠道开发员', $content); $logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '分配渠道开发员', $content);
} }
});
return $result; return $result;
} }
...@@ -297,6 +302,7 @@ class SupplierService ...@@ -297,6 +302,7 @@ class SupplierService
//分配采购员 //分配采购员
public function allocateChannelUser($supplierId, $channelUid) public function allocateChannelUser($supplierId, $channelUid)
{ {
$result = DB::connection('web')->transaction(function () use ($supplierId, $channelUid) {
$model = new SupplierChannelModel(); $model = new SupplierChannelModel();
$supplier = $model->where('supplier_id', $supplierId)->first(); $supplier = $model->where('supplier_id', $supplierId)->first();
$supplier = $supplier ? $supplier->toArray() : []; $supplier = $supplier ? $supplier->toArray() : [];
...@@ -318,6 +324,8 @@ class SupplierService ...@@ -318,6 +324,8 @@ class SupplierService
$contactResult = $contactModel->insert($contact); $contactResult = $contactModel->insert($contact);
} }
if ($contactResult) { if ($contactResult) {
//判断是否是非正式供应商,如果是,自动转正,并且修改为待审核状态
$this->autoChangeIsType($supplier);
//记录日志 //记录日志
$adminUserService = new AdminUserService(); $adminUserService = new AdminUserService();
$channelUser = $adminUserService->getAdminUserInfoByCodeId($channelUid); $channelUser = $adminUserService->getAdminUserInfoByCodeId($channelUid);
...@@ -326,9 +334,11 @@ class SupplierService ...@@ -326,9 +334,11 @@ class SupplierService
$content = "添加采购员 : " . $channelUserName; $content = "添加采购员 : " . $channelUserName;
$logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '添加采购员', $content); $logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '添加采购员', $content);
} }
return $contactResult;
});
$syncService = new SyncSupplierService(); $syncService = new SyncSupplierService();
$syncService->syncSupplierToErp($supplierId); $syncService->syncSupplierToErp($supplierId);
return $contactResult; return $result;
} }
//判断并且修改待跟进 //判断并且修改待跟进
...@@ -403,4 +413,17 @@ class SupplierService ...@@ -403,4 +413,17 @@ class SupplierService
} }
return true; return true;
} }
//判断是否自动转正,并且还要修改为待审核状态给相关人员进行补充资料
public function autoChangeIsType($supplier)
{
if ($supplier['is_type'] == 1) {
$model = new SupplierChannelModel();
$model->where('supplier_id', $supplier['supplier_id'])->update([
'update_time' => time(),
'status' => 0,
'is_type' => 0
]);
}
}
} }
\ No newline at end of file
...@@ -52,6 +52,11 @@ return [ ...@@ -52,6 +52,11 @@ return [
'SkuMode' => [ 'SkuMode' => [
1 => '原厂直供', 1 => '原厂直供',
2 => '国内现货', 2 => '国内现货',
3 => '国际现货',
4 => '猎芯期货',
5 => '海外代购',
6 => '线下现货',
7 => '猎芯自营',
], ],
'SupplierAccountType' => [ 'SupplierAccountType' => [
......
...@@ -10,21 +10,18 @@ ...@@ -10,21 +10,18 @@
</blockquote> </blockquote>
<table class="layui-table"> <table class="layui-table">
<colgroup> <colgroup>
<col width="300"> <col>
<col width="100">
<col> <col>
</colgroup> </colgroup>
<thead> <thead>
<tr> <tr>
<th>供应商名称</th> <th>供应商名称</th>
<th>当前渠道开发员</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach($suppliers as $supplier) @foreach($suppliers as $supplier)
<tr> <tr>
<td>{{$supplier['supplier_name']}}</td> <td>{{$supplier['supplier_name']}}</td>
<td>{{$supplier['purchase_username']}}</td>
</tr> </tr>
@endforeach @endforeach
</tbody> </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