Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
h5
/
account
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f14f0cc6
authored
Nov 27, 2023
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化代码
1 parent
fbf6891a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
39 deletions
html/merchant/edit.html
html/merchant/edit.html
View file @
f14f0cc
...
...
@@ -741,10 +741,10 @@ var _currentMerchantLevel = '' //当前的账户等级
var
_superMerchantInfo
=
{}
//上级商户的信息
var
_searchValue
=
''
var
_searchCount
=
0
var
_initFactoryCheckArr
=
[]
//
var _initFactoryCheckArr = []
function
loadSuperiorMerchants
(
pageNum
=
1
)
{
console
.
log
(
'accountLevelUpdate'
,
_currentMerchantLevel
)
//
console.log('accountLevelUpdate',_currentMerchantLevel)
return
new
Promise
((
resolve
,
reject
)
=>
{
var
params
=
{
method
:
'merchants.api.open.findMerchantListByPage'
,
...
...
@@ -905,7 +905,7 @@ form.on('checkbox', function(data) {
selectedValues
.
push
(
$
(
this
).
val
());
}
});
console
.
log
(
"选中的账户类型值: "
,
selectedValues
);
//
console.log("选中的账户类型值: ", selectedValues);
if
(
selectedValues
.
length
===
0
)
{
layer
.
msg
(
'账户类型不能为空'
,
{
icon
:
5
,
anim
:
6
});
$
(
'#accountTypeElRole .accounttypeId'
).
each
(
function
()
{
...
...
@@ -950,10 +950,11 @@ function prepareExecuteFindMenuFun(){
accountLevel
:
_currentMerchantLevel
}
}
getById
(
// _superMerchantInfo?.parentId
rolePageParams
)
// findMenuFunTreeByMerId(rolePageParams)
findMenuFunTreeByMerId
(
rolePageParams
)
// getById(
// // _superMerchantInfo?.parentId
// rolePageParams)
// // findMenuFunTreeByMerId(rolePageParams)
}
function
clearRoleAuthTabContent
()
{
// 清空特定选项卡标题
...
...
@@ -1048,17 +1049,17 @@ function clearRoleAuthTabContent() {
}
_currentMerchantLevel
=
data
.
value
if
(
data
.
value
==
3
)
$
(
'#accountLevelElTab option[value="2"]'
).
prop
(
'disabled'
,
true
)
if
(
data
.
value
==
2
)
$
(
'#accountLevelElTab option[value="3"]'
).
prop
(
'disabled'
,
true
)
if
(
data
.
value
==
2
&&
_subMerchantNoList
?.
length
>
0
||
data
.
value
==
3
&&
_subMerchantNoList
?.
length
>
0
){
if
(
data
.
value
==
2
)
$
(
'#accountLevelElTab option[value="3"]'
).
prop
(
'disabled'
,
true
)
if
(
data
.
value
==
2
&&
_subMerchantNoList
?.
length
>
0
||
data
.
value
==
3
&&
_subMerchantNoList
?.
length
>
0
){
$
(
"#accountLevelElTab"
).
attr
(
"disabled"
,
"disabled"
);
$
(
"#accountLevelElTab"
).
attr
(
"style"
,
"background-color: #EEEEEE;"
);
}
console
.
log
(
'账户等级下拉框的渲染账户类型参数'
,
'上级商户类型'
,
_superMerchantInfo
?.
accountType
?.
split
(
','
),
'本身的商户类型'
,
merchantForm
.
accountType
,
'本身的子商户类型'
,
merchantForm
.
subAccountTypeList
,
'页面的账户等级'
,
_currentMerchantLevel
)
//
console.log('账户等级下拉框的渲染账户类型参数',
//
'上级商户类型',_superMerchantInfo?.accountType?.split(','),
//
'本身的商户类型',merchantForm.accountType,
//
'本身的子商户类型',merchantForm.subAccountTypeList,
//
'页面的账户等级',_currentMerchantLevel)
renderAccountTypes
(
_superMerchantInfo
?.
accountType
?.
split
(
','
),
merchantForm
.
accountType
,
merchantForm
.
subAccountTypeList
,
_currentMerchantLevel
);
clearRoleAuthTabContent
();
...
...
@@ -1071,7 +1072,7 @@ function clearRoleAuthTabContent() {
// var $accountLevelElTab = $('#accountLevelElTab');
// var $options = $accountLevelElTab.find('option');
// var $superiorMerchantContainer = $('#superiorMerchantContainer');
//
var
_currentMerchantLevel = data.value;
// _currentMerchantLevel = data.value;
// function setOptionsDisabled(disabled) {
// $options.each(function() {
...
...
@@ -1350,7 +1351,7 @@ function clearRoleAuthTabContent() {
}
})
params
.
merchantBrandListJson
=
JSON
.
stringify
(
merchantForm
.
merchantBrandList
)
console
.
log
(
params
.
merchantBrandListJson
)
//
console.log(params.merchantBrandListJson)
}
if
(
merchantForm
.
merchantFiles
.
length
)
{
params
.
merchantFiles
=
JSON
.
stringify
(
merchantForm
.
merchantFiles
)
...
...
@@ -1989,7 +1990,7 @@ loadSuperiorMerchants(currentPage).then(function(list) {
parentId
:
merchantForm
.
parentId
,
accountType
:
merchantForm
.
superiorAccountType
}
console
.
log
(
merchantForm
)
//
console.log(merchantForm)
mySelect
.
setValue
([{
name
:
merchantForm
.
superiorMerchantName
,
value
:
merchantForm
.
superiorMerchantNo
,
...
...
@@ -2435,7 +2436,7 @@ loadSuperiorMerchants(currentPage).then(function(list) {
var
str
=
$
(
'<input lay-filter="filter" data-id="'
+
id
+
'" type="checkbox" name="check['
+
id
+
']" value="'
+
i
.
productId
+
'" title="'
+
i
.
productName
+
'" lay-skin="primary" />'
)
$
(
'#project'
+
id
).
append
(
str
)
if
(
productList
)
{
console
.
log
(
'productList'
,
productList
)
//
console.log('productList',productList)
productList
.
forEach
(
j
=>
{
if
(
j
.
productId
==
i
.
productId
)
{
str
.
attr
(
'checked'
,
true
)
...
...
@@ -2561,7 +2562,6 @@ loadSuperiorMerchants(currentPage).then(function(list) {
// 查询商户的菜单权限树
function
findMenuFunTreeByMerId
(
rolePageParams
)
{
console
.
log
(
'rolePageParams'
,
rolePageParams
)
var
params
=
{}
if
(
rolePageParams
){
params
=
rolePageParams
...
...
@@ -2590,29 +2590,28 @@ loadSuperiorMerchants(currentPage).then(function(list) {
if
(
res
.
code
==
'0'
)
{
menuFunTreeData
=
res
.
data
// 插个眼
console
.
log
(
'check_arr'
,
check_arr
)
console
.
log
(
'menuFunTreeData'
,
menuFunTreeData
)
console
.
log
(
'_initFactoryCheckArr'
,
_initFactoryCheckArr
)
//
console.log('check_arr',check_arr)
//
console.log('menuFunTreeData',menuFunTreeData)
//
console.log('_initFactoryCheckArr',_initFactoryCheckArr)
// 下周优化
if
(
_initFactoryCheckArr
&&
_currentMerchantLevel
==
1
){
menuFunTreeData
.
forEach
(
item
=>
{
if
(
!
_initFactoryCheckArr
.
some
(
initItem
=>
initItem
.
accounttypeId
==
item
.
accounttypeId
)){
const
newItem
=
{...
item
,
products
:[]}
_initFactoryCheckArr
.
push
(
newItem
)
}
})
}
else
{
//
if(_initFactoryCheckArr && _currentMerchantLevel == 1){
//
menuFunTreeData.forEach(item => {
//
if(!_initFactoryCheckArr.some(initItem => initItem.accounttypeId == item.accounttypeId)){
//
const newItem = {...item,products:[]}
//
_initFactoryCheckArr.push(newItem)
//
}
//
})
//
}else{
menuFunTreeData
.
forEach
(
item
=>
{
if
(
!
check_arr
.
some
(
initItem
=>
initItem
.
accounttypeId
==
item
.
accounttypeId
)){
const
newItem
=
{...
item
,
products
:[]}
check_arr
.
push
(
newItem
)
}
})
}
console
.
log
(
check_arr
)
check_arr
=
_currentMerchantLevel
==
1
?
_initFactoryCheckArr
:
check_arr
.
filter
(
item
=>
_currentaccountType
.
includes
(
String
(
item
.
accounttypeId
))))
// }
check_arr
=
check_arr
.
filter
(
item
=>
_currentaccountType
.
includes
(
String
(
item
.
accounttypeId
)))
// check_arr =_currentMerchantLevel == 1 ? _initFactoryCheckArr : check_arr.filter(item =>_currentaccountType.includes(String(item.accounttypeId)))
var
accountType
=
$
(
'#accountType'
)
accountType
.
empty
()
...
...
@@ -2626,7 +2625,6 @@ loadSuperiorMerchants(currentPage).then(function(list) {
var
id
=
item
.
accounttypeId
str
.
attr
(
'checked'
,
true
)
var
obj
=
{
title
:
item
.
accounttypeName
,
value
:
item
.
accounttypeId
}
// console.log(obj, productData.products)
active
.
tabAdd
(
obj
,
productData
.
products
)
if
(
productData
.
products
&&
productData
.
products
.
length
!=
0
)
{
productData
.
products
.
forEach
(
j
=>
{
...
...
@@ -2682,9 +2680,9 @@ loadSuperiorMerchants(currentPage).then(function(list) {
var
accounttypeId
=
''
if
(
res
.
data
)
{
check_arr
=
res
.
data
if
(
_currentMerchantLevel
==
1
){
_initFactoryCheckArr
=
check_arr
}
//
if(_currentMerchantLevel == 1){
//
_initFactoryCheckArr = check_arr
//
}
}
findMenuFunTreeByMerId
(
rolePageParams
)
form
.
val
(
'roleForm'
,
{
...
...
@@ -2854,7 +2852,8 @@ loadSuperiorMerchants(currentPage).then(function(list) {
merchantNoTarget
:
superiorMerchant
[
0
]?.
value
,
accountType
:
accountTypes
.
join
(
','
)
}
console
.
log
(
params
.
accountTypes
)
// console.log(superiorMerchant)
// console.log('params.merchantNoTarget',params.merchantNoTarget)
accountLevel
==
'1'
&&
delete
params
.
merchantNoTarget
params
.
method
=
'merchants.api.merchant.updatePermissions'
// 草稿
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment