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 88c8c815
authored
Aug 06, 2021
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' of 192.168.3.233:h5/account
2 parents
6e89b2bf
9fcf2a44
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
43 deletions
html/merchant/edit.html
html/merchant/index.html
js/request.js
html/merchant/edit.html
View file @
88c8c81
...
...
@@ -353,6 +353,7 @@
helper
.
store
.
set
(
'merchantMapObj'
,
merchantForm
)
form
.
on
(
'submit(handleSubmit)'
,
function
(
data
)
{
console
.
log
(
editLevel
)
// console.log(data.field)
var
formData
=
data
.
field
var
params
=
{
...
...
@@ -413,13 +414,16 @@
merchantForm
.
businessScopeCustomize
=
tempList
.
join
(
','
)
params
.
businessScopeCustomize
=
tempList
.
join
(
','
)
merchantForm
.
merchantBrand
=
treeObj
.
getCheckedNodes
(
true
)
params
.
merchantBrand
=
findId
(
merchantForm
.
merchantBrand
,
[]).
join
(
','
)
params
.
merchantFiles
=
JSON
.
stringify
(
merchantForm
.
merchantFiles
)
params
.
merchantBrand
=
findId
(
merchantForm
.
merchantBrand
).
join
(
','
)
if
(
merchantForm
.
merchantFiles
.
length
)
{
params
.
merchantFiles
=
JSON
.
stringify
(
merchantForm
.
merchantFiles
)
}
if
(
editLevel
==
1
)
{
params
.
method
=
'cn.com.glsx.merchants.merchant.saveMerchant'
}
else
if
(
editLevel
==
2
)
{
params
.
method
=
'cn.com.glsx.merchants.merchant.saveMerchant'
}
else
if
(
editLevel
==
3
)
{
params
.
id
=
id
params
.
method
=
'cn.com.glsx.merchants.merchant.updateMerchant'
}
// 保存状态 1.草稿 2.发布 3.注销 4.过期
...
...
@@ -432,19 +436,18 @@
console
.
log
(
params
)
request
(
params
,
function
(
res
)
{
console
.
log
(
res
)
go
(
'merchant'
,
'index'
)
layer
.
msg
(
'操作成功'
,
{
icon
:
1
})
// go('merchant', 'index')
})
return
false
})
function
findId
(
nodeList
,
idList
)
{
//
var idList = []
function
findId
(
nodeList
)
{
var
idList
=
[]
$
.
each
(
nodeList
,
function
(
index
,
item
)
{
if
(
item
.
children
)
{
findId
(
item
.
children
,
idList
)
}
else
{
idList
.
push
(
item
.
id
)
}
idList
.
push
(
item
.
id
)
})
return
idList
}
...
...
@@ -478,7 +481,7 @@
var
body
=
layer
.
getChildFrame
(
'body'
,
index
)
body
.
find
(
'#mapBtn'
).
click
()
var
res
=
helper
.
store
.
get
(
'merchantMapObj'
)
console
.
log
(
res
)
//
console.log(res)
merchantForm
.
lat
=
res
.
lat
merchantForm
.
lng
=
res
.
lng
merchantForm
.
merchantAddress
=
res
.
merchantAddress
...
...
@@ -584,22 +587,6 @@
getPeriod
()
}
function
setCheckbox
(
checkedStr
,
attr
)
{
if
(
!
checkedStr
||
!
checkedStr
.
length
)
{
return
false
}
var
list
=
[]
if
(
layui
.
_isArray
(
checkedStr
))
{
list
=
checkedStr
}
else
{
list
=
checkedStr
.
split
(
','
)
}
console
.
log
(
list
)
$
.
each
(
list
,
function
(
index
,
item
)
{
$
(
'input[class='
+
attr
+
']'
).
attr
(
"checked"
,
true
)
})
}
// 获取商户信息
function
getMerchantInfo
()
{
request
({
...
...
@@ -612,9 +599,6 @@
getBusiScope
()
getCarBrandTree
()
getAccountType
()
// if (merchantForm.accountTypes.length) {
// setCheckbox(merchantForm.accountTypes, 'accounttypeId')
// }
})
}
...
...
@@ -631,8 +615,22 @@
request
({
method
:
'cn.com.glsx.merchants.merchantCommon.getCarbrandTree'
},
function
(
res
)
{
// console.log(res.data)
baseData
.
carBrandTreeList
=
res
.
data
treeObj
=
tree
.
create
(
'carBrandTree'
,
res
.
data
)
var
checkedList
=
[]
if
(
editLevel
==
3
)
{
checkedList
=
merchantForm
.
merchantBrand
.
split
(
','
)
}
treeObj
=
tree
.
create
(
'carBrandTree'
,
res
.
data
,
{
checkedList
:
checkedList
})
// 修改-回显
// if (editLevel == 3) {
// checkedList = merchantForm.merchantBrand.split(',')
// for (var i = 0; i <= checkedList.length; i++) {
// treeObj.checkNode(treeObj.getNodeByParam("id", checkedList[i]), true)
// }
// }
})
}
...
...
@@ -680,17 +678,26 @@
function
getBusiScope
()
{
getDictData
(
'business_scope'
,
function
(
res
)
{
baseData
.
busiScopeList
=
res
.
data
var
checkedList
=
[]
if
(
editLevel
==
3
)
{
checkedList
=
merchantForm
.
businessScope
.
split
(
','
)
}
var
el
=
$
(
'#busiScopeEl'
)
$
.
each
(
baseData
.
busiScopeList
,
function
(
index
,
item
)
{
var
optionEl
=
$
(
'<input type="checkbox" class="businessScope" name="businessScope['
+
item
.
dictValue
+
']" title='
+
item
.
dictLabel
+
' value="'
+
item
.
dictValue
+
'" lay-skin="primary">'
)
el
.
append
(
optionEl
)
form
.
render
(
'checkbox'
)
// 修改-回显
if
(
editLevel
==
3
&&
merchantForm
.
businessScope
)
{
setCheckbox
(
merchantForm
.
businessScope
,
'businessScope'
)
if
(
editLevel
==
3
)
{
for
(
var
i
=
0
;
i
<=
checkedList
.
length
;
i
++
)
{
if
(
checkedList
[
i
]
==
item
.
dictValue
)
{
optionEl
.
attr
(
"checked"
,
true
)
break
}
}
}
el
.
append
(
optionEl
)
form
.
render
(
'checkbox'
)
})
})
}
...
...
@@ -700,17 +707,26 @@
getDictData
(
'account_type'
,
function
(
res
)
{
// console.log(res.data)
baseData
.
accountTypeList
=
res
.
data
var
checkedList
=
[]
if
(
editLevel
==
3
)
{
checkedList
=
merchantForm
.
accountType
.
split
(
','
)
}
var
el
=
$
(
'#accountTypeEl'
)
$
.
each
(
baseData
.
accountTypeList
,
function
(
index
,
item
)
{
var
optionEl
=
$
(
'<input type="checkbox" class="accounttypeId" name="accountType['
+
item
.
dictValue
+
']" title='
+
item
.
dictLabel
+
' value="'
+
item
.
dictValue
+
'">'
)
el
.
append
(
optionEl
)
form
.
render
(
'checkbox'
)
// 修改-回显
if
(
editLevel
==
3
&&
merchantForm
.
accountTypes
.
length
)
{
setCheckbox
(
merchantForm
.
accountTypes
,
'accounttypeId'
)
if
(
editLevel
==
3
)
{
for
(
var
i
=
0
;
i
<=
checkedList
.
length
;
i
++
)
{
if
(
checkedList
[
i
]
==
item
.
dictValue
)
{
optionEl
.
attr
(
"checked"
,
true
)
break
}
}
}
el
.
append
(
optionEl
)
form
.
render
(
'checkbox'
)
})
})
}
...
...
html/merchant/index.html
View file @
88c8c81
...
...
@@ -92,7 +92,7 @@
</div>
<div
style=
"float: right;"
>
<div
class=
"layui-inline"
>
<input
class=
"layui-input"
placeholder=
"请输入客户名称"
>
<input
class=
"layui-input"
name=
"merchantName"
placeholder=
"请输入客户名称"
>
</div>
<div
class=
"layui-inline"
>
<button
class=
"layui-btn"
lay-submit
lay-filter=
"searchSubmit"
>
查询
</button>
...
...
@@ -335,6 +335,7 @@
item
.
btn
.
createSubMerchant
=
true
}
}
else
{
// 下级商户
console
.
log
(
item
)
item
.
btn
.
edit
=
true
item
.
btn
.
editPeriod
=
true
// 直属门店
...
...
js/request.js
View file @
88c8c81
...
...
@@ -58,6 +58,9 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) {
config
=
config
||
{}
var
common
=
store
.
getEx
(
'external'
)
var
settings
=
helper
.
clone
(
true
,
defaultSettings
)
if
(
isOtherUrl
)
{
delete
settings
.
beforeSend
}
var
data
=
helper
.
clone
(
true
,
{
timestamp
:
new
Date
().
getTime
()
},
common
.
params
,
params
)
...
...
@@ -94,6 +97,8 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) {
}
delete
params
.
sign
var
arr
=
[]
var
secretArr
=
[]
for
(
var
key
in
params
)
{
var
isPush
=
false
$
.
each
(
noSignAttr
,
function
(
index
,
item
)
{
...
...
@@ -102,12 +107,17 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) {
}
})
if
(
!
isPush
)
{
arr
.
push
(
key
+
params
[
key
]
)
arr
.
push
(
key
)
}
}
var
str
=
arr
.
sort
().
join
(
''
)
arr
.
sort
()
for
(
var
key
in
arr
)
{
var
val
=
arr
[
key
]
secretArr
.
push
(
val
+
params
[
val
])
}
var
str
=
secretArr
.
join
(
''
)
return
isMd5
?
md5
(
secret
+
str
+
secret
).
toUpperCase
()
:
SHA1
(
secret
+
str
+
secret
).
toUpperCase
()
return
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