Commit bfeef9fc by 杨树贤

完善审核流

parent bc054980
...@@ -902,7 +902,13 @@ class SupplierApiController extends Controller ...@@ -902,7 +902,13 @@ class SupplierApiController extends Controller
{ {
$supplierId = $request->get('supplier_id'); $supplierId = $request->get('supplier_id');
$supplierAuditService = new AuditCenterService(); $supplierAuditService = new AuditCenterService();
//判断是否是待确认,是的话去请求crm转供应商的审核
$status = SupplierChannelModel::where('supplier_id', $supplierId)->value('status');
if ($status == SupplierChannelModel::STATUS_CONFIRM) {
$result = $supplierAuditService->getAuditInfoByIdAndType($supplierId, AuditCenterService::TYPE_CUSTOMER_CONVERT_SUPPLIER_AUDIT);
} else {
$result = $supplierAuditService->getAuditInfoByIdAndType($supplierId, AuditCenterService::TYPE_SUPPLIER_AUDIT); $result = $supplierAuditService->getAuditInfoByIdAndType($supplierId, AuditCenterService::TYPE_SUPPLIER_AUDIT);
}
$this->response(0, 'ok', $result); $this->response(0, 'ok', $result);
} }
} }
...@@ -20,47 +20,6 @@ class SupplierCrmApiController extends Controller ...@@ -20,47 +20,6 @@ class SupplierCrmApiController extends Controller
$this->$id($request, $id); $this->$id($request, $id);
} }
//转化供应商确认 - 提交审批到审核中心
public function ConfirmCrmSupplier($request)
{
$supplierId = $request->get('supplier_id');
$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客户转化)');
}
try {
// 提交审批到审核中心
$auditService = new SupplierAuditService();
$result = $auditService->addApproveForCustomerConvert($supplierId, '客户转化供应商审核');
// 更新状态为审核中
$model->where('supplier_id', $supplierId)->update([
'status' => SupplierChannelModel::STATUS_IN_REVIEW,
'update_time' => time(),
]);
// 记录提交审批日志
$logService = new LogService();
$logContent = "确认客户转化供应商:提交审核\n"
. date('Y-m-d H:i:s') . " " . $request->user->name;
$logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '客户转化供应商审核', $logContent);
$this->response(0, '提交审核成功', $result);
} catch (Exception $e) {
$this->response(-1, '提交审核失败: ' . $e->getMessage());
}
}
//客户转化供应商 - 审核操作 //客户转化供应商 - 审核操作
public function AuditCustomerConvertSupplier($request) public function AuditCustomerConvertSupplier($request)
{ {
......
...@@ -10,11 +10,13 @@ use App\Http\Services\CompanyService; ...@@ -10,11 +10,13 @@ use App\Http\Services\CompanyService;
use App\Http\Services\SupplierService; use App\Http\Services\SupplierService;
use App\Http\Services\SyncSupplierService; use App\Http\Services\SyncSupplierService;
use App\Http\Services\LogService; use App\Http\Services\LogService;
use App\Http\Services\SupplierAuditService;
use App\Model\LogModel; use App\Model\LogModel;
use App\Model\SupplierAttachmentsModel; use App\Model\SupplierAttachmentsModel;
use App\Model\SupplierChannelModel; use App\Model\SupplierChannelModel;
use App\Model\SupplierContactModel; use App\Model\SupplierContactModel;
use App\Model\SupplierExtendModel; use App\Model\SupplierExtendModel;
use App\Model\UserInfoModel;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
...@@ -55,7 +57,6 @@ class SupplierSyncController extends BaseSyncController ...@@ -55,7 +57,6 @@ class SupplierSyncController extends BaseSyncController
$result = (new SyncSupplierService())->syncSupplierToUnitedResult($resultData); $result = (new SyncSupplierService())->syncSupplierToUnitedResult($resultData);
$this->syncResponse(0, '同步一体化信息成功'); $this->syncResponse(0, '同步一体化信息成功');
} }
public function receiveEntityResult(Request $request) public function receiveEntityResult(Request $request)
...@@ -99,7 +100,6 @@ class SupplierSyncController extends BaseSyncController ...@@ -99,7 +100,6 @@ class SupplierSyncController extends BaseSyncController
} }
(new SyncSupplierService())->receiveEntityResult($resultData); (new SyncSupplierService())->receiveEntityResult($resultData);
$this->syncResponse(0, '获取审核结果广播成功'); $this->syncResponse(0, '获取审核结果广播成功');
} }
//获取供应商需要审核的数量 //获取供应商需要审核的数量
...@@ -140,7 +140,6 @@ class SupplierSyncController extends BaseSyncController ...@@ -140,7 +140,6 @@ class SupplierSyncController extends BaseSyncController
* - contact_email: 联系人邮箱 * - contact_email: 联系人邮箱
* - contact_mobile: 联系人手机号 * - contact_mobile: 联系人手机号
* - creator_name (必填): 创建人姓名 → 逆向采购员 * - creator_name (必填): 创建人姓名 → 逆向采购员
* - purchaser_uid: 采购员codeId(第一个审批人)
* - platform_agreement_url: 平台合作协议附件URL * - platform_agreement_url: 平台合作协议附件URL
* - platform_agreement_name: 平台合作协议附件文件名 * - platform_agreement_name: 平台合作协议附件文件名
* - quality_agreement_url: 品质保证协议附件URL * - quality_agreement_url: 品质保证协议附件URL
...@@ -155,13 +154,13 @@ class SupplierSyncController extends BaseSyncController ...@@ -155,13 +154,13 @@ class SupplierSyncController extends BaseSyncController
'contact_email', 'contact_email',
'contact_mobile', 'contact_mobile',
'creator_name', 'creator_name',
'purchaser_uid',
'platform_agreement_url', 'platform_agreement_url',
'platform_agreement_name', 'platform_agreement_name',
'quality_agreement_url', 'quality_agreement_url',
'quality_agreement_name', 'quality_agreement_name',
'customer_nature', 'customer_nature',
'crm_remark', 'crm_remark',
'apply_uid'
]); ]);
//参数校验 //参数校验
...@@ -169,6 +168,7 @@ class SupplierSyncController extends BaseSyncController ...@@ -169,6 +168,7 @@ class SupplierSyncController extends BaseSyncController
'customer_name' => 'required', 'customer_name' => 'required',
'sign_com_id' => 'required', 'sign_com_id' => 'required',
'creator_name' => 'required', 'creator_name' => 'required',
'apply_uid' => 'required',
]; ];
$validator = Validator::make($data, $rules); $validator = Validator::make($data, $rules);
...@@ -184,8 +184,10 @@ class SupplierSyncController extends BaseSyncController ...@@ -184,8 +184,10 @@ class SupplierSyncController extends BaseSyncController
$existingSupplier = SupplierChannelModel::where('supplier_name', $customerName)->first(); $existingSupplier = SupplierChannelModel::where('supplier_name', $customerName)->first();
if ($existingSupplier) { if ($existingSupplier) {
// CRM再次提交:仅当来源为CRM且状态为待确认(采购驳回后恢复待确认)时,更新数据 // CRM再次提交:仅当来源为CRM且状态为待确认(采购驳回后恢复待确认)时,更新数据
if ($existingSupplier['supplier_source'] == SupplierChannelModel::SUPPLIER_SOURCE_CRM if (
&& $existingSupplier['status'] == SupplierChannelModel::STATUS_CONFIRM) { $existingSupplier['supplier_source'] == SupplierChannelModel::SUPPLIER_SOURCE_CRM
&& $existingSupplier['status'] == SupplierChannelModel::STATUS_CONFIRM
) {
try { try {
$this->updateCrmSupplier($existingSupplier, $data); $this->updateCrmSupplier($existingSupplier, $data);
$this->syncResponse(0, 'CRM再次提交更新成功', ['supplier_id' => $existingSupplier['supplier_id']]); $this->syncResponse(0, 'CRM再次提交更新成功', ['supplier_id' => $existingSupplier['supplier_id']]);
...@@ -195,7 +197,7 @@ class SupplierSyncController extends BaseSyncController ...@@ -195,7 +197,7 @@ class SupplierSyncController extends BaseSyncController
} }
} }
Log::info('[CRM同步]供应商已存在且不满足再次提交条件,跳过: ' . $customerName); Log::info('[CRM同步]供应商已存在且不满足再次提交条件,跳过: ' . $customerName);
$this->syncResponse(0, '供应商已存在,跳过'); $this->syncResponse(-1, '供应商已存在,跳过');
} }
try { try {
...@@ -208,7 +210,8 @@ class SupplierSyncController extends BaseSyncController ...@@ -208,7 +210,8 @@ class SupplierSyncController extends BaseSyncController
$establishedTime = array_get($companyInfo, 'establishment_time', ''); $establishedTime = array_get($companyInfo, 'establishment_time', '');
// legal_representative 从天眼查数据获取(如果有) // legal_representative 从天眼查数据获取(如果有)
$legalRepresentative = ''; $legalRepresentative = '';
$applyUid = !empty($data['apply_uid']) ? $data['apply_uid'] : 1000;
$applyName = (new AdminUserService())->getAdminUserNameByUserId($applyUid);
// 2. 构建供应商数据 // 2. 构建供应商数据
$channel = [ $channel = [
'supplier_name' => $customerName, 'supplier_name' => $customerName,
...@@ -237,7 +240,7 @@ class SupplierSyncController extends BaseSyncController ...@@ -237,7 +240,7 @@ class SupplierSyncController extends BaseSyncController
'supplier_type' => SupplierChannelModel::SUPPLIER_TYPE_OFFICIAL, // 正式供应商 'supplier_type' => SupplierChannelModel::SUPPLIER_TYPE_OFFICIAL, // 正式供应商
'is_business_abnormal' => -1, // 默认无异常 'is_business_abnormal' => -1, // 默认无异常
'has_legal_ID_card' => -1, // 默认无法人身份证 'has_legal_ID_card' => -1, // 默认无法人身份证
'apply_uid' => $applyUid,
// 状态设为待确认 // 状态设为待确认
'status' => SupplierChannelModel::STATUS_CONFIRM, 'status' => SupplierChannelModel::STATUS_CONFIRM,
//CRM同步供应商不需要初审 //CRM同步供应商不需要初审
...@@ -253,11 +256,12 @@ class SupplierSyncController extends BaseSyncController ...@@ -253,11 +256,12 @@ class SupplierSyncController extends BaseSyncController
] ]
]); ]);
// 4. 使用事务创建供应商 // 4. 使用事务创建供应商和审核流
$supplierId = DB::connection('web')->transaction(function () use ($channel, $data) { $supplierId = DB::connection('web')->transaction(function () use ($applyUid, $applyName, $channel, $data) {
unset($channel['apply_uid']);
$model = new SupplierChannelModel(); $model = new SupplierChannelModel();
$channel['create_uid'] = 0; $channel['create_uid'] = $applyUid;
$channel['create_name'] = 'CRM同步'; $channel['create_name'] = $applyName;
$channel['create_time'] = time(); $channel['create_time'] = time();
$channel['update_time'] = time(); $channel['update_time'] = time();
...@@ -271,6 +275,10 @@ class SupplierSyncController extends BaseSyncController ...@@ -271,6 +275,10 @@ class SupplierSyncController extends BaseSyncController
'supplier_sn' => 'FOO' . ltrim($supplierCode, 'L'), 'supplier_sn' => 'FOO' . ltrim($supplierCode, 'L'),
]); ]);
// 提交审批到审核中心(在事务中,失败则回滚)
$auditService = new SupplierAuditService();
$auditService->addApproveForCustomerConvert($supplierId, $applyUid, '客户转化供应商审核');
// 写入逆向采购员到扩展表 // 写入逆向采购员到扩展表
$extendData = [ $extendData = [
'supplier_id' => $supplierId, 'supplier_id' => $supplierId,
...@@ -291,7 +299,7 @@ class SupplierSyncController extends BaseSyncController ...@@ -291,7 +299,7 @@ class SupplierSyncController extends BaseSyncController
'can_check_uids' => array_get($data, 'purchaser_uid', ''), 'can_check_uids' => array_get($data, 'purchaser_uid', ''),
'channel_user_type' => SupplierContactModel::CHANNEL_USER_TYPE_LIEXIN, 'channel_user_type' => SupplierContactModel::CHANNEL_USER_TYPE_LIEXIN,
'add_time' => time(), 'add_time' => time(),
'admin_id' => 0, 'admin_id' => $applyUid,
]; ];
SupplierContactModel::insert($contactData); SupplierContactModel::insert($contactData);
...@@ -301,11 +309,13 @@ class SupplierSyncController extends BaseSyncController ...@@ -301,11 +309,13 @@ class SupplierSyncController extends BaseSyncController
$platformAgreementName = array_get($data, 'platform_agreement_name', '平台合作协议'); $platformAgreementName = array_get($data, 'platform_agreement_name', '平台合作协议');
SupplierAttachmentsModel::insert([ SupplierAttachmentsModel::insert([
'supplier_id' => $supplierId, 'supplier_id' => $supplierId,
'type_name' => '平台合作协议',
'field_name' => 'cooperation_agreement', 'field_name' => 'cooperation_agreement',
'file_url' => $platformAgreementUrl, 'file_url' => $platformAgreementUrl,
'file_name' => $platformAgreementName, 'file_name' => $platformAgreementName,
'create_name' => $applyName,
'create_time' => time(), 'create_time' => time(),
'create_uid' => 0, 'create_uid' => $applyUid,
]); ]);
} }
...@@ -315,11 +325,13 @@ class SupplierSyncController extends BaseSyncController ...@@ -315,11 +325,13 @@ class SupplierSyncController extends BaseSyncController
$qualityAgreementName = array_get($data, 'quality_agreement_name', '品质保证协议'); $qualityAgreementName = array_get($data, 'quality_agreement_name', '品质保证协议');
SupplierAttachmentsModel::insert([ SupplierAttachmentsModel::insert([
'supplier_id' => $supplierId, 'supplier_id' => $supplierId,
'type_name' => '品质保证协议',
'field_name' => 'quality_assurance_agreement', 'field_name' => 'quality_assurance_agreement',
'file_url' => $qualityAgreementUrl, 'file_url' => $qualityAgreementUrl,
'file_name' => $qualityAgreementName, 'file_name' => $qualityAgreementName,
'create_name' => $applyName,
'create_time' => time(), 'create_time' => time(),
'create_uid' => 0, 'create_uid' => $applyUid,
]); ]);
} }
...@@ -329,6 +341,11 @@ class SupplierSyncController extends BaseSyncController ...@@ -329,6 +341,11 @@ class SupplierSyncController extends BaseSyncController
return $supplierId; return $supplierId;
}); });
// 记录提交审批日志
$logService = new LogService();
$logContent = "CRM同步:自动提交客户转化供应商审核";
$logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '客户转化供应商审核', $logContent);
Log::info('[CRM同步]供应商创建成功', ['supplier_id' => $supplierId, 'supplier_name' => $customerName]); Log::info('[CRM同步]供应商创建成功', ['supplier_id' => $supplierId, 'supplier_name' => $customerName]);
$this->syncResponse(0, '同步成功', ['supplier_id' => $supplierId]); $this->syncResponse(0, '同步成功', ['supplier_id' => $supplierId]);
......
...@@ -62,6 +62,11 @@ class AdminUserService ...@@ -62,6 +62,11 @@ class AdminUserService
return UserInfoModel::where('name', $userName)->value('userId'); return UserInfoModel::where('name', $userName)->value('userId');
} }
public function getAdminUserNameByUserId($userId)
{
return UserInfoModel::where('userId', $userId)->value('name');
}
public function getAdminIdByEmail($email) public function getAdminIdByEmail($email)
{ {
return UserInfoModel::where('email', $email)->value('userId'); return UserInfoModel::where('email', $email)->value('userId');
......
...@@ -126,7 +126,6 @@ class AuditCenterService ...@@ -126,7 +126,6 @@ class AuditCenterService
'apply_node_ids' => array_get($params, 'apply_node_ids', ''), 'apply_node_ids' => array_get($params, 'apply_node_ids', ''),
]; ];
$response = self::requestAudit("/sync/bill/addBill", $requestData); $response = self::requestAudit("/sync/bill/addBill", $requestData);
if ($response['code'] != 0) { if ($response['code'] != 0) {
throw new Exception($response['msg']); throw new Exception($response['msg']);
} }
......
...@@ -468,7 +468,7 @@ class SupplierAuditService ...@@ -468,7 +468,7 @@ class SupplierAuditService
{ {
// 如果是admin用户,直接跳过审核 // 如果是admin用户,直接跳过审核
if (isAdmin()) { if (isAdmin()) {
return false; // return false;
} }
//只要不是已通过状态,修改任何字段都需要审核 //只要不是已通过状态,修改任何字段都需要审核
...@@ -557,11 +557,11 @@ class SupplierAuditService ...@@ -557,11 +557,11 @@ class SupplierAuditService
/** /**
* 客户转化供应商 - 提交审批到审核中心 * 客户转化供应商 - 提交审批到审核中心
*/ */
public function addApproveForCustomerConvert($supplierId, $triggerReason) public function addApproveForCustomerConvert($supplierId, $applyUid, $triggerReason)
{ {
if (\isAdmin()) { // if (\isAdmin()) {
return true; // return true;
} // }
$supplierInfo = SupplierChannelModel::where('supplier_id', $supplierId)->first(); $supplierInfo = SupplierChannelModel::where('supplier_id', $supplierId)->first();
if (!$supplierInfo) { if (!$supplierInfo) {
...@@ -569,7 +569,6 @@ class SupplierAuditService ...@@ -569,7 +569,6 @@ class SupplierAuditService
} }
$auditInfo = AuditCenterService::getAuditInfoByIdAndType($supplierId, AuditCenterService::TYPE_CUSTOMER_CONVERT_SUPPLIER_AUDIT); $auditInfo = AuditCenterService::getAuditInfoByIdAndType($supplierId, AuditCenterService::TYPE_CUSTOMER_CONVERT_SUPPLIER_AUDIT);
// 如果存在审核信息,并且状态不是 已完成,已拒绝,已撤销时直接跳过 // 如果存在审核信息,并且状态不是 已完成,已拒绝,已撤销时直接跳过
if (!empty($auditInfo) && !in_array($auditInfo['approval_status'], [ if (!empty($auditInfo) && !in_array($auditInfo['approval_status'], [
AuditCenterService::APPROVAL_STATUS_REFUSE, AuditCenterService::APPROVAL_STATUS_REFUSE,
...@@ -579,13 +578,13 @@ class SupplierAuditService ...@@ -579,13 +578,13 @@ class SupplierAuditService
return $auditInfo; return $auditInfo;
} }
// 先获取审核流节点数据 // 先获取审核流节点数据
$flowInfo = AuditCenterService::getAuditFlowInfo( $flowInfo = AuditCenterService::getAuditFlowInfo(
AuditCenterService::TYPE_CUSTOMER_CONVERT_SUPPLIER_AUDIT, AuditCenterService::TYPE_CUSTOMER_CONVERT_SUPPLIER_AUDIT,
request()->user->userId, array_get(request()->user, 'userId', 1000),
null 1
); );
// 创建审批单据 // 创建审批单据
$billInfo = AuditCenterService::addAudit([ $billInfo = AuditCenterService::addAudit([
"flow_id" => $flowInfo['flow_info']['id'], "flow_id" => $flowInfo['flow_info']['id'],
...@@ -595,8 +594,7 @@ class SupplierAuditService ...@@ -595,8 +594,7 @@ class SupplierAuditService
"trigger_reason" => $triggerReason, "trigger_reason" => $triggerReason,
"current_node" => null, "current_node" => null,
"apply_node_ids" => implode(",", array_column($flowInfo['node_list'], 'id')) "apply_node_ids" => implode(",", array_column($flowInfo['node_list'], 'id'))
], request()->user->userId, request()->user->userId); ], $applyUid, $applyUid);
return $billInfo; return $billInfo;
} }
...@@ -647,14 +645,12 @@ class SupplierAuditService ...@@ -647,14 +645,12 @@ class SupplierAuditService
CrmService::confirmCrmSupplier($supplierName, $approverName, 'completed', $remark); CrmService::confirmCrmSupplier($supplierName, $approverName, 'completed', $remark);
// 记录审批日志 // 记录审批日志
$logContent = "确认客户转化供应商:审核通过" . ($remark ? " " . $remark : "") . "\n" $logContent = "确认客户转化供应商:审核通过";
. $currentTime . " " . $approverName;
$logService = new LogService(); $logService = new LogService();
$logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '客户转化供应商审核', $logContent); $logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '客户转化供应商审核', $logContent);
} else { } else {
// 中间节点审核通过,记录日志 // 中间节点审核通过,记录日志
$logContent = "确认客户转化供应商:审核通过" . ($remark ? " " . $remark : "") . "\n" $logContent = "确认客户转化供应商:审核通过";
. $currentTime . " " . $approverName;
$logService = new LogService(); $logService = new LogService();
$logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '客户转化供应商审核', $logContent); $logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '客户转化供应商审核', $logContent);
} }
...@@ -671,14 +667,12 @@ class SupplierAuditService ...@@ -671,14 +667,12 @@ class SupplierAuditService
CrmService::confirmCrmSupplier($supplierName, $approverName, 'purchase_rejected', $remark); CrmService::confirmCrmSupplier($supplierName, $approverName, 'purchase_rejected', $remark);
// 记录审批日志 // 记录审批日志
$logContent = "确认客户转化供应商:审核未通过" . ($remark ? " " . $remark : "") . "\n" $logContent = "确认客户转化供应商:审核未通过";
. $currentTime . " " . $approverName;
$logService = new LogService(); $logService = new LogService();
$logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '客户转化供应商审核', $logContent); $logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '客户转化供应商审核', $logContent);
} else { } else {
// 中间节点拒绝 // 中间节点拒绝
$logContent = "确认客户转化供应商:审核未通过" . ($remark ? " " . $remark : "") . "\n" $logContent = "确认客户转化供应商:审核未通过";
. $currentTime . " " . $approverName;
$logService = new LogService(); $logService = new LogService();
$logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '客户转化供应商审核', $logContent); $logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '客户转化供应商审核', $logContent);
} }
......
curl -X POST http://supplier.liexin.net/sync/crm/syncSupplier \ # 同步CRM客户到供应商
curl -X POST http://supplier.liexin.net/sync/crm/syncSupplier \ # 同步CRM客户到供应商
-H "Content-Type: application/x-www-form-urlencoded" \ curl -X POST http://supplier.liexin.net/sync/crm/syncSupplier
-d "customer_name=测试科技有限公司" \ -H "Content-Type: application/x-www-form-urlencoded"
-d "sign_com_id=1" \ -d "customer_name=测试科技有限公司"
-d "contact_name=张三" \ -d "sign_com_id=1"
-d "contact_email=zhangsan@test.com" \ -d "contact_name=张三"
-d "contact_mobile=13800138000" \ -d "contact_email=zhangsan@test.com"
-d "creator_name=李四" \ -d "contact_mobile=13800138000"
-d "purchaser_uid=P20240001" \ -d "creator_name=李四"
-d "customer_nature=工厂" \ -d "customer_nature=工厂"
-d "crm_remark=CRM客户转化供应商测试" \ -d "crm_remark=CRM客户转化供应商测试"
-d "platform_agreement_url=https://example.com/agreements/platform_2024.pdf" \ -d "platform_agreement_url=https://example.com/agreements/platform_2024.pdf"
-d "platform_agreement_name=平台合作协议_2024" \ -d "platform_agreement_name=平台合作协议_2024"
-d "quality_agreement_url=https://example.com/agreements/quality_2024.pdf" \ -d "quality_agreement_url=https://example.com/agreements/quality_2024.pdf"
-d "quality_agreement_name=品质保证协议_2024" -d "quality_agreement_name=品质保证协议_2024"
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
let admin = layui.admin; let admin = layui.admin;
let form = layui.form; let form = layui.form;
let layer = layui.layer; let layer = layui.layer;
form.on('submit(confirmCrmSupplier)', function (data) { form.on('submit(confirmCrmSupplier)', function (data) {
let supplierId = getQueryVariable('supplier_id'); let supplierId = getQueryVariable('supplier_id');
let auditOpinion = data.field.audit_opinion; let auditOpinion = data.field.audit_opinion;
let remark = data.field.remark || ''; let remark = data.field.remark || '';
let url = '/api/supplier_crm/ConfirmCrmSupplier?supplier_id=' + supplierId; let url = '/api/supplier_crm/AuditCustomerConvertSupplier';
let res = ajax(url, { let res = ajax(url, {
supplier_id: supplierId,
audit_opinion: auditOpinion, audit_opinion: auditOpinion,
remark: remark, remark: remark,
}); });
......
...@@ -467,6 +467,10 @@ ...@@ -467,6 +467,10 @@
let supplierId = data[0].supplier_id; let supplierId = data[0].supplier_id;
let status = data[0].status; let status = data[0].status;
let canReviewSupplier = {{checkPerm("ReviewSupplier")?1:0}}; let canReviewSupplier = {{checkPerm("ReviewSupplier")?1:0}};
if (status === 4){
layer.msg('该供应商状态为待确认,需要先确认客户转化供应商', {icon: 5});
return;
}
if (canReviewSupplier === 0 && status === -1) { if (canReviewSupplier === 0 && status === -1) {
layer.msg('你没有复审供应商的权限', {icon: 5}) layer.msg('你没有复审供应商的权限', {icon: 5})
return return
......
...@@ -70,4 +70,3 @@ ...@@ -70,4 +70,3 @@
</form> </form>
</div> </div>
</div> </div>
@include('script.ConfirmCrmSupplierScript')
...@@ -54,9 +54,7 @@ ...@@ -54,9 +54,7 @@
lay-submit lay-submit
lay-filter="saveSupplierMemo">确认 lay-filter="saveSupplierMemo">确认
</button> </button>
<button type="button" id="cancel" class="layui-btn layui-btn-primary" <button type="button" id="cancel" class="layui-btn layui-btn-primary" lay-submit lay-filter="cancelSupplierMemo">取消
lay-submit
lay-filter="cancelSupplierMemo">取消
</button> </button>
</div> </div>
</div> </div>
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
<label class="layui-form-label">供应商来源 : </label> <label class="layui-form-label">供应商来源 : </label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" class="layui-input" disabled <input type="text" class="layui-input" disabled
value="{{array_get(config('fixed.SupplierSource'), $supplier['supplier_source'] ?? '1', '供应商系统新增')}}"> value="{{array_get(config('fixed.SupplierSource'), !empty($supplier['supplier_source']) ? $supplier['supplier_source'] : '1', '供应商系统新增')}}">
</div> </div>
</div> </div>
</div> </div>
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
<label class="layui-form-label">逆向采购员 : </label> <label class="layui-form-label">逆向采购员 : </label>
<div class="layui-input-block" style="width: 150px"> <div class="layui-input-block" style="width: 150px">
<input type="text" class="layui-input layui-disabled" disabled <input type="text" class="layui-input layui-disabled" disabled
value="{{$supplier['reverse_purchaser'] ?? ''}}"> value="{{$supplier['reverse_purchaser'] or ''}}">
</div> </div>
</div> </div>
<div class="layui-col-md3"> <div class="layui-col-md3">
......
...@@ -467,6 +467,10 @@ ...@@ -467,6 +467,10 @@
let supplierId = data[0].supplier_id; let supplierId = data[0].supplier_id;
let status = data[0].status; let status = data[0].status;
let canReviewSupplier = <?php echo e(checkPerm("ReviewSupplier")?1:0); ?>; let canReviewSupplier = <?php echo e(checkPerm("ReviewSupplier")?1:0); ?>;
if (status === 4){
layer.msg('该供应商状态为待确认,需要先确认客户转化供应商', {icon: 5});
return;
}
if (canReviewSupplier === 0 && status === -1) { if (canReviewSupplier === 0 && status === -1) {
layer.msg('你没有复审供应商的权限', {icon: 5}) layer.msg('你没有复审供应商的权限', {icon: 5})
return return
......
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