Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
million
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
viitto
million
Commits
ffb9b711
Commit
ffb9b711
authored
Jul 01, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
308e3d4b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
351 additions
and
273 deletions
+351
-273
utils.js
src/boot/utils.js
+162
-75
tripcalendar.vue
src/components/trip/tripcalendar.vue
+189
-198
No files found.
src/boot/utils.js
View file @
ffb9b711
...
...
@@ -3,10 +3,10 @@ import axios from 'axios'
import
md5
from
'js-md5'
//域名管理对象
Vue
.
prototype
.
domainManager
=
function
()
{
Vue
.
prototype
.
domainManager
=
function
()
{
let
domainUrl
=
''
;
domainUrl
=
"http://192.168.2.214:8082"
;
//domainUrl=
"http://192.168.0.110";
domainUrl
=
"http://192.168.0.110"
;
//let locationName = location.hostname;
// if (locationName.indexOf('testerp.oytour') !== -1) {
// domainUrl = "http://testapi.oytour.com";
...
...
@@ -23,7 +23,7 @@ Vue.prototype.domainManager = function() {
}
//HTTP提交数据
Vue
.
prototype
.
apipost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
)
{
Vue
.
prototype
.
apipost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
)
{
if
(
msg
==
null
||
msg
==
""
)
{
msg
=
{}
}
...
...
@@ -59,7 +59,7 @@ Vue.prototype.apipost = function(cmd, msg, successCall, faildCall) {
}
//获取缓存
Vue
.
prototype
.
getLocalStorage
=
function
()
{
Vue
.
prototype
.
getLocalStorage
=
function
()
{
try
{
var
localStorageData
=
window
.
localStorage
[
"b2bUser"
];
if
(
localStorageData
!==
undefined
&&
localStorageData
!=
'undefined'
)
{
...
...
@@ -74,7 +74,7 @@ Vue.prototype.getLocalStorage = function() {
}
//向外跳转
Vue
.
prototype
.
OpenNewUrl
=
function
(
URL
)
{
Vue
.
prototype
.
OpenNewUrl
=
function
(
URL
)
{
if
(
URL
&&
URL
!=
''
)
{
if
(
URL
.
indexOf
(
"https"
)
!=
-
1
)
{
var
str
=
'http://'
+
URL
.
substring
(
8
);
...
...
@@ -89,9 +89,96 @@ Vue.prototype.OpenNewUrl = function(URL) {
}
//公用跳转
Vue
.
prototype
.
CommonJump
=
function
(
path
,
obj
)
{
Vue
.
prototype
.
CommonJump
=
function
(
path
,
obj
)
{
this
.
$router
.
push
({
path
:
path
,
query
:
obj
});
}
Vue
.
prototype
.
createCalendar
=
function
(
dateStr
)
{
var
days
=
[];
var
date
;
if
(
dateStr
)
{
date
=
new
Date
(
dateStr
);
}
else
{
var
now
=
new
Date
();
date
=
new
Date
(
this
.
formatDate
(
now
.
getFullYear
(),
now
.
getMonth
()
+
1
,
1
));
}
var
currentDay
=
date
.
getDate
();
var
currentYear
=
date
.
getFullYear
();
var
currentMonth
=
date
.
getMonth
()
+
1
;
var
currentWeek
=
date
.
getDay
();
// 1...6,0
var
str
=
this
.
formatDate
(
currentYear
,
currentMonth
,
currentDay
);
days
.
length
=
0
;
// 当月第一天是周日,放在第一行第1个位置,前面0个
//初始化第一周
for
(
var
i
=
currentWeek
;
i
>=
0
;
i
--
)
{
var
d
=
new
Date
(
str
);
d
.
setDate
(
d
.
getDate
()
-
i
);
var
dayobject
=
{};
dayobject
.
day
=
d
;
days
.
push
(
dayobject
);
//将日期放入data 中的days数组 供页面渲染使用
}
//其他周
var
temp
=
35
;
if
(
currentWeek
+
new
Date
(
currentYear
,
currentMonth
,
0
).
getDate
()
>
35
)
{
temp
=
41
;
}
for
(
var
i
=
1
;
i
<
temp
-
currentWeek
;
i
++
)
{
var
d
=
new
Date
(
str
);
d
.
setDate
(
d
.
getDate
()
+
i
);
var
dayobject
=
{};
dayobject
.
day
=
d
;
days
.
push
(
dayobject
);
}
return
{
DayArray
:
days
,
CurrentDay
:
currentDay
,
CurrentMonth
:
currentMonth
,
CurrentYear
:
currentYear
,
CurrentWeek
:
currentWeek
};
}
//格式化日期
Vue
.
prototype
.
formatDate
=
function
(
year
,
month
,
day
)
{
var
y
=
year
;
var
m
=
month
;
if
(
m
<
10
)
m
=
"0"
+
m
;
var
d
=
day
;
if
(
d
<
10
)
d
=
"0"
+
d
;
return
y
+
"-"
+
m
+
"-"
+
d
;
}
//格式化日期二
Vue
.
prototype
.
formatDate2
=
function
(
dateStr
)
{
var
date
=
new
Date
(
dateStr
);
return
{
CYear
:
date
.
getFullYear
(),
CMonth
:(
date
.
getMonth
()
+
1
),
CDay
:
date
.
getDate
(),
}
}
//添加月份
Vue
.
prototype
.
AddMonth
=
function
(
dateStr
,
month
)
{
var
v
=
new
Date
(
dateStr
);
if
(
v
)
{
var
t
=
new
Date
(
v
.
getFullYear
(),
v
.
getMonth
(),
v
.
getDate
(),
v
.
getHours
(),
v
.
getMinutes
(),
v
.
getSeconds
(),
v
.
getMilliseconds
());
t
.
setMonth
(
v
.
getMonth
()
+
month
);
if
(
t
.
getDate
()
!=
v
.
getDate
())
{
t
.
setDate
(
0
);
}
return
t
;
}
}
\ No newline at end of file
src/components/trip/tripcalendar.vue
View file @
ffb9b711
...
...
@@ -63,118 +63,139 @@
margin
:
10px
0
;
color
:
#ff4646
;
}
.Tripcan_info
{
width
:
100%
;
.Tripcan_info
{
width
:
100%
;
min-width
:
300px
;
height
:
100%
;
border
:
1px
solid
#d1d1d1
;
margin-top
:
25px
;
background-color
:
#fff
;
}
.trafficInfo
{
float
:
left
;
width
:
60%
;
min-height
:
190px
;
border-right
:
1px
solid
#d1d1d1
;
}
.trafficTitle
{
margin
:
20px
;
}
.trafficFlight
{
padding
:
20px
}
.trafficList
{
display
:
inline-block
;
width
:
30%
;
text-align
:
center
;
height
:
100%
;
border
:
1px
solid
#d1d1d1
;
margin-top
:
25px
;
background-color
:
#fff
;
}
.trafficInfo
{
float
:
left
;
width
:
60%
;
min-height
:
190px
;
border-right
:
1px
solid
#d1d1d1
;
}
.trafficTitle
{
margin
:
20px
;
}
.trafficFlight
{
padding
:
20px
}
.trafficList
{
display
:
inline-block
;
width
:
30%
;
text-align
:
center
;
vertical-align
:
middle
;
}
.trafficTime
{
display
:
flex
;
width
:
100px
;
margin
:
auto
;
font-weight
:
bold
;
.trafficTime
{
display
:
flex
;
width
:
100px
;
margin
:
auto
;
font-weight
:
bold
;
justify-content
:
space-between
;
}
.TripStartInfo
{
float
:
left
;
width
:
40%
;
padding
:
20px
;
color
:
#9a9696
;
.TripStartInfo
{
float
:
left
;
width
:
40%
;
padding
:
20px
;
color
:
#9a9696
;
}
.tripRightspan
{
color
:
black
;
.tripRightspan
{
color
:
black
;
}
.TripCanbao
{
display
:
flex
;
margin-top
:
10px
;
.TripCanbao
{
display
:
flex
;
margin-top
:
10px
;
align-items
:
center
;
justify-content
:
space-between
;
}
.TripCanbao
>
div
:last-child
{
color
:
orange
;
font-size
:
28px
;
.TripCanbao
>
div
:last-child
{
color
:
orange
;
font-size
:
28px
;
font-weight
:
bold
;
}
.TripQi
{
font-size
:
14px
;
.TripQi
{
font-size
:
14px
;
font-weight
:
normal
;
margin-left
:
10px
;
margin-left
:
10px
;
}
.Tripcan_info
:after
{
clear
:
both
;
content
:
'.'
;
display
:
block
;
height
:
0
;
overflow
:
hidden
;
}
.monthDayList
::after
{
}
.monthDayList
::after
{
clear
:
both
;
content
:
'.'
;
display
:
block
;
height
:
0
;
overflow
:
hidden
;
}
.monthDayList
{
}
.monthDayList
{
background-color
:
#fff
;
}
.trip_BtnDiv
{
margin-top
:
20px
;
}
.traffic_Line
{
position
:
relative
;
width
:
70px
;
height
:
1px
;
margin
:
10px
auto
;
}
.trip_BtnDiv
{
margin-top
:
20px
;
}
.traffic_Line
{
position
:
relative
;
width
:
70px
;
height
:
1px
;
margin
:
10px
auto
;
background-color
:
#d1d1d1
;
}
.traffic_Line
>
div
:first-child
{
width
:
7px
;
height
:
7px
;
}
.traffic_Line
>
div
:first-child
{
width
:
7px
;
height
:
7px
;
border-radius
:
50%
;
background-color
:
#d1d1d1
;
position
:
absolute
;
left
:
-3px
;
top
:
-3px
;
}
.traffic_Line
>
div
:last-child
{
width
:
7px
;
height
:
7px
;
left
:
-3px
;
top
:
-3px
;
}
.traffic_Line
>
div
:last-child
{
width
:
7px
;
height
:
7px
;
border-radius
:
50%
;
background-color
:
#d1d1d1
;
position
:
absolute
;
right
:
-3px
;
top
:
-3px
;
}
@media
only
screen
and
(
max-width
:
1200px
){
right
:
-3px
;
top
:
-3px
;
}
@media
only
screen
and
(
max-width
:
1200px
)
{
.trafficInfo
{
width
:
100%
;
border-right
:
0
;
width
:
100%
;
border-right
:
0
;
}
.TripStartInfo
{
width
:
100%
;
}
.TripStartInfo
{
width
:
100%
;
}
}
</
style
>
<
template
>
<div
class=
"q-mt-lg q-mb-lg"
>
...
...
@@ -186,10 +207,20 @@
</thead>
</table>
<div
class=
"monthDayList"
>
<div
v-for=
"(item,index) in daysData"
class=
"dayList"
:key=
"index"
@
click=
"item.price?selectDate(index):''"
:class=
"
{selectDay:isSelect == index,noPrice:!item.price,yesPrice:item.price}">
<p>
{{
item
.
day
}}
</p>
<p
v-if=
"item.price"
class=
"price"
>
¥
{{
item
.
price
}}
起
</p>
<div
class=
"hotelProductManage2_calendarItem"
v-for=
"(item, index) in monthList"
:key=
"index"
>
<div
class=
"calendarItem_month"
>
{{
item
.
monthStr
}}
</div>
<div
class=
"calendarItem_week"
>
<div
v-for=
"(i,index) in week"
:key=
"index"
>
{{
i
}}
</div>
</div>
<div
class=
"calendarItem_day"
>
<div
v-for=
"(subItem, index2) in item.dayArray"
:key=
"index2"
:class=
"subItem.daymonth===item.month? 'nowMonth':'otherMonth'"
>
<div>
{{
subItem
.
day
}}
</div>
</div>
</div>
</div>
</div>
<div
class=
"Tripcan_info"
>
...
...
@@ -228,8 +259,8 @@
</div>
</div>
<div
class=
"trip_BtnDiv"
>
<q-btn
style=
"width:48%"
type=
"a"
label=
"专人需求单"
color=
"secondary"
/>
<q-btn
style=
"width:48%;margin-left:10px;"
type=
"a"
label=
"立即预定"
color=
"primary"
/>
<q-btn
style=
"width:48%"
type=
"a"
label=
"专人需求单"
color=
"secondary"
/>
<q-btn
style=
"width:48%;margin-left:10px;"
type=
"a"
label=
"立即预定"
color=
"primary"
/>
</div>
</div>
</div>
...
...
@@ -238,7 +269,6 @@
</div>
</
template
>
<
script
>
// import bus from '../../plugins/event-bus'
export
default
{
props
:
{
dateData
:
Array
,
...
...
@@ -247,120 +277,81 @@
data
()
{
return
{
week
:
[
'日'
,
'一'
,
'二'
,
'三'
,
'四'
,
'五'
,
'六'
],
monthList
:
[],
//月份数据
priceData
:
this
.
dateData
,
currentDay
:
this
.
day
,
DaysInMonth
:
[],
daysData
:
[],
//daysData: [],
isSelect
:
-
1
,
mydate
:
-
1
,
}
},
mounted
()
{
console
.
log
(
this
.
dateData
,
'dateDate'
);
console
.
log
(
this
.
day
,
'daydaydaydayday'
);
this
.
getMonthsData
()
//console.log(this.dateData, 'dateDate');
//console.log(this.day, 'daydaydaydayday');
},
created
()
{
this
.
getYearMonthDay
()
// bus.$on('order-chosen_calendar', this.orderChosen)
//this.getMonthsData()
},
methods
:
{
orderChosen
:
function
(
date
)
{
let
day
=
parseInt
(
date
.
split
(
'-'
)[
2
]).
toString
()
this
.
daysData
.
forEach
((
x
,
index
)
=>
{
if
(
x
.
day
===
day
)
{
this
.
isSelect
=
index
;
this
.
$emit
(
'ChildrenSelect'
,
date
)
}
});
// this.$emit('ChildrenSelect', clickDate)
// let day = parseInt(date.split('-')[2]).toString()
// this.daysData.forEach((x, index) => {
// if (x.day === day) {
// this.isSelect = index;
// this.$emit('ChildrenSelect', date)
// }
// });
},
selectDate
(
index
)
{
if
(
this
.
$data
.
daysData
[
index
].
day
==
0
)
{
// bus.$emit('chosen-tripdate', null)
return
;
}
if
(
this
.
isSelect
==
index
)
{
this
.
isSelect
=
-
1
;
// bus.$emit('chosen-tripdate', null)
return
;
}
this
.
isSelect
=
index
;
let
currentDay
=
this
.
currentDay
.
split
(
'-'
)
let
clickDay
=
parseInt
(
this
.
$data
.
daysData
[
index
].
day
)
clickDay
=
clickDay
<
10
?
(
'0'
+
clickDay
)
:
clickDay
let
clickDate
=
currentDay
[
0
]
+
'-'
+
currentDay
[
1
]
+
'-'
+
clickDay
this
.
$emit
(
'ChildrenSelect'
,
clickDate
)
},
getYearMonthDay
()
{
let
currentYear
=
this
.
currentDay
.
substring
(
0
,
4
);
//当前年份
let
currentMonth
=
this
.
currentDay
.
substring
(
5
,
7
);
//当前月份
let
date
=
new
Date
();
let
strDate
=
date
.
getDate
();
let
strMonth
=
(
date
.
getMonth
()
+
1
).
toString
();
// alert(typeof strMonth)
//判断是否是闰年
if
(
this
.
isleapYears
(
currentYear
))
{
this
.
$data
.
DaysInMonth
=
[
31
,
29
,
31
,
30
,
31
,
30
,
31
,
31
,
30
,
31
,
30
,
31
];
}
else
{
this
.
$data
.
DaysInMonth
=
[
31
,
28
,
31
,
30
,
31
,
30
,
31
,
31
,
30
,
31
,
30
,
31
];
}
let
monthDay
=
this
.
$data
.
DaysInMonth
[
Number
(
currentMonth
)
-
1
];
//当前月的天数
let
daysData
=
[];
//给数据源赋值
for
(
var
i
=
0
;
i
<
Number
(
monthDay
);
i
++
)
{
var
priceDict
=
{
'day'
:
String
(
i
+
1
),
'price'
:
0
,
'dis'
:
false
};
daysData
.
push
(
priceDict
);
}
this
.
daysData
=
daysData
;
var
currentDay
=
`
${
currentYear
}
-
${
currentMonth
}
-01`
;
var
dateObject
=
new
Date
(
currentDay
);
var
firstDay
=
dateObject
.
getDay
();
//得到每个月1号是周几
for
(
var
i
in
this
.
priceData
)
{
var
price
=
this
.
priceData
[
i
];
var
dayIndex
=
price
.
startDate
.
substring
(
price
.
startDate
.
length
-
2
,
price
.
startDate
.
length
);
var
dqmonth
=
price
.
startDate
.
split
(
'-'
)[
1
];
console
.
log
(
dqmonth
,
'dqmonthdqmonthdqmonthdqmonthdqmonth'
);
console
.
log
(
dayIndex
,
'dayIndexxxxx'
);
var
dayDict
=
daysData
[
Number
(
dayIndex
)
-
1
];
dayDict
.
price
=
price
.
b2BPrice
;
console
.
log
(
strDate
,
'strDate'
);
console
.
log
(
currentMonth
,
'currentMonth'
);
console
.
log
(
strMonth
,
'strMonth'
);
// if (dayIndex
<
strDate
&&
strMonth
==
currentMonth
)
{
// dayDict.price = '';
// if (this.$data.daysData[index].day == 0) {
// return;
// }
if
(
dqmonth
!=
currentMonth
)
{
dayDict
.
price
=
''
;
}
// if (this.isSelect == index) {
// this.isSelect = -1;
// return;
// }
// this.isSelect = index;
}
if
(
firstDay
>
0
)
{
var
firstDayData
=
[];
for
(
var
i
=
0
;
i
<
firstDay
;
i
++
)
{
var
dict
=
{
'day'
:
' '
,
price
:
''
,
'dis'
:
true
// let currentDay = this.currentDay.split('-')
// let clickDay = parseInt(this.$data.daysData[index].day)
// clickDay = clickDay
<
10
?
(
'0'
+
clickDay
)
:
clickDay
// let clickDate = currentDay[0] + '-' + currentDay[1] + '-' + clickDay
// this.$emit('ChildrenSelect', clickDate)
},
//生成月份和每一天
getCalendarMonth
(
qDate
,
key
)
{
let
tempMonthData
=
this
.
createCalendar
(
qDate
);
let
tempMonth
=
tempMonthData
.
DayArray
;
let
days
=
[];
for
(
let
i
=
0
;
i
<
tempMonth
.
length
;
i
++
)
{
var
tempDay
=
new
Date
(
tempMonth
[
i
].
day
);
var
newDayStr
=
this
.
formatDate
(
tempDay
.
getFullYear
(),
(
tempDay
.
getMonth
()
+
1
),
tempDay
.
getDate
());
days
.
push
({
date
:
tempMonth
[
i
].
day
,
daymonth
:
(
tempDay
.
getMonth
()
+
1
),
dayStr
:
newDayStr
,
day
:
tempDay
.
getDate
()
});
};
firstDayData
.
push
(
dict
);
}
this
.
daysData
=
firstDayData
.
concat
(
daysData
);
}
else
{
this
.
daysData
=
daysData
;
}
console
.
log
(
this
.
daysData
,
'daysdataaaaaasadasd'
);
this
.
monthList
.
push
({
monthStr
:
tempMonthData
.
CurrentYear
+
"-"
+
tempMonthData
.
CurrentMonth
,
month
:
tempMonthData
.
CurrentMonth
,
dayArray
:
days
,
});
console
.
log
(
"this.monthList"
,
this
.
monthList
);
},
isleapYears
(
year
)
{
if
(((
year
%
4
)
==
0
)
&&
((
year
%
100
)
!=
0
)
||
((
year
%
400
)
==
0
))
{
return
true
;
}
else
{
return
false
;
//获取月份
getMonthsData
:
function
()
{
var
currentDate
=
this
.
formatDate2
(
new
Date
());
let
month
=
currentDate
.
CYear
+
"-"
+
currentDate
.
CMonth
+
'-1'
for
(
let
i
=
0
;
i
<
2
;
i
++
)
{
if
(
i
!=
0
)
{
let
newDate
=
this
.
formatDate2
(
this
.
AddMonth
(
month
,
1
));
month
=
newDate
.
CYear
+
"-"
+
newDate
.
CMonth
+
'-1'
;
}
this
.
getCalendarMonth
(
month
,
i
);
}
},
}
...
...
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