Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f8fffe03
authored
May 18, 2026
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
部分接口
parent
476536a7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
59 deletions
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Controllers/Api/SupplierCrmApiController.php
app/Http/routes.php
resources/views/script/ConfirmCrmSupplierScript.blade.php
app/Http/Controllers/Api/SupplierApiController.php
View file @
f8fffe03
...
...
@@ -301,64 +301,6 @@ class SupplierApiController extends Controller
}
}
//转化供应商确认
public
function
ConfirmCrmSupplier
(
$request
)
{
$supplierId
=
$request
->
get
(
'supplier_id'
);
$auditOpinion
=
$request
->
get
(
'audit_opinion'
);
// agree / disagree
$remark
=
trim
(
$request
->
get
(
'remark'
,
''
));
if
(
empty
(
$auditOpinion
))
{
$this
->
response
(
-
1
,
'必须选择一个审核意见'
);
}
if
(
$auditOpinion
==
'disagree'
&&
empty
(
$remark
))
{
$this
->
response
(
-
1
,
'请填写原因说明'
);
}
$model
=
new
SupplierChannelModel
();
$supplier
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
first
();
if
(
empty
(
$supplier
))
{
$this
->
response
(
-
1
,
'供应商不存在'
);
}
$supplier
=
$supplier
->
toArray
();
// 前置条件校验:状态必须为待确认(4)且来源为CRM客户转化(2)
if
(
$supplier
[
'status'
]
!=
SupplierChannelModel
::
STATUS_CONFIRM
||
$supplier
[
'supplier_source'
]
!=
SupplierChannelModel
::
SUPPLIER_SOURCE_CRM
)
{
$this
->
response
(
-
1
,
'该供应商不满足转化条件(须为待确认状态且来源为CRM客户转化)'
);
}
$approverName
=
$request
->
user
->
name
;
try
{
if
(
$auditOpinion
==
'agree'
)
{
// 同意:状态改为待提审(0)
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'status'
=>
SupplierChannelModel
::
STATUS_PENDING
,
'update_time'
=>
time
(),
]);
$approveResult
=
'agree'
;
}
else
{
// 不同意:状态保持待确认(4)
$approveResult
=
'disagree'
;
}
// 记录日志
$logService
=
new
LogService
();
$logContent
=
'转化供应商确认 - 审核意见: '
.
(
$auditOpinion
==
'agree'
?
'同意'
:
'不同意'
)
.
(
$remark
?
', 原因说明: '
.
$remark
:
''
);
$logService
->
AddLog
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
,
'转化供应商确认'
,
$logContent
);
// 回传CRM系统:审批人、审批结果、附加说明
$supplierName
=
$supplier
[
'supplier_name'
];
CrmService
::
confirmCrmSupplier
(
$supplierName
,
$approverName
,
$approveResult
,
$remark
);
$this
->
response
(
0
,
'操作成功'
);
}
catch
(
\Exception
$e
)
{
$this
->
response
(
-
1
,
'操作失败: '
.
$e
->
getMessage
());
}
}
//修改状态(禁用,启用(审核通过),驳回,草稿,取消黑名单)
public
function
ChangeSupplierStatus
(
$request
)
{
...
...
app/Http/Controllers/Api/SupplierCrmApiController.php
0 → 100644
View file @
f8fffe03
<?php
namespace
App\Http\Controllers\Api
;
use
Exception
;
use
App\Model\LogModel
;
use
Illuminate\Http\Request
;
use
App\Http\Services\CrmService
;
use
App\Http\Services\LogService
;
use
App\Model\SupplierChannelModel
;
use
App\Http\Controllers\Controller
;
//CRM转移供应商相关接口
class
SupplierCrmApiController
extends
Controller
{
public
function
Entrance
(
Request
$request
,
$id
)
{
$this
->
$id
(
$request
,
$id
);
}
//转化供应商确认
public
function
ConfirmCrmSupplier
(
$request
)
{
$supplierId
=
$request
->
get
(
'supplier_id'
);
$auditOpinion
=
$request
->
get
(
'audit_opinion'
);
// agree / disagree
$remark
=
trim
(
$request
->
get
(
'remark'
,
''
));
if
(
empty
(
$auditOpinion
))
{
$this
->
response
(
-
1
,
'必须选择一个审核意见'
);
}
if
(
$auditOpinion
==
'disagree'
&&
empty
(
$remark
))
{
$this
->
response
(
-
1
,
'请填写原因说明'
);
}
$model
=
new
SupplierChannelModel
();
$supplier
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
first
();
if
(
empty
(
$supplier
))
{
$this
->
response
(
-
1
,
'供应商不存在'
);
}
$supplier
=
$supplier
->
toArray
();
// 前置条件校验:状态必须为待确认(4)且来源为CRM客户转化(2)
if
(
$supplier
[
'status'
]
!=
SupplierChannelModel
::
STATUS_CONFIRM
||
$supplier
[
'supplier_source'
]
!=
SupplierChannelModel
::
SUPPLIER_SOURCE_CRM
)
{
$this
->
response
(
-
1
,
'该供应商不满足转化条件(须为待确认状态且来源为CRM客户转化)'
);
}
$approverName
=
$request
->
user
->
name
;
try
{
if
(
$auditOpinion
==
'agree'
)
{
// 同意:状态改为待提审(0)
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'status'
=>
SupplierChannelModel
::
STATUS_PENDING
,
'update_time'
=>
time
(),
]);
$approveResult
=
'agree'
;
}
else
{
// 不同意:状态保持待确认(4)
$approveResult
=
'disagree'
;
}
// 记录日志
$logService
=
new
LogService
();
$logContent
=
'转化供应商确认 - 审核意见: '
.
(
$auditOpinion
==
'agree'
?
'同意'
:
'不同意'
)
.
(
$remark
?
', 原因说明: '
.
$remark
:
''
);
$logService
->
AddLog
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
,
'转化供应商确认'
,
$logContent
);
// 回传CRM系统:审批人、审批结果、附加说明
$supplierName
=
$supplier
[
'supplier_name'
];
CrmService
::
confirmCrmSupplier
(
$supplierName
,
$approverName
,
$approveResult
,
$remark
);
$this
->
response
(
0
,
'操作成功'
);
}
catch
(
Exception
$e
)
{
$this
->
response
(
-
1
,
'操作失败: '
.
$e
->
getMessage
());
}
}
}
app/Http/routes.php
View file @
f8fffe03
...
...
@@ -57,6 +57,7 @@ Route::group(['middleware' => ['web'], 'namespace' => 'Api'], function () {
Route
::
match
([
'get'
,
'post'
],
'/api/supplier_statistics/{key}'
,
'SupplierStatisticsApiController@Entrance'
);
Route
::
match
([
'get'
,
'post'
],
'/api/sku_statistics/{key}'
,
'SkuStatisticsApiController@Entrance'
);
Route
::
match
([
'get'
,
'post'
],
'/api/supplier/{key}'
,
'SupplierApiController@Entrance'
);
Route
::
match
([
'get'
,
'post'
],
'/api/supplier_crm/{key}'
,
'SupplierCrmApiController@Entrance'
);
Route
::
match
([
'get'
,
'post'
],
'/api/log/{key}'
,
'LogApiController@Entrance'
);
Route
::
match
([
'get'
,
'post'
],
'/api/sku/{key}'
,
'SkuApiController@Entrance'
);
Route
::
match
([
'get'
,
'post'
],
'/api/supplier_receipt/{key}'
,
'SupplierReceiptApiController@Entrance'
);
...
...
resources/views/script/ConfirmCrmSupplierScript.blade.php
View file @
f8fffe03
...
...
@@ -9,7 +9,7 @@
let
auditOpinion
=
data
.
field
.
audit_opinion
;
let
remark
=
data
.
field
.
remark
||
''
;
let
url
=
'/api/supplier/ConfirmCrmSupplier?supplier_id='
+
supplierId
;
let
url
=
'/api/supplier
_crm
/ConfirmCrmSupplier?supplier_id='
+
supplierId
;
let
res
=
ajax
(
url
,
{
audit_opinion
:
auditOpinion
,
remark
:
remark
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment