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 c137a733
authored
Nov 20, 2023
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
更新代码
1 parent
54da19d1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
12 deletions
html/merchant/edit.html
html/merchant/edit.html
View file @
c137a73
...
@@ -765,7 +765,8 @@ var mySelect = layui.xmSelect.render({
...
@@ -765,7 +765,8 @@ var mySelect = layui.xmSelect.render({
}
}
},
},
on
:
function
(
data
)
{
on
:
function
(
data
)
{
console
.
log
(
data
)
var
handleAccountTypeToArray
=
data
?.
arr
[
0
].
accountType
.
split
(
','
)
renderAccountTypes
(
handleAccountTypeToArray
)
}
}
});
});
...
@@ -1726,17 +1727,24 @@ function uniqueNodes(nodes) {
...
@@ -1726,17 +1727,24 @@ function uniqueNodes(nodes) {
}
}
// 设置账户等级下拉框的初始值
// 设置账户等级下拉框的初始值
var
accountLevel
=
merchantForm
.
merchantAccountLevel
;
// 获取账户等级
var
accountLevel
=
merchantForm
.
merchantAccountLevel
;
// 获取账户等级
$
(
'#accountLevelElTab'
).
val
(
accountLevel
);
// 设置select元素的值
$
(
'#accountLevelElTab'
).
val
(
accountLevel
);
// 设置select元素的值
// 根据账户等级决定是否显示或隐藏上级商户
// 根据账户等级决定是否显示或隐藏上级商户
if
(
accountLevel
===
'1'
)
{
// 假设'1'代表工厂
if
(
accountLevel
==
'1'
)
{
// 假设'1'代表工厂
$
(
'#superiorMerchantContainer'
).
hide
();
$
(
'#superiorMerchantContainer'
).
hide
();
}
else
{
}
else
{
$
(
'#superiorMerchantContainer'
).
show
();
$
(
'#superiorMerchantContainer'
).
show
();
}
}
// 插个眼账户类型
// 获取并处理上级账户类型
var
superiorAccountType
=
merchantForm
.
superiorAccountType
?.
split
(
','
);
// 假设是以逗号分隔的字符串
renderAccountTypes
(
superiorAccountType
,
accountLevel
);
// 更新 LayUI 表单视图
// 更新 LayUI 表单视图
form
.
render
(
'select'
);
form
.
render
(
'select'
);
...
@@ -1744,13 +1752,11 @@ function uniqueNodes(nodes) {
...
@@ -1744,13 +1752,11 @@ function uniqueNodes(nodes) {
// 页面加载时获取初始数据
// 页面加载时获取初始数据
loadSuperiorMerchants
(
currentPage
).
then
(
function
(
list
)
{
loadSuperiorMerchants
(
currentPage
).
then
(
function
(
list
)
{
mySelect
.
update
({
data
:
list
});
mySelect
.
update
({
data
:
list
});
if
(
merchantForm
?.
superiorMerchantName
&&
merchantForm
?.
superiorMerchantNo
){
mySelect
.
setValue
([{
name
:
merchantForm
.
superiorMerchantName
,
value
:
merchantForm
.
superiorMerchantNo
}]);
mySelect
.
setValue
([{
name
:
merchantForm
.
superiorMerchantName
,
value
:
merchantForm
.
superiorMerchantNo
}]);
}
});
});
// 插个眼账户类型
// 获取并处理上级账户类型
var
superiorAccountType
=
merchantForm
.
superiorAccountType
?.
split
(
','
);
// 假设是以逗号分隔的字符串
renderAccountTypes
(
superiorAccountType
);
// 省市回显
// 省市回显
if
(
merchantForm
.
provinceName
)
{
if
(
merchantForm
.
provinceName
)
{
...
@@ -1798,8 +1804,9 @@ loadSuperiorMerchants(currentPage).then(function(list) {
...
@@ -1798,8 +1804,9 @@ loadSuperiorMerchants(currentPage).then(function(list) {
// merchantId, check_arr
function
renderAccountTypes
(
types
,
merchantId
,
check_arr
)
{
function
renderAccountTypes
(
types
,
accountLevel
)
{
if
(
!
types
)
types
=
[]
var
el
=
$
(
'#accountTypeElRole'
);
var
el
=
$
(
'#accountTypeElRole'
);
el
.
empty
();
// Clear existing contents
el
.
empty
();
// Clear existing contents
...
@@ -1809,7 +1816,11 @@ loadSuperiorMerchants(currentPage).then(function(list) {
...
@@ -1809,7 +1816,11 @@ loadSuperiorMerchants(currentPage).then(function(list) {
res
.
data
.
forEach
(
function
(
dict
)
{
res
.
data
.
forEach
(
function
(
dict
)
{
typeMapping
[
dict
.
dictValue
]
=
dict
.
dictLabel
;
typeMapping
[
dict
.
dictValue
]
=
dict
.
dictLabel
;
});
});
if
(
accountLevel
==
1
){
for
(
let
i
in
typeMapping
){
types
.
push
(
i
)
}
}
types
?.
forEach
(
function
(
type
)
{
types
?.
forEach
(
function
(
type
)
{
var
typeLabel
=
typeMapping
[
type
];
// Get the label corresponding to the type
var
typeLabel
=
typeMapping
[
type
];
// Get the label corresponding to the type
var
checkboxHtml
=
'<input type="checkbox" class="accounttypeId" name="accountType['
+
type
+
']" value="'
+
type
+
'" title="'
+
typeLabel
+
'">'
;
var
checkboxHtml
=
'<input type="checkbox" class="accounttypeId" name="accountType['
+
type
+
']" value="'
+
type
+
'" title="'
+
typeLabel
+
'">'
;
...
@@ -2325,6 +2336,10 @@ loadSuperiorMerchants(currentPage).then(function(list) {
...
@@ -2325,6 +2336,10 @@ loadSuperiorMerchants(currentPage).then(function(list) {
// 查询商户的菜单权限树
// 查询商户的菜单权限树
function
findMenuFunTreeByMerId
()
{
function
findMenuFunTreeByMerId
()
{
var
params
=
{}
var
params
=
{}
console
.
log
(
'parentMerchantId'
,
parentMerchantId
)
console
.
log
(
'merchantId'
,
merchantId
)
console
.
log
(
'accountlevel'
,
merchantForm
.
merchantAccountLevel
)
console
.
log
(
'ids'
,
merchantForm
.
accountType
)
if
(
parentMerchantId
)
{
if
(
parentMerchantId
)
{
params
=
{
params
=
{
method
:
'merchants.api.merchant.findMenuFunTreeByMerId'
,
method
:
'merchants.api.merchant.findMenuFunTreeByMerId'
,
...
@@ -2341,6 +2356,7 @@ loadSuperiorMerchants(currentPage).then(function(list) {
...
@@ -2341,6 +2356,7 @@ loadSuperiorMerchants(currentPage).then(function(list) {
}
}
}
}
request
(
params
,
function
(
res
)
{
request
(
params
,
function
(
res
)
{
console
.
log
(
res
)
if
(
res
.
code
==
'0'
)
{
if
(
res
.
code
==
'0'
)
{
menuFunTreeData
=
res
.
data
menuFunTreeData
=
res
.
data
var
accountType
=
$
(
'#accountType'
)
var
accountType
=
$
(
'#accountType'
)
...
@@ -2355,7 +2371,6 @@ loadSuperiorMerchants(currentPage).then(function(list) {
...
@@ -2355,7 +2371,6 @@ loadSuperiorMerchants(currentPage).then(function(list) {
var
id
=
item
.
accounttypeId
var
id
=
item
.
accounttypeId
str
.
attr
(
'checked'
,
true
)
str
.
attr
(
'checked'
,
true
)
var
obj
=
{
title
:
item
.
accounttypeName
,
value
:
item
.
accounttypeId
}
var
obj
=
{
title
:
item
.
accounttypeName
,
value
:
item
.
accounttypeId
}
console
.
log
(
'merchantId'
,
merchantId
)
active
.
tabAdd
(
obj
,
productData
.
products
)
active
.
tabAdd
(
obj
,
productData
.
products
)
if
(
productData
.
products
&&
productData
.
products
.
length
!=
0
)
{
if
(
productData
.
products
&&
productData
.
products
.
length
!=
0
)
{
productData
.
products
.
forEach
(
j
=>
{
productData
.
products
.
forEach
(
j
=>
{
...
@@ -2541,7 +2556,7 @@ loadSuperiorMerchants(currentPage).then(function(list) {
...
@@ -2541,7 +2556,7 @@ loadSuperiorMerchants(currentPage).then(function(list) {
function
submitAuth
()
{
function
submitAuth
()
{
var
accountLevel
=
$
(
'#accountLevelElTab'
).
val
();
var
accountLevel
=
$
(
'#accountLevelElTab'
).
val
();
var
superiorMerchant
=
layui
.
xmSelect
.
get
(
'#superiorMerchantSelect'
,
true
).
getValue
();
var
superiorMerchant
=
layui
.
xmSelect
.
get
(
'#superiorMerchantSelect'
,
true
)
?
.
getValue
();
var
accountTypeElements
=
$
(
'#accountTypeElRole input[type="checkbox"]:checked'
);
var
accountTypeElements
=
$
(
'#accountTypeElRole input[type="checkbox"]:checked'
);
var
accountTypes
=
[];
var
accountTypes
=
[];
...
@@ -2549,11 +2564,18 @@ loadSuperiorMerchants(currentPage).then(function(list) {
...
@@ -2549,11 +2564,18 @@ loadSuperiorMerchants(currentPage).then(function(list) {
accountTypes
.
push
(
$
(
this
).
val
());
accountTypes
.
push
(
$
(
this
).
val
());
});
});
if
(
accountLevel
!==
'1'
&&
superiorMerchant
.
length
==
0
)
{
layer
.
msg
(
'请选择上级商户'
,
{
icon
:
2
});
return
;
}
if
(
accountTypes
.
length
===
0
)
{
if
(
accountTypes
.
length
===
0
)
{
// 如果没有勾选任何账户类型
// 如果没有勾选任何账户类型
layer
.
msg
(
'请选择账户类型'
,
{
icon
:
2
});
layer
.
msg
(
'请选择账户类型'
,
{
icon
:
2
});
return
;
return
;
}
}
if
(
!
accountInfo
&&
merchantAccountLevel
==
4
&&
qs
(
'status'
)
==
1
&&
!
merchantForm
.
effectiveStarttime
)
{
if
(
!
accountInfo
&&
merchantAccountLevel
==
4
&&
qs
(
'status'
)
==
1
&&
!
merchantForm
.
effectiveStarttime
)
{
layer
.
msg
(
'请去“修改基本信息”填写账户有效期'
,
{
layer
.
msg
(
'请去“修改基本信息”填写账户有效期'
,
{
icon
:
2
icon
:
2
...
@@ -2566,7 +2588,7 @@ loadSuperiorMerchants(currentPage).then(function(list) {
...
@@ -2566,7 +2588,7 @@ loadSuperiorMerchants(currentPage).then(function(list) {
merchantId
:
merchantId
,
merchantId
:
merchantId
,
accountTypes
:
JSON
.
stringify
(
requestList
),
accountTypes
:
JSON
.
stringify
(
requestList
),
merchantAccountLevel
:
accountLevel
,
merchantAccountLevel
:
accountLevel
,
merchantNoTarget
:
superiorMerchant
[
0
]
.
value
,
merchantNoTarget
:
accountLevel
==
'1'
?
''
:
superiorMerchant
[
0
]?
.
value
,
accountType
:
accountTypes
.
join
(
','
)
accountType
:
accountTypes
.
join
(
','
)
}
}
...
...
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