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
01373727
authored
Jun 25, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
弹窗逻辑
parent
e5a97e7d
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
35 additions
and
77 deletions
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Services/SupplierAttachmentService.php
app/Http/Services/SupplierService.php
app/Http/Transformers/SupplierTransformer.php
app/Http/Validators/SupplierValidator.php
app/Model/SupplierChannelModel.php
public/plugins/assets/js/common.js
resources/views/script/AddSupplierScript.blade.php
resources/views/script/UpdateSupplierScript.blade.php
resources/views/script/supplier/SupplierBaseScript.blade.php
resources/views/web/supplier/SupplierFile.blade.php
app/Http/Controllers/Api/SupplierApiController.php
View file @
01373727
...
@@ -291,16 +291,15 @@ class SupplierApiController extends Controller
...
@@ -291,16 +291,15 @@ class SupplierApiController extends Controller
//如果是编辑操作,则要忽略非当前
//如果是编辑操作,则要忽略非当前
if
(
$supplierId
)
{
if
(
$supplierId
)
{
if
(
in_array
(
$supplierId
,
[
195
,
12263
]))
{
$this
->
response
(
0
,
'供应商名称合理'
);
}
$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'
,
'!='
,
$existedSupplierName
=
$model
->
where
(
'supplier_name'
,
$supplierName
)
->
where
(
'supplier_name'
,
'!='
,
$originSupplierName
)
$originSupplierName
)
->
value
(
'supplier_name'
);
->
value
(
'supplier_name'
);
if
(
$supplierName
!==
$existedSupplierName
)
{
if
(
$supplierName
!==
$existedSupplierName
)
{
// $supplierName = $model->where('supplier_name', 'like',
// "%$supplierName%")->limit(1)->value('supplier_name');
// if (!empty($supplierName)) {
// $this->response(-2, '存在类似的供应商名称', $supplierName);
// }
}
else
{
}
else
{
$this
->
response
(
-
1
,
'供应商已存在,请重新输入或者咨询审批人'
);
$this
->
response
(
-
1
,
'供应商已存在,请重新输入或者咨询审批人'
);
}
}
...
...
app/Http/Services/SupplierAttachmentService.php
View file @
01373727
...
@@ -61,9 +61,9 @@ class SupplierAttachmentService
...
@@ -61,9 +61,9 @@ class SupplierAttachmentService
$attachments
=
[];
$attachments
=
[];
foreach
(
$attachmentData
[
'file_name'
]
as
$key
=>
$value
)
{
foreach
(
$attachmentData
[
'file_name'
]
as
$key
=>
$value
)
{
//最后一个跳过,因为是模板里的数据
//最后一个跳过,因为是模板里的数据
if
(
$key
==
(
count
(
$attachmentData
[
'file_name'
])
-
1
))
{
//
if ($key == (count($attachmentData['file_name']) - 1)) {
continue
;
//
continue;
}
//
}
$attachment
=
[
$attachment
=
[
'supplier_id'
=>
$supplierId
,
'supplier_id'
=>
$supplierId
,
'file_name'
=>
$attachmentData
[
'file_name'
][
$key
],
'file_name'
=>
$attachmentData
[
'file_name'
][
$key
],
...
...
app/Http/Services/SupplierService.php
View file @
01373727
...
@@ -45,7 +45,6 @@ class SupplierService
...
@@ -45,7 +45,6 @@ class SupplierService
$oldSupplier
=
$model
->
where
(
'supplier_id'
,
$channel
[
'supplier_id'
])
->
first
();
$oldSupplier
=
$model
->
where
(
'supplier_id'
,
$channel
[
'supplier_id'
])
->
first
();
$oldSupplier
=
$supplierTransformer
->
transformInfo
(
$oldSupplier
);
$oldSupplier
=
$supplierTransformer
->
transformInfo
(
$oldSupplier
);
}
}
//走事务
//走事务
$supplierId
=
DB
::
connection
(
'web'
)
->
transaction
(
function
()
use
(
$channel
,
$model
,
$oldSupplier
)
{
$supplierId
=
DB
::
connection
(
'web'
)
->
transaction
(
function
()
use
(
$channel
,
$model
,
$oldSupplier
)
{
...
...
app/Http/Transformers/SupplierTransformer.php
View file @
01373727
...
@@ -226,11 +226,7 @@ class SupplierTransformer
...
@@ -226,11 +226,7 @@ class SupplierTransformer
$stockupType
=
!
empty
(
$stockupType
)
?
implode
(
","
,
$stockupType
)
:
''
;
$stockupType
=
!
empty
(
$stockupType
)
?
implode
(
","
,
$stockupType
)
:
''
;
$channel
[
'stockup_type'
]
=
$stockupType
;
$channel
[
'stockup_type'
]
=
$stockupType
;
}
}
if
(
!
empty
(
$channel
[
'currency'
]))
{
if
(
$channel
[
'currency'
]
!=
1
)
{
$channel
[
'tax_number'
]
=
''
;
}
}
if
(
empty
(
$channel
[
'purchase_uid'
]))
{
if
(
empty
(
$channel
[
'purchase_uid'
]))
{
unset
(
$channel
[
'purchase_uid'
]);
unset
(
$channel
[
'purchase_uid'
]);
}
}
...
...
app/Http/Validators/SupplierValidator.php
View file @
01373727
...
@@ -122,7 +122,8 @@ class SupplierValidator
...
@@ -122,7 +122,8 @@ class SupplierValidator
$errorMessageList
[]
=
'如果选择币种为人民币,开票资料必须上传'
;
$errorMessageList
[]
=
'如果选择币种为人民币,开票资料必须上传'
;
}
}
if
(
$validateData
[
'supplier_type'
]
==
SupplierChannelModel
::
SUPPLIER_TYPE_OFFICIAL
)
{
if
(
$validateData
[
'supplier_type'
]
==
SupplierChannelModel
::
SUPPLIER_TYPE_OFFICIAL
&&
!
in_array
(
$validateData
[
'supplier_group'
],
[
SupplierChannelModel
::
SUPPLIER_TYPE_OFFICIAL
,
SupplierChannelModel
::
SUPPLIER_GROUP_PROXY
]))
{
if
(
!
in_array
(
'quality_assurance_agreement'
,
$attachmentFields
))
{
if
(
!
in_array
(
'quality_assurance_agreement'
,
$attachmentFields
))
{
$errorMessageList
[]
=
'供应商为正式供应商,品质保证协议必须上传 (代理商跟原厂类型除外) '
;
$errorMessageList
[]
=
'供应商为正式供应商,品质保证协议必须上传 (代理商跟原厂类型除外) '
;
}
}
...
...
app/Model/SupplierChannelModel.php
View file @
01373727
...
@@ -33,6 +33,10 @@ class SupplierChannelModel extends Model
...
@@ -33,6 +33,10 @@ class SupplierChannelModel extends Model
const
SYNC_UNITED_STATUS_NOT_SYNC
=
0
;
const
SYNC_UNITED_STATUS_NOT_SYNC
=
0
;
const
SYNC_UNITED_STATUS_OK
=
1
;
const
SYNC_UNITED_STATUS_OK
=
1
;
//供应商类型
const
SUPPLIER_GROUP_ORIGINAL
=
1
;
//原厂
const
SUPPLIER_GROUP_PROXY
=
4
;
//代理
//黑名单信息
//黑名单信息
public
function
blacklist
()
public
function
blacklist
()
...
...
public/plugins/assets/js/common.js
View file @
01373727
...
@@ -85,54 +85,3 @@ function inArray(needle, haystack) {
...
@@ -85,54 +85,3 @@ function inArray(needle, haystack) {
}
}
return
false
;
return
false
;
}
}
function
attachmentsUploadedChangeSupplierType
(
supplierType
,
supplierGroup
,
fieldNameList
)
{
if
(
fieldNameList
.
length
===
0
)
{
return
true
;
}
let
msg
=
''
;
let
radioObj
=
$
(
'input[name="supplier_type"]'
);
//已经上传品质保证协议(代理商则提示为“已经上传代理证”),是否切换为正式供应商?
if
(
supplierType
===
'2'
)
{
//如果已经上传品质保证协议,并且供应商性质不是代理商(代理商要代理证)
if
(
inArray
(
'quality_assurance_agreement'
,
fieldNameList
)
&&
supplierGroup
!==
'1'
)
{
msg
=
'已经上传品质保证协议,是否切换为正式供应商?'
layer
.
confirm
(
msg
,
function
(
index
)
{
radioObj
.
get
(
0
).
checked
=
true
;
radioObj
.
get
(
1
).
checked
=
false
;
layui
.
form
.
render
(
'radio'
);
layer
.
closeAll
();
});
}
if
(
inArray
(
'proxy_certificate'
,
fieldNameList
)
&&
supplierGroup
===
'1'
)
{
msg
=
'该供应商为代理供应商,已经上传代理证,是否切换为正式供应商?'
layer
.
confirm
(
msg
,
function
(
index
)
{
radioObj
.
get
(
0
).
checked
=
true
;
radioObj
.
get
(
1
).
checked
=
false
;
layui
.
form
.
render
(
'radio'
);
layer
.
closeAll
();
});
}
}
else
{
if
(
!
inArray
(
'quality_assurance_agreement'
,
fieldNameList
)
&&
supplierGroup
!==
'1'
)
{
msg
=
'未上传品质保证协议,是否切换为临时供应商?'
layer
.
confirm
(
msg
,
function
(
index
)
{
radioObj
.
get
(
0
).
checked
=
false
;
radioObj
.
get
(
1
).
checked
=
true
;
layui
.
form
.
render
(
'radio'
);
layer
.
closeAll
();
});
}
if
(
!
inArray
(
'proxy_certificate'
,
fieldNameList
)
&&
supplierGroup
===
'1'
)
{
msg
=
'该供应商为代理供应商,但是未上传代理证,是否切换为临时供应商?'
layer
.
confirm
(
msg
,
function
(
index
)
{
radioObj
.
get
(
0
).
checked
=
false
;
radioObj
.
get
(
1
).
checked
=
true
;
layui
.
form
.
render
(
'radio'
);
layer
.
closeAll
();
});
}
}
return
true
;
}
resources/views/script/AddSupplierScript.blade.php
View file @
01373727
...
@@ -115,7 +115,8 @@
...
@@ -115,7 +115,8 @@
let
field_name
=
[];
let
field_name
=
[];
let
validity_period
=
[];
let
validity_period
=
[];
let
description
=
[];
let
description
=
[];
$
(
'.single_file_div'
).
each
(
function
()
{
//只要寻找上传主区域的数据即可
$
(
'#attachment_upload_div'
).
find
(
'.single_file_div'
).
each
(
function
()
{
file_name
.
push
(
$
(
this
).
find
(
'#file_name'
).
val
());
file_name
.
push
(
$
(
this
).
find
(
'#file_name'
).
val
());
file_url
.
push
(
$
(
this
).
find
(
'#file_url'
).
val
());
file_url
.
push
(
$
(
this
).
find
(
'#file_url'
).
val
());
field_name
.
push
(
$
(
this
).
find
(
'#field_name'
).
val
());
field_name
.
push
(
$
(
this
).
find
(
'#field_name'
).
val
());
...
@@ -130,9 +131,7 @@
...
@@ -130,9 +131,7 @@
data
.
field
.
validity_type
=
validity_type
;
data
.
field
.
validity_type
=
validity_type
;
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
fieldNameList
=
field_name
;
//提交先提示是否要转换供应商类型
//提交先提示是否要转换供应商类型
let
radioObj
=
$
(
'input[name="supplier_type"]'
);
let
radioObj
=
$
(
'input[name="supplier_type"]'
);
//已经上传品质保证协议(代理商则提示为“已经上传代理证”),是否切换为正式供应商?
//已经上传品质保证协议(代理商则提示为“已经上传代理证”),是否切换为正式供应商?
...
@@ -165,7 +164,8 @@
...
@@ -165,7 +164,8 @@
}
}
}
}
if
(
msg
)
{
if
(
msg
)
{
layer
.
confirm
(
msg
,
function
(
index
)
{
layer
.
confirm
(
msg
,
{
btn
:
[
"确认"
,
"取消"
]},
function
(
index
)
{
if
(
obj1Checked
!==
0
)
{
if
(
obj1Checked
!==
0
)
{
radioObj
.
get
(
0
).
checked
=
obj1Checked
;
radioObj
.
get
(
0
).
checked
=
obj1Checked
;
radioObj
.
get
(
1
).
checked
=
obj2Checked
;
radioObj
.
get
(
1
).
checked
=
obj2Checked
;
...
@@ -174,7 +174,11 @@
...
@@ -174,7 +174,11 @@
layer
.
closeAll
();
layer
.
closeAll
();
}
}
auditAndAddSupplier
(
data
);
auditAndAddSupplier
(
data
);
});
},
function
(
index
)
{
auditAndAddSupplier
(
data
);
}
);
}
else
{
}
else
{
auditAndAddSupplier
(
data
);
auditAndAddSupplier
(
data
);
}
}
...
...
resources/views/script/UpdateSupplierScript.blade.php
View file @
01373727
...
@@ -21,7 +21,6 @@
...
@@ -21,7 +21,6 @@
confirmMessage
=
'确定要重新提交审核吗?一旦提交,该供应商就会再次进入审核中阶段,审核过程中无法进行信息修改'
;
confirmMessage
=
'确定要重新提交审核吗?一旦提交,该供应商就会再次进入审核中阶段,审核过程中无法进行信息修改'
;
}
else
{
}
else
{
//修改不需要进入审核了,有个单独提交审核的按钮
//修改不需要进入审核了,有个单独提交审核的按钮
confirmMessage
=
'确定要修改供应商信息吗
?
<
br
>
一旦修改关键字段
,
该供应商就会再次进入
<
b
>
待审核
<
/b>状态,需要去列表页<b>提交申请审核</
b
>
,
送至主管审核
';
updateSupplier
(
data
);
updateSupplier
(
data
);
return
;
return
;
}
}
...
@@ -35,7 +34,7 @@
...
@@ -35,7 +34,7 @@
});
});
form
.
on
(
'submit(applyAuditSupplier)'
,
function
(
data
)
{
form
.
on
(
'submit(applyAuditSupplier)'
,
function
(
data
)
{
$
(
'input:disabled'
).
attr
(
'disabled'
,
false
);
let
fieldNameList
=
[];
let
fieldNameList
=
[];
$
(
'.attachment_fields'
).
each
(
function
()
{
$
(
'.attachment_fields'
).
each
(
function
()
{
fieldNameList
.
push
(
$
(
this
).
text
());
fieldNameList
.
push
(
$
(
this
).
text
());
...
@@ -73,7 +72,8 @@
...
@@ -73,7 +72,8 @@
}
}
}
}
if
(
msg
)
{
if
(
msg
)
{
layer.confirm(msg, function (index) {
layer
.
confirm
(
msg
,
{
btn
:
[
"确认"
,
"取消"
]},
function
(
index
)
{
if
(
obj1Checked
!==
0
)
{
if
(
obj1Checked
!==
0
)
{
radioObj
.
get
(
0
).
checked
=
obj1Checked
;
radioObj
.
get
(
0
).
checked
=
obj1Checked
;
radioObj
.
get
(
1
).
checked
=
obj2Checked
;
radioObj
.
get
(
1
).
checked
=
obj2Checked
;
...
@@ -82,13 +82,18 @@
...
@@ -82,13 +82,18 @@
layer
.
closeAll
();
layer
.
closeAll
();
}
}
auditAndUpdateSupplier
(
data
);
auditAndUpdateSupplier
(
data
);
});
},
function
(
index
)
{
auditAndUpdateSupplier
(
data
);
}
);
}
else
{
}
else
{
auditAndUpdateSupplier
(
data
);
auditAndUpdateSupplier
(
data
);
}
}
return
false
;
return
false
;
});
});
//直接审核并且更新供应商
function
auditAndUpdateSupplier
(
data
)
{
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'
)
{
...
...
resources/views/script/supplier/SupplierBaseScript.blade.php
View file @
01373727
...
@@ -298,7 +298,7 @@
...
@@ -298,7 +298,7 @@
let companyInfo = res.data;
let companyInfo = res.data;
$('#supplier_name').val(companyInfo.supplier_name);
$('#supplier_name').val(companyInfo.supplier_name);
//这个属性因为是disabled了,没法直接用jq去修改,就算直接修改layui也是没法接到值的
//这个属性因为是disabled了,没法直接用jq去修改,就算直接修改layui也是没法接到值的
layui.
form.val('supplier_form', {tax_number: companyInfo.tax_number})
form.val('supplier_form', {tax_number: companyInfo.tax_number})
$('#tax_number').val(companyInfo.tax_number);
$('#tax_number').val(companyInfo.tax_number);
$('#supplier_address').val(companyInfo.supplier_address);
$('#supplier_address').val(companyInfo.supplier_address);
$('#registered_capital').val(companyInfo.registered_capital);
$('#registered_capital').val(companyInfo.registered_capital);
...
...
resources/views/web/supplier/SupplierFile.blade.php
View file @
01373727
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
</button>
</button>
<input
type=
"hidden"
class=
"upload_obj"
value=
""
>
<input
type=
"hidden"
class=
"upload_obj"
value=
""
>
</div>
</div>
<div
class=
"layui-col-md12"
style=
"padding-left: 45px;margin-top: 5px"
>
<div
class=
"layui-col-md12"
style=
"padding-left: 45px;margin-top: 5px"
id=
"attachment_upload_div"
>
<blockquote
class=
"layui-elem-quote layui-quote-nm"
style=
"padding-bottom: 5px"
>
<blockquote
class=
"layui-elem-quote layui-quote-nm"
style=
"padding-bottom: 5px"
>
<div
id=
"file_list"
class=
"layui-row"
>
<div
id=
"file_list"
class=
"layui-row"
>
@foreach(config('fixed.FileNameMapping') as $name=>$cnName)
@foreach(config('fixed.FileNameMapping') as $name=>$cnName)
...
@@ -43,6 +43,7 @@
...
@@ -43,6 +43,7 @@
</div>
</div>
</div>
</div>
{{--这个模板是用来附加附件的--}}
<div
id=
"file_template"
style=
"display: none"
>
<div
id=
"file_template"
style=
"display: none"
>
<div
class=
"layui-row single_file_div"
>
<div
class=
"layui-row single_file_div"
>
<div
class=
"layui-col-md3"
>
<div
class=
"layui-col-md3"
>
...
...
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