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
76a39e77
authored
May 24, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
主营品牌限制
parent
e50ca5b4
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
72 additions
and
27 deletions
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Transformers/SupplierTransformer.php
app/Http/Validators/SupplierValidator.php
resources/views/script/SupplierListScript.blade.php
resources/views/script/supplier/SupplierBaseScript.blade.php
resources/views/web/AddSupplier.blade.php
resources/views/web/SupplierDetail.blade.php
resources/views/web/supplier/SupplierBase.blade.php
app/Http/Controllers/Api/SupplierApiController.php
View file @
76a39e77
...
@@ -39,6 +39,8 @@ class SupplierApiController extends Controller
...
@@ -39,6 +39,8 @@ class SupplierApiController extends Controller
'tax_number'
,
'tax_number'
,
'supplier_address'
,
'supplier_address'
,
'main_brands'
,
'main_brands'
,
'main_brands_limit'
,
'main_brands_limit_type'
,
'purchase_uid'
,
'purchase_uid'
,
'upload_file'
,
'upload_file'
,
'legal_representative'
,
'legal_representative'
,
...
...
app/Http/Transformers/SupplierTransformer.php
View file @
76a39e77
...
@@ -62,9 +62,9 @@ class SupplierTransformer
...
@@ -62,9 +62,9 @@ class SupplierTransformer
$userInfo
=
$adminUserService
->
getAdminUserInfo
(
$supplier
[
'create_uid'
]);
$userInfo
=
$adminUserService
->
getAdminUserInfo
(
$supplier
[
'create_uid'
]);
$supplier
[
'create_name'
]
=
array_get
(
$userInfo
,
'name'
);
$supplier
[
'create_name'
]
=
array_get
(
$userInfo
,
'name'
);
}
}
$supplier
[
'first_upload_sku_time'
]
=
array_get
(
$firstUploadSkuTimes
,
$supplier
[
'supplier_code'
])
?
date
(
'Y-m-d H:i:s'
,
$supplier
[
'first_upload_sku_time'
]
=
array_get
(
$firstUploadSkuTimes
,
$supplier
[
'supplier_code'
])
?
date
(
'Y-m-d H:i:s'
,
$firstUploadSkuTimes
[
$supplier
[
'supplier_code'
]])
:
''
;
$firstUploadSkuTimes
[
$supplier
[
'supplier_code'
]])
:
''
;
$supplier
[
'last_upload_sku_time'
]
=
array_get
(
$lastUploadSkuTimes
,
$supplier
[
'supplier_code'
])
?
date
(
'Y-m-d H:i:s'
,
$supplier
[
'last_upload_sku_time'
]
=
array_get
(
$lastUploadSkuTimes
,
$supplier
[
'supplier_code'
])
?
date
(
'Y-m-d H:i:s'
,
$lastUploadSkuTimes
[
$supplier
[
'supplier_code'
]])
:
''
;
$lastUploadSkuTimes
[
$supplier
[
'supplier_code'
]])
:
''
;
//获取最新修改人以及下级审核员
//获取最新修改人以及下级审核员
...
@@ -331,6 +331,9 @@ class SupplierTransformer
...
@@ -331,6 +331,9 @@ class SupplierTransformer
}
}
$channel
[
'attachment'
]
=
$attachment
;
$channel
[
'attachment'
]
=
$attachment
;
//没有值就是无限制,就是-1
$channel
[
'main_brands_limit'
]
=
$channel
[
'main_brands_limit_type'
]
==
2
?
-
1
:
$channel
[
'main_brands_limit'
];
unset
(
$channel
[
'main_brands_limit_type'
]);
return
$channel
;
return
$channel
;
}
}
...
...
app/Http/Validators/SupplierValidator.php
View file @
76a39e77
...
@@ -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'
,
...
@@ -145,6 +145,18 @@ class SupplierValidator
...
@@ -145,6 +145,18 @@ class SupplierValidator
];
];
$errorMessageList
=
[];
$errorMessageList
=
[];
//主营品牌数量的判断
if
(
$validateData
[
'main_brands_limit_type'
]
==
1
)
{
if
(
!
$validateData
[
'main_brands_limit'
])
{
$errorMessageList
[]
=
'主营品牌限制数量不能为空'
;
}
if
(
count
(
explode
(
','
,
trim
(
$validateData
[
'main_brands'
],
','
)))
>
$validateData
[
'main_brands_limit'
])
{
$errorMessageList
[]
=
'主营品牌数量大于设置的限制数量'
;
}
}
//判断供应商类型,如果类型为临时,而且名字属于不能修改为临时的代购供应商列表里面,就要报错
//判断供应商类型,如果类型为临时,而且名字属于不能修改为临时的代购供应商列表里面,就要报错
if
(
empty
(
$validateData
[
'supplier_type'
]))
{
if
(
empty
(
$validateData
[
'supplier_type'
]))
{
...
...
resources/views/script/SupplierListScript.blade.php
View file @
76a39e77
...
@@ -170,6 +170,9 @@
...
@@ -170,6 +170,9 @@
}
}
},
},
{
field
:
'average_sku_num'
,
title
:
'日均上架数'
,
align
:
'center'
,
width
:
100
},
{
field
:
'average_sku_num'
,
title
:
'日均上架数'
,
align
:
'center'
,
width
:
100
},
{
field
:
'cp_time_day'
,
title
:
'有效期最高天数'
,
align
:
'center'
,
width
:
120
,
templet
:
function
(
data
)
{
return
data
.
cp_time_day
?
data
.
cp_time_day
+
'天'
:
''
;
}},
{
field
:
'create_name'
,
title
:
'创建人'
,
align
:
'center'
,
width
:
70
},
{
field
:
'create_name'
,
title
:
'创建人'
,
align
:
'center'
,
width
:
70
},
{
field
:
'update_time'
,
title
:
'最近修改时间'
,
align
:
'center'
,
width
:
145
},
{
field
:
'update_time'
,
title
:
'最近修改时间'
,
align
:
'center'
,
width
:
145
},
{
field
:
'supplier_type_name'
,
title
:
'供应商类别'
,
align
:
'center'
,
width
:
110
},
{
field
:
'supplier_type_name'
,
title
:
'供应商类别'
,
align
:
'center'
,
width
:
110
},
...
...
resources/views/script/supplier/SupplierBaseScript.blade.php
View file @
76a39e77
...
@@ -163,13 +163,36 @@
...
@@ -163,13 +163,36 @@
}
}
});
});
//主营品牌限制的初始化
let
mainBrandsLimitTypeObj
=
$
(
'#main_brands_limit_type'
);
let
mainBrandsLimitTypeObj
=
$
(
'#main_brands_limit_type'
);
if
(
supplierId
)
{
if
(
supplierId
)
{
if
(
$
(
'#main_brands_limit'
).
val
()
==
-
1
)
{
let
mainBrandsLimitObj
=
$
(
'#main_brands_limit'
);
if
(
mainBrandsLimitObj
.
val
()
==
-
1
)
{
mainBrandsLimitTypeObj
.
val
(
2
);
mainBrandsLimitTypeObj
.
val
(
2
);
mainBrandsLimitObj
.
val
(
''
);
mainBrandsLimitObj
.
attr
(
'disabled'
,
true
);
mainBrandsLimitObj
.
addClass
(
'layui-disabled'
);
form
.
render
(
'select'
);
form
.
render
(
'select'
);
}
}
}
}
let
supplierGroupMap
=
{
!!
json_encode
(
config
(
'fixed.SupplierGroup'
))
!!
};
let
limitMap
=
{
!!
json_encode
(
config
(
'field.SupplierGroupMainBrandsLimitMap'
))
!!
};
//监听主营品牌限制的数字,不同供应商性质的数量限制不一样
$
(
document
).
on
(
'change'
,
'#main_brands_limit'
,
function
()
{
let
supplierGroup
=
$
(
'#supplier_group'
).
val
();
if
(
!
supplierGroup
)
{
layer
.
msg
(
"请先选择供应商性质"
,
{
icon
:
5
});
$
(
'#main_brands_limit'
).
val
(
''
);
return
false
;
}
let
limit
=
limitMap
[
supplierGroup
];
if
(
$
(
this
).
val
()
>
limit
&&
limit
!==
-
1
)
{
layer
.
msg
(
"供应商性质为"
+
supplierGroupMap
[
supplierGroup
]
+
"时,主营品牌数量最大可以设置为 "
+
limit
,
{
icon
:
5
});
$
(
'#main_brands_limit'
).
val
(
limit
);
}
});
//监听供应商性质选择,如果为混合分销商,那么要展示混合分销商品牌设置
//监听供应商性质选择,如果为混合分销商,那么要展示混合分销商品牌设置
form
.
on
(
'select(supplier_group)'
,
function
(
data
)
{
form
.
on
(
'select(supplier_group)'
,
function
(
data
)
{
if
(
data
.
value
===
'7'
)
{
if
(
data
.
value
===
'7'
)
{
...
@@ -183,7 +206,6 @@
...
@@ -183,7 +206,6 @@
// 混合分销商,现货商,代工厂,品牌数量默认为10;
// 混合分销商,现货商,代工厂,品牌数量默认为10;
// 方案商,其他,品牌数量默认为5;
// 方案商,其他,品牌数量默认为5;
let
mainBrandsLimitObj
=
$
(
'#main_brands_limit'
);
let
mainBrandsLimitObj
=
$
(
'#main_brands_limit'
);
let
limitMap
=
{
!!
json_encode
(
config
(
'field.SupplierGroupMainBrandsLimitMap'
))
!!
};
let
limit
=
limitMap
[
data
.
value
];
let
limit
=
limitMap
[
data
.
value
];
console
.
log
(
limit
)
console
.
log
(
limit
)
if
(
limit
===
-
1
)
{
if
(
limit
===
-
1
)
{
...
...
resources/views/web/AddSupplier.blade.php
View file @
76a39e77
...
@@ -227,7 +227,7 @@
...
@@ -227,7 +227,7 @@
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"
>
<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>
...
...
resources/views/web/SupplierDetail.blade.php
View file @
76a39e77
...
@@ -177,6 +177,9 @@
...
@@ -177,6 +177,9 @@
</div>
</div>
<div
class=
"layui-row"
>
<div
class=
"layui-row"
>
<span
class=
"required_field"
>
*
</span>
主营品牌 :{{$supplier['main_brand_names']}}
<span
class=
"required_field"
>
*
</span>
主营品牌 :{{$supplier['main_brand_names']}}
<div
style=
"margin-left: 50px"
>
主营品牌数量 :{{$supplier['main_brands_limit']}}
</div>
</div>
</div>
@if($supplier['supplier_group'] == \App\Model\SupplierChannelModel::SUPPLIER_GROUP_MIX)
@if($supplier['supplier_group'] == \App\Model\SupplierChannelModel::SUPPLIER_GROUP_MIX)
<div
class=
"layui-row"
>
<div
class=
"layui-row"
>
...
...
resources/views/web/supplier/SupplierBase.blade.php
View file @
76a39e77
...
@@ -231,7 +231,7 @@
...
@@ -231,7 +231,7 @@
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"
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>
...
...
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