Commit cc223814 by 杨树贤

Merge branch 'ysx-供应商类型-20220614' into ysx-供应商新需求-20220627

parents 063befa4 b7a2d47c
...@@ -72,7 +72,9 @@ class CommonApiController extends Controller ...@@ -72,7 +72,9 @@ class CommonApiController extends Controller
//请求天眼查校验接口 //请求天眼查校验接口
$supplierName = $request->get('supplier_name'); $supplierName = $request->get('supplier_name');
$taxNumber = $request->get('tax_number'); $taxNumber = $request->get('tax_number');
$company = (new CompanyService())->getCompanyInfo($supplierName, $taxNumber); $region = $request->get('region');
$regionType = $region == 2 ? 1 : 2;
$company = (new CompanyService())->getCompanyInfo($supplierName, $taxNumber, $regionType);
if (!$company) { if (!$company) {
$this->response(-1, '获取不到公司'); $this->response(-1, '获取不到公司');
} }
......
...@@ -142,6 +142,10 @@ class SupplierApiController extends Controller ...@@ -142,6 +142,10 @@ class SupplierApiController extends Controller
]); ]);
$channel = $request->only($channelMap); $channel = $request->only($channelMap);
//如果是有直接新增权限的(绕过天眼查等校验)
if (checkPerm('IgnoreCompanyCheck')) {
$channel['is_standard_add'] = -1;
}
$service = new SupplierService(); $service = new SupplierService();
$supplierId = $service->saveSupplier($channel); $supplierId = $service->saveSupplier($channel);
if (!$supplierId) { if (!$supplierId) {
......
...@@ -307,6 +307,9 @@ class SupplierFilter ...@@ -307,6 +307,9 @@ class SupplierFilter
break; break;
case "level_a": case "level_a":
$query->where('level', 'A'); $query->where('level', 'A');
break;
case "pay_type_term":
$query->where('pay_type', 1);
} }
return $query; return $query;
} }
......
...@@ -79,9 +79,11 @@ class SupplierAuditService ...@@ -79,9 +79,11 @@ class SupplierAuditService
//发送队列消息同步到金蝶 //发送队列消息同步到金蝶
$service = new SyncSupplierService(); $service = new SyncSupplierService();
$service->syncSupplierToErp($supplierId); $service->syncSupplierToErp($supplierId);
if ($status == SupplierChannelModel::STATUS_PASSED ) {
//同步给一体化系统 //同步给一体化系统
(new SyncSupplierService())->syncSupplierToUnited($supplierId); (new SyncSupplierService())->syncSupplierToUnited($supplierId);
} }
}
return $result; return $result;
} }
......
...@@ -55,6 +55,8 @@ class SupplierStatisticsService ...@@ -55,6 +55,8 @@ class SupplierStatisticsService
//历史检测异常 //历史检测异常
$historyAbnormal = $this->getStatisticsCount('history_abnormal'); $historyAbnormal = $this->getStatisticsCount('history_abnormal');
//战略供应商(等级为A) //战略供应商(等级为A)
$payTypeTerm = $this->getStatisticsCount('pay_type_term');
//账期供应商
$levelA = $this->getStatisticsCount('level_a'); $levelA = $this->getStatisticsCount('level_a');
$result = [ $result = [
'total' => $total, 'total' => $total,
...@@ -75,6 +77,7 @@ class SupplierStatisticsService ...@@ -75,6 +77,7 @@ class SupplierStatisticsService
'has_supplier_tag' => $hasTagSupplier, 'has_supplier_tag' => $hasTagSupplier,
'contact_no_complete' => $concatNoComplete, 'contact_no_complete' => $concatNoComplete,
'history_abnormal' => $historyAbnormal, 'history_abnormal' => $historyAbnormal,
'pay_type_term' => $payTypeTerm,
'level_a' => $levelA, 'level_a' => $levelA,
]; ];
$result = array_map(function ($value) { $result = array_map(function ($value) {
......
...@@ -152,11 +152,21 @@ class SyncSupplierService ...@@ -152,11 +152,21 @@ class SyncSupplierService
$groupCode = array_get($syncResult, 'group_code'); $groupCode = array_get($syncResult, 'group_code');
$sourceSn = array_get($syncResult, 'source_sn'); $sourceSn = array_get($syncResult, 'source_sn');
$supplierId = $sourceSn; $supplierId = $sourceSn;
if ($supplierId) {
return SupplierChannelModel::where('supplier_id', $supplierId) return SupplierChannelModel::where('supplier_id', $supplierId)
->update([ ->update([
'sync_united_status' => SupplierChannelModel::SYNC_UNITED_STATUS_OK, 'sync_united_status' => SupplierChannelModel::SYNC_UNITED_STATUS_OK,
'group_code' => $groupCode, 'group_code' => $groupCode,
'company_nature' => $syncResult['company_nature'], 'company_nature' => $syncResult['company_nature'],
]); ]);
}else{
return SupplierChannelModel::where('group_code', $groupCode)
->update([
'sync_united_status' => SupplierChannelModel::SYNC_UNITED_STATUS_OK,
'group_code' => $groupCode,
'company_nature' => $syncResult['company_nature'],
]);
}
} }
} }
\ No newline at end of file
...@@ -60,5 +60,6 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function () ...@@ -60,5 +60,6 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
}); });
Route::match(['get', 'post'], '/test', function () { Route::match(['get', 'post'], '/test', function () {
(new \App\Http\Services\SyncSupplierService())->syncSupplierToUnited(12421); $resut = json_decode('{"group_code":"G000010","source_sn":0,"company_name":"深圳大事件科技有限公司","init_nature":"原厂","company_nature":"方案商","company_type":2}',true);
dd((new \App\Http\Services\SyncSupplierService())->syncSupplierToUnitedResult($resut));
}); });
...@@ -49,7 +49,7 @@ class BrandSelectorPresenter ...@@ -49,7 +49,7 @@ class BrandSelectorPresenter
page: pageIndex page: pageIndex
}, },
dataType: 'json', dataType: 'json',
timeout: 10000, timeout: 20000,
success: function (res) { success: function (res) {
if (!res) return layer.msg('网络错误,请重试', {icon: 5}); if (!res) return layer.msg('网络错误,请重试', {icon: 5});
if (res.code === 0) { if (res.code === 0) {
......
...@@ -236,6 +236,7 @@ return [ ...@@ -236,6 +236,7 @@ return [
'has_supplier_tag' => '客户指定供应商', 'has_supplier_tag' => '客户指定供应商',
'history_abnormal' => '历史检测异常', 'history_abnormal' => '历史检测异常',
'level_a' => '战略供应商', 'level_a' => '战略供应商',
'pay_type_term' => '账期供应商',
], ],
//Sku列表的罗盘对应菜单id //Sku列表的罗盘对应菜单id
'SkuListCompassMenuMap' => [ 'SkuListCompassMenuMap' => [
......
...@@ -67,7 +67,7 @@ function ajax(url, data) { ...@@ -67,7 +67,7 @@ function ajax(url, data) {
data: data, data: data,
async: false, async: false,
dataType: 'json', dataType: 'json',
timeout: 10000, timeout: 20000,
success: function (resp) { success: function (resp) {
if (resp) { if (resp) {
result = resp; result = resp;
......
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
page: pageIndex page: pageIndex
}, },
dataType: 'json', dataType: 'json',
timeout: 10000, timeout: 20000,
success: function (res) { success: function (res) {
if (!res) return layer.msg('网络错误,请重试', {icon: 5}); if (!res) return layer.msg('网络错误,请重试', {icon: 5});
if (res.errcode === 0) { if (res.errcode === 0) {
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
type: 'post', type: 'post',
async: true, async: true,
dataType: 'json', dataType: 'json',
timeout: 10000, timeout: 20000,
success: function (res) { success: function (res) {
if (res.err_code === 0) { if (res.err_code === 0) {
$.each(res.data, function (index, value) { $.each(res.data, function (index, value) {
......
...@@ -46,10 +46,8 @@ ...@@ -46,10 +46,8 @@
type: 'GET', type: 'GET',
async: true, async: true,
dataType: 'json', dataType: 'json',
timeout: 10000, timeout: 20000,
success: function (res) { success: function (res) {
console.log(supplier_name);
console.log(tax_number);
if (supplier_name !== '' || tax_number !== '') { if (supplier_name !== '' || tax_number !== '') {
if (res.err_code !== 0) { if (res.err_code !== 0) {
//当code=-2的时候,是公司信息校验有问题,但是如果有跳过检查权限,那么就什么都不处理 //当code=-2的时候,是公司信息校验有问题,但是如果有跳过检查权限,那么就什么都不处理
...@@ -67,8 +65,11 @@ ...@@ -67,8 +65,11 @@
"<p style='color: red;'>" + res.err_msg + "</p></div>"); "<p style='color: red;'>" + res.err_msg + "</p></div>");
$('#supplier_name').prop('disabled', false); $('#supplier_name').prop('disabled', false);
} }
if (!ignoreCompanyCheck) {
//监听是不是供应商名称变化 //监听是不是供应商名称变化
resetCompanyInfo(self.attr('id') === 'supplier_name'); resetCompanyInfo(self.attr('id') === 'supplier_name');
}
} else if (res.err_code === 0) { } else if (res.err_code === 0) {
//如果供应商没有问题,就要去自动填补部分资料 //如果供应商没有问题,就要去自动填补部分资料
let companyInfo = res.data; let companyInfo = res.data;
...@@ -78,12 +79,15 @@ ...@@ -78,12 +79,15 @@
$('#supplier_address').val(companyInfo.supplier_address); $('#supplier_address').val(companyInfo.supplier_address);
$('#registered_capital').val(companyInfo.registered_capital); $('#registered_capital').val(companyInfo.registered_capital);
layer.msg('校验公司信息通过,自动补全相关数据', {icon: 6}) layer.msg('校验公司信息通过,自动补全相关数据', {icon: 6})
if (!ignoreCompanyCheck) {
if (self.attr('id') === 'supplier_name') { if (self.attr('id') === 'supplier_name') {
$('#tax_number').attr('disabled', true); $('#tax_number').attr('disabled', true);
} else { } else {
$('#supplier_name').attr('disabled', true); $('#supplier_name').attr('disabled', true);
} }
} }
}
} }
...@@ -278,6 +282,7 @@ ...@@ -278,6 +282,7 @@
$('#recheck_company_info').click(function () { $('#recheck_company_info').click(function () {
let supplierName = $('#supplier_name').val(); let supplierName = $('#supplier_name').val();
let taxNumber = $('#tax_number').val(); let taxNumber = $('#tax_number').val();
let region = $('#region').val();
admin.btnLoading('#recheck_company_info', '正在查验公司信息,请稍等...'); admin.btnLoading('#recheck_company_info', '正在查验公司信息,请稍等...');
if (!supplierName && !taxNumber) { if (!supplierName && !taxNumber) {
layer.msg('请填写供应商名称或者税号后再进行查验', {icon: 5}); layer.msg('请填写供应商名称或者税号后再进行查验', {icon: 5});
...@@ -285,13 +290,13 @@ ...@@ -285,13 +290,13 @@
return false; return false;
} }
$('#supplier_check_tip').remove(); $('#supplier_check_tip').remove();
let url = '/api/common/checkCompanyInfo?supplier_name=' + supplierName + '&tax_number=' + taxNumber; let url = '/api/common/checkCompanyInfo?supplier_name=' + supplierName + '&tax_number=' + taxNumber + '&region=' + region;
$.ajax({ $.ajax({
url: url, url: url,
type: 'GET', type: 'GET',
async: true, async: true,
dataType: 'json', dataType: 'json',
timeout: 10000, timeout: 20000,
success: function (res) { success: function (res) {
admin.btnLoading('#recheck_company_info', false); admin.btnLoading('#recheck_company_info', false);
if (res.err_code === 0) { if (res.err_code === 0) {
...@@ -306,7 +311,7 @@ ...@@ -306,7 +311,7 @@
layer.msg('验证成功,校验公司信息通过,自动补全相关数据', {icon: 6}) layer.msg('验证成功,校验公司信息通过,自动补全相关数据', {icon: 6})
} else { } else {
if (ignoreCompanyCheck) { if (ignoreCompanyCheck) {
layer.msg('公司未进行工商注册', {icon: 5})
} else { } else {
$('#supplier_name').after("<div id='supplier_check_tip' style='margin-top: 5px'>" + $('#supplier_name').after("<div id='supplier_check_tip' style='margin-top: 5px'>" +
"<p style='color: red;'>公司未进行工商注册,请修改后重新提交</p></div>"); "<p style='color: red;'>公司未进行工商注册,请修改后重新提交</p></div>");
......
...@@ -54,11 +54,11 @@ ...@@ -54,11 +54,11 @@
<label class="layui-form-label"><span class="require">*</span>供应商名称 : </label> <label class="layui-form-label"><span class="require">*</span>供应商名称 : </label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="supplier_name" id="supplier_name" <input type="text" name="supplier_name" id="supplier_name"
placeholder="请输入供应商名称" class="layui-input @if ($supplier['sync_united_status']==1) placeholder="请输入供应商名称" class="layui-input @if ($supplier)
layui-disabled layui-disabled
@endif" @endif"
value="{{$supplier['supplier_name'] or ''}}" value="{{$supplier['supplier_name'] or ''}}"
@if ($supplier['sync_united_status']==1) disabled @endif> @if ($supplier) disabled @endif>
</div> </div>
</div> </div>
<div class="layui-col-md5"> <div class="layui-col-md5">
......
...@@ -126,6 +126,10 @@ ...@@ -126,6 +126,10 @@
<a class="main_filter" title="战略供应商" id="level_a"> <a class="main_filter" title="战略供应商" id="level_a">
</a> </a>
</div> </div>
<div class="layui-row">
<a class="main_filter" title="账期供应商" id="pay_type_term">
</a>
</div>
</div> </div>
<div class="split-item" id="s7" style="text-align: center"> <div class="split-item" id="s7" style="text-align: center">
......
...@@ -26,11 +26,26 @@ ...@@ -26,11 +26,26 @@
value="{{$supplier['pay_type_value'] or ''}}"> value="{{$supplier['pay_type_value'] or ''}}">
<select lay-filter="pay_type_month"> <select lay-filter="pay_type_month">
<option value="">请选择</option> <option value="">请选择</option>
<option value="7"
@if($supplier['pay_type_value']==7)
selected='selected'
@endif>7
</option>
<option value="15"
@if($supplier['pay_type_value']==15)
selected='selected'
@endif>15
</option>
<option value="30" <option value="30"
@if($supplier['pay_type_value']==30) @if($supplier['pay_type_value']==30)
selected='selected' selected='selected'
@endif>30 @endif>30
</option> </option>
<option value="45"
@if($supplier['pay_type_value']==45)
selected='selected'
@endif>45
</option>
<option value="60" <option value="60"
@if($supplier['pay_type_value']==60) @if($supplier['pay_type_value']==60)
selected='selected' selected='selected'
...@@ -55,7 +70,10 @@ ...@@ -55,7 +70,10 @@
<input class="layui-input valueInput" type="hidden" name="pay_type_value"> <input class="layui-input valueInput" type="hidden" name="pay_type_value">
<select lay-filter="pay_type_month"> <select lay-filter="pay_type_month">
<option value="">请选择</option> <option value="">请选择</option>
<option value="30">7</option>
<option value="30">15</option>
<option value="30">30</option> <option value="30">30</option>
<option value="30">45</option>
<option value="60">60</option> <option value="60">60</option>
<option value="90">90</option> <option value="90">90</option>
</select> </select>
......
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