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
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
49 additions
and
91 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
//如果是编辑操作,则要忽略非当前
if
(
$supplierId
)
{
if
(
in_array
(
$supplierId
,
[
195
,
12263
]))
{
$this
->
response
(
0
,
'供应商名称合理'
);
}
$originSupplierName
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
value
(
'supplier_name'
);
$existedSupplierName
=
$model
->
where
(
'supplier_name'
,
$supplierName
)
->
where
(
'supplier_name'
,
'!='
,
$originSupplierName
)
->
value
(
'supplier_name'
);
if
(
$supplierName
!==
$existedSupplierName
)
{
// $supplierName = $model->where('supplier_name', 'like',
// "%$supplierName%")->limit(1)->value('supplier_name');
// if (!empty($supplierName)) {
// $this->response(-2, '存在类似的供应商名称', $supplierName);
// }
}
else
{
$this
->
response
(
-
1
,
'供应商已存在,请重新输入或者咨询审批人'
);
}
...
...
app/Http/Services/SupplierAttachmentService.php
View file @
01373727
...
...
@@ -61,9 +61,9 @@ class SupplierAttachmentService
$attachments
=
[];
foreach
(
$attachmentData
[
'file_name'
]
as
$key
=>
$value
)
{
//最后一个跳过,因为是模板里的数据
if
(
$key
==
(
count
(
$attachmentData
[
'file_name'
])
-
1
))
{
continue
;
}
//
if ($key == (count($attachmentData['file_name']) - 1)) {
//
continue;
//
}
$attachment
=
[
'supplier_id'
=>
$supplierId
,
'file_name'
=>
$attachmentData
[
'file_name'
][
$key
],
...
...
app/Http/Services/SupplierService.php
View file @
01373727
...
...
@@ -45,7 +45,6 @@ class SupplierService
$oldSupplier
=
$model
->
where
(
'supplier_id'
,
$channel
[
'supplier_id'
])
->
first
();
$oldSupplier
=
$supplierTransformer
->
transformInfo
(
$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
$stockupType
=
!
empty
(
$stockupType
)
?
implode
(
","
,
$stockupType
)
:
''
;
$channel
[
'stockup_type'
]
=
$stockupType
;
}
if
(
!
empty
(
$channel
[
'currency'
]))
{
if
(
$channel
[
'currency'
]
!=
1
)
{
$channel
[
'tax_number'
]
=
''
;
}
}
if
(
empty
(
$channel
[
'purchase_uid'
]))
{
unset
(
$channel
[
'purchase_uid'
]);
}
...
...
app/Http/Validators/SupplierValidator.php
View file @
01373727
...
...
@@ -122,7 +122,8 @@ class SupplierValidator
$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
))
{
$errorMessageList
[]
=
'供应商为正式供应商,品质保证协议必须上传 (代理商跟原厂类型除外) '
;
}
...
...
app/Model/SupplierChannelModel.php
View file @
01373727
...
...
@@ -33,6 +33,10 @@ class SupplierChannelModel extends Model
const
SYNC_UNITED_STATUS_NOT_SYNC
=
0
;
const
SYNC_UNITED_STATUS_OK
=
1
;
//供应商类型
const
SUPPLIER_GROUP_ORIGINAL
=
1
;
//原厂
const
SUPPLIER_GROUP_PROXY
=
4
;
//代理
//黑名单信息
public
function
blacklist
()
...
...
public/plugins/assets/js/common.js
View file @
01373727
...
...
@@ -85,54 +85,3 @@ function inArray(needle, haystack) {
}
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 @@
let
field_name
=
[];
let
validity_period
=
[];
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_url
.
push
(
$
(
this
).
find
(
'#file_url'
).
val
());
field_name
.
push
(
$
(
this
).
find
(
'#field_name'
).
val
());
...
...
@@ -130,9 +131,7 @@
data
.
field
.
validity_type
=
validity_type
;
data
.
field
.
validity_period
=
validity_period
;
data
.
field
.
apply_audit_reason
=
$
(
'#apply_audit_reason'
).
val
();
let
fieldNameList
=
field_name
;
//提交先提示是否要转换供应商类型
let
radioObj
=
$
(
'input[name="supplier_type"]'
);
//已经上传品质保证协议(代理商则提示为“已经上传代理证”),是否切换为正式供应商?
...
...
@@ -165,16 +164,21 @@
}
}
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
();
layer
.
confirm
(
msg
,
{
btn
:
[
"确认"
,
"取消"
]},
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
);
},
function
(
index
)
{
auditAndAddSupplier
(
data
);
}
auditAndAddSupplier
(
data
);
});
);
}
else
{
auditAndAddSupplier
(
data
);
}
...
...
resources/views/script/UpdateSupplierScript.blade.php
View file @
01373727
...
...
@@ -21,7 +21,6 @@
confirmMessage
=
'确定要重新提交审核吗?一旦提交,该供应商就会再次进入审核中阶段,审核过程中无法进行信息修改'
;
}
else
{
//修改不需要进入审核了,有个单独提交审核的按钮
confirmMessage
=
'确定要修改供应商信息吗
?
<
br
>
一旦修改关键字段
,
该供应商就会再次进入
<
b
>
待审核
<
/b>状态,需要去列表页<b>提交申请审核</
b
>
,
送至主管审核
';
updateSupplier
(
data
);
return
;
}
...
...
@@ -35,7 +34,7 @@
});
form
.
on
(
'submit(applyAuditSupplier)'
,
function
(
data
)
{
$
(
'input:disabled'
).
attr
(
'disabled'
,
false
);
let
fieldNameList
=
[];
$
(
'.attachment_fields'
).
each
(
function
()
{
fieldNameList
.
push
(
$
(
this
).
text
());
...
...
@@ -73,22 +72,28 @@
}
}
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();
layer
.
confirm
(
msg
,
{
btn
:
[
"确认"
,
"取消"
]},
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
);
},
function
(
index
)
{
auditAndUpdateSupplier
(
data
);
}
auditAndUpdateSupplier(data);
});
);
}
else
{
auditAndUpdateSupplier
(
data
);
}
return
false
;
});
//直接审核并且更新供应商
function
auditAndUpdateSupplier
(
data
)
{
data
.
field
.
is_audit
=
1
;
if
(
data
.
field
.
supplier_type
===
'2'
)
{
...
...
resources/views/script/supplier/SupplierBaseScript.blade.php
View file @
01373727
...
...
@@ -298,7 +298,7 @@
let companyInfo = res.data;
$('#supplier_name').val(companyInfo.supplier_name);
//这个属性因为是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);
$('#supplier_address').val(companyInfo.supplier_address);
$('#registered_capital').val(companyInfo.registered_capital);
...
...
resources/views/web/supplier/SupplierFile.blade.php
View file @
01373727
...
...
@@ -23,7 +23,7 @@
</button>
<input
type=
"hidden"
class=
"upload_obj"
value=
""
>
</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"
>
<div
id=
"file_list"
class=
"layui-row"
>
@foreach(config('fixed.FileNameMapping') as $name=>$cnName)
...
...
@@ -43,6 +43,7 @@
</div>
</div>
{{--这个模板是用来附加附件的--}}
<div
id=
"file_template"
style=
"display: none"
>
<div
class=
"layui-row single_file_div"
>
<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