Commit 98f56bd5 by 杨树贤

暂存

parent b0aa33f2
...@@ -4,8 +4,8 @@ namespace App\Http\Controllers\Api; ...@@ -4,8 +4,8 @@ namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Services\AdminUserService; use App\Http\Services\AdminUserService;
use App\Http\Services\CompanyService;
use App\Model\BrandModel; use App\Model\BrandModel;
use App\Model\SelfClassifyModel;
use App\Model\StandardBrandModel; use App\Model\StandardBrandModel;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use GuzzleHttp\Client; use GuzzleHttp\Client;
...@@ -19,13 +19,6 @@ class CommonApiController extends Controller ...@@ -19,13 +19,6 @@ class CommonApiController extends Controller
$this->$id($request, $id); $this->$id($request, $id);
} }
//获取分类列表(自营专属)
public function getSelfClassList($request)
{
$model = new SelfClassifyModel();
$result = $model->getClassList();
return $this->response(0, 'ok', $result);
}
//获取所有品牌 //获取所有品牌
public function getBrandList($request) public function getBrandList($request)
...@@ -35,7 +28,7 @@ class CommonApiController extends Controller ...@@ -35,7 +28,7 @@ class CommonApiController extends Controller
$type = $type ?: 1; $type = $type ?: 1;
$model = new BrandModel(); $model = new BrandModel();
$brandList = $model->getBrandListByType($type); $brandList = $model->getBrandListByType($type);
return $this->response(0, 'ok', $brandList); $this->response(0, 'ok', $brandList);
} }
//获取标准品牌 //获取标准品牌
...@@ -43,32 +36,7 @@ class CommonApiController extends Controller ...@@ -43,32 +36,7 @@ class CommonApiController extends Controller
{ {
$model = new BrandModel(); $model = new BrandModel();
$brandList = $model->getStandardBrandList(); $brandList = $model->getStandardBrandList();
return $this->response(0, 'ok', $brandList); $this->response(0, 'ok', $brandList);
}
//搜索标准品牌
public function SearchStandardBrand($request)
{
$brandName = $request->input('brand_name');
$standardBrandModel = new StandardBrandModel();
$query = $standardBrandModel->where('status', 1);
if ($brandName) {
$query = $query->where('brand_name', 'like', $brandName . '%');
}
$count = $query->count();
$list = $query->select('brand_name', 'brand_id')->paginate(17);
$list = $list ? $list->toArray() : [];
$data = array_get($list, 'data');
$lastPage = array_get($list, 'last_page');
echo json_encode([
'errcode' => 0,
'errmsg' => 'ok',
'total' => $count,
'count' => $count,
'data' => $data,
'last_page' => $lastPage
]);
} }
private function SearchBrand($request) private function SearchBrand($request)
...@@ -99,10 +67,17 @@ class CommonApiController extends Controller ...@@ -99,10 +67,17 @@ class CommonApiController extends Controller
]); ]);
} }
public function test($request) public function checkCompanyInfo($request)
{ {
$as = new AdminUserService(); //请求天眼查校验接口
$as->getPurchaseUsers(); $supplierName = $request->get('supplier_name');
$taxNumber = $request->get('tax_number');
$company = (new CompanyService())->getCompanyInfo($supplierName, $taxNumber);
if (!$company) {
$this->response(-1, '获取不到公司');
}
$this->response(0, 'ok', $company);
} }
} }
...@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Api; ...@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Controllers\Filter\SupplierFilter; use App\Http\Controllers\Filter\SupplierFilter;
use App\Http\Services\AdminUserService; use App\Http\Services\AdminUserService;
use App\Http\Services\CompanyService;
use App\Http\Services\LogService; use App\Http\Services\LogService;
use App\Http\Services\SupplierAuditService; use App\Http\Services\SupplierAuditService;
use App\Http\Services\SupplierService; use App\Http\Services\SupplierService;
...@@ -278,52 +279,49 @@ class SupplierApiController extends Controller ...@@ -278,52 +279,49 @@ class SupplierApiController extends Controller
$this->response(0, '修改状态成功'); $this->response(0, '修改状态成功');
} }
//导出供应商信息申请表到word
public function ExportSupplierToWord($request)
{
$supplierId = $request->get('supplier_id');
$exporter = new SupplierWordExporter();
$exporter->export($supplierId);
}
//检查供应商名称是否相似或者重复 //检查供应商名称是否相似或者重复
public function CheckSupplierName($request) public function CheckSupplierName($request)
{ {
$supplierName = $request->get('supplier_name'); $supplierName = trim($request->get('supplier_name'));
$taxNumber = $request->get('tax_number');
$supplierId = $request->get('supplier_id'); $supplierId = $request->get('supplier_id');
$model = new SupplierChannelModel(); $model = new SupplierChannelModel();
//如果是编辑操作,则要忽略非当前 //如果是编辑操作,则要忽略非当前
if ($supplierId) { if ($supplierId) {
$originSupplierName = $model->where('supplier_id', $supplierId)->value('supplier_name'); $originSupplierName = $model->where('supplier_id', $supplierId)->value('supplier_name');
$existedSupplierName = $model->where('supplier_name', $supplierName)->where('supplier_name','!=',$originSupplierName) $existedSupplierName = $model->where('supplier_name', $supplierName)->where('supplier_name', '!=',
$originSupplierName)
->value('supplier_name'); ->value('supplier_name');
if ($supplierName !== $existedSupplierName) { if ($supplierName !== $existedSupplierName) {
$supplierName = $model->where('supplier_name', 'like', // $supplierName = $model->where('supplier_name', 'like',
"%$supplierName%")->limit(1)->value('supplier_name'); // "%$supplierName%")->limit(1)->value('supplier_name');
if (!empty($supplierName)) { // if (!empty($supplierName)) {
$this->response(-2, '存在类似的供应商名称', $supplierName); // $this->response(-2, '存在类似的供应商名称', $supplierName);
} // }
}else{ } else {
$this->response(-1,'该供应商名称已经存在'); $this->response(-1, '供应商已存在,请重新输入或者咨询审批人');
} }
} else { } else {
$existedSupplierName = $model->where('supplier_name', $supplierName) $existedSupplierName = $model->where('supplier_name', $supplierName)
->value('supplier_name'); ->value('supplier_name');
if ($existedSupplierName) { if ($existedSupplierName) {
$this->response(-1, '已经有重复的供应商名称'); $this->response(-1, '供应商已存在,请重新输入或者咨询审批人');
} else { } else {
$supplierName = $model->where('supplier_name', 'like', // $supplierName = $model->where('supplier_name', 'like',
"%$supplierName%")->limit(1)->value('supplier_name'); // "%$supplierName%")->limit(1)->value('supplier_name');
if (!empty($supplierName)) { // if (!empty($supplierName)) {
$this->response(-2, '存在类似的供应商名称', $supplierName); // $this->response(-2, '存在类似的供应商名称', $supplierName);
} // }
} }
} }
//去请求天眼查获取资料 //还要去请求天眼查获取资料
$company = (new CompanyService())->getCompanyInfo($supplierName, $taxNumber);
$this->response(0, '供应商名称合理'); if (!$company) {
$this->response(-1, '公司未进行工商注册,请修改后重新提交');
}
$this->response(0, '供应商名称合理', $company);
} }
//审核供应商 //审核供应商
......
...@@ -35,9 +35,15 @@ class SupplierFilter ...@@ -35,9 +35,15 @@ class SupplierFilter
$codes = explode(',', $map['supplier_code']); $codes = explode(',', $map['supplier_code']);
$query->whereIn('supplier_code', $codes); $query->whereIn('supplier_code', $codes);
} }
if (!empty($map['group_code'])) {
$query->where('group_code', 'like', "%{$map['group_code']}%");
}
if (!empty($map['supplier_group']) || (isset($map['supplier_group']) && $map['supplier_group'] === '0')) { if (!empty($map['supplier_group']) || (isset($map['supplier_group']) && $map['supplier_group'] === '0')) {
$query->where('supplier_group', $map['supplier_group']); $query->where('supplier_group', $map['supplier_group']);
} }
if (!empty($map['company_nature'])) {
$query->where('company_nature', $map['company_nature']);
}
if (!empty($map['stockup_type'])) { if (!empty($map['stockup_type'])) {
$query->where('stockup_type', 'like', "%{$map['stockup_type']}%"); $query->where('stockup_type', 'like', "%{$map['stockup_type']}%");
} }
...@@ -58,7 +64,7 @@ class SupplierFilter ...@@ -58,7 +64,7 @@ class SupplierFilter
$query->where('create_uid', $adminId); $query->where('create_uid', $adminId);
} }
if ((isset($map['status']) && $map['status'] === "0") || !empty($map['status'])) { if ((isset($map['status']) && $map['status'] === "0") || !empty($map['status'])) {
$query->whereIn('status', explode(',',$map['status'])); $query->whereIn('status', explode(',', $map['status']));
} }
if (!empty($map['is_type'])) { if (!empty($map['is_type'])) {
......
<?php
namespace App\Http\Services;
//后台用户相关信息服务
use App\Model\IntracodeModel;
use App\Model\UserDepartmentModel;
use App\Model\UserInfoModel;
use Illuminate\Support\Facades\DB;
class CompanyService
{
public function getCompanyInfo($supplierName, $taxNumber)
{
$params = [
'keyword' => $supplierName ?: $taxNumber,
'region' => 1,
'select_type' => 1,
];
$url = config('website.InternalApiDomain') . '/companyInfo';
$result = curl($url, $params, true);
$result = json_decode($result, true);
$company = [];
if (array_get($result, 'code') === 0) {
$companyInfo = array_get($result['data'], 0);
$company = [
'supplier_name' => $companyInfo['com_name'],
'registered_capital' => $companyInfo['registered_capital'],
'supplier_address' => $companyInfo['com_address'],
'tax_number' => $companyInfo['tyc_info']['taxNumber'],
'phone' => $companyInfo['tyc_info']['phoneNumber'],
];
}
return $company;
}
}
\ No newline at end of file
...@@ -38,6 +38,7 @@ class SupplierTransformer ...@@ -38,6 +38,7 @@ class SupplierTransformer
$supplier['purchase_username'] = array_get($users, $supplier['purchase_uid']); $supplier['purchase_username'] = array_get($users, $supplier['purchase_uid']);
$supplier['status_name'] = array_get(config('fixed.SupplierStatus'), $supplier['status']); $supplier['status_name'] = array_get(config('fixed.SupplierStatus'), $supplier['status']);
$supplier['supplier_type_name'] = array_get(config('field.SupplierType'), $supplier['supplier_type']); $supplier['supplier_type_name'] = array_get(config('field.SupplierType'), $supplier['supplier_type']);
$supplier['company_nature_name'] = array_get(config('field.CompanyNature'), $supplier['company_nature']);
$supplier['region_name'] = array_get(config('fixed.Region'), $supplier['region'], '暂无'); $supplier['region_name'] = array_get(config('fixed.Region'), $supplier['region'], '暂无');
$supplier['contact_num'] = $this->getContactNum($supplier['supplier_id']); $supplier['contact_num'] = $this->getContactNum($supplier['supplier_id']);
$supplier['has_sku'] = $supplier['sku_num'] ? '是' : '否'; $supplier['has_sku'] = $supplier['sku_num'] ? '是' : '否';
......
...@@ -168,5 +168,14 @@ return [ ...@@ -168,5 +168,14 @@ return [
"深圳市九州电子之家有限公司", "深圳市九州电子之家有限公司",
"深圳前海硬之城信息技术有限公司", "深圳前海硬之城信息技术有限公司",
"北京京北通宇电子元件有限公司济南分公司" "北京京北通宇电子元件有限公司济南分公司"
],
'CompanyNature' => [
'其它' => '其它',
'代理商' => '代理商',
'现货商' => '现货商',
'方案商' => '方案商',
'原厂' => '原厂',
'分销平台' => '分销平台',
'代工厂' => '代工厂',
] ]
]; ];
\ No newline at end of file
...@@ -21,6 +21,7 @@ return [ ...@@ -21,6 +21,7 @@ return [
'UploadUrl' => env('API_DOMAIN') . '/oss/upload', 'UploadUrl' => env('API_DOMAIN') . '/oss/upload',
'UploadKey' => 'fh6y5t4rr351d2c3bryi', 'UploadKey' => 'fh6y5t4rr351d2c3bryi',
'QueueDomain' => 'http://192.168.1.252:16590/mq/push', 'QueueDomain' => 'http://192.168.1.252:16590/mq/push',
'InternalApiDomain' => 'http://192.168.1.192:8200',
'WarningRobot' => 'https://oapi.dingtalk.com/robot/send?access_token=7ff88e1ee208e3a637c17bc51c1c879bccbf101fef5885d22ad70d21ea2f966a', 'WarningRobot' => 'https://oapi.dingtalk.com/robot/send?access_token=7ff88e1ee208e3a637c17bc51c1c879bccbf101fef5885d22ad70d21ea2f966a',
'CSWarningRobot' => 'https://oapi.dingtalk.com/robot/send?access_token=92917a6e090a8a39832c4843a579d6c6f9dfecc46fa275f8753ddee2b4399045', 'CSWarningRobot' => 'https://oapi.dingtalk.com/robot/send?access_token=92917a6e090a8a39832c4843a579d6c6f9dfecc46fa275f8753ddee2b4399045',
......
<script> <script>
layui.use(['table', 'form', 'element', 'layer', 'admin', 'upload', 'index'], function () { layui.use(['table', 'form', 'element', 'layer', 'admin', 'upload', 'index'], function () {
let layer = layui.layer; let layer = layui.layer;
let admin = layui.admin;
let supplierId = getQueryVariable('supplier_id') let supplierId = getQueryVariable('supplier_id')
$('#updateSupplierUrl').click(function () { $('#updateSupplierUrl').click(function () {
layer.load(1); admin.showLoading({
type: 3,
});
let tabName = $('.layui-this').attr('id'); let tabName = $('.layui-this').attr('id');
window.location.href = "/supplier/UpdateSupplier?view=iframe&supplier_id={{$supplier['supplier_id']}}&tab=" + tabName; window.location.href = "/supplier/UpdateSupplier?view=iframe&supplier_id={{$supplier['supplier_id']}}&tab=" + tabName;
}) })
...@@ -14,7 +17,7 @@ ...@@ -14,7 +17,7 @@
let supplierId = getQueryVariable('supplier_id'); let supplierId = getQueryVariable('supplier_id');
let res = ajax('/api/supplier/CancelBlockSupplier', {supplier_id: supplierId, is_type: 0}) let res = ajax('/api/supplier/CancelBlockSupplier', {supplier_id: supplierId, is_type: 0})
if (res.err_code === 0) { if (res.err_code === 0) {
layer.closeAll(); admin.removeLoading();
layer.msg(res.err_msg, {icon: 6}) layer.msg(res.err_msg, {icon: 6})
location.reload(); location.reload();
} else { } else {
...@@ -29,7 +32,7 @@ ...@@ -29,7 +32,7 @@
let supplierId = getQueryVariable('supplier_id'); let supplierId = getQueryVariable('supplier_id');
let res = ajax('/api/supplier/CancelDisableSupplier', {supplier_id: supplierId, is_type: 0}) let res = ajax('/api/supplier/CancelDisableSupplier', {supplier_id: supplierId, is_type: 0})
if (res.err_code === 0) { if (res.err_code === 0) {
layer.closeAll(); admin.removeLoading();
layer.msg(res.err_msg, {icon: 6}) layer.msg(res.err_msg, {icon: 6})
location.reload(); location.reload();
} else { } else {
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
} }
}) })
} }
supplierStatistics(true); supplierStatistics(true);
//罗盘隐藏 //罗盘隐藏
...@@ -111,8 +112,9 @@ ...@@ -111,8 +112,9 @@
"' class='list-href' ew-title='供应商详情 - " + data.supplier_code + "'>" + data.supplier_code + "</a>" "' class='list-href' ew-title='供应商详情 - " + data.supplier_code + "'>" + data.supplier_code + "</a>"
} }
}, },
{field: 'group_code', title: '集团编码', align: 'center', width: 90},
{ {
field: 'supplier_name', title: '供应商名称', align: 'center', width: 180, templet: function (data) { field: 'supplier_name', title: '供应商名称', align: 'left', width: 180, templet: function (data) {
if (data.status === -3) { if (data.status === -3) {
return "<span title='" + data.block_reason + "'>" + data.supplier_name + "</span>" return "<span title='" + data.block_reason + "'>" + data.supplier_name + "</span>"
} else { } else {
...@@ -121,6 +123,7 @@ ...@@ -121,6 +123,7 @@
} }
}, },
{field: 'supplier_group', title: '供应商性质', align: 'center', width: 115}, {field: 'supplier_group', title: '供应商性质', align: 'center', width: 115},
{field: 'company_nature', title: '公司实际性质', align: 'center', width: 125},
{ {
field: 'level', title: '等级', align: 'center', width: 60, templet: function (d) { field: 'level', title: '等级', align: 'center', width: 60, templet: function (d) {
return d.level ? d.level : '-'; return d.level ? d.level : '-';
......
...@@ -7,7 +7,9 @@ ...@@ -7,7 +7,9 @@
let element = layui.element; let element = layui.element;
$('#supplierDetailUrl').click(function () { $('#supplierDetailUrl').click(function () {
layer.load(1); admin.showLoading({
type: 3,
});
}); });
......
...@@ -18,18 +18,28 @@ ...@@ -18,18 +18,28 @@
$("#supplier_name").blur(function () { $("#supplier_name").blur(function () {
const supplier_name = $(this).val(); const supplier_name = $(this).val();
const supplier_id = supplierId; const supplier_id = supplierId;
const taxNumber = $('#tax_number').val();
$('#supplier_check_tip').remove(); $('#supplier_check_tip').remove();
let url = '/api/supplier/CheckSupplierName?supplier_name=' + supplier_name + '&supplier_id=' + supplier_id; let url = '/api/supplier/CheckSupplierName?supplier_name=' + supplier_name + '&supplier_id=' + supplier_id + '&tax_number=' + taxNumber;
let res = ajax(url); let res = ajax(url);
if (!res) { if (!res) {
layer.msg('网络错误,请重试', {icon: 5}); layer.msg('网络错误,请重试', {icon: 5});
} else { } else {
if (supplier_name !== '') { if (supplier_name !== '') {
if (res.err_code === -1) { if (res.err_code === -1) {
$(this).after("<div id='supplier_check_tip' style='margin-top: 10px'>" + layer.msg(res.err_msg, {icon: 5});
"<p style='color: red;'>供应商已存在,请重新输入或者咨询审批人</p></div>"); $(this).after("<div id='supplier_check_tip' style='margin-top: 5px'>" +
"<p style='color: red;'>" + res.err_msg + "</p></div>");
$('#supplier_name').prop('disabled', false); $('#supplier_name').prop('disabled', false);
} else { } else if (res.err_code === 0) {
//如果供应商没有问题,就要去自动填补部分资料
let companyInfo = res.data;
$('#supplier_name').val(companyInfo.supplier_name);
$('#tax_number').val(companyInfo.tax_number);
$('#phone').val(companyInfo.phone);
$('#supplier_address').val(companyInfo.supplier_address);
$('#registered_capital').val(companyInfo.registered_capital);
layer.msg('校验公司信息通过,自动补全相关数据', {icon: 6})
} }
} }
} }
...@@ -218,8 +228,10 @@ ...@@ -218,8 +228,10 @@
$('#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();
console.log(supplierName);
console.log(taxNumber);
admin.btnLoading('#recheck_company_info', '正在查验公司信息,请稍后'); admin.btnLoading('#recheck_company_info', '正在查验公司信息,请稍后');
if (!supplierName || !taxNumber) { if (!supplierName && !taxNumber) {
layer.msg('请填写供应商名称或者税号后再进行查验', {icon: 5}); layer.msg('请填写供应商名称或者税号后再进行查验', {icon: 5});
admin.btnLoading('#recheck_company_info', false); admin.btnLoading('#recheck_company_info', false);
return false; return false;
...@@ -228,16 +240,24 @@ ...@@ -228,16 +240,24 @@
let url = '/api/common/checkCompanyInfo?supplier_name=' + supplierName + '&tax_number=' + taxNumber; let url = '/api/common/checkCompanyInfo?supplier_name=' + supplierName + '&tax_number=' + taxNumber;
let res = ajax(url); let res = ajax(url);
if (!res) { if (!res) {
admin.btnLoading('#recheck_company_info', false);
layer.msg('网络错误,请重试', {icon: 5}); layer.msg('网络错误,请重试', {icon: 5});
} else { } else {
if (res.err_code === 0) { if (res.err_code === 0) {
admin.btnLoading('#recheck_company_info', false);
let companyInfo = res.data; let companyInfo = res.data;
$('#supplier_name').val(companyInfo.supplier_name);
$('#tax_number').val(companyInfo.tax_number);
$('#phone').val(companyInfo.phone);
$('#supplier_address').val(companyInfo.supplier_address);
$('#registered_capital').val(companyInfo.registered_capital);
layer.msg('校验公司信息通过,自动补全相关数据', {icon: 6})
} else { } else {
admin.btnLoading('#recheck_company_info', false);
$('#supplier_name').after("<div id='supplier_check_tip' style='margin-top: 10px'>" + $('#supplier_name').after("<div id='supplier_check_tip' style='margin-top: 10px'>" +
"<p style='color: red;'>公司未进行工商注册,请修改后重新提交</p></div>"); "<p style='color: red;'>公司未进行工商注册,请修改后重新提交</p></div>");
layer.msg('公司未进行工商注册,请修改后重新提交', {icon: 5}) layer.msg('公司未进行工商注册,请修改后重新提交', {icon: 5})
} }
admin.btnLoading('#recheck_company_info', false);
} }
}); });
}); });
......
...@@ -143,17 +143,15 @@ ...@@ -143,17 +143,15 @@
?> ?>
<div class="layui-row"> <div class="layui-row">
<div class="layui-inline"> <div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter') @inject('multiTransformableSelectPresenter','App\Presenters\Filter\MultiTransformableSelectPresenter')
{!! $statusPresenter->render('supplier_group','供应商性质','', {!! $multiTransformableSelectPresenter->render(['supplier_group'=>'供应商性质','company_nature'=>'公司实际性质'],
config('fixed.SupplierGroup')) !!} ['supplier_group'=>config('fixed.SupplierGroup'),'company_nature'=>config('field.CompanyNature')]) !!}
</div> </div>
<div class="layui-inline"> <div class="layui-inline">
@inject('transformableInputPresenter','App\Presenters\Filter\TransformableInputPresenter') @inject('transformableInputPresenter','App\Presenters\Filter\TransformableInputPresenter')
{!! $transformableInputPresenter->render(['supplier_name'=>'供应商名称','supplier_code'=>'供应商编码','supplier_id'=>'供应商ID']) !!} {!! $transformableInputPresenter->render(['supplier_name'=>'供应商名称','supplier_code'=>'供应商编码','group_code'=>'集团编码','supplier_id'=>'供应商ID']) !!}
</div> </div>
<div class="layui-inline"> <div class="layui-inline">
{{-- @inject('statusPresenter','App\Presenters\StatusPresenter')--}}
{{-- {!! $statusPresenter->render('status','供应商状态','',config('fixed.SupplierStatus')) !!}--}}
@inject('multiSelectorPresenter','App\Presenters\MultiSelectorPresenter') @inject('multiSelectorPresenter','App\Presenters\MultiSelectorPresenter')
{!! $multiSelectorPresenter->render('status','供应商状态','',$statusData) !!} {!! $multiSelectorPresenter->render('status','供应商状态','',$statusData) !!}
</div> </div>
......
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