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
9898f02a
authored
Jun 25, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
完善禁用逻辑
parent
3f40a276
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
250 additions
and
81 deletions
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Services/CompanyService.php
app/Http/Services/SupplierService.php
app/Http/Validators/SupplierValidator.php
config/website.php
public/plugins/assets/js/common.js
public/plugins/common.js
resources/views/script/AddSupplierScript.blade.php
resources/views/script/UpdateSupplierScript.blade.php
resources/views/script/supplier/SupplierAttachmentScript.blade.php
resources/views/script/supplier/SupplierBaseScript.blade.php
resources/views/script/supplier/SupplierFileScript.blade.php
resources/views/web/AddSupplier.blade.php
resources/views/web/UpdateSupplier.blade.php
resources/views/web/supplier/SupplierBase.blade.php
app/Http/Controllers/Api/SupplierApiController.php
View file @
9898f02a
...
@@ -174,7 +174,6 @@ class SupplierApiController extends Controller
...
@@ -174,7 +174,6 @@ class SupplierApiController extends Controller
}
}
$channelMap
=
array_merge
(
$this
->
channelMap
,
config
(
'field.AttachmentFields'
));
$channelMap
=
array_merge
(
$this
->
channelMap
,
config
(
'field.AttachmentFields'
));
$channel
=
$request
->
only
(
$channelMap
);
$channel
=
$request
->
only
(
$channelMap
);
dd
(
$channel
);
$service
=
new
SupplierService
();
$service
=
new
SupplierService
();
$result
=
$service
->
saveSupplier
(
$channel
);
$result
=
$service
->
saveSupplier
(
$channel
);
if
(
!
$result
)
{
if
(
!
$result
)
{
...
...
app/Http/Services/CompanyService.php
View file @
9898f02a
...
@@ -15,17 +15,19 @@ class CompanyService
...
@@ -15,17 +15,19 @@ class CompanyService
public
function
getCompanyInfo
(
$supplierName
,
$taxNumber
,
$regionType
=
1
)
public
function
getCompanyInfo
(
$supplierName
,
$taxNumber
,
$regionType
=
1
)
{
{
$params
=
[
$params
=
[
'
keyword'
=>
$supplierName
?:
$taxNumber
,
'
company_name'
=>
$supplierName
,
'region'
=>
$regionType
,
'region'
=>
$regionType
,
'select_type'
=>
1
,
'company_type'
=>
1
,
'company_tax_no'
=>
$taxNumber
,
];
];
$url
=
config
(
'website.
InternalApiDomain'
)
.
'/companyInfo
'
;
$url
=
config
(
'website.
UnitedDataDomain'
)
.
'/sync/Company/getCompanyInfoByName
'
;
$result
=
curl
(
$url
,
$params
,
true
);
$result
=
curl
(
$url
,
$params
);
$result
=
json_decode
(
$result
,
true
);
$result
=
json_decode
(
$result
,
true
);
$company
=
[];
$company
=
[];
if
(
array_get
(
$result
,
'code'
)
===
0
)
{
if
(
array_get
(
$result
,
'code'
)
===
0
)
{
$companyInfo
=
array_get
(
array_get
(
$result
[
'data'
],
'company_info_list'
),
0
);
$companyInfoList
=
array_get
(
array_get
(
$result
[
'data'
],
'tycList'
),
'company_info_list'
);
if
(
!
empty
(
$companyInfo
))
{
if
(
!
empty
(
$companyInfoList
))
{
$companyInfo
=
$companyInfoList
[
0
];
$company
=
[
$company
=
[
'supplier_name'
=>
$companyInfo
[
'com_name'
],
'supplier_name'
=>
$companyInfo
[
'com_name'
],
'registered_capital'
=>
(
int
)
$companyInfo
[
'registered_capital'
],
'registered_capital'
=>
(
int
)
$companyInfo
[
'registered_capital'
],
...
...
app/Http/Services/SupplierService.php
View file @
9898f02a
...
@@ -247,13 +247,16 @@ class SupplierService
...
@@ -247,13 +247,16 @@ class SupplierService
$oldSystemTags
);
$oldSystemTags
);
$tagService
->
saveTags
(
$supplierId
,
SupplierTagService
::
TAG_TYPE_CUSTOMER
,
$channel
[
'customer_tags'
],
$tagService
->
saveTags
(
$supplierId
,
SupplierTagService
::
TAG_TYPE_CUSTOMER
,
$channel
[
'customer_tags'
],
$oldCustomerTags
);
$oldCustomerTags
);
return
$supplierId
;
}
}
//重新生成外部显示的编码
//重新生成外部显示的编码
$this
->
generateSupplierSn
(
$supplierId
,
$channel
[
'supplier_group'
]);
$this
->
generateSupplierSn
(
$supplierId
,
$channel
[
'supplier_group'
]);
//保存和搜索相关的标签情况
//保存和搜索相关的标签情况
$supplierSearchTagService
=
new
SupplierSearchTagService
();
$supplierSearchTagService
=
new
SupplierSearchTagService
();
$supplierSearchTagService
->
saveSupplierSearchTags
(
$supplierId
);
$supplierSearchTagService
->
saveSupplierSearchTags
(
$supplierId
);
return
$supplierId
;
});
});
//保存日志
//保存日志
...
...
app/Http/Validators/SupplierValidator.php
View file @
9898f02a
...
@@ -17,7 +17,6 @@ class SupplierValidator
...
@@ -17,7 +17,6 @@ class SupplierValidator
//因为控制器那边已经被之前的人魔改的难用的一比,而且控制器那边还接收了一大堆统一变量
//因为控制器那边已经被之前的人魔改的难用的一比,而且控制器那边还接收了一大堆统一变量
public
function
checkSave
(
$validateData
,
$isAudit
)
public
function
checkSave
(
$validateData
,
$isAudit
)
{
{
dd
(
$validateData
[
'tax_number'
]);
//整理下请求数据
//整理下请求数据
$validateData
=
$this
->
transformRequestData
(
$validateData
);
$validateData
=
$this
->
transformRequestData
(
$validateData
);
//这个supplierId是用来判断是新增还是修改的
//这个supplierId是用来判断是新增还是修改的
...
...
config/website.php
View file @
9898f02a
...
@@ -22,6 +22,7 @@ return [
...
@@ -22,6 +22,7 @@ return [
'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.252:8200'
,
'InternalApiDomain'
=>
'http://192.168.1.252:8200'
,
'UnitedDataDomain'
=>
'http://united_data.liexindev.net'
,
'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'
,
...
...
public/plugins/assets/js/common.js
View file @
9898f02a
...
@@ -86,43 +86,53 @@ function inArray(needle, haystack) {
...
@@ -86,43 +86,53 @@ function inArray(needle, haystack) {
return
false
;
return
false
;
}
}
function
attachmentsUploadedChangeSupplierType
(
supplierType
,
supplierGroup
,
fieldName
)
{
function
attachmentsUploadedChangeSupplierType
(
supplierType
,
supplierGroup
,
fieldNameList
)
{
if
(
fieldNameList
.
length
===
0
)
{
return
true
;
}
let
msg
=
''
;
let
msg
=
''
;
let
radioObj
=
$
(
'input[name="supplier_type"]'
);
let
radioObj
=
$
(
'input[name="supplier_type"]'
);
//已经上传品质保证协议(代理商则提示为“已经上传代理证”),是否切换为正式供应商?
//已经上传品质保证协议(代理商则提示为“已经上传代理证”),是否切换为正式供应商?
if
(
supplierType
===
'2'
)
{
if
(
supplierType
===
'2'
)
{
//如果已经上传品质保证协议,并且供应商性质不是代理商(代理商要代理证)
//如果已经上传品质保证协议,并且供应商性质不是代理商(代理商要代理证)
if
(
'quality_assurance_agreement'
===
fieldName
&&
supplierGroup
!==
'1'
)
{
if
(
inArray
(
'quality_assurance_agreement'
,
fieldNameList
)
&&
supplierGroup
!==
'1'
)
{
msg
=
'已经上传品质保证协议,是否切换为正式供应商?'
msg
=
'已经上传品质保证协议,是否切换为正式供应商?'
layer
.
confirm
(
msg
,
function
(
index
)
{
layer
.
confirm
(
msg
,
function
(
index
)
{
radioObj
.
get
(
0
).
checked
=
true
;
radioObj
.
get
(
0
).
checked
=
true
;
radioObj
.
get
(
1
).
checked
=
false
;
radioObj
.
get
(
1
).
checked
=
false
;
layui
.
form
.
render
(
'radio'
);
layer
.
closeAll
();
});
});
}
}
if
(
'proxy_certificate'
===
fieldName
&&
supplierGroup
===
'1'
)
{
if
(
inArray
(
'proxy_certificate'
,
fieldNameList
)
&&
supplierGroup
===
'1'
)
{
msg
=
'该供应商为代理供应商,已经上传代理证,是否切换为正式供应商?'
msg
=
'该供应商为代理供应商,已经上传代理证,是否切换为正式供应商?'
layer
.
confirm
(
msg
,
function
(
index
)
{
layer
.
confirm
(
msg
,
function
(
index
)
{
radioObj
.
get
(
0
).
checked
=
true
;
radioObj
.
get
(
0
).
checked
=
true
;
radioObj
.
get
(
1
).
checked
=
false
;
radioObj
.
get
(
1
).
checked
=
false
;
layui
.
form
.
render
(
'radio'
);
layer
.
closeAll
();
});
});
}
}
}
else
{
}
else
{
if
(
'quality_assurance_agreement'
===
fieldName
&&
supplierGroup
!==
'1'
)
{
if
(
!
inArray
(
'quality_assurance_agreement'
,
fieldNameList
)
&&
supplierGroup
!==
'1'
)
{
msg
=
'未上传品质保证协议,是否切换为临时供应商?'
msg
=
'未上传品质保证协议,是否切换为临时供应商?'
layer
.
confirm
(
msg
,
function
(
index
)
{
layer
.
confirm
(
msg
,
function
(
index
)
{
radioObj
.
get
(
0
).
checked
=
false
;
radioObj
.
get
(
0
).
checked
=
false
;
radioObj
.
get
(
1
).
checked
=
true
;
radioObj
.
get
(
1
).
checked
=
true
;
layui
.
form
.
render
(
'radio'
);
layer
.
closeAll
();
});
});
}
}
if
(
'proxy_certificate'
===
fieldName
&&
supplierGroup
===
'1'
)
{
if
(
!
inArray
(
'proxy_certificate'
,
fieldNameList
)
&&
supplierGroup
===
'1'
)
{
msg
=
'该供应商为代理供应商,但是未上传代理证,是否切换为临时供应商?'
msg
=
'该供应商为代理供应商,但是未上传代理证,是否切换为临时供应商?'
layer
.
confirm
(
msg
,
function
(
index
)
{
layer
.
confirm
(
msg
,
function
(
index
)
{
radioObj
.
get
(
0
).
checked
=
false
;
radioObj
.
get
(
0
).
checked
=
false
;
radioObj
.
get
(
1
).
checked
=
true
;
radioObj
.
get
(
1
).
checked
=
true
;
layui
.
form
.
render
(
'radio'
);
layer
.
closeAll
();
});
});
}
}
}
}
layui
.
form
.
render
(
'radio'
);
return
msg
;
return
true
;
}
}
public/plugins/common.js
View file @
9898f02a
...
@@ -55,10 +55,6 @@ function getQueryVariable(variable) {
...
@@ -55,10 +55,6 @@ function getQueryVariable(variable) {
}
}
function
ajax
(
url
,
data
){
function
ajax
(
url
,
data
){
layer
.
msg
(
'加载中'
,
{
icon
:
16
,
shade
:
0.01
});
var
result
=
false
;
var
result
=
false
;
$
.
ajax
({
$
.
ajax
({
url
:
url
,
url
:
url
,
...
@@ -73,6 +69,5 @@ function ajax(url,data){
...
@@ -73,6 +69,5 @@ function ajax(url,data){
}
}
}
}
})
})
layer
.
closeAll
();
return
result
;
return
result
;
}
}
\ No newline at end of file
resources/views/script/AddSupplierScript.blade.php
View file @
9898f02a
...
@@ -107,6 +107,7 @@
...
@@ -107,6 +107,7 @@
});
});
form
.
on
(
'submit(addAndApplySupplier)'
,
function
(
data
)
{
form
.
on
(
'submit(addAndApplySupplier)'
,
function
(
data
)
{
//去找出附件的所有数据
//去找出附件的所有数据
let
file_name
=
[];
let
file_name
=
[];
let
file_url
=
[];
let
file_url
=
[];
...
@@ -130,6 +131,58 @@
...
@@ -130,6 +131,58 @@
data
.
field
.
validity_period
=
validity_period
;
data
.
field
.
validity_period
=
validity_period
;
data
.
field
.
apply_audit_reason
=
$
(
'#apply_audit_reason'
).
val
();
data
.
field
.
apply_audit_reason
=
$
(
'#apply_audit_reason'
).
val
();
let
fieldNameList
=
field_name
;
//提交先提示是否要转换供应商类型
let
radioObj
=
$
(
'input[name="supplier_type"]'
);
//已经上传品质保证协议(代理商则提示为“已经上传代理证”),是否切换为正式供应商?
let
supplierGroup
=
data
.
field
.
supplier_group
;
let
msg
;
let
obj1Checked
=
0
;
let
obj2Checked
=
0
;
if
(
data
.
field
.
supplier_type
===
'2'
)
{
//如果已经上传品质保证协议,并且供应商性质不是代理商(代理商要代理证)
if
(
inArray
(
'quality_assurance_agreement'
,
fieldNameList
)
&&
supplierGroup
!==
'1'
)
{
msg
=
'已经上传品质保证协议,是否切换为正式供应商?'
obj1Checked
=
true
;
obj2Checked
=
false
;
}
if
(
inArray
(
'proxy_certificate'
,
fieldNameList
)
&&
supplierGroup
===
'1'
)
{
msg
=
'该供应商为代理供应商,已经上传代理证,是否切换为正式供应商?'
obj1Checked
=
true
;
obj2Checked
=
false
;
}
}
else
{
if
(
!
inArray
(
'quality_assurance_agreement'
,
fieldNameList
)
&&
supplierGroup
!==
'1'
)
{
msg
=
'未上传品质保证协议,是否切换为临时供应商?'
obj1Checked
=
false
;
obj2Checked
=
true
;
}
if
(
!
inArray
(
'proxy_certificate'
,
fieldNameList
)
&&
supplierGroup
===
'1'
)
{
msg
=
'该供应商为代理供应商,但是未上传代理证,是否切换为临时供应商?'
obj1Checked
=
false
;
obj2Checked
=
true
;
}
}
if
(
msg
)
{
layer
.
confirm
(
msg
,
function
(
index
)
{
if
(
obj1Checked
!==
0
)
{
radioObj
.
get
(
0
).
checked
=
obj1Checked
;
radioObj
.
get
(
1
).
checked
=
obj2Checked
;
layui
.
form
.
render
(
'radio'
);
data
.
field
.
supplier_type
=
obj1Checked
?
1
:
2
;
layer
.
closeAll
();
}
auditAndAddSupplier
(
data
);
});
}
else
{
auditAndAddSupplier
(
data
);
}
return
false
;
});
function
auditAndAddSupplier
(
data
)
{
if
(
data
.
field
.
supplier_type
===
'2'
)
{
if
(
data
.
field
.
supplier_type
===
'2'
)
{
layer
.
open
({
layer
.
open
({
type
:
1
,
type
:
1
,
...
@@ -152,9 +205,7 @@
...
@@ -152,9 +205,7 @@
addSupplier
(
data
);
addSupplier
(
data
);
});
});
}
}
}
return
false
;
});
function
addSupplier
(
data
)
{
function
addSupplier
(
data
)
{
admin
.
showLoading
({
admin
.
showLoading
({
...
@@ -163,6 +214,7 @@
...
@@ -163,6 +214,7 @@
let
url
=
'/api/supplier/AddSupplier?direct_apply=1'
;
let
url
=
'/api/supplier/AddSupplier?direct_apply=1'
;
let
res
=
ajax
(
url
,
data
.
field
);
let
res
=
ajax
(
url
,
data
.
field
);
if
(
!
res
)
{
if
(
!
res
)
{
admin
.
removeLoading
();
layer
.
msg
(
'网络错误,请重试'
,
{
icon
:
6
});
layer
.
msg
(
'网络错误,请重试'
,
{
icon
:
6
});
}
else
{
}
else
{
if
(
res
.
err_code
===
0
)
{
if
(
res
.
err_code
===
0
)
{
...
...
resources/views/script/UpdateSupplierScript.blade.php
View file @
9898f02a
<script>
<script>
layui
.
use
([
'table'
,
'form'
,
'element'
,
'layer'
,
'admin'
,
'index'
,
'laydate'
,
'xmSelect'
],
function
()
{
layui
.
use
([
'table'
,
'form'
,
'element'
,
'layer'
,
'admin'
,
'index'
,
'laydate'
,
'xmSelect'
],
function
()
{
let
admin
=
layui
.
admin
;
let
admin
=
layui
.
admin
;
let
index
=
layui
.
index
;
let
form
=
layui
.
form
;
let
form
=
layui
.
form
;
let
table
=
layui
.
table
;
let
table
=
layui
.
table
;
let
element
=
layui
.
element
;
$
(
'#supplierDetailUrl'
).
click
(
function
()
{
$
(
'#supplierDetailUrl'
).
click
(
function
()
{
admin
.
showLoading
({
admin
.
showLoading
({
...
@@ -37,6 +35,61 @@
...
@@ -37,6 +35,61 @@
});
});
form.on('
submit
(
applyAuditSupplier
)
', function (data) {
form.on('
submit
(
applyAuditSupplier
)
', function (data) {
let fieldNameList = [];
$('
.
attachment_fields
').each(function () {
fieldNameList.push($(this).text());
});
//提交先提示是否要转换供应商类型
let radioObj = $('
input
[
name
=
"supplier_type"
]
');
//已经上传品质保证协议(代理商则提示为“已经上传代理证”),是否切换为正式供应商?
let supplierGroup = data.field.supplier_group;
let msg;
let obj1Checked = 0;
let obj2Checked = 0;
if (data.field.supplier_type === '
2
') {
//如果已经上传品质保证协议,并且供应商性质不是代理商(代理商要代理证)
if (inArray('
quality_assurance_agreement
', fieldNameList) && supplierGroup !== '
1
') {
msg = '
已经上传品质保证协议,是否切换为正式供应商?
'
obj1Checked = true;
obj2Checked = false;
}
if (inArray('
proxy_certificate
', fieldNameList) && supplierGroup === '
1
') {
msg = '
该供应商为代理供应商
,
已经上传代理证,是否切换为正式供应商?
'
obj1Checked = true;
obj2Checked = false;
}
} else {
if (!inArray('
quality_assurance_agreement
', fieldNameList) && supplierGroup !== '
1
') {
msg = '
未上传品质保证协议,是否切换为临时供应商?
'
obj1Checked = false;
obj2Checked = true;
}
if (!inArray('
proxy_certificate
', fieldNameList) && supplierGroup === '
1
') {
msg = '
该供应商为代理供应商
,
但是未上传代理证,是否切换为临时供应商?
'
obj1Checked = false;
obj2Checked = true;
}
}
if (msg) {
layer.confirm(msg, function (index) {
if (obj1Checked !== 0) {
radioObj.get(0).checked = obj1Checked;
radioObj.get(1).checked = obj2Checked;
layui.form.render('
radio
');
data.field.supplier_type = obj1Checked ? "1" : "2";
layer.closeAll();
}
auditAndUpdateSupplier(data);
});
} else {
auditAndUpdateSupplier(data);
}
return false;
});
function auditAndUpdateSupplier(data) {
data.field.is_audit = 1;
data.field.is_audit = 1;
if (data.field.supplier_type === '
2
') {
if (data.field.supplier_type === '
2
') {
layer.open({
layer.open({
...
@@ -62,12 +115,10 @@
...
@@ -62,12 +115,10 @@
updateSupplier(data);
updateSupplier(data);
});
});
}
}
}
);
}
function updateSupplier(data) {
function updateSupplier(data) {
admin.showLoading({
admin.showLoading('
.
layui
-
layer
-
btn0
');
type: 3,
});
let res = ajax('
/
api
/
supplier
/
UpdateSupplier
', data.field);
let res = ajax('
/
api
/
supplier
/
UpdateSupplier
', data.field);
if (res.err_code === 0) {
if (res.err_code === 0) {
admin.putTempData("needFreshList", 1)
admin.putTempData("needFreshList", 1)
...
@@ -76,13 +127,14 @@
...
@@ -76,13 +127,14 @@
layer.msg(res.err_msg, {icon: 6})
layer.msg(res.err_msg, {icon: 6})
} else {
} else {
let errMsg = res.err_msg;
let errMsg = res.err_msg;
console.log(res);
let msg = '';
let msg = '';
$.each(errMsg.split('
|
'
),
function
(
index
,
value
)
{
$.each(errMsg.split('
|
'
),
function
(
index
,
value
)
{
msg
+=
"
<
span
>
" + value + "
<
/span><br>
"
msg
+=
"
<
span
>
" + value + "
<
/span><br>
"
});
});
layer
.
msg
(
msg
,
{
icon
:
5
})
layer
.
msg
(
msg
,
{
icon
:
5
})
}
}
admin
.
removeLoading
();
admin
.
removeLoading
(
'.layui-layer-btn0'
);
}
}
});
});
</script>
</script>
\ No newline at end of file
resources/views/script/supplier/SupplierAttachmentScript.blade.php
View file @
9898f02a
...
@@ -33,11 +33,11 @@
...
@@ -33,11 +33,11 @@
field
:
'file_name'
,
field
:
'file_name'
,
title
:
'
<
span
class
=
"require"
>*
<
/span>附件名称', align: 'center', width: 270
,
title
:
'
<
span
class
=
"require"
>*
<
/span>附件名称', align: 'center', width: 270
,
templet
:
function
(
data
)
{
templet
:
function
(
data
)
{
return
"
<
a
style
=
'color: blue'
href
=
'" + data.file_url + "'
target
=
'_blank'
>
" + data.file_name + "
<
/a>"
;
return
"
<
a
style
=
'color: blue'
href
=
'" + data.file_url + "'
target
=
'_blank'
>
" + data.file_name + "
<
div
style
=
'display:none'
class
=
'attachment_fields'
>
" + data.field_name + "
<
/div><
/
a
>
"
;
}
}
},
},
{
field
:
'description'
,
title
:
'附件说明'
,
align
:
'center'
,
width
:
250
},
{
field
:
'description'
,
title
:
'附件说明'
,
align
:
'center'
,
width
:
250
},
{
field
:
'validity_period'
,
title
:
'
<
span
class
=
"require"
>*
<
/span>有效期', align: 'center', width: 2
5
0}
,
{
field
:
'validity_period'
,
title
:
'
<
span
class
=
"require"
>*
<
/span>有效期', align: 'center', width: 2
2
0}
,
{
field
:
'create_name'
,
title
:
'上传人'
,
align
:
'center'
,
width
:
100
},
{
field
:
'create_name'
,
title
:
'上传人'
,
align
:
'center'
,
width
:
100
},
{
field
:
'create_time'
,
title
:
'上传时间'
,
align
:
'center'
,
width
:
150
},
{
field
:
'create_time'
,
title
:
'上传时间'
,
align
:
'center'
,
width
:
150
},
]],
]],
...
...
resources/views/script/supplier/SupplierBaseScript.blade.php
View file @
9898f02a
...
@@ -18,33 +18,57 @@
...
@@ -18,33 +18,57 @@
const
supplierId
=
getQueryVariable
(
'supplier_id'
);
const
supplierId
=
getQueryVariable
(
'supplier_id'
);
$
(
"#supplier_name"
).
blur
(
function
()
{
$
(
"#supplier_name
,#tax_number
"
).
blur
(
function
()
{
cons
t
supplier_name
=
$
(
this
).
val
();
le
t
supplier_name
=
$
(
this
).
val
();
const
supplier_id
=
supplierId
;
const
supplier_id
=
supplierId
;
const
region
=
$
(
'#region'
).
val
();
const
region
=
$
(
'#region'
).
val
();
const
taxN
umber
=
$
(
'#tax_number'
).
val
();
let
tax_n
umber
=
$
(
'#tax_number'
).
val
();
$
(
'#supplier_check_tip'
).
remove
();
$
(
'#supplier_check_tip'
).
remove
();
let
url
=
'/api/supplier/CheckSupplierName?supplier_name='
+
supplier_name
+
'&supplier_id='
+
supplier_id
+
'&tax_number='
+
taxNumber
+
'®ion='
+
region
;
var
self
=
$
(
this
);
let
res
=
ajax
(
url
);
let
url
=
'/api/supplier/CheckSupplierName?supplier_name='
+
supplier_name
+
'&supplier_id='
+
supplier_id
if
(
!
res
)
{
+
'&tax_number='
+
tax_number
+
'®ion='
+
region
;
layer
.
msg
(
'网络错误,请重试'
,
{
icon
:
5
});
}
else
{
@
if
(
!
checkPerm
(
'IgnoreCompanyCheck'
))
if
(
supplier_name
!==
''
)
{
if
(
supplier_name
===
''
&&
self
.
attr
(
'id'
)
===
'supplier_name'
)
{
$
(
'#tax_number'
).
val
(
''
);
tax_number
=
''
;
resetCompanyInfo
();
}
if
(
tax_number
===
''
&&
self
.
attr
(
'id'
)
===
'tax_number'
)
{
$
(
'#supplier_name'
).
val
(
''
);
supplier_name
=
''
;
resetCompanyInfo
();
}
@
endif
$
.
ajax
({
url
:
url
,
type
:
'GET'
,
async
:
true
,
dataType
:
'json'
,
timeout
:
10000
,
success
:
function
(
res
)
{
console
.
log
(
supplier_name
);
console
.
log
(
tax_number
);
if
(
supplier_name
!==
''
||
tax_number
!==
''
)
{
if
(
res
.
err_code
!==
0
)
{
if
(
res
.
err_code
!==
0
)
{
//当code=-2的时候,是公司信息校验有问题,但是如果有跳过检查权限,那么就什么都不处理
//当code=-2的时候,是公司信息校验有问题,但是如果有跳过检查权限,那么就什么都不处理
if
(
res
.
err_code
===
-
2
)
{
if
(
res
.
err_code
===
-
2
)
{
if
(
!
ignoreCompanyCheck
)
{
if
(
!
ignoreCompanyCheck
)
{
layer
.
msg
(
res
.
err_msg
,
{
icon
:
5
});
layer
.
msg
(
res
.
err_msg
,
{
icon
:
5
});
$
(
this
)
.
after
(
"
<
div
id
=
'supplier_check_tip'
style
=
'margin-top: 5px'
>
" +
self
.
after
(
"
<
div
id
=
'supplier_check_tip'
style
=
'margin-top: 5px'
>
" +
"
<
p
style
=
'color: red;'
>
" + res.err_msg + "
<
/p></
div
>
");
"
<
p
style
=
'color: red;'
>
" + res.err_msg + "
<
/p></
div
>
");
$('#supplier_name').prop('readonly
', false);
$('#supplier_name').prop('disabled
', false);
}
}
} else {
} else {
//这个code代表供应商名称已经存在,自然要检测
layer.msg(res.err_msg, {icon: 5});
layer.msg(res.err_msg, {icon: 5});
$(this)
.after("
<
div
id
=
'supplier_check_tip'
style
=
'margin-top: 5px'
>
" +
self
.after("
<
div
id
=
'supplier_check_tip'
style
=
'margin-top: 5px'
>
" +
"
<
p
style
=
'color: red;'
>
" + res.err_msg + "
<
/p></
div
>
");
"
<
p
style
=
'color: red;'
>
" + res.err_msg + "
<
/p></
div
>
");
$('#supplier_name').prop('readonly
', false);
$('#supplier_name').prop('disabled
', false);
}
}
//监听是不是供应商名称变化
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;
...
@@ -54,10 +78,33 @@
...
@@ -54,10 +78,33 @@
$('#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 (self.attr('id') === 'supplier_name') {
$('#tax_number').attr('disabled', true);
} else {
$('#supplier_name').attr('disabled', true);
}
}
}
}
}
}
},
error: function () {
layer.msg('网络错误,请重试', {icon: 5});
}
});
});
});
function resetCompanyInfo(isSupplierNameChange = true) {
if (isSupplierNameChange) {
$('#tax_number').val('');
} else {
$('#supplier_name').val('');
}
$('#phone').val('');
$('#supplier_address').val('');
$('#registered_capital').val('');
}
@if(!empty($supplier))
@if(!empty($supplier))
@if($supplier['region']==2)
@if($supplier['region']==2)
...
@@ -66,21 +113,23 @@
...
@@ -66,21 +113,23 @@
@endif
@endif
//监听所在区域变化,中国才显示省市选择
//监听所在区域变化,中国才显示省市选择
//而且有值才能修改供应商名字和税号
//而且有值
+新增供应商操作
才能修改供应商名字和税号
form.on('select(region)', function (data) {
form.on('select(region)', function (data) {
@if(empty($supplier))
let supplierNameObj = $('#supplier_name');
let supplierNameObj = $('#supplier_name');
let taxNumberObj = $('#tax_number');
let taxNumberObj = $('#tax_number');
if (data.value) {
if (data.value) {
supplierNameObj.attr('
readonly
', false);
supplierNameObj.attr('
disabled
', false);
supplierNameObj.removeClass('layui-disabled');
supplierNameObj.removeClass('layui-disabled');
taxNumberObj.attr('
readonly
', false);
taxNumberObj.attr('
disabled
', false);
taxNumberObj.removeClass('layui-disabled');
taxNumberObj.removeClass('layui-disabled');
} else {
} else {
supplierNameObj.attr('
readonly
', true);
supplierNameObj.attr('
disabled
', true);
supplierNameObj.addClass('layui-disabled');
supplierNameObj.addClass('layui-disabled');
taxNumberObj.attr('
readonly
', true);
taxNumberObj.attr('
disabled
', true);
taxNumberObj.addClass('layui-disabled');
taxNumberObj.addClass('layui-disabled');
}
}
@endif
if (data.value === '2') {
if (data.value === '2') {
$('.city-div').show();
$('.city-div').show();
} else {
} else {
...
@@ -94,10 +143,10 @@
...
@@ -94,10 +143,10 @@
$('#supplier_name').change(function () {
$('#supplier_name').change(function () {
let taxNumberObj = $('#tax_number');
let taxNumberObj = $('#tax_number');
if ($(this).val()) {
if ($(this).val()) {
taxNumberObj.attr('
readonly
', true);
taxNumberObj.attr('
disabled
', true);
taxNumberObj.addClass('layui-disabled');
taxNumberObj.addClass('layui-disabled');
} else {
} else {
taxNumberObj.attr('
readonly
', false);
taxNumberObj.attr('
disabled
', false);
taxNumberObj.removeClass('layui-disabled');
taxNumberObj.removeClass('layui-disabled');
}
}
...
@@ -105,10 +154,10 @@
...
@@ -105,10 +154,10 @@
$('#tax_number').change(function () {
$('#tax_number').change(function () {
let supplierNameObj = $('#supplier_name');
let supplierNameObj = $('#supplier_name');
if ($(this).val()) {
if ($(this).val()) {
supplierNameObj.attr('
readonly
', true);
supplierNameObj.attr('
disabled
', true);
supplierNameObj.addClass('layui-disabled');
supplierNameObj.addClass('layui-disabled');
} else {
} else {
supplierNameObj.attr('
readonly
', false);
supplierNameObj.attr('
disabled
', false);
supplierNameObj.removeClass('layui-disabled');
supplierNameObj.removeClass('layui-disabled');
}
}
});
});
...
@@ -229,7 +278,7 @@
...
@@ -229,7 +278,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();
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);
...
@@ -237,32 +286,40 @@
...
@@ -237,32 +286,40 @@
}
}
$('#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;
let res = ajax(url);
$.ajax({
if (!res) {
url: url,
type: 'GET',
async: true,
dataType: 'json',
timeout: 10000,
success: function (res) {
admin.btnLoading('#recheck_company_info', false);
admin.btnLoading('#recheck_company_info', false);
layer.msg('网络错误,请重试', {icon: 5});
} 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').attr('value', companyInfo.supplier_name);
$('#supplier_name').val(companyInfo.supplier_name);
$('#tax_number').attr('value', companyInfo.tax_number);
//这个属性因为是disabled了,没法直接用jq去修改,就算直接修改layui也是没法接到值的
$('#phone').attr('value', companyInfo.phone);
layui.form.val('supplier_form', {tax_number: companyInfo.tax_number})
$('#supplier_address').attr('value', companyInfo.supplier_address);
$('#tax_number').val(companyInfo.tax_number);
$('#registered_capital').attr('value', companyInfo.registered_capital);
$('#supplier_address').val(companyInfo.supplier_address);
$('#registered_capital').val(companyInfo.registered_capital);
form.render();
form.render();
layer.msg('
校验公司信息通过,自动补全相关数据', {icon: 6})
layer.msg('验证成功,
校验公司信息通过,自动补全相关数据', {icon: 6})
} else {
} else {
admin.btnLoading('#recheck_company_info', false);
if (ignoreCompanyCheck) {
if (ignoreCompanyCheck) {
layer.msg('公司未进行工商注册')
} 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
>
"
);
layer
.
msg
(
'公司未进行工商注册,请修改后重新提交'
,
{
icon
:
5
})
layer
.
msg
(
'验证失败,公司未进行工商注册,请修改后重新提交'
,
{
icon
:
5
})
resetCompanyInfo
(
supplierName
!==
''
);
}
}
}
}
},
error
:
function
()
{
admin
.
btnLoading
(
'#recheck_company_info'
,
false
);
layer
.
msg
(
'网络错误,请重试'
,
{
icon
:
5
});
}
}
})
});
});
});
});
</script>
</script>
\ No newline at end of file
resources/views/script/supplier/SupplierFileScript.blade.php
View file @
9898f02a
...
@@ -97,9 +97,7 @@
...
@@ -97,9 +97,7 @@
});
});
});
});
delete
this
.
files
[
index
];
delete
this
.
files
[
index
];
let
supplierType
=
$
(
'input[name="supplier_type"]:checked'
)
.
val
();
layer
.
close
(
loadIndex
);
layer
.
close
(
loadIndex
);
attachmentsUploadedChangeSupplierType
(
supplierType
,
$
(
'#supplier_group'
)
.
val
(),
fieldName
)
},
},
});
});
...
...
resources/views/web/AddSupplier.blade.php
View file @
9898f02a
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
<blockquote
class=
"layui-elem-quote layui-text"
>
<blockquote
class=
"layui-elem-quote layui-text"
>
<b>
基本信息
</b>
<b>
基本信息
</b>
</blockquote>
</blockquote>
<form
class=
"layui-form"
action=
""
>
<form
class=
"layui-form"
action=
""
lay-filter=
"supplier_form"
>
<input
type=
"hidden"
name=
"apply_audit_reason"
id=
"apply_audit_reason"
>
<input
type=
"hidden"
name=
"apply_audit_reason"
id=
"apply_audit_reason"
>
...
@@ -61,14 +61,14 @@
...
@@ -61,14 +61,14 @@
<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 layui-disabled"
value=
""
disabled
>
placeholder=
"
选择所在区域才允许输入供应商名称
"
class=
"layui-input layui-disabled"
value=
""
disabled
>
</div>
</div>
</div>
</div>
<div
class=
"layui-col-md5"
>
<div
class=
"layui-col-md5"
>
<div
class=
"layui-block"
id=
"tax_number_div"
>
<div
class=
"layui-block"
id=
"tax_number_div"
>
<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=
"tax_number"
id=
"tax_number"
placeholder=
"
请输入公司税号,选择所在区域才允许输入
"
<input
type=
"text"
name=
"tax_number"
id=
"tax_number"
placeholder=
"
选择所在区域才允许输入公司税号
"
class=
"layui-input layui-disabled"
disabled
value=
""
>
class=
"layui-input layui-disabled"
disabled
value=
""
>
</div>
</div>
</div>
</div>
...
...
resources/views/web/UpdateSupplier.blade.php
View file @
9898f02a
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
}
}
</style>
</style>
<div
class=
"layui-card"
>
<div
class=
"layui-card"
>
<form
class=
"layui-form"
action=
""
>
<form
class=
"layui-form"
action=
""
lay-filter=
"supplier_form"
>
<div
class=
"layui-card-header fix-top"
>
<div
class=
"layui-card-header fix-top"
>
<div
class=
"layui-row"
>
<div
class=
"layui-row"
>
<div
class=
"layui-col-md2"
>
<div
class=
"layui-col-md2"
>
...
...
resources/views/web/supplier/SupplierBase.blade.php
View file @
9898f02a
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<b>
基本信息
</b>
<b>
基本信息
</b>
</blockquote>
</blockquote>
@if($operate=='add')
@if($operate=='add')
<form
class=
"layui-form"
action=
""
>
<form
class=
"layui-form"
action=
""
lay-filter=
"supplier_form"
>
@endif
@endif
<?php
<?php
$supplierType
=
config
(
'field.SupplierType'
);
$supplierType
=
config
(
'field.SupplierType'
);
...
@@ -58,7 +58,7 @@
...
@@ -58,7 +58,7 @@
layui-disabled
layui-disabled
@endif"
@endif"
value=
"{{$supplier['supplier_name'] or ''}}"
value=
"{{$supplier['supplier_name'] or ''}}"
@
if
($
supplier
['
sync_united_status
']==
1
)
readonly
@
endif
>
@
if
($
supplier
['
sync_united_status
']==
1
)
disabled
@
endif
>
</div>
</div>
</div>
</div>
<div
class=
"layui-col-md5"
>
<div
class=
"layui-col-md5"
>
...
@@ -66,7 +66,7 @@
...
@@ -66,7 +66,7 @@
<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=
"tax_number"
id=
"tax_number"
placeholder=
"请输入公司税号,选择所在区域才允许输入"
<input
type=
"text"
name=
"tax_number"
id=
"tax_number"
placeholder=
"请输入公司税号,选择所在区域才允许输入"
class=
"layui-input layui-disabled"
readonly
value=
"{{$supplier['tax_number'] or ''}}"
>
class=
"layui-input layui-disabled"
disabled
value=
"{{$supplier['tax_number'] or ''}}"
>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -95,7 +95,7 @@
...
@@ -95,7 +95,7 @@
<div
class=
"layui-row"
>
<div
class=
"layui-row"
>
<div
class=
"layui-col-md3"
>
<div
class=
"layui-col-md3"
>
@inject('statusPresenter','App\Presenters\StatusPresenter')
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('purchase_uid','渠道开发员 : ',
''
,$userCodes,['required'=>true,'width'=>'150px']) !!}
{!! $statusPresenter->render('purchase_uid','渠道开发员 : ',
$supplier['purchase_uid']
,$userCodes,['required'=>true,'width'=>'150px']) !!}
</div>
</div>
<div
class=
"layui-col-md3"
>
<div
class=
"layui-col-md3"
>
<label
class=
"layui-form-label"
><span
class=
"require"
>
*
</span>
注册资金(万):
</label>
<label
class=
"layui-form-label"
><span
class=
"require"
>
*
</span>
注册资金(万):
</label>
...
...
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