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 0e2b3e18
authored
Aug 08, 2021
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
商户/子商户-新建/编辑基本信息
1 parent
7c03bf2d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
112 additions
and
21 deletions
html/merchant/edit.html
html/merchant/index.html
js/request.js
html/merchant/edit.html
View file @
0e2b3e1
...
...
@@ -247,6 +247,20 @@
</div>
</div>
<p
class=
"edit-title"
>
账户基本信息
</p>
<div
id=
"subMerchantEl"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label required"
>
上级商户:
</label>
<div
class=
"layui-input-inline"
>
<input
class=
"layui-input layui-btn-disabled"
name=
"parentName"
placeholder=
"请输入上级商户"
disabled
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label required"
>
账户类型:
</label>
<div
class=
"layui-input-inline"
>
<input
class=
"layui-input layui-btn-disabled"
name=
"parentAccountTypeName"
placeholder=
"请输入账户类型"
>
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label required"
>
登陆账户名:
</label>
<div
class=
"layui-input-inline"
>
...
...
@@ -325,6 +339,10 @@
// 1-基本信息;2-权限树
var
step
=
1
var
merchantId
=
null
var
parentMerchantId
=
null
// 是否工厂
var
isFactory
=
true
var
parentInfo
=
{}
var
merchantForm
=
{
channelId
:
''
,
...
...
@@ -393,12 +411,12 @@
form
.
on
(
'submit(handleSubmit)'
,
function
(
data
)
{
//---------------
baseIsShow
(
false
)
treeIsShow
(
true
)
//
baseIsShow(false)
//
treeIsShow(true)
// getMenuList()
findMenuFunTreeByMerId
()
//
findMenuFunTreeByMerId()
//-------------------
console
.
log
(
editLevel
)
//
console.log(editLevel)
// console.log(data.field)
var
formData
=
data
.
field
var
params
=
{
...
...
@@ -466,9 +484,15 @@
if
(
editLevel
==
1
)
{
params
.
method
=
'cn.com.glsx.merchants.merchant.saveMerchant'
}
else
if
(
editLevel
==
2
)
{
if
(
!
isFactory
)
{
params
.
parentId
=
parentInfo
.
parentId
}
params
.
method
=
'cn.com.glsx.merchants.merchant.saveMerchant'
}
else
if
(
editLevel
==
3
)
{
params
.
id
=
merchantId
if
(
!
isFactory
)
{
params
.
parentId
=
parentInfo
.
parentId
}
params
.
method
=
'cn.com.glsx.merchants.merchant.updateMerchant'
}
// 保存状态 1.草稿 2.发布 3.注销 4.过期
...
...
@@ -577,7 +601,6 @@
subParent
.
append
(
child1
)
subParent
.
append
(
child2
)
parent
.
append
(
subParent
)
// console.log(parent)
},
handleCancel
()
{
go
(
'merchant'
,
'index'
)
...
...
@@ -642,26 +665,42 @@
function
init
()
{
editLevel
=
qs
(
'editLevel'
)
merchantId
=
qs
(
'id'
)
isFactory
=
(
qs
(
'isFactory'
)
==
'true'
)
console
.
log
(
isFactory
)
if
(
isFactory
)
{
merchantId
=
qs
(
'id'
)
$
(
'#subMerchantEl'
).
hide
()
getAccountLevel
()
}
else
{
// 创建/编辑子商户
parentMerchantId
=
qs
(
'parentId'
)
if
(
editLevel
==
3
)
{
merchantId
=
qs
(
'id'
)
}
$
(
'#validPeriodEl'
).
attr
(
'disabled'
,
true
)
$
(
'#channelEl'
).
attr
(
'disabled'
,
true
)
getParentInfo
()
}
step
=
qs
(
'step'
)
if
(
step
==
1
)
{
treeIsShow
(
false
)
}
else
{
baseIsShow
(
false
)
// getMenuList()
//
findMenuFunTreeByMerId()
findMenuFunTreeByMerId
()
}
if
(
editLevel
==
3
)
{
// merchantName = qs('merchantName')
getMerchantInfo
()
$
(
'#accountLevelEl'
).
attr
(
'disabled'
,
true
)
}
else
{
getBusiScope
()
getCarBrandTree
()
getAccountType
()
findMenuFunTreeByMerId
()
}
getChannel
()
getAccountLevel
()
getPeriod
()
bindEvent
()
}
...
...
@@ -695,15 +734,44 @@
})
}
// 获取商户信息
function
getMerchantInfo
()
{
function
getMerchantApi
(
id
,
fn
)
{
request
({
method
:
'cn.com.glsx.merchants.merchant.findMerchantDetail'
,
id
:
merchantI
d
id
:
i
d
},
function
(
res
)
{
console
.
log
(
res
.
data
)
fn
&&
fn
(
res
)
})
}
// 子商户 - 获取父商户信息
function
getParentInfo
()
{
// console.log(parentMerchantId)
getMerchantApi
(
parentMerchantId
,
function
(
res
)
{
// console.log(res.data)
var
data
=
res
.
data
parentInfo
=
{
parentId
:
data
.
id
,
parentName
:
data
.
merchantName
,
parentAccountTypeName
:
data
.
accountTypeNames
,
parentAccountType
:
data
.
merchantType
,
channelId
:
data
.
channelId
,
effectiveTime
:
data
.
effectiveTime
}
form
.
val
(
'merchantForm'
,
parentInfo
)
if
(
editLevel
==
3
)
{
getMerchantInfo
()
$
(
'#accountLevelEl'
).
attr
(
'disabled'
,
true
)
}
getAccountLevel
()
})
}
// 获取商户信息
function
getMerchantInfo
()
{
getMerchantApi
(
merchantId
,
function
(
res
)
{
form
.
val
(
'merchantForm'
,
res
.
data
)
merchantForm
=
res
.
data
// console.log(merchantForm)
getBusiScope
()
getCarBrandTree
()
getAccountType
()
...
...
@@ -768,6 +836,15 @@
function
getAccountLevel
()
{
getDictData
(
'account_level'
,
function
(
res
)
{
baseData
.
accountLevelList
=
res
.
data
if
(
!
isFactory
)
{
var
tempList
=
[]
$
.
each
(
baseData
.
accountLevelList
,
function
(
index
,
item
)
{
if
(
item
.
dictValue
>
parentInfo
.
parentAccountType
)
{
tempList
.
push
(
baseData
.
accountLevelList
[
index
])
}
})
baseData
.
accountLevelList
=
tempList
}
setSelectOption
(
'#accountLevelEl'
,
'accountLevelList'
,
'dictValue'
,
'dictLabel'
)
})
}
...
...
@@ -1072,22 +1149,25 @@
// end
function
toInt
(
str
)
{
var
arr
=
str
.
split
(
','
)
$
.
each
(
arr
,
function
(
index
,
item
)
{
$
.
each
(
arr
,
function
(
index
,
item
)
{
arr
[
index
]
=
parseInt
(
item
)
})
return
arr
}
// findMenuFunTreeByMerId()
// 查询商户的菜单权限树
function
findMenuFunTreeByMerId
()
{
console
.
log
(
merchantForm
.
merchantAccountLevel
)
var
accountType
=
toInt
(
merchantForm
.
accountType
)
//
console.log(merchantForm.merchantAccountLevel)
//
var accountType = toInt(merchantForm.accountType)
var
params
=
{
// method: 'cn.com.glsx.merchants.merchant.findMenuFunTreeByMerId',
method
:
'org.ore.api.accountType.getProductTreeList'
,
idList
:
accountType
,
// ids: merchantForm.accountType,
ids
:
'1,26'
,
merchantId
:
merchantId
,
accountLevel
:
merchantForm
.
merchantAccountLevel
// accountLevel: merchantForm.merchantAccountLevel
accountLevel
:
1
}
request
(
params
,
function
(
res
)
{
if
(
res
.
code
==
'0'
)
{
...
...
html/merchant/index.html
View file @
0e2b3e1
...
...
@@ -224,18 +224,25 @@
case
'handleEdit'
:
// editLevel - 1-创建新商户;2-创建子商户;3-修改
// step - 1-基本信息;2-权限树
// merchantAccountLevel 账户等级(1-工厂;2-省代;3-市代;4-门店)
go
(
'merchant'
,
'edit'
,
{
editLevel
:
3
,
id
:
row
.
id
,
parentId
:
row
.
parentId
,
isFactory
:
(
row
.
merchantAccountLevel
==
1
),
step
:
1
})
break
case
'handleAuthority'
:
// editLevel - 1-创建新商户;2-创建子商户;3-修改
// step - 1-基本信息;2-权限树
// merchantAccountLevel 账户等级
go
(
'merchant'
,
'edit'
,
{
editLevel
:
3
,
id
:
row
.
id
,
parentId
:
row
.
parentId
,
isFactory
:
(
row
.
merchantAccountLevel
==
1
),
id
:
row
.
id
,
step
:
2
})
break
...
...
@@ -244,7 +251,9 @@
// 1-创建新商户;2-创建子商户;3-修改
go
(
'merchant'
,
'edit'
,
{
editLevel
:
2
,
id
:
row
.
id
parentId
:
row
.
id
,
isFactory
:
'false'
,
step
:
1
})
break
// 创建员工
...
...
@@ -293,7 +302,9 @@
$
(
'#addBtn'
).
on
(
'click'
,
function
()
{
// 1-创建新商户;2-创建子商户;3-修改
go
(
'merchant'
,
'edit'
,
{
editLevel
:
1
editLevel
:
1
,
step
:
1
,
isFactory
:
'true'
})
return
false
})
...
...
js/request.js
View file @
0e2b3e1
...
...
@@ -116,8 +116,8 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) {
secretArr
.
push
(
val
+
params
[
val
])
}
var
str
=
secretArr
.
join
(
''
)
// console.log(str)
return
isMd5
?
md5
(
secret
+
str
+
secret
).
toUpperCase
()
:
SHA1
(
secret
+
str
+
secret
).
toUpperCase
()
// return SHA1(secret + str + secret).toUpperCase()
}
function
msg
(
msg
)
{
...
...
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