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 f76feb17
authored
Oct 09, 2021
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
新增商户添加有效期
1 parent
edc4451a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
11 deletions
html/merchant/add.html
html/merchant/index.html
js/helper.js
html/merchant/add.html
View file @
f76feb1
...
...
@@ -10,7 +10,7 @@
<link
rel=
"stylesheet"
type=
"text/css"
href=
"/css/main.css"
/>
<style>
.edit-box
{
width
:
1046px
;
/* width: 1046px; */
padding
:
20px
20px
;
color
:
#333333
;
background-color
:
#ffffff
;
...
...
@@ -137,10 +137,10 @@
padding
:
0
20px
;
width
:
100%
;
}
.Wrap
{
/*
.Wrap {
margin: 8px auto 0;
width: 1046px;
}
}
*/
.layui-tab-content
{
position
:
relative
;
}
...
...
@@ -370,6 +370,21 @@
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
账户有效期:
</label>
<div
class=
"layui-inline"
>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
id=
"effectiveStarttime"
class=
"layui-input"
name=
"effectiveStarttime"
placeholder=
"开始时间"
/>
</div>
<div
class=
"layui-form-mid"
>
-
</div>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
id=
"expireDate"
class=
"layui-input"
name=
"expireDate"
placeholder=
"结束时间"
/>
</div>
<button
id=
"sevenday"
type=
"button"
class=
"layui-btn btn-no-border"
>
续7天
</button>
<button
id=
"oneyear"
type=
"button"
class=
"layui-btn btn-no-border"
>
续1年
</button>
<button
id=
"twoyears"
type=
"button"
class=
"layui-btn btn-no-border"
>
续2年
</button>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label required"
>
登录账户名:
</label>
<div
class=
"layui-input-inline"
>
<input
...
...
@@ -533,6 +548,21 @@
lay
(
'#endDate'
).
html
(
value
)
}
})
var
effectiveStarttime
=
laydate
.
render
({
elem
:
'#effectiveStarttime'
,
format
:
'yyyy-MM-dd'
,
min
:
'2021-09-30'
,
done
:
function
(
value
,
date
)
{
console
.
log
(
value
,
date
)
expireDate
.
config
.
min
=
date
lay
(
'#effectiveStarttime'
).
html
(
value
)
}
})
var
expireDate
=
laydate
.
render
({
elem
:
'#expireDate'
,
format
:
'yyyy-MM-dd'
})
editLevel
=
qs
(
'editLevel'
)
isFactory
=
qs
(
'isFactory'
)
==
'true'
...
...
@@ -860,6 +890,30 @@
reader
.
onload
()
})
$
(
'#sevenday'
).
on
(
'click'
,
function
()
{
var
startTime
=
new
Date
(
new
Date
().
setHours
(
0
,
0
,
0
,
0
))
var
endTime
=
startTime
*
1
+
86400
*
7
*
1000
console
.
log
(
helper
.
dateFormat
(
startTime
),
endTime
)
$
(
'#effectiveStarttime'
).
val
(
helper
.
dateFormat
(
startTime
))
$
(
'#expireDate'
).
val
(
helper
.
dateFormat
(
endTime
))
})
$
(
'#oneyear'
).
on
(
'click'
,
function
()
{
var
startTime
=
new
Date
(
new
Date
().
setHours
(
0
,
0
,
0
,
0
))
var
endTime
=
startTime
.
setFullYear
(
startTime
.
getFullYear
()
+
1
)
console
.
log
(
helper
.
dateFormat
(
endTime
))
$
(
'#effectiveStarttime'
).
val
(
helper
.
dateFormat
(
new
Date
(
new
Date
().
setHours
(
0
,
0
,
0
,
0
))))
$
(
'#expireDate'
).
val
(
helper
.
dateFormat
(
endTime
))
})
$
(
'#twoyears'
).
on
(
'click'
,
function
()
{
var
startTime
=
new
Date
(
new
Date
().
setHours
(
0
,
0
,
0
,
0
))
var
endTime
=
startTime
.
setFullYear
(
startTime
.
getFullYear
()
+
2
)
console
.
log
(
helper
.
dateFormat
(
endTime
))
$
(
'#effectiveStarttime'
).
val
(
helper
.
dateFormat
(
new
Date
(
new
Date
().
setHours
(
0
,
0
,
0
,
0
))))
$
(
'#expireDate'
).
val
(
helper
.
dateFormat
(
endTime
))
})
function
baseIsShow
(
isShow
)
{
if
(
isShow
)
{
$
(
'#basicForm'
).
show
()
...
...
html/merchant/index.html
View file @
f76feb1
...
...
@@ -344,13 +344,13 @@
toolbar
:
'#merchantBtns'
,
width
:
220
// fixed: 'right'
},
{
align
:
'left'
,
title
:
'账户开关'
,
toolbar
:
'#vaildPeriod'
,
width
:
150
// fixed: 'right'
//
},
//
{
//
align: 'left',
//
title: '账户开关',
//
toolbar: '#vaildPeriod',
//
width: 150
//
// fixed: 'right'
}
]
...
...
js/helper.js
View file @
f76feb1
...
...
@@ -127,12 +127,35 @@ layui.define(['store'], function (exports) {
return
showNodeList
}
function
dateFormat
(
time
,
fmt
=
'YYYY-mm-dd'
)
{
console
.
log
(
time
,
'============'
)
var
time
=
new
Date
(
time
)
let
ret
;
const
opt
=
{
"Y+"
:
time
.
getFullYear
().
toString
(),
// 年
"m+"
:
(
time
.
getMonth
()
+
1
).
toString
(),
// 月
"d+"
:
time
.
getDate
().
toString
(),
// 日
"H+"
:
time
.
getHours
().
toString
(),
// 时
"M+"
:
time
.
getMinutes
().
toString
(),
// 分
"S+"
:
time
.
getSeconds
().
toString
()
// 秒
// 有其他格式化字符需求可以继续添加,必须转化成字符串
};
for
(
let
k
in
opt
)
{
ret
=
new
RegExp
(
"("
+
k
+
")"
).
exec
(
fmt
);
if
(
ret
)
{
fmt
=
fmt
.
replace
(
ret
[
1
],
(
ret
[
1
].
length
==
1
)
?
(
opt
[
k
])
:
(
opt
[
k
].
padStart
(
ret
[
1
].
length
,
"0"
)))
};
};
return
fmt
;
}
exports
(
'helper'
,
{
clone
:
clone
,
store
:
layui
.
store
,
debounce
:
debounce
,
formateNullFieldData
:
formateNullFieldData
,
defaultChecked
:
defaultChecked
,
findShowNode
:
findShowNode
findShowNode
:
findShowNode
,
dateFormat
:
dateFormat
})
})
\ No newline at end of file
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