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
c432aea0
authored
Jun 05, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
去除品牌限制
parent
d04b7e73
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
116 additions
and
116 deletions
app/Http/Validators/SupplierValidator.php
resources/views/script/supplier/SupplierBaseScript.blade.php
resources/views/web/AddSupplier.blade.php
resources/views/web/supplier/SupplierBase.blade.php
app/Http/Validators/SupplierValidator.php
View file @
c432aea0
...
@@ -77,27 +77,27 @@ class SupplierValidator
...
@@ -77,27 +77,27 @@ class SupplierValidator
//这个supplierId是用来判断是新增还是修改的
//这个supplierId是用来判断是新增还是修改的
$supplierId
=
array_get
(
$validateData
,
'supplier_id'
);
$supplierId
=
array_get
(
$validateData
,
'supplier_id'
);
//如果是修改直接提交,不是点申请审核的,只需要校验供应商名称和采购员是否完整即可
//如果是修改直接提交,不是点申请审核的,只需要校验供应商名称和采购员是否完整即可
//
if (!$isAudit) {
if
(
!
$isAudit
)
{
//
if (empty($validateData['supplier_name'])) {
if
(
empty
(
$validateData
[
'supplier_name'
]))
{
//
return '供应商名称 不能为空';
return
'供应商名称 不能为空'
;
//
}
}
//
//
if (empty($supplierId)) {
if
(
empty
(
$supplierId
))
{
//
//新增的时候,必须要设置采购员
//新增的时候,必须要设置采购员
//
if (empty($validateData['can_check_uids'])) {
if
(
empty
(
$validateData
[
'can_check_uids'
]))
{
//
return '第一次新增供应商,必须设置联系人的采购员';
return
'第一次新增供应商,必须设置联系人的采购员'
;
//
}
}
//
$count = SupplierChannelModel::where('supplier_name', $validateData['supplier_name'])->count();
$count
=
SupplierChannelModel
::
where
(
'supplier_name'
,
$validateData
[
'supplier_name'
])
->
count
();
//
} else {
}
else
{
//
//对接一体化以后,名称不能修改了,所以直接为0
//对接一体化以后,名称不能修改了,所以直接为0
//
$count = 0;
$count
=
0
;
//
}
}
//
if ($count) {
if
(
$count
)
{
//
return "该供应商名称已经存在,请核验后再提交";
return
"该供应商名称已经存在,请核验后再提交"
;
//
}
}
//
//
return null;
return
null
;
//
}
}
$rules
=
[
$rules
=
[
'supplier_type'
=>
'required'
,
'supplier_type'
=>
'required'
,
...
@@ -146,15 +146,15 @@ class SupplierValidator
...
@@ -146,15 +146,15 @@ class SupplierValidator
$errorMessageList
=
[];
$errorMessageList
=
[];
//主营品牌数量的判断
//主营品牌数量的判断
if
(
$validateData
[
'main_brands_limit_type'
]
==
1
)
{
//
if ($validateData['main_brands_limit_type'] == 1) {
if
(
!
$validateData
[
'main_brands_limit'
])
{
//
if (!$validateData['main_brands_limit']) {
$errorMessageList
[]
=
'主营品牌限制数量不能为空'
;
//
$errorMessageList[] = '主营品牌限制数量不能为空';
}
//
}
//
if
(
count
(
explode
(
','
,
trim
(
$validateData
[
'main_brands'
],
','
)))
>
$validateData
[
'main_brands_limit'
])
{
//
if (count(explode(',', trim($validateData['main_brands'], ','))) > $validateData['main_brands_limit']) {
$errorMessageList
[]
=
'主营品牌数量大于设置的限制数量'
;
//
$errorMessageList[] = '主营品牌数量大于设置的限制数量';
}
//
}
}
//
}
...
...
resources/views/script/supplier/SupplierBaseScript.blade.php
View file @
c432aea0
...
@@ -163,35 +163,35 @@
...
@@ -163,35 +163,35 @@
}
}
});
});
//主营品牌限制的初始化
//
//
主营品牌限制的初始化
let
mainBrandsLimitTypeObj
=
$
(
'#main_brands_limit_type'
);
//
let mainBrandsLimitTypeObj = $('#main_brands_limit_type');
if
(
supplierId
)
{
//
if (supplierId) {
let
mainBrandsLimitObj
=
$
(
'#main_brands_limit'
);
//
let mainBrandsLimitObj = $('#main_brands_limit');
if
(
mainBrandsLimitObj
.
val
()
==
-
1
)
{
//
if (mainBrandsLimitObj.val() == -1) {
mainBrandsLimitTypeObj
.
val
(
2
);
//
mainBrandsLimitTypeObj.val(2);
mainBrandsLimitObj
.
val
(
''
);
//
mainBrandsLimitObj.val('');
mainBrandsLimitObj
.
attr
(
'disabled'
,
true
);
//
mainBrandsLimitObj.attr('disabled', true);
mainBrandsLimitObj
.
addClass
(
'layui-disabled'
);
//
mainBrandsLimitObj.addClass('layui-disabled');
form
.
render
(
'select'
);
//
form.render('select');
}
//
}
}
//
}
let
supplierGroupMap
=
{
!!
json_encode
(
config
(
'fixed.SupplierGroup'
))
!!
};
{{
--
let
supplierGroupMap
=
{
!!
json_encode
(
config
(
'fixed.SupplierGroup'
))
!!
};
--
}}
let
limitMap
=
{
!!
json_encode
(
config
(
'field.SupplierGroupMainBrandsLimitMap'
))
!!
};
{{
--
let
limitMap
=
{
!!
json_encode
(
config
(
'field.SupplierGroupMainBrandsLimitMap'
))
!!
};
--
}}
//监听主营品牌限制的数字,不同供应商性质的数量限制不一样
{{
--
//监听主营品牌限制的数字,不同供应商性质的数量限制不一样--}}
$
(
document
).
on
(
'change'
,
'#main_brands_limit'
,
function
()
{
{{
--
$
(
document
).
on
(
'change'
,
'#main_brands_limit'
,
function
()
{
--
}}
let
supplierGroup
=
$
(
'#supplier_group'
).
val
();
{{
--
let
supplierGroup
=
$
(
'#supplier_group'
).
val
();
--
}}
if
(
!
supplierGroup
)
{
{{
--
if
(
!
supplierGroup
)
{
--
}}
layer
.
msg
(
"请先选择供应商性质"
,
{
icon
:
5
});
{{
--
layer
.
msg
(
"请先选择供应商性质"
,
{
icon
:
5
});
--
}}
$
(
'#main_brands_limit'
).
val
(
''
);
{{
--
$
(
'#main_brands_limit'
).
val
(
''
);
--
}}
return
false
;
{{
--
return
false
;
--
}}
}
{{
--
}
--
}
}
let
limit
=
limitMap
[
supplierGroup
];
{{
--
let
limit
=
limitMap
[
supplierGroup
];
--
}}
if
(
$
(
this
).
val
()
>
limit
&&
limit
!==
-
1
)
{
{{
--
if
(
$
(
this
).
val
()
>
limit
&&
limit
!==
-
1
)
{
--
}}
layer
.
msg
(
"供应商性质为"
+
supplierGroupMap
[
supplierGroup
]
+
"时,主营品牌数量最大可以设置为 "
+
limit
,
{
icon
:
5
});
{{
--
layer
.
msg
(
"供应商性质为"
+
supplierGroupMap
[
supplierGroup
]
+
"时,主营品牌数量最大可以设置为 "
+
limit
,
{
icon
:
5
});
--
}}
$
(
'#main_brands_limit'
).
val
(
limit
);
{{
--
$
(
'#main_brands_limit'
).
val
(
limit
);
--
}}
}
{{
--
}
--
}
}
});
{{
--
});
--
}}
//监听供应商性质选择,如果为混合分销商,那么要展示混合分销商品牌设置
//监听供应商性质选择,如果为混合分销商,那么要展示混合分销商品牌设置
form
.
on
(
'select(supplier_group)'
,
function
(
data
)
{
form
.
on
(
'select(supplier_group)'
,
function
(
data
)
{
...
@@ -201,37 +201,37 @@
...
@@ -201,37 +201,37 @@
$
(
'#agency_brands_div'
).
hide
();
$
(
'#agency_brands_div'
).
hide
();
}
}
// 这里还要去判断主营品牌数量限制的切换
//
//
这里还要去判断主营品牌数量限制的切换
// 原厂,代理商,分销平台,品牌数量不做限制;默认为“无限制”;
//
//
原厂,代理商,分销平台,品牌数量不做限制;默认为“无限制”;
// 混合分销商,现货商,代工厂,品牌数量默认为10;
//
//
混合分销商,现货商,代工厂,品牌数量默认为10;
// 方案商,其他,品牌数量默认为5;
//
//
方案商,其他,品牌数量默认为5;
let
mainBrandsLimitObj
=
$
(
'#main_brands_limit'
);
//
let mainBrandsLimitObj = $('#main_brands_limit');
let
limit
=
limitMap
[
data
.
value
];
//
let limit = limitMap[data.value];
console
.
log
(
limit
)
//
console.log(limit)
if
(
limit
===
-
1
)
{
//
if (limit === -1) {
mainBrandsLimitObj
.
attr
(
'disabled'
,
true
);
//
mainBrandsLimitObj.attr('disabled', true);
mainBrandsLimitObj
.
addClass
(
'layui-disabled'
);
//
mainBrandsLimitObj.addClass('layui-disabled');
mainBrandsLimitTypeObj
.
val
(
2
);
//
mainBrandsLimitTypeObj.val(2);
}
else
{
//
} else {
mainBrandsLimitObj
.
attr
(
'disabled'
,
false
);
//
mainBrandsLimitObj.attr('disabled', false);
mainBrandsLimitObj
.
removeClass
(
'layui-disabled'
);
//
mainBrandsLimitObj.removeClass('layui-disabled');
mainBrandsLimitTypeObj
.
val
(
1
);
//
mainBrandsLimitTypeObj.val(1);
}
//
}
form
.
render
(
'select'
);
//
form.render('select');
//
mainBrandsLimitObj
.
val
(
limit
===
-
1
?
''
:
limit
);
//
mainBrandsLimitObj.val(limit === -1 ? '' : limit);
});
});
form
.
on
(
'select(main_brands_limit_type)'
,
function
(
data
)
{
//
form.on('select(main_brands_limit_type)', function (data) {
let
mainBrandsLimitObj
=
$
(
'#main_brands_limit'
);
//
let mainBrandsLimitObj = $('#main_brands_limit');
if
(
data
.
value
==
2
)
{
//
if (data.value == 2) {
mainBrandsLimitObj
.
attr
(
'disabled'
,
true
);
//
mainBrandsLimitObj.attr('disabled', true);
mainBrandsLimitObj
.
addClass
(
'layui-disabled'
);
//
mainBrandsLimitObj.addClass('layui-disabled');
}
else
{
//
} else {
mainBrandsLimitObj
.
attr
(
'disabled'
,
false
);
//
mainBrandsLimitObj.attr('disabled', false);
mainBrandsLimitObj
.
removeClass
(
'layui-disabled'
);
//
mainBrandsLimitObj.removeClass('layui-disabled');
}
//
}
});
//
});
//如果没有直接忽略公司校验的权限,那么就要做到下面的互相disable
//如果没有直接忽略公司校验的权限,那么就要做到下面的互相disable
@
if
(
!
checkPerm
(
'IgnoreCompanyCheck'
))
@
if
(
!
checkPerm
(
'IgnoreCompanyCheck'
))
...
...
resources/views/web/AddSupplier.blade.php
View file @
c432aea0
...
@@ -209,7 +209,7 @@
...
@@ -209,7 +209,7 @@
</div>
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-col-md
8
"
>
<div
class=
"layui-col-md
12
"
>
<label
class=
"layui-form-label"
>
<label
class=
"layui-form-label"
>
<span
class=
"require"
>
*
</span>
<span
class=
"require"
>
*
</span>
主营品牌
</label>
主营品牌
</label>
...
@@ -220,19 +220,19 @@
...
@@ -220,19 +220,19 @@
id=
"main_brands"
>
id=
"main_brands"
>
</div>
</div>
</div>
</div>
<div
class=
"layui-col-md4"
>
{{--
<div
class=
"layui-col-md4"
>
--}}
<label
class=
"layui-form-label"
style=
"width: 100px"
>
主营品牌数量:
</label>
{{--
<label
class=
"layui-form-label"
style=
"width: 100px"
>
主营品牌数量:
</label>
--}}
<div
class=
"layui-input-inline"
style=
"width: 150px"
>
{{--
<div
class=
"layui-input-inline"
style=
"width: 150px"
>
--}}
<input
type=
"text"
name=
"main_brands_limit"
id=
"main_brands_limit"
{{--
<input
type=
"text"
name=
"main_brands_limit"
id=
"main_brands_limit"
--
}}
placeholder=
"请输入主营品牌数量限制"
class=
"layui-input"
value=
""
>
{{
--
placeholder=
"请输入主营品牌数量限制"
class=
"layui-input"
value=
""
>
--}}
</div>
{{--
</div>
--}}
<div
class=
"layui-inline"
>
{{--
<div
class=
"layui-inline"
>
--}}
<select
id=
"main_brands_limit_type"
lay-filter=
"main_brands_limit_type"
name=
"main_brands_limit_type"
>
{{--
<select
id=
"main_brands_limit_type"
lay-filter=
"main_brands_limit_type"
name=
"main_brands_limit_type"
>
--}}
<option
value=
"1"
>
自定义
</option>
{{--
<option
value=
"1"
>
自定义
</option>
--}}
<option
value=
"2"
>
无限制
</option>
{{--
<option
value=
"2"
>
无限制
</option>
--}}
</select>
{{--
</select>
--}}
</div>
{{--
</div>
--}}
</div>
{{--
</div>
--}}
</div>
</div>
{{--选择“混合分销商”时,在主营品牌下面新增一栏“代理品牌”;代理品牌取值同主营品牌一样--}}
{{--选择“混合分销商”时,在主营品牌下面新增一栏“代理品牌”;代理品牌取值同主营品牌一样--}}
...
...
resources/views/web/supplier/SupplierBase.blade.php
View file @
c432aea0
...
@@ -213,7 +213,7 @@
...
@@ -213,7 +213,7 @@
</div>
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-col-md
8
"
>
<div
class=
"layui-col-md
12
"
>
<label
class=
"layui-form-label"
>
<label
class=
"layui-form-label"
>
<span
class=
"require"
>
*
</span>
<span
class=
"require"
>
*
</span>
主营品牌
</label>
主营品牌
</label>
...
@@ -224,19 +224,19 @@
...
@@ -224,19 +224,19 @@
id=
"main_brands"
value=
"{{$supplier['main_brands'] or ''}}"
>
id=
"main_brands"
value=
"{{$supplier['main_brands'] or ''}}"
>
</div>
</div>
</div>
</div>
<div
class=
"layui-col-md4"
>
{{--
<div
class=
"layui-col-md4"
>
--}}
<label
class=
"layui-form-label"
style=
"width: 100px"
>
主营品牌数量:
</label>
{{--
<label
class=
"layui-form-label"
style=
"width: 100px"
>
主营品牌数量:
</label>
--}}
<div
class=
"layui-input-inline"
style=
"width: 150px"
>
{{--
<div
class=
"layui-input-inline"
style=
"width: 150px"
>
--}}
<input
type=
"text"
name=
"main_brands_limit"
id=
"main_brands_limit"
{{--
<input
type=
"text"
name=
"main_brands_limit"
id=
"main_brands_limit"
--
}}
placeholder=
"请输入主营品牌数量限制"
class=
"layui-input"
value=
"{{$supplier['main_brands_limit'] or ''}}"
>
{{
--
placeholder=
"请输入主营品牌数量限制"
class=
"layui-input"
value=
"{{$supplier['main_brands_limit'] or ''}}"
>
--}}
</div>
{{--
</div>
--}}
<div
class=
"layui-inline"
>
{{--
<div
class=
"layui-inline"
>
--}}
<select
id=
"main_brands_limit_type"
name=
"main_brands_limit_type"
lay-filter=
"main_brands_limit_type"
>
{{--
<select
id=
"main_brands_limit_type"
name=
"main_brands_limit_type"
lay-filter=
"main_brands_limit_type"
>
--}}
<option
value=
"1"
>
自定义
</option>
{{--
<option
value=
"1"
>
自定义
</option>
--}}
<option
value=
"2"
>
无限制
</option>
{{--
<option
value=
"2"
>
无限制
</option>
--}}
</select>
{{--
</select>
--}}
</div>
{{--
</div>
--}}
</div>
{{--
</div>
--}}
</div>
</div>
{{--选择“混合分销商”时,在主营品牌下面新增一栏“代理品牌”;代理品牌取值同主营品牌一样--}}
{{--选择“混合分销商”时,在主营品牌下面新增一栏“代理品牌”;代理品牌取值同主营品牌一样--}}
...
...
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