Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_wechat
Overview
Overview
Details
Activity
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
pseer
gxpt_wechat
Commits
60755f0c
Commit
60755f0c
authored
Mar 06, 2024
by
zhangzhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
细节优化
parent
ae7d46f5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
459 additions
and
400 deletions
+459
-400
index.vue
pages/couponList/index.vue
+2
-1
order.vue
pages/order/order.vue
+431
-393
index.vue
pages/useCoupon/index.vue
+26
-6
No files found.
pages/couponList/index.vue
View file @
60755f0c
...
...
@@ -66,10 +66,11 @@
<
script
>
import
{
dictList
}
from
"@/api/index.js"
;
import
{
getDictItem
}
from
"@/utils/tools.js"
import
indexConfig
from
"@/config/index.config"
;
import
FixedHeader
from
"@/components/fixedHeader/index"
;
import
{
getCouponList
}
from
"@/api/coupon"
import
{
getDictItem
}
from
"@/utils/tools.js"
export
default
{
data
()
{
...
...
pages/order/order.vue
View file @
60755f0c
...
...
@@ -7,29 +7,29 @@
<view
class=
"part-right"
>
<text
class=
"text-title text-xl text-bold"
>
{{
roomInfo
.
name
||
'凑角'
}}{{
roomInfo
.
roomType
?
'【'
+
roomTypeEnum
[
roomInfo
.
roomType
]
+
'】'
:
''
}}
</text>
<view
v-if=
"roomInfo.roomStat >= 3"
class=
"status-icon-box"
>
<view
class=
"status-box"
:class=
"'status-box-1'"
>
<text>
维护中
</text>
</view>
<image
class=
"img"
:src=
"assetsPath+'/fa_icon_1.png'"
mode=
"widthFix"
></image>
</view>
<view
v-else-if=
"roomInfo.isDirtyRoom >=1"
class=
"status-icon-box"
>
<view
class=
"status-box"
:class=
"'status-box-1'"
>
<text>
未保洁
</text>
</view>
<image
class=
"img"
:src=
"assetsPath+'/fa_icon_1.png'"
mode=
"widthFix"
></image>
</view>
<view
v-else
class=
"status-icon-box"
>
<view
class=
"status-box"
:class=
"'status-box-'+roomInfo.status"
>
<text>
{{
roomStatusEnum
[
roomInfo
.
status
]
}}
</text>
</view>
<image
class=
"img"
:src=
"assetsPath+'/fa_icon_'+roomInfo.status+'.png'"
mode=
"widthFix"
></image>
</view>
</view>
<view
class=
"part-left"
>
<image
:src=
"roomInfo.images.length?roomInfo.images[0]: assetsPath+'/banner.jpg'"
mode=
"widthFix"
>
...
...
@@ -41,9 +41,9 @@
@tap="onTypeChange(i)">
<text
class=
"text-gray text-xl text-bold"
>
{{
item
.
label
}}
</text>
<view
v-if=
"item.type == 2"
class=
"hot-icon"
>
<view
class=
"img-icon"
>
<image
src=
"../../static/hot_icon.png"
mode=
"widthFix"
></image>
</view>
<view
class=
"img-icon"
>
<image
src=
"../../static/hot_icon.png"
mode=
"widthFix"
></image>
</view>
</view>
</view>
</view>
...
...
@@ -59,7 +59,8 @@
</view>
<view
v-for=
"(item,k) in dateList"
:key=
"k"
class=
"flex-1 flex-col date-item"
:class=
"
{active:dateIndex === k}" @tap="onDateChange(k)">
<text
class=
"text-title text-bold text-first "
>
{{
k
===
0
&&
item
.
readDate
===
toDayDate
?
'今天'
:
item
.
weekday
}}
</text>
<text
class=
"text-title text-bold text-first "
>
{{
k
===
0
&&
item
.
readDate
===
toDayDate
?
'今天'
:
item
.
weekday
}}
</text>
<text
class=
"text-title text-bold"
style=
"margin-top: 12upx;"
>
{{
item
.
date
}}
</text>
</view>
</view>
...
...
@@ -69,22 +70,21 @@
<view
v-show=
"index==1"
class=
"flex-col package-mode"
>
<view
class=
"part-1"
>
<text
class=
"text-title text-lg text-bold"
>
套餐选择:
</text>
</view>
<scroll-view
scroll-x=
"true"
class=
"scroll-view"
>
</view>
<scroll-view
scroll-x=
"true"
class=
"scroll-view"
>
<view
class=
"flex-row package-box"
>
<view
v-for=
"(item,index) in packageMode"
:key=
"index"
class=
"flex-col item"
:class=
"
{active: modeIndex===index}"
@tap="onChangeMode(index)">
:class=
"
{active: modeIndex===index}" @tap="onChangeMode(index)">
<text
class=
"text-title"
>
{{
item
.
name
}}
</text>
<view
class=
"flex-row"
style=
"margin-top: 8upx;"
>
<!--
<text>
{{
item
.
duration
}}
小时/
</text>
-->
<text
style=
"margin-bottom: 2upx;"
>
¥
</text>
<!--
<text>
{{
item
.
duration
}}
小时/
</text>
-->
<text
style=
"margin-bottom: 2upx;"
>
¥
</text>
<text
class=
"text-bold text-xl"
>
{{
item
.
price
}}
</text>
</view>
</view>
</view>
</scroll-view>
<view
v-if=
"packageMode[modeIndex].remark"
class=
"flex-col tip-box"
>
<view
v-if=
"packageMode[modeIndex].remark"
class=
"flex-col tip-box"
>
<text
class=
""
style=
"margin-bottom: 12upx;"
>
套餐说明:
</text>
<text
class=
"text-sm"
>
{{
packageMode
[
modeIndex
].
remark
}}
</text>
</view>
...
...
@@ -105,7 +105,8 @@
</view>
</view>
<view
v-if=
"orderType ===2 && index == 0"
class=
"flex-col distance-mode"
style=
"margin: 40upx 20upx 40upx;"
>
<view
v-if=
"orderType ===2 && index == 0"
class=
"flex-col distance-mode"
style=
"margin: 40upx 20upx 40upx;"
>
<view
class=
"distance-title"
>
<text
class=
"text-title text-lg text-bold"
>
时长选择:
</text>
</view>
...
...
@@ -171,8 +172,7 @@
</view>
<view
class=
"date-point-box"
>
<view
v-for=
"(item,k) in intervalList"
:key=
"k"
class=
"date-point-item"
v-if=
"k>=startHours && k
<
=
endHours
"
@
tap=
"onSelectDatePoint(item,k)"
>
v-if=
"k>=startHours && k
<
=
endHours
"
@
tap=
"onSelectDatePoint(item,k)"
>
<view
class=
"date-point"
:class=
"item.status === 0 || (item.status==1 && item.m
<59
)
?'
free
'
:item
.
status=
=1
&&
item
.
m
>
=59?'used': item.status==2?'checked':'error'">
</view>
...
...
@@ -203,7 +203,8 @@
</view>
</view>
<view
class=
"flex-between price use-coupon-box"
>
<text
class=
"text-black text-left"
>
{{
useCouponList
[
selectCouponIndex
].
couponType
==
2
?
'团购券'
:
'优惠券'
}}
</text>
<text
class=
"text-black text-left"
>
{{
useCouponList
[
selectCouponIndex
].
couponType
==
2
?
'团购券'
:
'优惠券'
}}
</text>
<view
class=
"flex-row"
@
tap=
"onNavToSelectCoupon"
>
<text
class=
""
:class=
"useCouponList.length?'text-pink':'text-gray'"
>
{{
useCouponList
.
length
&&
selectCouponIndex
>=
0
?
useCouponList
[
selectCouponIndex
].
name
:
couponList
.
length
?
'请选择'
:
'暂无可用'
}}
</text>
...
...
@@ -228,8 +229,7 @@
</view>
</view>
<view
class=
"btn-box"
>
<button
class=
"cu-btn cu-btn-1 margin-right"
@
tap=
"onNavToCheckedCoupon"
>
团购验券
</button>
<button
class=
"cu-btn cu-btn-1 margin-right"
@
tap=
"onNavToCheckedCoupon"
>
团购验券
</button>
<button
class=
"cu-btn cu-btn-2 "
@
tap=
"onOrderConfirmBefore"
>
{{
orderType
===
1
?
'预约'
:
'续单'
}}
</button>
</view>
</view>
...
...
@@ -241,8 +241,8 @@
<view
class=
"action text-pink"
@
tap=
"onSelectedDate"
>
确定
</view>
</view>
<view
class=
"select-box"
>
<picker-view
class=
"picker-view"
indicator-style=
"height: 42px;"
:immediate-change=
"true"
v-model=
"checkedDateList"
@
change=
"onBindChange"
>
<picker-view
class=
"picker-view"
indicator-style=
"height: 42px;"
:immediate-change=
"true"
v-model=
"checkedDateList"
@
change=
"onBindChange"
>
<picker-view-column>
<view
class=
"item"
v-for=
"(item,index) in hourList"
:key=
"index"
>
<text>
{{
item
}}
</text>
...
...
@@ -265,8 +265,8 @@
<view
class=
"action text-pink"
@
tap=
"onSelectedDuration"
>
确定
</view>
</view>
<view
class=
"select-box"
>
<picker-view
class=
"picker-view"
indicator-style=
"height: 42px;"
:immediate-change=
"true"
v-model=
"durationIndex2"
@
change=
"onBindDuratin"
>
<picker-view
class=
"picker-view"
indicator-style=
"height: 42px;"
:immediate-change=
"true"
v-model=
"durationIndex2"
@
change=
"onBindDuratin"
>
<picker-view-column>
<view
class=
"item"
v-for=
"(item,index) in hourList2"
:key=
"index"
>
<text>
{{
item
}}
小时
</text>
...
...
@@ -323,19 +323,12 @@
</view>
</uni-popup>
<LoginPop
ref=
"loginPop"
@
success=
'onLoading'
/>
<uni-popup
ref=
"popupConfirm"
type=
"dialog"
>
<uni-popup-dialog
type=
"warn"
mode=
"base"
:content=
"content"
:duration=
"2000"
:before-close=
"true"
@
close=
"close"
@
confirm=
"confirm"
></uni-popup-dialog>
<uni-popup-dialog
type=
"warn"
mode=
"base"
:content=
"content"
:duration=
"2000"
:before-close=
"true"
@
close=
"close"
@
confirm=
"confirm"
></uni-popup-dialog>
</uni-popup>
<uni-popup
ref=
"popupMessage"
type=
"center"
>
<view
class=
"flex-col message-box"
>
<view
class=
"header"
>
...
...
@@ -351,7 +344,7 @@
</view>
</view>
</uni-popup>
</view>
</
template
>
...
...
@@ -386,7 +379,7 @@
data
()
{
return
{
id
:
''
,
orderType
:
1
,
//订单模式,1:下单;2续单
orderType
:
1
,
//订单模式,1:下单;2续单
payWay
:
1
,
hostUrl
:
config
.
hostUrl
,
assetsPath
:
config
.
assetsPath
,
...
...
@@ -396,7 +389,7 @@
startTime
:
moment
().
format
(
"HH:mm"
),
endTime
:
'12:00'
,
dateIndex
:
0
,
dateList
:[
dateList
:
[
// {
// date:"02-28",
// readDate:'2024-02-28',
...
...
@@ -459,8 +452,8 @@
"16"
,
"17"
,
"18"
,
"19"
,
"20"
,
"21"
,
"22"
,
"23"
],
durationIndex2
:[
0
],
hourList2
:
[
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
21
,
22
,
23
,
24
],
durationIndex2
:
[
0
],
hourList2
:
[
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
21
,
22
,
23
,
24
],
minuteList
:
[
'00'
,
"30"
],
orderTypeEnum
:
{
1
:
"预定"
,
...
...
@@ -482,38 +475,38 @@
roomStatusEnum
:
{},
roomTypeEnum
:
{},
setStartTime
:
{
status
:
false
,
startTime
:
''
,
startDate
:
''
,
duration
:
0
,
days
:
1
status
:
false
,
startTime
:
''
,
startDate
:
''
,
duration
:
0
,
days
:
1
},
days
:
1
,
addM
:
false
,
//初始化加一分钟,之后不加
startHours
:
0
,
endHours
:
48
,
content
:
''
,
days
:
1
,
addM
:
false
,
//初始化加一分钟,之后不加
startHours
:
0
,
endHours
:
48
,
content
:
''
,
toDayDate
:
''
,
// 今天日期
};
},
filters
:{
resetStartTime
(
val
){
let
hour
=
val
.
split
(
':'
).
map
((
n
,
k
)
=>
{
filters
:
{
resetStartTime
(
val
)
{
let
hour
=
val
.
split
(
':'
).
map
((
n
,
k
)
=>
{
let
t
=
Number
(
n
)
if
(
k
==
0
)
{
if
(
n
>=
24
)
{
t
=
n
>=
24
?
n
-
24
:
n
if
(
k
==
0
)
{
if
(
n
>=
24
)
{
t
=
n
>=
24
?
n
-
24
:
n
}
}
return
t
>=
10
?
t
:
`0
${
t
}
`
return
t
>=
10
?
t
:
`0
${
t
}
`
}).
join
(
":"
)
return
hour
;
}
},
watch
:{
dateIndex
(){
this
.
onSetSelectTime
()
watch
:
{
dateIndex
()
{
this
.
onSetSelectTime
()
this
.
onSetStartHours
()
}
},
...
...
@@ -539,41 +532,45 @@
}
},
methods
:
{
onInitDateList
(){
onInitDateList
()
{
this
.
toDayDate
=
moment
().
format
(
"YYYY-MM-DD"
)
let
dateList
=
[];
for
(
let
i
=
0
;
i
<
5
;
i
++
)
{
let
obj
=
{
date
:
this
.
dateList
.
length
?
moment
(
this
.
dateList
[
1
].
readDate
).
add
(
i
,
"days"
).
format
(
"MM-DD"
):
moment
().
add
(
i
,
"days"
).
format
(
"MM-DD"
),
readDate
:
this
.
dateList
.
length
?
moment
(
this
.
dateList
[
1
].
readDate
).
add
(
i
,
"days"
).
format
(
"YYYY-MM-DD"
)
:
moment
().
add
(
i
,
"days"
).
format
(
"YYYY-MM-DD"
),
weekday
:
this
.
dateList
.
length
?
moment
(
this
.
dateList
[
1
].
readDate
).
add
(
i
,
"days"
).
format
(
"dddd"
)
:
moment
().
add
(
i
,
"days"
).
format
(
"dddd"
)
date
:
this
.
dateList
.
length
?
moment
(
this
.
dateList
[
1
].
readDate
).
add
(
i
,
"days"
).
format
(
"MM-DD"
)
:
moment
().
add
(
i
,
"days"
).
format
(
"MM-DD"
),
readDate
:
this
.
dateList
.
length
?
moment
(
this
.
dateList
[
1
].
readDate
).
add
(
i
,
"days"
).
format
(
"YYYY-MM-DD"
)
:
moment
().
add
(
i
,
"days"
).
format
(
"YYYY-MM-DD"
),
weekday
:
this
.
dateList
.
length
?
moment
(
this
.
dateList
[
1
].
readDate
).
add
(
i
,
"days"
).
format
(
"dddd"
)
:
moment
().
add
(
i
,
"days"
).
format
(
"dddd"
)
}
dateList
.
push
(
obj
)
}
this
.
dateList
=
dateList
;
},
onSetSelectTime
(){
if
(
this
.
dateIndex
===
0
)
{
onSetSelectTime
()
{
if
(
this
.
dateIndex
===
0
)
{
let
h
=
Number
(
moment
().
format
(
"HH"
))
this
.
hourList
=
this
.
hourList
.
filter
(
item
=>
Number
(
item
)
>=
h
).
map
(
item
=>
{
this
.
hourList
=
this
.
hourList
.
filter
(
item
=>
Number
(
item
)
>=
h
).
map
(
item
=>
{
let
i
=
Number
(
item
)
return
i
>=
10
?
i
:
`0
${
i
}
`
}
)
}
else
{
this
.
hourList
=
[
"00"
,
"01"
,
"02"
,
"03"
,
"04"
,
"05"
,
"06"
,
"07"
,
"08"
,
"09"
,
"10"
,
"11"
,
"12"
,
"13"
,
"14"
,
"15"
,
"16"
,
"17"
,
"18"
,
"19"
,
"20"
,
"21"
,
"22"
,
"23"
]
return
i
>=
10
?
i
:
`0
${
i
}
`
})
}
else
{
this
.
hourList
=
[
"00"
,
"01"
,
"02"
,
"03"
,
"04"
,
"05"
,
"06"
,
"07"
,
"08"
,
"09"
,
"10"
,
"11"
,
"12"
,
"13"
,
"14"
,
"15"
,
"16"
,
"17"
,
"18"
,
"19"
,
"20"
,
"21"
,
"22"
,
"23"
]
}
},
onSetStartHours
(){
if
(
this
.
dateIndex
===
0
)
{
onSetStartHours
()
{
if
(
this
.
dateIndex
===
0
)
{
this
.
startHours
=
Number
(
moment
().
format
(
"HH"
));
}
else
{
}
else
{
this
.
startHours
=
0
}
this
.
endHours
=
this
.
startHours
+
23
;
this
.
endHours
=
this
.
startHours
+
23
;
this
.
onSetSelectTime
();
},
onGetDicts
()
{
...
...
@@ -603,13 +600,13 @@
images
:
res
.
data
.
data
.
images
?
res
.
data
.
data
.
images
.
split
(
","
).
map
(
val
=>
this
.
hostUrl
+
val
)
:
[]
}
uni
.
setNavigationBarTitle
({
title
:
`
${
this
.
roomInfo
.
storeName
}
-房间
${
this
.
orderType
==
1
?
'预约'
:
'续单'
}
`
})
uni
.
setNavigationBarTitle
({
title
:
`
${
this
.
roomInfo
.
storeName
}
-房间
${
this
.
orderType
==
1
?
'预约'
:
'续单'
}
`
})
// 判断房间有没有绑定套餐
if
(
this
.
roomInfo
.
packList
&&
this
.
roomInfo
.
packList
.
length
)
{
this
.
packageMode
=
this
.
roomInfo
.
packList
if
(
this
.
orderType
===
1
)
{
if
(
this
.
orderType
===
1
)
{
this
.
index
=
1
;
}
this
.
modeIndex
=
0
;
...
...
@@ -617,14 +614,14 @@
this
.
index
=
0
;
this
.
orderTypeList
=
this
.
orderTypeList
.
filter
(
item
=>
item
.
type
==
1
)
}
// if(this.roomInfo.isDirtyRoom >=1){
// uni.showToast({
// icon:"none",
// title:'当前房间未保洁,无法预定,请选择其他房间'
// })
// }
this
.
onGetSortDistance
()
}
})
...
...
@@ -646,27 +643,27 @@
storeId
:
this
.
roomInfo
.
storeId
,
roomId
:
this
.
roomInfo
.
id
,
day
:
this
.
dateList
[
this
.
dateIndex
].
readDate
,
orderType
:
this
.
orderType
orderType
:
this
.
orderType
}).
then
(
res
=>
{
uni
.
hideLoading
()
if
(
this
.
orderTypeList
[
this
.
index
].
type
==
2
)
{
this
.
duration
=
Number
(
this
.
packageMode
[
this
.
modeIndex
].
duration
);
}
else
{
this
.
duration
=
Number
(
this
.
distanceMode
[
this
.
distanceIndex
].
duration
);
}
if
(
this
.
orderTypeList
[
this
.
index
].
type
==
2
)
{
this
.
duration
=
Number
(
this
.
packageMode
[
this
.
modeIndex
].
duration
);
}
else
{
this
.
duration
=
Number
(
this
.
distanceMode
[
this
.
distanceIndex
].
duration
);
}
this
.
dateIntervalList
=
res
.
data
.
data
.
map
((
item
,
index
)
=>
{
return
{
...
item
,
m
:
item
.
endHoldTime
?
Number
(
moment
(
item
.
endHoldTime
).
format
(
"mm"
)):
0
,
m
:
item
.
endHoldTime
?
Number
(
moment
(
item
.
endHoldTime
).
format
(
"mm"
))
:
0
,
hour
:
index
>
0
&&
index
-
24
==
0
?
'次日'
:
index
>
24
?
index
-
24
:
index
}
})
if
(
this
.
orderType
===
2
)
{
if
(
this
.
orderType
===
2
)
{
this
.
onSetEndTime
()
}
else
{
this
.
onCheckDate
();
}
else
{
this
.
onCheckDate
();
}
})
},
...
...
@@ -741,13 +738,13 @@
let
end
=
Number
(
this
.
endTime
.
split
(
":"
)[
0
])
let
endM
=
Number
(
this
.
endTime
.
split
(
":"
)[
1
])
// 如果开始时间是第二天
// if(this.setStartTime.days >=2 || this.days == 2){
// 如果开始时间是第二天
// if(this.setStartTime.days >=2 || this.days == 2){
// start +=24
// }
if
(
this
.
orderType
==
2
&&
end
<
start
)
{
if
(
this
.
orderType
==
2
&&
end
<
start
)
{
end
+=
24
}
else
if
(
this
.
orderType
==
1
&&
end
<=
start
)
{
}
else
if
(
this
.
orderType
==
1
&&
end
<=
start
)
{
end
+=
24
}
this
.
dateObj
=
await
this
.
onSetDateTime
(
this
.
startTime
,
this
.
endTime
);
...
...
@@ -757,13 +754,14 @@
...
this
.
dateIntervalList
]
for
(
let
index
=
start
;
index
<=
end
;
index
++
)
{
let
endTimeM
=
0
if
(
this
.
dateIntervalList
[
index
].
status
==
1
)
{
endTimeM
=
moment
(
this
.
dateIntervalList
[
index
].
startHoldTime
).
format
(
'mm'
)
}
let
endTimeM
=
0
if
(
this
.
dateIntervalList
[
index
].
status
==
1
)
{
endTimeM
=
moment
(
this
.
dateIntervalList
[
index
].
startHoldTime
).
format
(
'mm'
)
}
// 在时间小时段内,在被占用的情况下,新增订单的开始分钟时间需要占用结束时间后,结束分钟时间需在时间占用开始前
if
((
this
.
dateIntervalList
[
index
].
status
==
1
&&
index
>
start
&&
index
<
start
+
this
.
duration
)
||
(
this
.
dateIntervalList
[
index
].
status
==
1
&&
index
==
end
&&
Number
(
startM
)
>=
Number
(
endTimeM
)
)
if
((
this
.
dateIntervalList
[
index
].
status
==
1
&&
index
>
start
&&
index
<
start
+
this
.
duration
)
||
(
this
.
dateIntervalList
[
index
].
status
==
1
&&
index
==
end
&&
Number
(
startM
)
>=
Number
(
endTimeM
))
)
{
// 表示时间点被占用,无法选择
this
.
useDateStatus
=
false
...
...
@@ -797,23 +795,29 @@
preStartDate
:
this
.
dateObj
.
startDate
,
preEndDate
:
this
.
dateObj
.
endDate
,
orderType
:
this
.
orderType
,
packageId
:
this
.
index
>
0
?
this
.
packageMode
[
this
.
modeIndex
].
id
:
''
packageId
:
this
.
index
>
0
?
this
.
packageMode
[
this
.
modeIndex
].
id
:
''
}).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
&&
res
.
data
.
data
.
length
)
{
this
.
couponList
=
res
.
data
.
data
;
let
list
=
res
.
data
.
data
.
filter
(
item
=>
item
.
isAvailable
===
0
).
map
(
item
=>
{
return
{
...
item
,
subPrice
:
item
.
subPrice
||
0
}
})
list
.
sort
((
a
,
b
)
=>
b
.
subPrice
-
a
.
subPrice
)
this
.
useCouponList
=
list
;
if
(
this
.
useCouponList
.
length
){
let
i
=
this
.
useCouponList
.
findIndex
(
item
=>
item
.
duration
==
this
.
duration
)
this
.
selectCouponIndex
=
i
>=
0
?
i
:
0
;
}
this
.
couponList
=
res
.
data
.
data
;
let
list
=
res
.
data
.
data
.
filter
(
item
=>
item
.
isAvailable
===
0
)
if
(
list
.
length
)
{
list
=
list
.
map
(
item
=>
{
return
{
...
item
,
subPrice
:
item
.
subPrice
||
0
}
})
list
.
sort
((
a
,
b
)
=>
b
.
subPrice
-
a
.
subPrice
)
this
.
useCouponList
=
list
;
let
i
=
this
.
useCouponList
.
findIndex
(
item
=>
item
.
duration
==
this
.
duration
)
this
.
selectCouponIndex
=
i
>=
0
?
i
:
0
}
else
{
this
.
useCouponList
=
list
;
this
.
selectCouponIndex
=
-
1
}
}
}
else
if
(
res
.
data
.
code
==
401
)
{
this
.
$refs
.
loginPop
.
open
();
...
...
@@ -828,9 +832,10 @@
url
:
"/pages/useCoupon/index"
,
events
:
{
getSelectData
(
data
)
{
if
(
data
.
couponId
){
that
.
selectCouponIndex
=
that
.
useCouponList
.
findIndex
(
item
=>
item
.
id
===
data
.
couponId
)
}
else
{
if
(
data
.
couponId
)
{
that
.
selectCouponIndex
=
that
.
useCouponList
.
findIndex
(
item
=>
item
.
id
===
data
.
couponId
)
}
else
{
that
.
selectCouponIndex
=
-
1
}
that
.
onComputePrice
();
...
...
@@ -843,9 +848,10 @@
orderMode
:
that
.
orderTypeList
[
that
.
index
].
type
,
preStartDate
:
that
.
dateObj
.
startDate
,
orderType
:
that
.
orderType
,
packageId
:
that
.
packageMode
[
that
.
modeIndex
].
id
,
packageId
:
that
.
packageMode
[
that
.
modeIndex
].
id
,
preEndDate
:
that
.
dateObj
.
endDate
,
selectId
:
that
.
selectCouponIndex
>=
0
?
that
.
useCouponList
[
that
.
selectCouponIndex
].
id
:
''
selectId
:
that
.
selectCouponIndex
>=
0
?
that
.
useCouponList
[
that
.
selectCouponIndex
].
id
:
''
})
}
})
...
...
@@ -860,7 +866,8 @@
storeId
:
this
.
roomInfo
.
storeId
,
roomId
:
this
.
roomInfo
.
id
,
buyType
:
this
.
orderTypeList
[
this
.
index
].
type
,
couponId
:
this
.
useCouponList
.
length
&&
this
.
selectCouponIndex
>=
0
?
this
.
useCouponList
[
this
.
selectCouponIndex
].
id
:
''
,
couponId
:
this
.
useCouponList
.
length
&&
this
.
selectCouponIndex
>=
0
?
this
.
useCouponList
[
this
.
selectCouponIndex
].
id
:
''
,
orderType
:
this
.
orderType
,
preStartDate
:
this
.
dateObj
.
startDate
,
preEndDate
:
this
.
dateObj
.
endDate
,
...
...
@@ -873,10 +880,10 @@
// uni.hideLoading()
if
(
res
.
data
.
code
==
200
)
{
this
.
computePriceInfo
=
res
.
data
.
data
;
}
else
{
}
else
{
uni
.
showToast
({
icon
:
"none"
,
title
:
res
.
data
.
msg
icon
:
"none"
,
title
:
res
.
data
.
msg
})
}
...
...
@@ -895,20 +902,20 @@
this
.
index
=
i
this
.
modeIndex
=
0
;
this
.
addM
=
false
;
this
.
distanceIndex
=
this
.
orderType
==
2
?
1
:
0
;
this
.
distanceIndex
=
this
.
orderType
==
2
?
1
:
0
;
this
.
setStartTime
=
{
status
:
false
,
startTime
:
''
,
startDate
:
''
,
duration
:
0
,
days
:
1
status
:
false
,
startTime
:
''
,
startDate
:
''
,
duration
:
0
,
days
:
1
}
// if(Number(this.startTime.split(":")[0])
<
new
Date
().
getHours
()){
// this.days = 2
// }else{
// this.days =1
// }
this
.
days
=
1
this
.
days
=
1
// this.checkedDateList= [0,0]
// this.onSetEndTime();
this
.
onGetSortDistance
();
...
...
@@ -919,39 +926,40 @@
this
.
selectCouponIndex
=
-
1
;
this
.
useDateStatus
=
true
;
this
.
duration
=
Number
(
this
.
packageMode
[
this
.
modeIndex
].
duration
);
let
val
=
this
.
intervalList
.
findIndex
(
item
=>
item
.
status
===
2
)
let
len
=
this
.
intervalList
.
filter
(
item
=>
item
.
status
===
2
).
length
;
let
val
=
this
.
intervalList
.
findIndex
(
item
=>
item
.
status
===
2
)
let
len
=
this
.
intervalList
.
filter
(
item
=>
item
.
status
===
2
).
length
;
let
duration
=
Number
(
this
.
packageMode
[
this
.
modeIndex
].
duration
);
let
start
=
Number
(
this
.
startTime
.
split
(
":"
)[
0
])
let
startM
=
Number
(
this
.
startTime
.
split
(
":"
)[
1
])
let
h
=
val
;
if
(
val
>=
24
)
{
if
(
val
>=
24
)
{
this
.
setStartTime
.
days
=
2
;
this
.
days
=
2
;
}
if
(
val
+
duration
>=
24
)
{
h
=
val
+
duration
-
24
}
else
{
h
=
val
+
duration
if
(
val
+
duration
>=
24
)
{
h
=
val
+
duration
-
24
}
else
{
h
=
val
+
duration
}
this
.
endTime
=
`
${
h
>=
10
?
h
:
'0'
+
h
}
:
${
startM
>=
10
?
startM
:
'0'
+
startM
}
`
;
this
.
intervalList
=
this
.
intervalList
.
map
((
item
,
index
)
=>
{
this
.
intervalList
=
this
.
intervalList
.
map
((
item
,
index
)
=>
{
let
status
=
item
.
status
;
if
(
index
>=
val
&&
index
<=
val
+
duration
)
{
if
(
index
>=
val
&&
index
<=
val
+
duration
)
{
status
=
2
let
endTimeM
=
0
if
(
this
.
dateIntervalList
[
index
].
status
==
1
)
{
if
(
this
.
dateIntervalList
[
index
].
status
==
1
)
{
endTimeM
=
moment
(
this
.
dateIntervalList
[
index
].
startHoldTime
).
format
(
'mm'
)
}
if
((
this
.
dateIntervalList
[
index
].
status
===
1
&&
index
>
val
&&
index
<
val
+
duration
)
||
(
this
.
dateIntervalList
[
index
].
status
===
1
&&
index
==
val
+
duration
&&
Number
(
startM
)
>=
Number
(
endTimeM
))){
if
((
this
.
dateIntervalList
[
index
].
status
===
1
&&
index
>
val
&&
index
<
val
+
duration
)
||
(
this
.
dateIntervalList
[
index
].
status
===
1
&&
index
==
val
+
duration
&&
Number
(
startM
)
>=
Number
(
endTimeM
)))
{
this
.
useDateStatus
=
false
}
}
else
{
}
else
{
status
=
this
.
dateIntervalList
[
index
].
status
}
return
{
...
...
@@ -964,13 +972,14 @@
icon
:
"none"
,
title
:
"所选时段已被其他订单占用"
,
success
:
()
=>
{
setTimeout
(
async
()
=>
{
this
.
dateObj
=
await
this
.
onSetDateTime
(
this
.
startTime
,
this
.
endTime
);
setTimeout
(
async
()
=>
{
this
.
dateObj
=
await
this
.
onSetDateTime
(
this
.
startTime
,
this
.
endTime
);
this
.
onGetUseCoupon
()
},
1000
)
},
1000
)
}
})
}
else
{
}
else
{
this
.
dateObj
=
this
.
onSetDateTime
(
this
.
startTime
,
this
.
endTime
);
this
.
onGetUseCoupon
();
}
...
...
@@ -994,13 +1003,13 @@
onDateChange
(
k
)
{
if
(
this
.
orderType
==
2
)
return
;
if
(
this
.
dateIndex
===
k
)
return
;
listSortDistance
({
storeId
:
this
.
roomInfo
.
storeId
,
roomId
:
this
.
roomInfo
.
id
,
day
:
this
.
dateList
[
k
].
readDate
,
orderType
:
this
.
orderType
}).
then
(
res
=>
{
orderType
:
this
.
orderType
}).
then
(
res
=>
{
// 今天可连续选择的时段
let
selectNum
=
0
;
//预定节点
...
...
@@ -1010,63 +1019,65 @@
let
ms
=
0
;
let
endDate
=
""
// 查询有无可预定的时段
let
todaySelectStatus
=
false
;
res
.
data
.
data
.
forEach
((
val
,
i
)
=>
{
if
(
val
.
status
==
1
&&
moment
(
val
.
endHoldTime
).
format
(
'mm'
)
<
59
&&
selectNum
==
0
){
startDate
=
moment
(
val
.
endHoldTime
).
format
(
"YYYY-MM-DD HH:mm:ss"
)
selectNum
+=
1
t
=
i
}
else
if
(
val
.
status
==
1
&&
selectNum
>
0
){
let
start
=
moment
(
startDate
).
valueOf
()
let
end
=
moment
(
val
.
startHoldTime
).
valueOf
()
if
(
end
-
start
>
this
.
duration
*
60
*
60
*
1000
){
todaySelectStatus
=
true
;
}
else
{
startDate
=
''
selectNum
=
0
endDate
=
""
t
=
-
1
}
}
else
if
(
selectNum
==
0
&&
!
val
.
status
){
startDate
=
val
.
timeHour
+
":00:00"
;
selectNum
+=
1
t
=
i
}
else
if
(
selectNum
>
0
&&
!
val
.
status
){
// 计算时长
let
start
=
moment
(
startDate
).
valueOf
()
endDate
=
endDate
?
moment
(
endDate
).
add
(
1
,
'h'
).
format
(
"YYYY-MM-DD HH:mm:ss"
)
:
moment
(
startDate
).
add
(
1
,
'h'
).
format
(
"YYYY-MM-DD HH:mm:ss"
)
let
end
=
moment
(
endDate
).
valueOf
()
if
(
end
-
start
>
this
.
duration
*
60
*
60
*
1000
){
todaySelectStatus
=
true
;
}
else
{
selectNum
+=
1
}
}
let
todaySelectStatus
=
false
;
res
.
data
.
data
.
forEach
((
val
,
i
)
=>
{
if
(
val
.
status
==
1
&&
moment
(
val
.
endHoldTime
).
format
(
'mm'
)
<
59
&&
selectNum
==
0
)
{
startDate
=
moment
(
val
.
endHoldTime
).
format
(
"YYYY-MM-DD HH:mm:ss"
)
selectNum
+=
1
t
=
i
}
else
if
(
val
.
status
==
1
&&
selectNum
>
0
)
{
let
start
=
moment
(
startDate
).
valueOf
()
let
end
=
moment
(
val
.
startHoldTime
).
valueOf
()
if
(
end
-
start
>
this
.
duration
*
60
*
60
*
1000
)
{
todaySelectStatus
=
true
;
}
else
{
startDate
=
''
selectNum
=
0
endDate
=
""
t
=
-
1
}
}
else
if
(
selectNum
==
0
&&
!
val
.
status
)
{
startDate
=
val
.
timeHour
+
":00:00"
;
selectNum
+=
1
t
=
i
}
else
if
(
selectNum
>
0
&&
!
val
.
status
)
{
// 计算时长
let
start
=
moment
(
startDate
).
valueOf
()
endDate
=
endDate
?
moment
(
endDate
).
add
(
1
,
'h'
).
format
(
"YYYY-MM-DD HH:mm:ss"
)
:
moment
(
startDate
).
add
(
1
,
'h'
).
format
(
"YYYY-MM-DD HH:mm:ss"
)
let
end
=
moment
(
endDate
).
valueOf
()
if
(
end
-
start
>
this
.
duration
*
60
*
60
*
1000
)
{
todaySelectStatus
=
true
;
}
else
{
selectNum
+=
1
}
}
})
if
((
todaySelectStatus
&&
t
>=
24
)
||
!
todaySelectStatus
)
{
if
((
todaySelectStatus
&&
t
>=
24
)
||
!
todaySelectStatus
)
{
uni
.
showToast
({
icon
:
"none"
,
title
:
"当前日期无可预约时段"
icon
:
"none"
,
title
:
"当前日期无可预约时段"
})
return
;
}
this
.
dateIndex
=
k
this
.
selectCouponIndex
=
-
1
this
.
addM
=
false
;
this
.
onGetSortDistance
()
})
},
// 开始选择时间
onSelectDate
()
{
if
(
this
.
orderType
===
2
)
return
;
if
(
!
this
.
checkedIndex
.
length
)
{
let
arr
=
this
.
startTime
.
split
(
":"
).
map
((
item
,
k
)
=>
{
let
arr
=
this
.
startTime
.
split
(
":"
).
map
((
item
,
k
)
=>
{
let
n
=
Number
(
item
)
if
(
k
===
0
&&
this
.
dateIndex
===
0
)
{
if
(
k
===
0
&&
this
.
dateIndex
===
0
)
{
n
=
this
.
hourList
.
findIndex
(
val
=>
Number
(
val
)
===
n
)
}
return
n
...
...
@@ -1097,7 +1108,7 @@
},
// 选择完时间
onSelectedDate
()
{
this
.
checkedDateList
=
this
.
checkedIndex
.
length
?
this
.
checkedIndex
.
map
(
item
=>
Number
(
item
)):[
0
,
0
];
this
.
checkedDateList
=
this
.
checkedIndex
.
length
?
this
.
checkedIndex
.
map
(
item
=>
Number
(
item
))
:
[
0
,
0
];
this
.
startTime
=
`
${
this
.
hourList
[
this
.
checkedDateList
[
0
]]}
:
${
this
.
minuteList
[
this
.
checkedDateList
[
1
]]}
`
;
this
.
$forceUpdate
();
//重新设置结束时间
...
...
@@ -1132,26 +1143,26 @@
onCancle
()
{
this
.
$refs
.
confirmPop
.
close
();
},
onOrderConfirmBefore
(){
onOrderConfirmBefore
()
{
wx
.
requestSubscribeMessage
({
tmplIds
:
[
'UkvsRnZkZB_w3MqXPbRhi4jEk8ML4N9PWT3rnd3Bhxg'
,
],
success
:
(
res
)
=>
{
},
complete
:
(
res
)
=>
{
console
.
log
(
res
,
909090
)
console
.
log
(
res
,
909090
)
// this.$refs.confirmPop.open();
this
.
onOrderConfirm
();
}
})
},
onOrderConfirm
()
{
if
(
this
.
roomInfo
.
roomStat
>=
3
)
{
if
(
this
.
roomInfo
.
roomStat
>=
3
)
{
uni
.
showToast
({
icon
:
"none"
,
title
:
'当前房间维护中,无法预定,请选择其他房间'
icon
:
"none"
,
title
:
'当前房间维护中,无法预定,请选择其他房间'
})
return
;
}
...
...
@@ -1162,27 +1173,30 @@
// })
// return;
// }
let
nowDate
=
moment
().
format
(
"MMDD"
)
let
nowTime
=
moment
().
format
(
"HHmm"
)
let
setDate
=
moment
(
this
.
dateObj
.
startDate
).
format
(
"MMDD"
);
let
setTime
=
moment
(
this
.
dateObj
.
startDate
).
format
(
"HHmm"
);
// 如果当前时间大于开始时间,则不允许下单
if
(
this
.
orderType
==
1
&&
nowDate
==
setDate
&&
nowTime
>
setTime
)
{
if
(
this
.
orderType
==
1
&&
nowDate
==
setDate
&&
nowTime
>
setTime
)
{
uni
.
showToast
({
icon
:
"none"
,
title
:
"当前时间晚于预约开始时间,请重新选择预约时间"
icon
:
"none"
,
title
:
"当前时间晚于预约开始时间,请重新选择预约时间"
})
return
}
if
(
this
.
orderTypeList
[
this
.
index
].
type
===
2
){
if
(
this
.
packageMode
[
this
.
modeIndex
].
packaEndPeriod
-
this
.
packageMode
[
this
.
modeIndex
].
packaStartPeriod
<
23
&&
Number
(
moment
(
this
.
dateObj
.
endDate
).
format
(
"HH"
))
>=
this
.
packageMode
[
this
.
modeIndex
].
packaEndPeriod
){
this
.
content
=
`所选套餐为限时套餐,订单结束时间为当日
${
Number
(
this
.
packageMode
[
this
.
modeIndex
].
packaEndPeriod
)
>=
10
?
this
.
packageMode
[
this
.
modeIndex
].
packaEndPeriod
:
'0'
+
this
.
packageMode
[
this
.
modeIndex
].
packaEndPeriod
}
:00,请注意下单结束时间!`
if
(
this
.
orderTypeList
[
this
.
index
].
type
===
2
)
{
if
(
this
.
packageMode
[
this
.
modeIndex
].
packaEndPeriod
-
this
.
packageMode
[
this
.
modeIndex
]
.
packaStartPeriod
<
23
&&
Number
(
moment
(
this
.
dateObj
.
endDate
).
format
(
"HH"
))
>=
this
.
packageMode
[
this
.
modeIndex
].
packaEndPeriod
)
{
this
.
content
=
`所选套餐为限时套餐,订单结束时间为当日
${
Number
(
this
.
packageMode
[
this
.
modeIndex
].
packaEndPeriod
)
>=
10
?
this
.
packageMode
[
this
.
modeIndex
].
packaEndPeriod
:
'0'
+
this
.
packageMode
[
this
.
modeIndex
].
packaEndPeriod
}
:00,请注意下单结束时间!`
this
.
$refs
.
popupConfirm
.
open
()
return
}
...
...
@@ -1196,10 +1210,10 @@
}
this
.
$refs
.
confirmPop
.
open
();
},
close
(){
close
()
{
this
.
$refs
.
popupConfirm
.
close
()
},
confirm
(){
confirm
()
{
this
.
close
()
if
(
!
this
.
useDateStatus
)
{
uni
.
showToast
({
...
...
@@ -1210,17 +1224,17 @@
}
this
.
$refs
.
confirmPop
.
open
();
},
onOrder
(){
onOrder
()
{
wx
.
requestSubscribeMessage
({
tmplIds
:
[
'HB2_moQRQrXC2cKw6zE08FF8UZJ5ue1h_qXZhvOkacc'
,
'K8fbcKVq46w9o7Ekpesn70wK3mYjXqdSfFUth4AufqU'
],
success
:
(
res
)
=>
{
},
complete
:
(
res
)
=>
{
console
.
log
(
res
,
909090
)
console
.
log
(
res
,
909090
)
// this.$refs.confirmPop.open();
this
.
onOrderCreate
();
}
...
...
@@ -1237,7 +1251,8 @@
orderType
:
this
.
orderType
,
buyType
:
this
.
orderTypeList
[
this
.
index
].
type
,
payType
:
1
,
couponId
:
this
.
useCouponList
.
length
&&
this
.
selectCouponIndex
>=
0
?
this
.
useCouponList
[
this
.
selectCouponIndex
].
id
:
''
,
couponId
:
this
.
useCouponList
.
length
&&
this
.
selectCouponIndex
>=
0
?
this
.
useCouponList
[
this
.
selectCouponIndex
].
id
:
''
,
preStartDate
:
this
.
dateObj
.
startDate
,
preEndDate
:
this
.
dateObj
.
endDate
,
totalFee
:
Number
(
this
.
roomInfo
.
price
)
*
this
.
duration
,
...
...
@@ -1274,19 +1289,19 @@
})
},
"fail"
:
(
resp
)
=>
{
console
.
log
(
resp
,
"支付失败"
)
console
.
log
(
resp
,
"支付失败"
)
// 取消支付或支付失败
uni
.
showToast
({
title
:
"取消支付"
})
orderCancelPay
({
orderNo
:
res
.
data
.
data
.
orderNo
}).
then
(
res
=>
{
orderNo
:
res
.
data
.
data
.
orderNo
}).
then
(
res
=>
{
console
.
log
(
res
)
})
},
"complete"
:
(
resp
)
=>
{
console
.
log
(
resp
,
"支付完成"
)
console
.
log
(
resp
,
"支付完成"
)
// 接口调用结束的回调函数(调用成功、失败都会执行)
}
});
...
...
@@ -1309,7 +1324,7 @@
uni
.
showToast
({
icon
:
"none"
,
title
:
res
.
data
.
msg
||
"下单失败"
,
duration
:
2000
,
duration
:
2000
,
success
:
()
=>
{
// setTimeout(()=>{
// this.onGetSortDistance()
...
...
@@ -1356,68 +1371,68 @@
})
},
onSelectDatePoint
(
val
,
i
)
{
if
(
this
.
orderType
==
2
)
return
;
if
(
i
>=
24
)
{
if
(
this
.
orderType
==
2
)
return
;
if
(
i
>=
24
)
{
uni
.
showToast
({
icon
:
"none"
,
title
:
'预约次日时段,请先选择日期'
icon
:
"none"
,
title
:
'预约次日时段,请先选择日期'
})
return
}
let
time
=
i
;
if
(
i
>=
24
)
{
time
=
i
-
24
;
if
(
this
.
dateIndex
===
0
)
{
this
.
dateIndex
+=
1
;
if
(
i
>=
24
)
{
time
=
i
-
24
;
if
(
this
.
dateIndex
===
0
)
{
this
.
dateIndex
+=
1
;
}
}
if
(
val
.
endHoldTime
)
{
let
mTime
=
Number
(
moment
(
val
.
endHoldTime
).
format
(
"mm"
))
if
(
mTime
>=
59
)
{
uni
.
showToast
({
icon
:
'none'
,
title
:
'当前时段不可预定'
})
return
;
}
else
{
this
.
startTime
=
`
${
time
>=
10
?
time
:
'0'
+
time
}
:
${
mTime
>=
10
?
mTime
:
'0'
+
mTime
}
`
;
if
(
time
>=
0
){
// 开始时间加一分钟
let
arr
=
this
.
startTime
.
split
(
":"
);
let
m
=
Number
(
arr
[
1
])
+
1
let
h
=
Number
(
arr
[
0
])
this
.
startTime
=
`
${
h
>=
10
?
h
:
'0'
+
h
}
:
${
m
>=
10
?
m
:
'0'
+
m
}
`
}
this
.
endTime
=
this
.
startTime
.
split
(
":"
).
map
((
item
,
k
)
=>
{
let
n
=
Number
(
item
);
if
(
k
==
0
){
n
=
n
+
this
.
duration
>=
24
?
n
+
this
.
duration
-
24
:
n
+
this
.
duration
}
return
n
>=
10
?
n
:
`0
${
n
}
`
}).
join
(
":"
)
if
(
val
.
endHoldTime
)
{
let
mTime
=
Number
(
moment
(
val
.
endHoldTime
).
format
(
"mm"
))
if
(
mTime
>=
59
)
{
uni
.
showToast
({
icon
:
'none'
,
title
:
'当前时段不可预定'
})
return
;
}
else
{
this
.
startTime
=
`
${
time
>=
10
?
time
:
'0'
+
time
}
:
${
mTime
>=
10
?
mTime
:
'0'
+
mTime
}
`
;
if
(
time
>=
0
)
{
// 开始时间加一分钟
let
arr
=
this
.
startTime
.
split
(
":"
);
let
m
=
Number
(
arr
[
1
])
+
1
let
h
=
Number
(
arr
[
0
])
this
.
startTime
=
`
${
h
>=
10
?
h
:
'0'
+
h
}
:
${
m
>=
10
?
m
:
'0'
+
m
}
`
}
}
else
{
this
.
startTime
=
`
${
time
>=
10
?
time
:
'0'
+
time
}
:00`
;
this
.
endTime
=
this
.
startTime
.
split
(
":"
).
map
((
item
,
k
)
=>
{
this
.
endTime
=
this
.
startTime
.
split
(
":"
).
map
((
item
,
k
)
=>
{
let
n
=
Number
(
item
);
if
(
k
==
0
)
{
n
=
n
+
this
.
duration
>=
24
?
n
+
this
.
duration
-
24
:
n
+
this
.
duration
if
(
k
==
0
)
{
n
=
n
+
this
.
duration
>=
24
?
n
+
this
.
duration
-
24
:
n
+
this
.
duration
}
return
n
>=
10
?
n
:
`0
${
n
}
`
return
n
>=
10
?
n
:
`0
${
n
}
`
}).
join
(
":"
)
}
}
else
{
this
.
startTime
=
`
${
time
>=
10
?
time
:
'0'
+
time
}
:00`
;
this
.
endTime
=
this
.
startTime
.
split
(
":"
).
map
((
item
,
k
)
=>
{
let
n
=
Number
(
item
);
if
(
k
==
0
)
{
n
=
n
+
this
.
duration
>=
24
?
n
+
this
.
duration
-
24
:
n
+
this
.
duration
}
return
n
>=
10
?
n
:
`0
${
n
}
`
}).
join
(
":"
)
}
this
.
dateObj
=
this
.
onSetDateTime
(
this
.
startTime
,
this
.
endTime
);
this
.
onGetUseCoupon
();
this
.
useDateStatus
=
true
;
this
.
intervalList
=
this
.
intervalList
.
map
((
item
,
index
)
=>
{
this
.
intervalList
=
this
.
intervalList
.
map
((
item
,
index
)
=>
{
let
status
=
item
.
status
;
if
(
index
>=
i
&&
index
<=
i
+
this
.
duration
)
{
if
(
index
>=
i
&&
index
<=
i
+
this
.
duration
)
{
status
=
2
if
(
this
.
dateIntervalList
[
index
].
status
===
1
&&
index
!==
i
)
{
if
(
this
.
dateIntervalList
[
index
].
status
===
1
&&
index
!==
i
)
{
this
.
useDateStatus
=
false
;
}
}
else
{
}
else
{
status
=
this
.
dateIntervalList
[
index
].
status
}
return
{
...
...
@@ -1440,13 +1455,13 @@
}
let
startArr
=
startTime
.
split
(
":"
)
let
endArr
=
endTime
.
split
(
":"
)
obj
.
startDate
=
`
${
this
.
dateList
[
this
.
dateIndex
].
readDate
}
${
startTime
}
:00`
if
((
this
.
orderType
==
1
&&
Number
(
endArr
[
0
])
<=
Number
(
startArr
[
0
])))
{
obj
.
endDate
=
`
${
moment
(
obj
.
startDate
).
add
(
1
,
"days"
).
format
(
"YYYY-MM-DD"
)}
${
endTime
}
:00`
}
else
if
(
this
.
orderType
==
2
&&
Number
(
endArr
[
0
])
<
Number
(
startArr
[
0
]))
{
}
else
if
(
this
.
orderType
==
2
&&
Number
(
endArr
[
0
])
<
Number
(
startArr
[
0
]))
{
obj
.
endDate
=
`
${
moment
(
obj
.
startDate
).
add
(
1
,
"days"
).
format
(
"YYYY-MM-DD"
)}
${
endTime
}
:00`
}
else
{
...
...
@@ -1454,86 +1469,87 @@
}
return
obj
;
},
onCheckDate
(){
onCheckDate
()
{
// 今天可连续选择的时段
let
selectNum
=
0
;
//预定节点
let
t
=
-
1
;
//预定开始时间
let
startDate
=
''
;
let
ms
=
0
;
let
endDate
=
""
// 查询有无可预定的时段
let
todaySelectStatus
=
false
;
this
.
dateIntervalList
.
forEach
((
val
,
i
)
=>
{
if
(
val
.
status
==
1
&&
moment
(
val
.
endHoldTime
).
format
(
'mm'
)
<
59
&&
selectNum
==
0
){
startDate
=
moment
(
val
.
endHoldTime
).
format
(
"YYYY-MM-DD HH:mm:ss"
)
selectNum
+=
1
t
=
i
}
else
if
(
val
.
status
==
1
&&
selectNum
>
0
){
let
start
=
moment
(
startDate
).
valueOf
()
let
end
=
moment
(
val
.
startHoldTime
).
valueOf
()
if
(
end
-
start
>
this
.
duration
*
60
*
60
*
1000
){
todaySelectStatus
=
true
;
}
else
{
startDate
=
''
selectNum
=
0
endDate
=
""
t
=
-
1
}
}
else
if
(
selectNum
==
0
&&
!
val
.
status
){
startDate
=
val
.
timeHour
+
":00:00"
;
selectNum
+=
1
t
=
i
}
else
if
(
selectNum
>
0
&&
!
val
.
status
){
// 计算时长
let
start
=
moment
(
startDate
).
valueOf
()
endDate
=
endDate
?
moment
(
endDate
).
add
(
1
,
'h'
).
format
(
"YYYY-MM-DD HH:mm:ss"
)
:
moment
(
startDate
).
add
(
1
,
'h'
).
format
(
"YYYY-MM-DD HH:mm:ss"
)
let
end
=
moment
(
endDate
).
valueOf
()
if
(
end
-
start
>
this
.
duration
*
60
*
60
*
1000
){
todaySelectStatus
=
true
;
}
else
{
selectNum
+=
1
}
}
let
todaySelectStatus
=
false
;
this
.
dateIntervalList
.
forEach
((
val
,
i
)
=>
{
if
(
val
.
status
==
1
&&
moment
(
val
.
endHoldTime
).
format
(
'mm'
)
<
59
&&
selectNum
==
0
)
{
startDate
=
moment
(
val
.
endHoldTime
).
format
(
"YYYY-MM-DD HH:mm:ss"
)
selectNum
+=
1
t
=
i
}
else
if
(
val
.
status
==
1
&&
selectNum
>
0
)
{
let
start
=
moment
(
startDate
).
valueOf
()
let
end
=
moment
(
val
.
startHoldTime
).
valueOf
()
if
(
end
-
start
>
this
.
duration
*
60
*
60
*
1000
)
{
todaySelectStatus
=
true
;
}
else
{
startDate
=
''
selectNum
=
0
endDate
=
""
t
=
-
1
}
}
else
if
(
selectNum
==
0
&&
!
val
.
status
)
{
startDate
=
val
.
timeHour
+
":00:00"
;
selectNum
+=
1
t
=
i
}
else
if
(
selectNum
>
0
&&
!
val
.
status
)
{
// 计算时长
let
start
=
moment
(
startDate
).
valueOf
()
endDate
=
endDate
?
moment
(
endDate
).
add
(
1
,
'h'
).
format
(
"YYYY-MM-DD HH:mm:ss"
)
:
moment
(
startDate
).
add
(
1
,
'h'
).
format
(
"YYYY-MM-DD HH:mm:ss"
)
let
end
=
moment
(
endDate
).
valueOf
()
if
(
end
-
start
>
this
.
duration
*
60
*
60
*
1000
)
{
todaySelectStatus
=
true
;
}
else
{
selectNum
+=
1
}
}
})
if
((
todaySelectStatus
&&
t
>=
24
)
||
!
todaySelectStatus
)
{
if
(
this
.
dateIndex
>=
this
.
dateList
.
length
-
1
)
{
if
((
todaySelectStatus
&&
t
>=
24
)
||
!
todaySelectStatus
)
{
if
(
this
.
dateIndex
>=
this
.
dateList
.
length
-
1
)
{
this
.
onInitDateList
()
}
else
{
this
.
dateIndex
+=
1
;
}
else
{
this
.
dateIndex
+=
1
;
}
//房间维护就不循环
if
(
this
.
roomInfo
.
roomStat
!==
3
)
{
if
(
this
.
roomInfo
.
roomStat
!==
3
)
{
this
.
onGetSortDistance
();
}
return
;
}
else
{
let
startDateTime
=
""
;
if
(
!
this
.
addM
&&
(
t
!=
0
||
(
t
==
0
&&
this
.
dateIntervalList
[
0
].
status
==
1
))){
this
.
addM
=
true
startDateTime
=
moment
(
startDate
).
add
(
1
,
"m"
).
format
(
"YYYY-MM-DD"
);
this
.
startTime
=
moment
(
startDate
).
add
(
1
,
"m"
).
format
(
"HH:mm"
);
}
else
{
startDateTime
=
moment
(
startDate
).
format
(
"YYYY-MM-DD"
);
this
.
startTime
=
moment
(
startDate
).
format
(
"HH:mm"
);
}
let
i
=
this
.
dateList
.
findIndex
(
item
=>
item
.
readDate
===
startDateTime
)
if
(
this
.
dateIndex
!==
i
&&
this
.
dateIndex
>=
0
){
this
.
dateIndex
=
i
;
//房间维护就不循环
if
(
this
.
roomInfo
.
roomStat
!==
3
){
this
.
onGetSortDistance
();
}
return
;
}
else
{
let
startDateTime
=
""
;
if
(
!
this
.
addM
&&
(
t
!=
0
||
(
t
==
0
&&
this
.
dateIntervalList
[
0
].
status
==
1
)))
{
this
.
addM
=
true
startDateTime
=
moment
(
startDate
).
add
(
1
,
"m"
).
format
(
"YYYY-MM-DD"
);
this
.
startTime
=
moment
(
startDate
).
add
(
1
,
"m"
).
format
(
"HH:mm"
);
}
else
{
startDateTime
=
moment
(
startDate
).
format
(
"YYYY-MM-DD"
);
this
.
startTime
=
moment
(
startDate
).
format
(
"HH:mm"
);
}
let
i
=
this
.
dateList
.
findIndex
(
item
=>
item
.
readDate
===
startDateTime
)
if
(
this
.
dateIndex
!==
i
&&
this
.
dateIndex
>=
0
)
{
this
.
dateIndex
=
i
;
//房间维护就不循环
if
(
this
.
roomInfo
.
roomStat
!==
3
)
{
this
.
onGetSortDistance
();
}
this
.
onSetEndTime
()
return
;
}
this
.
onSetEndTime
()
}
}
}
...
...
@@ -1583,7 +1599,8 @@
display
:
block
;
width
:
100%
;
border-radius
:
6
upx
;
overflow
:
hidden
;
overflow
:
hidden
;
image
{
display
:
block
;
width
:
100%
;
...
...
@@ -1640,53 +1657,60 @@
}
}
.tab-box
{
.tab-box
{
display
:
flex
;
flex-direction
:
row
;
justify-content
:
center
;
width
:
92%
;
margin
:
20
upx
0
30
upx
;
background
:
#ffffff
;
border-radius
:
10
upx
;
overflow
:
hidden
;
.tab-item
{
position
:
relative
;
display
:
flex
;
flex
-direction
:
row
;
flex
:
1
;
justify-content
:
center
;
width
:
92%
;
margin
:
20
upx
0
30
upx
;
background
:
#ffffff
;
border-radius
:
10
upx
;
overflow
:
hidden
;
align-items
:
center
;
height
:
80
upx
;
.tab-item
{
text
{
color
:
#000000
;
font-size
:
34
upx
;
font-weight
:
700
;
}
.hot-icon
{
position
:
relative
;
display
:
flex
;
flex
:
1
;
justify-content
:
center
;
align-items
:
center
;
height
:
80
upx
;
text
{
color
:
#000000
;
font-size
:
34
upx
;
font-weight
:
700
;
}
.hot-icon
{
position
:
relative
;
height
:
40
upx
;
.img-icon{
position
:
absolute
;
top
:
-4
upx
;
left
:
4
upx
;
width
:
46
upx
;
image{
width
:
100%
;
}
height
:
40
upx
;
.img-icon
{
position
:
absolute
;
top
:
-4
upx
;
left
:
4
upx
;
width
:
46
upx
;
image
{
width
:
100%
;
}
}
}
}
.active
{
background-color
:
#dc4397
;
text
{
color
:
#ffffff
;
font-weight
:
800
;
}
.active
{
background-color
:
#dc4397
;
text
{
color
:
#ffffff
;
font-weight
:
800
;
}
}
}
.order-type-box
{
display
:
flex
;
flex-direction
:
column
;
...
...
@@ -1694,8 +1718,9 @@
min-height
:
600
upx
;
overflow
:
hidden
;
border
:
4
upx
solid
#DC4397
;
box-shadow
:
0
0
8
upx
#DC4397
;
box-shadow
:
0
0
8
upx
#DC4397
;
border-radius
:
12
upx
12
upx
0
0
;
.date-content-box
{
width
:
100%
;
background-color
:
#FFF7F5
;
...
...
@@ -1763,6 +1788,7 @@
.package-mode
{
padding
:
0
0
30
upx
;
border-bottom
:
2
upx
solid
#F1F1F1
;
.part-1
{
margin
:
30
upx
;
}
...
...
@@ -1813,11 +1839,12 @@
display
:
flex
;
flex-direction
:
row
;
align-items
:
center
;
.cu-tag{
.cu-tag
{
padding
:
4
upx
16
upx
;
border-radius
:
20
upx
;
}
}
}
...
...
@@ -2136,7 +2163,8 @@
}
}
}
.tip-box
{
.tip-box
{
padding
:
12
upx
;
border
:
4
upx
solid
#DBA556
;
border-radius
:
12
upx
;
...
...
@@ -2145,10 +2173,12 @@
color
:
#B67D32
;
//
font-size
:
24
upx
;
}
.scroll-view
{
.scroll-view
{
height
:
136
upx
;
width
:
100vw
;
.package-box{
.package-box
{
position
:
absolute
;
top
:
0
;
left
:
2vw
;
...
...
@@ -2156,28 +2186,33 @@
width
:
96vw
;
display
:
flex
;
flex-direction
:
row
;
.item{
.item
{
display
:
flex
;
flex-direction
:
column
;
flex
:
1
;
height
:
100%
;
.text-title{
.text-title
{
font-size
:
28
upx
;
}
.flex-row
{
.flex-row
{
//
font-size
:
23
upx
;
}
}
}
}
.message-box
{
.message-box
{
display
:
flex
;
width
:
80%
;
background-color
:
#ffffff
;
border-radius
:
12
upx
;
overflow
:
hidden
;
margin
:
0
auto
;
.header{
.header
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
...
...
@@ -2185,7 +2220,8 @@
height
:
90
upx
;
border-bottom
:
1px
solid
#e5e5e5
;
}
.content
{
.content
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
...
...
@@ -2193,12 +2229,14 @@
border-bottom
:
1px
solid
#e5e5e5
;
padding
:
0
30
upx
;
}
.button-box
{
.button-box
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
height
:
90
upx
;
text{
text
{
color
:
#55aaff
;
}
}
...
...
pages/useCoupon/index.vue
View file @
60755f0c
...
...
@@ -25,11 +25,11 @@
<text
class=
"text-black"
>
可用时段:
</text>
<text
class=
"text-black"
>
{{
item
.
couponTimeStart
}}
-
{{
item
.
couponTimeEnd
}}
</text>
</view>
<text>
{{
item
.
platformType
==
2
?
'美团核销'
:
''
}}
</text>
<text>
{{
platformEnum
[
item
.
platformType
]
}}
</text>
</view>
<view
v-else
class=
"des margin-top"
>
<text
class=
""
>
全天通用
</text>
<text>
{{
item
.
platformType
==
2
?
'美团核销'
:
''
}}
</text>
<text>
{{
platformEnum
[
item
.
platformType
]
}}
</text>
</view>
</view>
...
...
@@ -62,12 +62,12 @@
</
template
>
<
script
>
import
{
dictList
}
from
"@/api/index.js"
;
import
{
getDictItem
}
from
"@/utils/tools.js"
import
config
from
"@/config/index.config"
import
indexConfig
from
"@/config/index.config"
;
import
FixedHeader
from
"@/components/fixedHeader/index"
;
import
{
getUseCoupon
}
from
"@/api/coupon"
import
{
getUseCoupon
}
from
"@/api/coupon"
export
default
{
data
()
{
...
...
@@ -90,13 +90,15 @@
tipText
:
""
,
show
:
false
,
eventChannel
:
null
,
selectId
:
''
selectId
:
''
,
platformEnum
:{}
};
},
components
:
{
'fixed-header'
:
FixedHeader
},
onLoad
()
{
this
.
onGetDicts
();
this
.
eventChannel
=
this
.
getOpenerEventChannel
();
// eventChannel.emit('acceptDataFromOpenedPage', {data: 'data from test page'});
...
...
@@ -106,6 +108,24 @@
})
},
methods
:
{
onGetDicts
()
{
let
dicts
=
[]
let
dictStr
=
uni
.
getStorageSync
(
'dicts'
)
if
(
dictStr
)
{
let
dicts
=
JSON
.
parse
(
dictStr
)
this
.
platformEnum
=
getDictItem
(
dicts
,
"consumer_coupon_platform_type"
);
this
.
couponSourceEnum
=
getDictItem
(
dicts
,
"consumer_coupon_source_type"
);
this
.
$forceUpdate
()
}
dictList
().
then
(
res
=>
{
dicts
=
res
.
data
.
data
;
uni
.
setStorageSync
(
'dicts'
,
JSON
.
stringify
(
res
.
data
.
data
))
this
.
platformEnum
=
getDictItem
(
dicts
,
"consumer_coupon_platform_type"
);
this
.
couponSourceEnum
=
getDictItem
(
dicts
,
"consumer_coupon_source_type"
);
this
.
$forceUpdate
()
})
},
onLoading
(
d
)
{
getUseCoupon
(
d
).
then
(
res
=>
{
if
(
res
.
statusCode
==
200
)
{
...
...
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