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
e50ca5b4
authored
May 23, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
品牌数量限制
parent
3551fc32
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
158 additions
and
24 deletions
app/Http/Services/DataService.php
app/Http/routes.php
config/field.php
config/fixed.php
public/plugins/assets/js/common.js
resources/views/script/supplier/SupplierBaseScript.blade.php
resources/views/web/AddSupplier.blade.php
resources/views/web/supplier/SupplierBase.blade.php
app/Http/Services/DataService.php
View file @
e50ca5b4
...
...
@@ -1204,15 +1204,32 @@ class DataService
if
(
trim
(
$supplier
[
'main_brands'
],
','
))
{
$mainBrands
=
explode
(
','
,
trim
(
$supplier
[
'main_brands'
],
','
));
$ruler
=
$redis
->
hget
(
'supplier_sku_upload_ruler_v2'
,
$supplier
[
'supplier_id'
]);
if
(
$ruler
){
if
(
$ruler
)
{
$ruler
=
json_decode
(
$ruler
,
true
);
$ruler
[
'upload_allow_brands'
]
=
$mainBrands
;
}
else
{
}
else
{
$ruler
[
'upload_allow_brands'
]
=
$mainBrands
;
}
dump
(
json_encode
(
$ruler
));
// $redis->hset('supplier_sku_upload_ruler_v2', $supplier['supplier_id'], json_encode($ruler));
$redis
->
hset
(
'supplier_sku_upload_ruler_v2'
,
$supplier
[
'supplier_id'
],
json_encode
(
$ruler
));
}
}
}
//初始化品牌数量限制(还要跳过API对接的供应商)
public
function
initialMainBrandsLimit
()
{
$suppliers
=
SupplierChannelModel
::
where
(
'is_type'
,
0
)
->
get
()
->
toArray
();
foreach
(
$suppliers
as
$supplier
)
{
//判断是否是API对接的供应商
if
(
DataManageModel
::
where
(
'canal'
,
$supplier
[
'supplier_code'
])
->
where
(
'is_type'
,
0
)
->
exists
())
{
dump
(
"大数据供应商"
);
continue
;
}
//获取具体限制数量
$mainBrandsLimit
=
array_get
(
config
(
'field.SupplierGroupMainBrandsLimitMap'
),
$supplier
[
'supplier_group'
],
-
1
);
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplier
[
'supplier_id'
])
->
update
([
'main_brands_limit'
=>
$mainBrandsLimit
,
]);
}
}
}
\ No newline at end of file
app/Http/routes.php
View file @
e50ca5b4
...
...
@@ -67,7 +67,7 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
(
new
\App\Http\Services\DataService
())
->
initialMainBrands
ToSkuRuler
();
(
new
\App\Http\Services\DataService
())
->
initialMainBrands
Limit
();
// \App\Model\SupplierChannelModel::where('supplier_name', '深圳市金开盛电子有限公司')->update([
// 'status' => 2,
// 'update_time' => time(),
...
...
config/field.php
View file @
e50ca5b4
...
...
@@ -237,4 +237,16 @@ return [
1
=>
'待审核'
,
2
=>
'通过'
,
],
//不同供应商性质的品牌数量限制最大值,具体供应商性质数据见 fixed.php 里的 SupplierGroup
'SupplierGroupMainBrandsLimitMap'
=>
[
4
=>
-
1
,
//其实就是无限制
1
=>
-
1
,
//其实就是无限制
5
=>
-
1
,
//其实就是无限制
7
=>
10
,
2
=>
10
,
6
=>
10
,
3
=>
5
,
0
=>
5
,
],
];
\ No newline at end of file
config/fixed.php
View file @
e50ca5b4
...
...
@@ -16,7 +16,7 @@ return [
'WMSKEY'
=>
'j9q##VRhaXBEtznIEeDiR@1Hvy0sW3wp'
,
//WMS加密密钥
//1代理商,2现货商,3财务供应商,4原厂,5代工厂,6黑名单
'SupplierGroup'
=>
[
2
=>
'现货商'
,
4
=>
'原厂'
,
...
...
public/plugins/assets/js/common.js
View file @
e50ca5b4
...
...
@@ -86,6 +86,19 @@ function inArray(needle, haystack) {
return
false
;
}
function
arrayGet
(
obj
,
key
,
defaultValue
=
null
)
{
// 分割键名
const
keys
=
typeof
key
===
'string'
?
key
.
split
(
'.'
)
:
[
key
];
// 遍历对象获取对应值
for
(
let
i
=
0
;
i
<
keys
.
length
;
i
++
)
{
if
(
typeof
obj
!==
'object'
||
!
obj
.
hasOwnProperty
(
keys
[
i
]))
{
return
defaultValue
;
}
obj
=
obj
[
keys
[
i
]];
}
return
obj
;
}
function
getCookie
(
name
)
{
var
arr
=
document
.
cookie
.
match
(
new
RegExp
(
"(^| )"
+
name
+
"=([^;]*)(;|$)"
));
if
(
arr
!=
null
)
return
unescape
(
arr
[
2
]);
...
...
@@ -99,3 +112,5 @@ function getLogDomain() {
}
return
default_domain
;
}
resources/views/script/supplier/SupplierBaseScript.blade.php
View file @
e50ca5b4
...
...
@@ -163,6 +163,13 @@
}
});
let
mainBrandsLimitTypeObj
=
$
(
'#main_brands_limit_type'
);
if
(
supplierId
)
{
if
(
$
(
'#main_brands_limit'
).
val
()
==
-
1
)
{
mainBrandsLimitTypeObj
.
val
(
2
);
form
.
render
(
'select'
);
}
}
//监听供应商性质选择,如果为混合分销商,那么要展示混合分销商品牌设置
form
.
on
(
'select(supplier_group)'
,
function
(
data
)
{
if
(
data
.
value
===
'7'
)
{
...
...
@@ -170,6 +177,38 @@
}
else
{
$
(
'#agency_brands_div'
).
hide
();
}
// 这里还要去判断主营品牌数量限制的切换
// 原厂,代理商,分销平台,品牌数量不做限制;默认为“无限制”;
// 混合分销商,现货商,代工厂,品牌数量默认为10;
// 方案商,其他,品牌数量默认为5;
let
mainBrandsLimitObj
=
$
(
'#main_brands_limit'
);
let
limitMap
=
{
!!
json_encode
(
config
(
'field.SupplierGroupMainBrandsLimitMap'
))
!!
};
let
limit
=
limitMap
[
data
.
value
];
console
.
log
(
limit
)
if
(
limit
===
-
1
)
{
mainBrandsLimitObj
.
attr
(
'disabled'
,
true
);
mainBrandsLimitObj
.
addClass
(
'layui-disabled'
);
mainBrandsLimitTypeObj
.
val
(
2
);
}
else
{
mainBrandsLimitObj
.
attr
(
'disabled'
,
false
);
mainBrandsLimitObj
.
removeClass
(
'layui-disabled'
);
mainBrandsLimitTypeObj
.
val
(
1
);
}
form
.
render
(
'select'
);
mainBrandsLimitObj
.
val
(
limit
===
-
1
?
''
:
limit
);
});
form
.
on
(
'select(main_brands_limit_type)'
,
function
(
data
)
{
let
mainBrandsLimitObj
=
$
(
'#main_brands_limit'
);
if
(
data
.
value
==
2
)
{
mainBrandsLimitObj
.
attr
(
'disabled'
,
true
);
mainBrandsLimitObj
.
addClass
(
'layui-disabled'
);
}
else
{
mainBrandsLimitObj
.
attr
(
'disabled'
,
false
);
mainBrandsLimitObj
.
removeClass
(
'layui-disabled'
);
}
});
//如果没有直接忽略公司校验的权限,那么就要做到下面的互相disable
...
...
@@ -281,6 +320,19 @@
let
agencyBrandInitValue
=
{
!!
json_encode
(
$agency_brand_init_value
?:[])
!!
};
agencyBrandSelector
.
setValue
(
agencyBrandInitValue
);
//主营品牌数量逻辑
form
.
on
(
'select(day_type)'
,
function
(
data
)
{
console
.
log
(
data
.
value
)
if
(
data
.
value
===
'2'
)
{
$
(
'#cp_time_day'
).
attr
(
'disabled'
,
true
);
$
(
'#cp_time_day'
).
addClass
(
'layui-disabled'
);
}
else
{
$
(
'#cp_time_day'
).
attr
(
'disabled'
,
false
);
$
(
'#cp_time_day'
).
removeClass
(
'layui-disabled'
);
}
});
//供应商标签的多选
function
getTagOption
(
element
)
{
//获取系统标签列表
...
...
resources/views/web/AddSupplier.blade.php
View file @
e50ca5b4
...
...
@@ -61,7 +61,8 @@
<label
class=
"layui-form-label"
><span
class=
"require"
>
*
</span>
供应商名称 :
</label>
<div
class=
"layui-input-block"
>
<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
id=
'supplier_check_tip'
style=
'margin-top: 5px'
>
<p
style=
'color: red;'
></p>
</div>
...
...
@@ -71,7 +72,8 @@
<div
class=
"layui-block"
id=
"tax_number_div"
>
<label
class=
"layui-form-label"
><span
id=
"tax_number_required_span"
class=
"require"
>
*
</span>
公司税号
</label>
<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=
""
>
<div
id=
'supplier_check_tip'
style=
'margin-top: 5px'
>
<p
style=
'color: red;'
></p>
...
...
@@ -80,7 +82,8 @@
</div>
</div>
<div
class=
"layui-col-md2"
style=
"padding-left: 40px"
>
<button
type=
"button"
class=
"layui-btn layui-btn-sm"
id=
"recheck_company_info"
>
重新查验公司信息
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm"
id=
"recheck_company_info"
>
重新查验公司信息
</button>
</div>
</div>
...
...
@@ -206,15 +209,31 @@
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
<span
class=
"require"
>
*
</span>
主营品牌
</label>
<div
class=
"layui-input-block"
>
<div
id=
"brand_selector"
class=
"layui-input-inline"
style=
"width: 100%;"
>
<div
class=
"layui-col-md8"
>
<label
class=
"layui-form-label"
>
<span
class=
"require"
>
*
</span>
主营品牌
</label>
<div
class=
"layui-input-block"
>
<div
id=
"brand_selector"
class=
"layui-input-inline"
style=
"width: 100%;"
>
</div>
<input
type=
"hidden"
name=
"main_brands"
value=
""
id=
"main_brands"
>
</div>
<input
type=
"hidden"
name=
"main_brands"
value=
""
id=
"main_brands"
>
</div>
<div
class=
"layui-col-md4"
>
<label
class=
"layui-form-label"
style=
"width: 100px"
>
主营品牌数量:
</label>
<div
class=
"layui-input-inline"
style=
"width: 150px"
>
<input
type=
"text"
name=
"main_brands_limit"
id=
"main_brands_limit"
placeholder=
"请输入主营品牌数量限制"
class=
"layui-input"
value=
""
>
</div>
<div
class=
"layui-inline"
>
<select
id=
"main_brands_limit_type"
lay-filter=
"main_brands_limit_type"
>
<option
value=
"1"
>
自定义
</option>
<option
value=
"2"
>
无限制
</option>
</select>
</div>
</div>
</div>
{{--选择“混合分销商”时,在主营品牌下面新增一栏“代理品牌”;代理品牌取值同主营品牌一样--}}
<div
class=
"layui-form-item"
id=
"agency_brands_div"
style=
"display: none"
>
...
...
@@ -245,7 +264,8 @@
<div
class=
"layui-form-item layui-form-text"
>
<label
class=
"layui-form-label"
>
资信调查 :
</label>
<div
class=
"layui-input-block"
>
<textarea
name=
"credit_investigation"
placeholder=
"请输入资信调查"
class=
"layui-textarea"
></textarea>
<textarea
name=
"credit_investigation"
placeholder=
"请输入资信调查"
class=
"layui-textarea"
></textarea>
</div>
</div>
...
...
resources/views/web/supplier/SupplierBase.blade.php
View file @
e50ca5b4
...
...
@@ -213,15 +213,31 @@
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
<span
class=
"require"
>
*
</span>
主营品牌
</label>
<div
class=
"layui-input-block"
style=
"margin-top: 15px"
>
<div
id=
"brand_selector"
class=
"layui-input-inline"
style=
"width: 100%;"
>
<div
class=
"layui-col-md8"
>
<label
class=
"layui-form-label"
>
<span
class=
"require"
>
*
</span>
主营品牌
</label>
<div
class=
"layui-input-block"
>
<div
id=
"brand_selector"
class=
"layui-input-inline"
style=
"width: 100%;"
>
</div>
<input
type=
"hidden"
name=
"main_brands"
value=
""
id=
"main_brands"
value=
"{{$supplier['main_brands'] or ''}}"
>
</div>
<input
type=
"hidden"
name=
"main_brands"
value=
"{{$supplier['main_brands'] or ''}}"
id=
"main_brands"
>
</div>
<div
class=
"layui-col-md4"
>
<label
class=
"layui-form-label"
style=
"width: 100px"
>
主营品牌数量:
</label>
<div
class=
"layui-input-inline"
style=
"width: 150px"
>
<input
type=
"text"
name=
"main_brands_limit"
id=
"main_brands_limit"
placeholder=
"请输入主营品牌数量限制"
class=
"layui-input"
value=
"{{$supplier['main_brands_limit'] or ''}}"
>
</div>
<div
class=
"layui-inline"
>
<select
id=
"main_brands_limit_type"
lay-filter=
"main_brands_limit_type"
>
<option
value=
"1"
>
自定义
</option>
<option
value=
"2"
>
无限制
</option>
</select>
</div>
</div>
</div>
{{--选择“混合分销商”时,在主营品牌下面新增一栏“代理品牌”;代理品牌取值同主营品牌一样--}}
<div
class=
"layui-form-item"
id=
"agency_brands_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