Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
FlashMan
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
华国豪
FlashMan
Commits
2dcabb44
Commit
2dcabb44
authored
Jul 17, 2019
by
huangyuanyuan
Browse files
Options
Browse Files
Download
Plain Diff
解决冲突
parents
8b04d869
e1bde05d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
1083 additions
and
77 deletions
+1083
-77
Common.wxss
Common.wxss
+3
-0
app.json
app.json
+2
-0
ChDateNum.wxml
pages/GroupTour/ChDateNum/ChDateNum.wxml
+0
-1
Ticket.js
pages/Ticket/Ticket.js
+17
-1
Ticket.wxml
pages/Ticket/Ticket.wxml
+3
-3
TicketList.js
pages/Ticket/TicketList/TicketList.js
+357
-7
TicketList.json
pages/Ticket/TicketList/TicketList.json
+4
-1
TicketList.wxml
pages/Ticket/TicketList/TicketList.wxml
+256
-2
TicketList.wxss
pages/Ticket/TicketList/TicketList.wxss
+322
-1
Voucher.js
pages/Voucher/Voucher.js
+4
-4
Voucher.wxml
pages/Voucher/Voucher.wxml
+13
-8
visaList.js
pages/visa/visaList/visaList.js
+11
-2
visaList.wxml
pages/visa/visaList/visaList.wxml
+1
-1
project.config.json
project.config.json
+3
-44
util.js
utils/util.js
+87
-2
No files found.
Common.wxss
View file @
2dcabb44
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
color:#000000;
color:#000000;
background: #fff;
background: #fff;
}
}
.commonF .cff{
color: #fff;
}
#searchView{
#searchView{
height: 70rpx;
height: 70rpx;
width: 100%;
width: 100%;
...
...
app.json
View file @
2dcabb44
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
"pages/Voucher/write/write"
,
"pages/Voucher/write/write"
,
"pages/Ticket/Ticket"
,
"pages/Ticket/Ticket"
,
"pages/Ticket/TicketList/TicketList"
,
"pages/Ticket/TicketList/TicketList"
,
"pages/Ticket/TicketDate/TicketDate"
,
"pages/login/smsLogin/smsLogin"
,
"pages/login/smsLogin/smsLogin"
,
"pages/login/revisePwd/revisePwd"
,
"pages/login/revisePwd/revisePwd"
,
"pages/product/SametradeZW/prizelist/prizelist"
,
"pages/product/SametradeZW/prizelist/prizelist"
,
...
@@ -54,6 +55,7 @@
...
@@ -54,6 +55,7 @@
"pages/product/SametradeZW/Applicationnotes/Applicationnotes"
,
"pages/product/SametradeZW/Applicationnotes/Applicationnotes"
,
"pages/product/SametradeZW/Successview/Successview"
,
"pages/product/SametradeZW/Successview/Successview"
,
"component/amount/amount"
,
"component/amount/amount"
,
"component/newCalendar/newCalendar"
,
"pages/activity/activity"
,
"pages/activity/activity"
,
"pages/local/TicketOrder/TicketOrder"
,
"pages/local/TicketOrder/TicketOrder"
,
"pages/local/LocalFoodDetails/LocalFoodDetails"
,
"pages/local/LocalFoodDetails/LocalFoodDetails"
,
...
...
pages/GroupTour/ChDateNum/ChDateNum.wxml
View file @
2dcabb44
...
@@ -7,7 +7,6 @@
...
@@ -7,7 +7,6 @@
<view>{{item.date}}</view>
<view>{{item.date}}</view>
<view wx:if="{{index<1}}" wx:key="index2" wx:for="{{item.datalist}}" wx:for-item="pre">¥{{pre.b2BPrice}}起</view>
<view wx:if="{{index<1}}" wx:key="index2" wx:for="{{item.datalist}}" wx:for-item="pre">¥{{pre.b2BPrice}}起</view>
</view>
</view>
</scroll-view>
</scroll-view>
<!-- 日历 -->
<!-- 日历 -->
<view style="padding-bottom:10rpx">
<view style="padding-bottom:10rpx">
...
...
pages/Ticket/Ticket.js
View file @
2dcabb44
...
@@ -44,11 +44,20 @@ Page({
...
@@ -44,11 +44,20 @@ Page({
cr
:
0
,
cr
:
0
,
child
:
0
,
child
:
0
,
ye
:
0
,
ye
:
0
,
lr
:
0
lr
:
0
,
arrivalName
:
''
,
departureName
:
''
},
},
countryHidden
:
false
,
countryHidden
:
false
,
type
:
''
,
type
:
''
,
},
},
// 搜索进入机票列表
seachTiket
:
function
()
{
let
_this
=
this
;
wx
.
navigateTo
({
url
:
'/pages/Ticket/TicketList/TicketList?date='
+
_this
.
data
.
msg
.
qFlightDateStart
+
"&sName="
+
_this
.
data
.
msg
.
departureName
+
"&sId="
+
_this
.
data
.
msg
.
departure_city
+
"&eName="
+
_this
.
data
.
msg
.
arrivalName
+
"&eId="
+
_this
.
data
.
msg
.
arrival_city
+
"&type="
+
_this
.
data
.
msg
.
ticketType
})
},
bindPickerChange
:
function
(
e
)
{
bindPickerChange
:
function
(
e
)
{
console
.
log
(
'picker发送选择改变,携带值为'
,
e
.
detail
.
value
)
console
.
log
(
'picker发送选择改变,携带值为'
,
e
.
detail
.
value
)
this
.
setData
({
this
.
setData
({
...
@@ -73,9 +82,16 @@ Page({
...
@@ -73,9 +82,16 @@ Page({
type
:
type
type
:
type
})
})
},
},
changeTiketType
:
function
(
e
){
let
type
=
Number
(
e
.
currentTarget
.
dataset
.
type
)
this
.
setData
({
"msg.ticketType"
:
type
})
},
selectCity
(
val
)
{
selectCity
(
val
)
{
let
that
=
this
;
let
that
=
this
;
let
vastr
=
val
.
detail
;
let
vastr
=
val
.
detail
;
console
.
log
(
vastr
)
if
(
that
.
data
.
type
==
"start"
)
{
if
(
that
.
data
.
type
==
"start"
)
{
that
.
data
.
msg
.
departure_city
=
vastr
.
id
;
that
.
data
.
msg
.
departure_city
=
vastr
.
id
;
that
.
data
.
msg
.
departureName
=
vastr
.
name
;
that
.
data
.
msg
.
departureName
=
vastr
.
name
;
...
...
pages/Ticket/Ticket.wxml
View file @
2dcabb44
...
@@ -7,8 +7,8 @@
...
@@ -7,8 +7,8 @@
</view>
</view>
<view class="Choose">
<view class="Choose">
<view class="Title flex">
<view class="Title flex">
<view class="{{msg.ticketType==1?'Active':''}}">单程</view>
<view
data-type='1' bindtap='changeTiketType'
class="{{msg.ticketType==1?'Active':''}}">单程</view>
<view class="{{msg.ticketType==2?'Active':''}}">往返</view>
<view
data-type='2' bindtap='changeTiketType'
class="{{msg.ticketType==2?'Active':''}}">往返</view>
</view>
</view>
<view class="city flexb">
<view class="city flexb">
<view style="width:200rpx" bindtap="getCity" data-type="start">出发:{{msg.departureName}}</view>
<view style="width:200rpx" bindtap="getCity" data-type="start">出发:{{msg.departureName}}</view>
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
</radio-group>
</radio-group>
</view>
</view>
</view>
</view>
<view class="btn">
<view class="btn"
bindtap='seachTiket'
>
搜索
搜索
</view>
</view>
</view>
</view>
...
...
pages/Ticket/TicketList/TicketList.js
View file @
2dcabb44
This diff is collapsed.
Click to expand it.
pages/Ticket/TicketList/TicketList.json
View file @
2dcabb44
{
{
"usingComponents"
:
{}
"usingComponents"
:
{
"newCalendar"
:
"/component/newCalendar/newCalendar"
,
"amount"
:
"/component/amount/amount"
}
}
}
\ No newline at end of file
pages/Ticket/TicketList/TicketList.wxml
View file @
2dcabb44
This diff is collapsed.
Click to expand it.
pages/Ticket/TicketList/TicketList.wxss
View file @
2dcabb44
/* pages/Ticket/TicketList/TicketList.wxss */
\ No newline at end of file
.top-date-box{
padding: 17rpx 0;
background-color: #fff;
display: flex;
}
.top-date-box .date{
float: left;
width: 90%;
display: flex;
}
.date-item.active view{
background:rgba(238,68,84,1);
color: white;
}
.top-date-box .more-date{
float: left;
width: 10%;
text-align: center;
padding-top: 20rpx;
border-left: 2rpx solid #f5f5f5;
}
.top-date-box .date .date-item{
width: 160rpx;
text-align: center;
padding: 14rpx 16rpx;
border-radius: 4rpx;
display: inline-block;
}
.top-date-box .date .date-item .active{
color: #fff;
background-color: #EE4454;
}
.date-img,.arr-img{
height: 30rpx;
}
.date-img image,.btn-item image{
width: 30rpx;
height: 30rpx;
}
.arr-img image{
width: 20rpx;
height: 10rpx;
}
.tips-box{
height: 60rpx;
line-height: 60rpx;
text-align: center;
background-color: #f5f5f5;
}
.content-box{
height:calc(100vh - 322rpx);
background-color: #f5f5f5;
padding: 0 30rpx;
}
.list-item-content{
display: flex;
align-items: center;
}
.list-item{
padding: 30rpx;
background-color: white;
border-radius:12rpx;
position: relative;
margin-bottom: 20rpx;
}
.item-tag{
width:90rpx;
height:28rpx;
background:rgba(250,199,203,1);
border-radius:0px 0px 4rpx 4rpx;
display: inline-block;
text-align: center;
line-height: 28rpx;
position: absolute;
left: 30rpx;
top: 0;
}
.list-item-left{
width: 80%;
}
.list-item-right{
width: 20%;
}
.list-item-left-time{
display: flex;
align-items: center;
}
.list-item-left-time>view{
width: 40%;
}
.list-item-left-time>view:nth-child(2){
width: 20%;
}
.list-item-left-time image{
height: 10rpx;
width: 118rpx;
}
.zhuan{
margin-top: -40rpx;
}
.list-item-right{
text-align: right;
}
.shengyu text{
display: inline-block;
width: 70rpx;
height: 30rpx;
line-height: 30rpx;
background: rgba(255,255,255,1);
border: 1px solid rgba(238, 68, 84, 1);
border-radius: 3rpx;
text-align: center;
}
.name-time{
margin-top: 15rpx;
display: flex;
align-items: center;
}
.name-time image{
width: 24rpx;
height: 24rpx;
margin-right: 10rpx;
}
.name-time view{
margin-right: 30rpx;
}
.margin-lr20{
margin: 0 30rpx;
}
.bottom-btn{
height:100rpx;
border-top: 1px solid #f5f5f5;
display: flex;
align-items: center;
justify-content: space-around;
}
.bottom-btn .btn-item{
text-align: center;
}
.screen-box,.calen-box,.detail-box{
width: 100%;
height: 100%;
position: fixed;
left: 0;
top: 0;
background:rgba(17,17,17, .5);
z-index: 2;
}
.calen-box>view{
background-color: white;
padding: 30rpx 0;
}
.screen-box-top{
padding: 30rpx;
}
.screen-box-content{
height: 90%;
width: 100%;
position: absolute;
bottom: 0;
left: 0;
background-color: white;
border-radius:12rpx 12rpx 0px 0px;
}
.close-img{
width: 30rpx;
height: 30rpx;
position: absolute;
right: 30rpx;
top: 30rpx;
}
.screen-list{
height: 900rpx;
display: flex;
border-top: 1px solid rgba(233,233,233,1);
}
.screen-list .left-type{
width: 20%;
background-color: rgba(246,247,250,1);
}
.screen-list .left-type>view{
border-bottom: 1px solid rgba(233,233,233,1);
border-right: 1px solid rgba(233,233,233,1);
background-color: rgba(246,247,250,1);
}
.screen-list .left-type view.active{
border-right: 0;
background-color: #fff;
}
.screen-list .right-list{
width: 80%;
padding: 0 20rpx;
}
.left-type>view{
height: 87rpx;
text-align: center;
line-height: 87rpx;
}
.airline-list-item{
display: flex;
align-items: center;
height: 87rpx;
line-height: 87rpx;
justify-content: space-between;
border-bottom: 1px solid rgba(233,233,233,1);
}
.raduis{
width:34rpx;
height:34rpx;
border-radius: 50%;
border:1px solid rgba(153, 153, 153, 1);
}
.xuanzhong{
width: 34rpx;
height: 34rpx;
}
.screen-btn{
height: 110rpx;
text-align: right;
padding-right: 30rpx;
}
.screen-btn text{
display: inline-block;
width: 400rpx;
height: 70rpx;
background:rgba(238,68,84,1);
border-radius: 35rpx;
text-align: center;
color: white;
line-height: 70rpx;
margin-top: 10rpx;
}
.calender-ctrl{
text-align: center;
}
.calender-ctrl .btn{
width: 60rpx;
height: 60rpx;
display: inline-block;
line-height: 60rpx;
color: #ffffff;
font-weight: 700;
text-align: center;
background: rgba(210, 210, 210, 1);
border-radius: 50%;
margin: 0 60rpx;
}
.body_footer{
display: flex;
justify-content: center;
align-items: center;
height: 30px;
font-size: 12px;
color: #666666;
background-color:#F5F5F5;
}
.detail-box>view{
height: 870rpx;
position: absolute;
bottom: 0;
width: 100%;
background-color: white;
}
.detail-box-tit{
background-color: #FFE9EB;
height: 30rpx;
line-height: 30rpx;
border-radius:12rpx 12rpx 0 0;
overflow: hidden;
margin-bottom: 30rpx;
}
.detail-box-tit text:nth-child(1) {
width: 30rpx;
text-align: center;
display: inline-block;
background:rgba(250,199,203,1);
margin-right: 20rpx;
}
.detail-box-item{
display: flex;
}
.detail-box-item .detail-box-left{
width: 25%;
border-right: 4rpx solid #E9E9E9;
padding-right: 30rpx;
text-align: right;
}
.detail-box-item .detail-box-left view:nth-child(2){
margin: 10rpx 0 37rpx 0;
}
.detail-box-item .detail-box-right{
flex: 1;
padding-left: 30rpx;
}
.detail-box-item .detail-box-right view.imgs-item{
display: flex;
align-items: center;
}
.detail-box-item .detail-box-right view.imgs-item image{
width: 24rpx;
height: 24rpx;
margin-right: 15rpx;
}
.margin-b10{
margin-bottom: 10rpx;
}
.margin-t10{
margin-top: 10rpx;
}
.detail-box-zhuan{
margin: 28rpx 0 28rpx 138rpx;
}
.detail-box-zhuan text:nth-child(2){
padding: 0 10rpx;
border-right: 1px solid #CCCCCC;
margin-right: 10rpx;
}
.margin-top30{
margin-top: 30rpx;
}
pages/Voucher/Voucher.js
View file @
2dcabb44
...
@@ -10,6 +10,7 @@ Page({
...
@@ -10,6 +10,7 @@ Page({
tcId
:
null
,
tcId
:
null
,
orderId
:
null
,
orderId
:
null
,
dataList
:
[],
dataList
:
[],
tipsMsg
:
""
},
},
goPage
:
function
(
e
)
{
goPage
:
function
(
e
)
{
console
.
log
(
e
)
console
.
log
(
e
)
...
@@ -51,10 +52,9 @@ Page({
...
@@ -51,10 +52,9 @@ Page({
dataList
:
data
dataList
:
data
})
})
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
wx
.
showToast
({
console
.
log
(
err
)
title
:
err
.
message
,
this
.
setData
({
icon
:
'none'
,
tipsMsg
:
err
.
message
duration
:
1000
})
})
})
})
return
return
...
...
pages/Voucher/Voucher.wxml
View file @
2dcabb44
<view class='page-Voucher'>
<view class='page-Voucher commonF'>
<view class='item' wx:for="{{dataList}}" wx:for-index="index" wx:for-item="item" wx:key="index" data-index="{{index}}" bindtap='goPage'>
<view wx:if="{{dataList.length>0}}">
<view>
<view class='item' wx:for="{{dataList}}" wx:for-index="index" wx:for-item="item" wx:key="index" data-index="{{index}}" bindtap='goPage'>
<text class='name'>{{item.SurName + item.Name}}</text>
<view>
<text class='phone'>{{item.MobilePhoneS}}</text>
<text class='name'>{{item.SurName + item.Name}}</text>
</view>
<text class='phone'>{{item.MobilePhoneS}}</text>
<image mode='widthFix' src='../../images/group/chakn.png'></image>
</view>
</view>
<image mode='widthFix' src='../../images/group/chakn.png'></image>
</view>
</view>
<view wx:else class='f26' style='width:80%;margin: 2rem auto'>
{{tipsMsg}}
</view>
<!-- <text class='text'>身份确认</text>
<!-- <text class='text'>身份确认</text>
<input bindinput='TelPhone' placeholder='请输入手机号以确认身份'></input>
<input bindinput='TelPhone' placeholder='请输入手机号以确认身份'></input>
<button class='next {{telPhone !== "" ? "active" : ""}}' type="default" size="mini" bindtap="Details">确认</button> -->
<button class='next {{telPhone !== "" ? "active" : ""}}' type="default" size="mini" bindtap="Details">确认</button> -->
...
...
pages/visa/visaList/visaList.js
View file @
2dcabb44
...
@@ -143,7 +143,7 @@ Page({
...
@@ -143,7 +143,7 @@ Page({
if
(
tagItem
[
i
].
active
)
{
if
(
tagItem
[
i
].
active
)
{
this
.
data
.
listmsg
.
tags
.
push
(
tagItem
[
i
].
id
)
this
.
data
.
listmsg
.
tags
.
push
(
tagItem
[
i
].
id
)
}
}
}
}
this
.
setData
({
this
.
setData
({
listmsg
:
this
.
data
.
listmsg
,
listmsg
:
this
.
data
.
listmsg
,
showBox
:
false
,
showBox
:
false
,
...
@@ -155,8 +155,17 @@ Page({
...
@@ -155,8 +155,17 @@ Page({
data
[
i
].
tagList
=
data
[
i
].
tagTames
.
split
(
","
);
data
[
i
].
tagList
=
data
[
i
].
tagTames
.
split
(
","
);
}
}
}
}
let
arr
=
this
.
data
.
AirticketList
;
let
arr2
=
data
;
if
(
type
)
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
arr
.
push
(
data
[
i
])
}
}
else
{
arr
=
arr2
}
this
.
setData
({
this
.
setData
({
dataList
:
res
.
pageData
,
dataList
:
arr
,
totalPage
:
res
.
pageCount
?
res
.
pageCount
:
1
,
totalPage
:
res
.
pageCount
?
res
.
pageCount
:
1
,
pageIndex
:
res
.
pageIndex
?
res
.
pageIndex
:
1
,
pageIndex
:
res
.
pageIndex
?
res
.
pageIndex
:
1
,
})
})
...
...
pages/visa/visaList/visaList.wxml
View file @
2dcabb44
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<view class='searcj-box'>
<view class='searcj-box'>
<search></search>
<search></search>
</view>
</view>
<scroll-view scroll-x style="height: 180rpx;width: 100%; white-space: nowrap; padding-left: 30rpx;">
<scroll-view scroll-x style="height: 180rpx;width: 100%; white-space: nowrap; padding-left: 30rpx;"
bindscrolltolower="scrollGetMore"
>
<view class='top-scroll-nav'>
<view class='top-scroll-nav'>
<view class='top-scroll-nav-item {{CountryId == item.id ? "active" : "" }}' data-id="{{item.id}}" bindtap='setCountry' wx:for="{{hotcountry}}" wx:for-item="item" wx:for-index="index" wx:key="index">
<view class='top-scroll-nav-item {{CountryId == item.id ? "active" : "" }}' data-id="{{item.id}}" bindtap='setCountry' wx:for="{{hotcountry}}" wx:for-item="item" wx:for-index="index" wx:key="index">
<view class='img-box'>
<view class='img-box'>
...
...
project.config.json
View file @
2dcabb44
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
"list"
:
[]
"list"
:
[]
},
},
"miniprogram"
:
{
"miniprogram"
:
{
"current"
:
2
1
,
"current"
:
1
,
"list"
:
[
"list"
:
[
{
{
"id"
:
2
,
"id"
:
2
,
...
@@ -49,10 +49,10 @@
...
@@ -49,10 +49,10 @@
"scene"
:
null
"scene"
:
null
},
},
{
{
"id"
:
3
,
"id"
:
1
,
"name"
:
"调查"
,
"name"
:
"调查"
,
"pathName"
:
"pages/Voucher/Voucher"
,
"pathName"
:
"pages/Voucher/Voucher"
,
"query"
:
""
,
"query"
:
"
tcid=3922
"
,
"scene"
:
null
"scene"
:
null
},
},
{
{
...
@@ -152,47 +152,6 @@
...
@@ -152,47 +152,6 @@
"pathName"
:
"pages/GroupTour/FillOrder/FillOrder"
,
"pathName"
:
"pages/GroupTour/FillOrder/FillOrder"
,
"query"
:
""
,
"query"
:
""
,
"scene"
:
null
"scene"
:
null
},
{
"id"
:
-1
,
"name"
:
"幸福存折"
,
"pathName"
:
"pages/mine/Happypassbook/Happypassbook"
,
"query"
:
""
,
"scene"
:
null
},
{
"id"
:
-1
,
"name"
:
"首页"
,
"pathName"
:
"pages/Home/home"
,
"query"
:
""
,
"scene"
:
null
},
{
"id"
:
-1
,
"name"
:
"幸福存折明细"
,
"pathName"
:
"pages/mine/UseDetails/UseDetails"
,
"query"
:
""
,
"scene"
:
null
},
{
"id"
:
-1
,
"name"
:
"登录"
,
"pathName"
:
"pages/login/login"
,
"query"
:
""
,
"scene"
:
null
},
{
"id"
:
-1
,
"name"
:
"支付"
,
"pathName"
:
"pages/Pay/Pay"
,
"query"
:
""
,
"scene"
:
null
},
{
"id"
:
-1
,
"name"
:
"定制游"
,
"pathName"
:
"pages/freeTravel/PersonalTailor/PersonalTailor"
,
"scene"
:
null
}
}
]
]
}
}
...
...
utils/util.js
View file @
2dcabb44
...
@@ -8,6 +8,20 @@ const formatTime = date => {
...
@@ -8,6 +8,20 @@ const formatTime = date => {
return
[
year
,
month
,
day
].
map
(
formatNumber
).
join
(
'/'
)
+
' '
+
[
hour
,
minute
,
second
].
map
(
formatNumber
).
join
(
':'
)
return
[
year
,
month
,
day
].
map
(
formatNumber
).
join
(
'/'
)
+
' '
+
[
hour
,
minute
,
second
].
map
(
formatNumber
).
join
(
':'
)
}
}
// 获取7天后是啥时候
const
AddDays
=
(
date
,
days
)
=>
{
var
nd
=
new
Date
(
date
);
nd
=
nd
.
valueOf
();
nd
=
nd
+
days
*
24
*
60
*
60
*
1000
;
nd
=
new
Date
(
nd
);
var
y
=
nd
.
getFullYear
();
var
m
=
nd
.
getMonth
()
+
1
;
var
d
=
nd
.
getDate
();
if
(
m
<=
9
)
m
=
"0"
+
m
;
if
(
d
<=
9
)
d
=
"0"
+
d
;
var
cdate
=
y
+
"-"
+
m
+
"-"
+
d
;
return
cdate
;
}
const
YYMMDD
=
date
=>
{
const
YYMMDD
=
date
=>
{
const
year
=
date
.
getFullYear
()
const
year
=
date
.
getFullYear
()
const
month
=
date
.
getMonth
()
+
1
const
month
=
date
.
getMonth
()
+
1
...
@@ -52,13 +66,84 @@ const getDays = (year, month)=>{
...
@@ -52,13 +66,84 @@ const getDays = (year, month)=>{
month
=
parseInt
(
month
,
10
);
month
=
parseInt
(
month
,
10
);
var
d
=
new
Date
(
year
,
month
,
0
);
var
d
=
new
Date
(
year
,
month
,
0
);
return
d
.
getDate
();
return
d
.
getDate
();
}
// 时间格式化
Date
.
prototype
.
Format
=
function
(
fmt
)
{
var
o
=
{
"M+"
:
this
.
getMonth
()
+
1
,
//月份
"d+"
:
this
.
getDate
(),
//日
"h+"
:
this
.
getHours
(),
//小时
"m+"
:
this
.
getMinutes
(),
//分
"s+"
:
this
.
getSeconds
()
//秒
};
if
(
/
(
y+
)
/
.
test
(
fmt
))
{
//根据y的长度来截取年
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
this
.
getFullYear
()
+
""
).
substr
(
4
-
RegExp
.
$1
.
length
));
}
for
(
var
k
in
o
)
{
if
(
new
RegExp
(
"("
+
k
+
")"
).
test
(
fmt
))
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
RegExp
.
$1
.
length
==
1
)
?
(
o
[
k
])
:
((
"00"
+
o
[
k
]).
substr
((
""
+
o
[
k
]).
length
)));
}
return
fmt
;
}
}
// 上个月
const
getPreMonth
=
(
date
)
=>
{
var
arr
=
date
.
split
(
'-'
);
var
year
=
arr
[
0
];
//获取当前日期的年份
var
month
=
arr
[
1
];
//获取当前日期的月份
var
day
=
arr
[
2
];
//获取当前日期的日
var
days
=
new
Date
(
year
,
month
,
0
);
days
=
days
.
getDate
();
//获取当前日期中月的天数
var
year2
=
year
;
var
month2
=
parseInt
(
month
)
-
1
;
if
(
month2
==
0
)
{
year2
=
parseInt
(
year2
)
-
1
;
month2
=
12
;
}
var
day2
=
day
;
var
days2
=
new
Date
(
year2
,
month2
,
0
);
days2
=
days2
.
getDate
();
if
(
day2
>
days2
)
{
day2
=
days2
;
}
if
(
month2
<
10
)
{
month2
=
'0'
+
month2
;
}
var
t2
=
year2
+
'-'
+
month2
+
'-'
+
day2
;
return
t2
;
}
//下个月
const
getNextMonth
=
(
date
)
=>
{
var
arr
=
date
.
split
(
'-'
);
var
year
=
arr
[
0
];
//获取当前日期的年份
var
month
=
arr
[
1
];
//获取当前日期的月份
var
day
=
arr
[
2
];
//获取当前日期的日
var
days
=
new
Date
(
year
,
month
,
0
);
days
=
days
.
getDate
();
//获取当前日期中的月的天数
var
year2
=
year
;
var
month2
=
parseInt
(
month
)
+
1
;
if
(
month2
==
13
)
{
year2
=
parseInt
(
year2
)
+
1
;
month2
=
1
;
}
var
day2
=
day
;
var
days2
=
new
Date
(
year2
,
month2
,
0
);
days2
=
days2
.
getDate
();
if
(
day2
>
days2
)
{
day2
=
days2
;
}
if
(
month2
<
10
)
{
month2
=
'0'
+
month2
;
}
var
t2
=
year2
+
'-'
+
month2
+
'-'
+
day2
;
return
t2
;
}
module
.
exports
=
{
module
.
exports
=
{
formatTime
:
formatTime
,
formatTime
:
formatTime
,
CompareDate
:
CompareDate
,
CompareDate
:
CompareDate
,
YYMMDD
:
YYMMDD
,
YYMMDD
:
YYMMDD
,
changeMonth
:
changeMonth
,
changeMonth
:
changeMonth
,
YYMM
:
YYMM
,
YYMM
:
YYMM
,
getDays
:
getDays
getDays
:
getDays
,
AddDays
:
AddDays
,
getNextMonth
:
getNextMonth
,
getPreMonth
:
getPreMonth
,
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment