Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
U
uni-pdtravel
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
panyongping
uni-pdtravel
Commits
43d75e25
Commit
43d75e25
authored
Dec 22, 2023
by
潘永坪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
路径修改
parent
bd4cb2c5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
1822 deletions
+62
-1822
pages.json
pages.json
+16
-25
distributionCombiChoose.vue
...ation/distributionCombiChoose/distributionCombiChoose.vue
+44
-45
index.vue
pages/indexs/index/index.vue
+1
-1
merchantListIndex.vue
pages/indexs/merchantListIndex/merchantListIndex.vue
+1
-1
scenicOrder.vue
pages/scenic/scenicOrder/scenicOrder.vue
+0
-1750
No files found.
pages.json
View file @
43d75e25
...
...
@@ -263,7 +263,7 @@
}
}
]
]
},
{
"root"
:
"pages/scenic"
,
//景区分包
...
...
@@ -294,31 +294,22 @@
"enablePullDownRefresh"
:
false
}
},
{
},
{
"path"
:
"scenicIndex/scenicIndex"
,
"style"
:
{
"navigationBarTitleText"
:
"景区"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"scenicCombiOrder/scenicCombiOrder"
,
"style"
:
{
"navigationBarTitleText"
:
"订单填写"
,
"enablePullDownRefresh"
:
false
}
}
,{
"path"
:
"scenicOrder/scenicOrder"
,
"style"
:
{
"navigationBarTitleText"
:
""
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"scenicCombiOrder/scenicCombiOrder"
,
"style"
:
{
"navigationBarTitleText"
:
""
,
"enablePullDownRefresh"
:
false
}
}
]
]
},
{
"root"
:
"pages/vlog"
,
//vlogo分包
...
...
@@ -468,7 +459,7 @@
"enablePullDownRefresh"
:
false
,
"navigationStyle"
:
"custom"
}
},
},
{
"path"
:
"myPhotoAlbum/myPhotoAlbum"
,
"style"
:
{
...
...
@@ -476,7 +467,7 @@
"enablePullDownRefresh"
:
false
}
},
},
{
"path"
:
"albumOrderdetail/albumOrderdetail"
,
"style"
:
{
...
...
@@ -484,7 +475,7 @@
"enablePullDownRefresh"
:
false
}
},
},
{
"path"
:
"purchasedPhotoAlbum/purchasedPhotoAlbum"
,
"style"
:
{
...
...
@@ -492,7 +483,7 @@
"enablePullDownRefresh"
:
false
}
},
},
{
"path"
:
"DIYPurchase/DIYPurchase"
,
"style"
:
{
...
...
@@ -500,7 +491,7 @@
"enablePullDownRefresh"
:
false
}
},
},
{
"path"
:
"DIYDetails/DIYDetails"
,
"style"
:
{
...
...
pages/combination/distributionCombiChoose/distributionCombiChoose.vue
View file @
43d75e25
...
...
@@ -504,55 +504,54 @@ export default {
uni
.
showLoading
({
title
:
'加载中'
})
this
.
$request
(
'/scenic/groupGood/getGroupProducts'
,
data
)
.
then
(
res
=>
{
uni
.
hideLoading
()
if
(
res
.
code
==
'00'
)
{
this
.
scenicList
=
res
.
data
.
merchantList
||
[]
this
.
groupId
=
res
.
data
.
groupId
||
''
this
.
groupChannelId
=
res
.
data
.
groupChannelId
||
''
this
.
scenicList
.
forEach
((
item
,
index
)
=>
{
//获取当前景区图片,把当前景区放在第一位
if
(
item
.
id
==
this
.
merchantId
)
{
this
.
imgList
=
item
.
imgList
this
.
scenicList
.
splice
(
index
,
1
)
this
.
scenicList
.
unshift
(
item
)
item
.
productListCopy
=
item
.
productList
}
else
{
item
.
productListCopy
=
item
.
productList
.
slice
(
0
,
2
)
}
//预订时间为当天时,当前时间大于最早预订时间显示未开售,当前时间大于最晚预订时间显示已售罄
let
times
=
new
Date
().
Format
(
'hh:mm:ss'
)
let
timeNumber
=
parseInt
(
this
.
$commonjs
.
changeTime
(
times
))
//将当前时间转化为数字
item
.
productList
.
forEach
(
item2
=>
{
item2
.
timeNumber1
=
parseInt
(
this
.
$commonjs
.
changeTime
(
item2
.
earlyBookTime
))
item2
.
timeNumber2
=
parseInt
(
this
.
$commonjs
.
changeTime
(
item2
.
bookTime
))
if
(
item2
.
aheadBookDays
==
0
)
{
if
(
item2
.
status
==
2
)
{
this
.
$request
(
'/scenic/groupGood/getGroupProducts'
,
data
).
then
(
res
=>
{
uni
.
hideLoading
()
if
(
res
.
code
==
'00'
)
{
this
.
scenicList
=
res
.
data
.
merchantList
||
[]
this
.
groupId
=
res
.
data
.
groupId
||
''
this
.
groupChannelId
=
res
.
data
.
groupChannelId
||
''
this
.
scenicList
.
forEach
((
item
,
index
)
=>
{
//获取当前景区图片,把当前景区放在第一位
if
(
item
.
id
==
this
.
merchantId
)
{
this
.
imgList
=
item
.
imgList
this
.
scenicList
.
splice
(
index
,
1
)
this
.
scenicList
.
unshift
(
item
)
item
.
productListCopy
=
item
.
productList
}
else
{
item
.
productListCopy
=
item
.
productList
.
slice
(
0
,
2
)
}
//预订时间为当天时,当前时间大于最早预订时间显示未开售,当前时间大于最晚预订时间显示已售罄
let
times
=
new
Date
().
Format
(
'hh:mm:ss'
)
let
timeNumber
=
parseInt
(
this
.
$commonjs
.
changeTime
(
times
))
//将当前时间转化为数字
item
.
productList
.
forEach
(
item2
=>
{
item2
.
timeNumber1
=
parseInt
(
this
.
$commonjs
.
changeTime
(
item2
.
earlyBookTime
))
item2
.
timeNumber2
=
parseInt
(
this
.
$commonjs
.
changeTime
(
item2
.
bookTime
))
if
(
item2
.
aheadBookDays
==
0
)
{
if
(
item2
.
status
==
2
)
{
item2
.
statusName
=
'已售罄'
}
else
{
if
(
timeNumber
<
item2
.
timeNumber1
)
{
item2
.
status
=
2
item2
.
statusName
=
'未开售'
}
if
(
timeNumber
>
item2
.
timeNumber2
)
{
item2
.
status
=
2
item2
.
statusName
=
'已售罄'
}
else
{
if
(
timeNumber
<
item2
.
timeNumber1
)
{
item2
.
status
=
2
item2
.
statusName
=
'未开售'
}
if
(
timeNumber
>
item2
.
timeNumber2
)
{
item2
.
status
=
2
item2
.
statusName
=
'已售罄'
}
}
}
})
})
this
.
$nextTick
(()
=>
{
this
.
countSwiper
()
})
}
else
{
uni
.
showToast
({
title
:
res
.
message
,
icon
:
'none'
}
})
}
})
})
this
.
$nextTick
(()
=>
{
this
.
countSwiper
()
})
}
else
{
uni
.
showToast
({
title
:
res
.
message
,
icon
:
'none'
})
}
})
.
catch
(
err
=>
{
uni
.
hideLoading
()
})
...
...
pages/indexs/index/index.vue
View file @
43d75e25
...
...
@@ -284,7 +284,7 @@ export default {
//---跳转索道
goSuodao
(){
uni
.
navigateTo
({
url
:
'/pages/
scenic/combinationProduct/combinationProduct
?merchantId=z0015605022691a5945bbe463141668c'
url
:
'/pages/
combination/distributionCombiChoose/distributionCombiChoose
?merchantId=z0015605022691a5945bbe463141668c'
})
},
//---跳转联合国际
...
...
pages/indexs/merchantListIndex/merchantListIndex.vue
View file @
43d75e25
...
...
@@ -215,7 +215,7 @@ export default {
//---跳转产品页面
goProduct
(
merchantId
){
uni
.
navigateTo
({
url
:
'/pages/
scenic/combinationProduct/combinationProduct
?merchantId='
+
merchantId
url
:
'/pages/
combination/distributionCombiChoose/distributionCombiChoose
?merchantId='
+
merchantId
})
},
//---加载数据
...
...
pages/scenic/scenicOrder/scenicOrder.vue
deleted
100644 → 0
View file @
bd4cb2c5
<
template
>
<!-- 临时用,后面需要把代码放入老页面 -->
<view
class=
"orderBox"
>
<view
class=
"head"
>
</view>
<view
class=
"middle"
>
<view
class=
"middle-top"
>
<!-- --------------------------------------------产品信息部分------------------------------------- -->
<view
class=
"middle-Product"
>
<view
class=
"merchantName"
>
<text
class=
"title-text"
>
{{
productIfo
.
merchantName
||
''
}}
</text>
<text>
{{
productIfo
.
name
||
''
}}
</text>
</view>
<view
@
click=
"showBuyKnow()"
class=
"buyKnow"
>
<view>
<text
v-if=
"productIfo.backChangeRule == 0"
>
不可退换
</text>
<text
v-if=
"productIfo.backChangeRule == 1"
>
可退
</text>
<text
v-if=
"productIfo.backChangeRule == 2"
>
随时可退
</text>
<text
v-if=
"productIfo.isFetch == 1"
>
无需取号
</text>
</view>
<view>
购买须知
<u-icon
name=
"arrow-right"
color=
'#FC6703'
></u-icon>
</view>
</view>
</view>
<!--需要排队并且站点数大于1-->
<view
class=
"middle-place"
@
click=
"openArea()"
v-if=
"productIfo.isFetch == 1 && productIfo.productAreaList.length > 1 && areaUp"
>
<view>
出发站点
</view>
<view>
{{
areaObj
.
areaName
||
'请选择站点'
}}
</view>
<view>
<u-icon
name=
"arrow-right"
color=
"#3688FF"
></u-icon>
</view>
</view>
<!--需要排队并且为一个站点-->
<!--
<view
class=
"middle-place"
v-if=
"productIfo.isFetch == 1 && productIfo.productAreaList.length == 1 && areaUp"
@
click=
"getSortInfor()"
>
<view>
获取排队信息
</view>
<view>
{{
areaObj
.
areaName
}}
</view>
<view>
<u-icon
name=
"arrow-right"
color=
"#3688FF"
></u-icon>
</view>
</view>
-->
<view
class=
"middle-Date"
>
<view
class=
"title-text"
>
游玩日期
</view>
<view
class=
"middle-Datelist"
>
<scroll-view
class=
"date-content"
scroll-x=
"true"
:scroll-left=
"dateScroll"
v-if=
"dateList.length > 0"
>
<view
class=
"date-list"
v-for=
"(item, index) of dateList"
:class=
"
{ on: active == index }" @click="dateChoose(index)" :key="index">
<view
v-if=
"item.week"
>
<text
v-if=
"item.week != '今天' && item.week != '明天' && item.week != '后天'"
>
周
</text>
{{
item
.
week
}}
</view>
<view>
{{
item
.
startTime
?
item
.
startTime
.
substr
(
5
,
5
)
:
''
}}
</view>
<view
class=
"date-price"
>
¥
<text
style=
"font-weight: bold;"
>
{{
item
.
sellingPrice
}}
</text>
</view>
<view
v-if=
"active == index"
class=
"date-icon"
>
<u-icon
name=
"checkmark"
color=
"#ffffff"
></u-icon>
</view>
</view>
</scroll-view>
<text
v-else
class=
"no-date"
>
不可购买
</text>
<view
class=
"dateMore"
@
click=
"showCalendar()"
>
<view
class=
"date-more-content"
>
<view>
更多
</view>
<view>
日期
</view>
</view>
<u-icon
name=
"arrow-right"
></u-icon>
</view>
</view>
</view>
<view
class=
"middle-time"
v-if=
"productIfo.productType == 3"
>
<view
class=
"title-text"
>
场次
</view>
<view
class=
"middle-timelist"
>
<scroll-view
class=
"time-content"
scroll-x=
"true"
:scroll-left=
"timeScroll"
v-if=
"timeList.length> 0"
>
<view
class=
"time-list"
:style=
"
{color:item.copyLast=='售罄'?'#ff0000':''}"
v-for="(item, index) of timeList"
@click="chooseTime(index)"
:class="{ on: timeActive == index }"
:key="index"
>
<view
>
{{
item
.
startPlanTime
?
item
.
startPlanTime
.
substr
(
0
,
5
)
:
''
}}
<text
v-if=
"!item.saleOnlyShowFromDate"
>
-
{{
item
.
endPlanTime
?
item
.
endPlanTime
.
substr
(
0
,
5
)
:
''
}}
</text>
</view>
<view>
<text
v-if=
"item.copyLast!='余票充足'&&item.copyLast!='售罄'"
>
剩余:
</text>
{{
item
.
copyLast
}}
</view>
<view
v-if=
"timeActive == index"
class=
"date-icon"
>
<u-icon
name=
"checkmark"
color=
"#ffffff"
></u-icon>
</view>
</view>
</scroll-view>
<text
class=
"no-time"
v-if=
"startDate && endDate && timeList.length == 0"
>
该日票种已售罄,请选择其他日期
</text>
<text
class=
"no-time"
v-if=
"!startDate || !endDate"
>
请先选游玩日期
</text>
<view
class=
"timeMore"
@
click=
"showTime()"
>
<view
class=
"time-more-content"
>
<view>
更多
</view>
<view>
场次
</view>
</view>
<u-icon
name=
"arrow-right"
></u-icon>
</view>
</view>
</view>
<view
class=
"middle-divider"
>
</view>
<view
class=
"middle-Number"
>
<view
class=
"title-text"
>
购买数量
</view>
<view>
<u-number-box
v-model=
"buyNum"
@
change=
'buyNumChange'
:max=
"maxBookNum"
>
<view
slot=
"minus"
class=
"number-minus"
>
<u-icon
name=
"minus"
color=
"#FFFFFF"
size=
"32"
></u-icon>
</view>
<text
slot=
"input"
class=
"number-input"
>
{{
buyNum
}}
</text>
<view
slot=
"plus"
class=
"number-plus"
>
<u-icon
name=
"plus"
color=
"#FFFFFF"
size=
"32"
></u-icon>
</view>
</u-number-box>
</view>
</view>
<view
class=
" middle-coupon"
v-if=
"couponData.length>0"
@
click=
"showCoupon()"
>
<view>
券
</view>
<!-- 有可用优惠券,并且未选中 -->
<template
v-if=
"couponData.masterSlaveCouponList&&couponData.masterSlaveCouponList.length>0&&!chooseCouponObj"
>
<view>
{{
couponData
.
masterSlaveCouponList
[
0
].
couponName
}}
</view>
<view
>
未使用优惠券
</view>
</
template
>
<!-- 有可用优惠券 -->
<
template
v-if=
"chooseCouponObj&&savedMoney>0"
>
<view>
{{
chooseCouponObj
.
couponName
}}
</view>
<view
style=
"font-size: 32rpx;"
>
<text
style=
"font-size: 24rpx;position: relative;top: 6rpx;"
>
¥
</text>
{{
parseFloat
(
savedMoney
.
toFixed
(
2
))
}}
</view>
</
template
>
<!-- 可用优惠券条件-->
<
template
v-if=
"ableConpon"
>
<view>
{{
ableConpon
.
couponName
}}
</view>
<view>
{{
ableConpon
.
couponRule
}}
</view>
</
template
>
<u-icon
name=
"arrow-right"
color=
"#3688FF"
></u-icon>
</view>
<!-- --------------------------------------------额外服务部分-------------------------------------------- -->
<view
class=
"extraService"
v-if=
"serviceList.length>0&&showErmai"
>
<checkbox-group
@
change=
"extraChange"
>
<view
v-for=
"(item,index) of serviceList"
:key=
"item.id"
>
<label>
<view>
<text>
{{item.name}}
</text>
<text
style=
"font-size:20rpx;color: #666666;"
v-if=
"item.deposit"
>
(押金:¥{{item.deposit}})
</text>
</view>
<view>
<text
style=
"font-size: 24rpx;"
>
¥
</text>
<text
style=
"font-size: 32rpx;font-weight: bold;"
>
{{item.sellingPrice}}
</text>
<checkbox
class=
"blue"
:value=
"JSON.stringify(item)"
style=
"transform: scale(0.7);position: relative;left: 10rpx;"
:checked=
"item.ifChoose"
/>
</view>
</label>
</view>
</checkbox-group>
</view>
<!-- -----------------------------------支付之后有额外服务,没有选额外服务的弹窗------------------------- -->
<u-popup
:show=
"showExtraPop"
:round=
"20"
@
close=
"showExtraPop = false"
closeable
>
<view
class=
"extra-wrap"
>
<view
style=
"font-weight: bold;font-size: 32rpx;"
>
云智能导览耳机
</view>
<view
style=
"color: #666666;margin:40rpx 0;"
>
深度了解索道典故由来,周边攻略推荐
</view>
<view>
<text
@
click=
"extraNo()"
class=
"btn"
style=
"background: #fff;color: #333;border: 1px solid #c0c0c0;"
>
不需要
</text>
<text
@
click=
"extraYes()"
class=
"btn"
style=
"margin-left: 40rpx;"
>
需要
</text>
</view>
</view>
</u-popup>
</view>
<view
class=
"middle-divider"
>
</view>
<!-- ---------------------------------------------游客信息-------------------------------------------- -->
<view
class=
"middle-bottom"
v-if=
"productIfo.tripTemplateFlag != 2"
>
<view
class=
"middle-visitor"
>
<view
class=
"visitorTitle"
>
<text
class=
"title-text"
>
用户信息
</text>
<text>
需填
<text
class=
"title-bold"
>
{{ contactNum }}
</text>
位出行人
<!-- <text class="title-bold" v-if="contactNum - chooseContact.length > 0">,还需{{ contactNum - chooseContact.length }}位</text> -->
</text>
</view>
<view
class=
"visitorPlus"
v-if=
"contactTotal.length>0"
>
<!-- 这里key必须是index,如果是id会出现数据改变和样式不改变的bug -->
<view
class=
"plus-list"
:class=
"{on:item.ifChoose}"
v-for=
"(item, index) of contactTotal.slice(0, 3)"
@
click=
"visitorChoose(index)"
:key=
"index"
>
{{ item.name }}
<view
v-if=
"item.ifChoose"
class=
"date-icon"
>
<u-icon
name=
"checkmark"
color=
"#ffffff"
></u-icon>
</view>
</view>
<view
@
click=
"showContacts()"
class=
"plus-list plus-list-last"
>
选择/新增
<u-icon
name=
"arrow-right"
color=
"#3688FF"
></u-icon>
</view>
</view>
<view
class=
"visitorBtn"
v-else
@
click=
"$refs.editContacts.showEdit = true"
>
<u-icon
name=
"plus-circle"
color=
"#3688FF"
size=
"52"
></u-icon>
<text
style=
"margin-left:16rpx;"
>
新增
</text>
</view>
<view
class=
"visitorEdit"
v-show=
"chooseContact.length > 0"
>
<view
class=
"edit-list"
v-for=
"(item, index) of chooseContact"
:key=
"item.id"
>
<view
@
click=
"delChooseContact(item, index)"
>
<u-icon
name=
"close-circle"
color=
"#3688ff"
size=
"40"
></u-icon>
</view>
<view>
{{ item.name }}
</view>
<view>
{{ item.credentialNumber ? item.credentialNumber.substr(0, 3) + '****' + item.credentialNumber.substr(14, 4) : '' }}
</view>
<view
@
click=
"showEdit(item)"
>
<u-icon
name=
"edit-pen-fill"
color=
"#3688ff"
size=
"48"
></u-icon>
</view>
</view>
</view>
</view>
<view
class=
"middle-phone"
v-if=
"productIfo.tripTemplateFlag != 2"
>
<text>
联系电话:
</text>
<input
type=
"number"
maxlength=
"11"
placeholder=
"请输入联系电话"
v-model
.
trim=
"ticketPhone"
/>
</view>
</view>
<!-- ---------------------------------------------产品押金部分---------------------------------------- -->
<view
class=
"productDeposit"
v-if=
"productIfo.deposit"
>
<view>
{{ productIfo.name }}
<text
style=
"color: #FC6703;margin-left: 10rpx;"
>
押金
</text>
</view>
<view
style=
"color: #FC6703"
>
{{ productIfo.deposit }}元
</view>
</view>
</view>
<view
class=
"bottom"
>
<view
class=
"bottom-left"
>
<text>
¥{{ originalTotal || 0 }}
</text>
<text>
<text>
¥
</text>
{{ sellTotal || 0 }}
</text>
</view>
<view
class=
"bottom-right"
>
<view
@
click=
"showDetail()"
class=
"bottom-detail"
>
明细
<u-icon
name=
"arrow-down"
></u-icon>
</view>
<view
class=
"bottom-btn"
>
<text
v-if=
"productIfo.status == 1"
>
已下架
</text>
<
template
v-else
>
<text
v-if=
"parseInt(maxBookNum)
<1
"
>
暂无库存
</text>
<text
v-if=
"parseInt(maxBookNum) >0"
@
click=
"goPay()"
style=
"background:#3688FF;"
>
去支付
</text>
</
template
>
</view>
</view>
</view>
<calendar
ref=
"calendar"
@
dateConfig=
"dateConfig"
:dateList=
"dateList"
v-if=
"dateList.length > 0"
></calendar>
<buyKnow
ref=
"buyKnow"
:buyKnowData=
"buyKnowData"
></buyKnow>
<detail
ref=
"detail"
:sellTotal=
'sellTotal'
:merchantName=
"productIfo.merchantName"
:name=
"productIfo.name"
:buyNum=
"buyNum"
:sellingPrice=
"sellingPrice"
:chooseService=
"chooseService"
:productDepositTotal=
"productDepositTotal"
:chooseCouponObj=
"chooseCouponObj"
></detail>
<chooseArea
v-if=
"showArea"
:areaList=
"productIfo.productAreaList"
@
areaSure=
"areaSure"
:sortArr=
"sortArr"
:defaultAreaCode=
"defaultAreaCode"
></chooseArea>
<times
ref=
"times"
:chooseTimeList=
"timeList"
@
timeConfig=
"timeConfig"
:timeActive=
"timeActive"
></times>
<editContacts
ref=
"editContacts"
:editContact=
"editContact"
:contactTotal=
"contactTotal"
></editContacts>
<contactList
ref=
"contactList"
@
getEditContact=
"getEditContact"
:contactTotal=
"contactTotal"
:contactNum=
"contactNum"
></contactList>
<orderCoupon
:couponData=
"couponData"
ref=
"orderCoupon"
@
couponChoose=
"couponChoose"
:chooseCouponObj=
"chooseCouponObj"
></orderCoupon>
<!--一个站点时获取排队信息弹窗-->
<!-- <u-popup :show="sortInforPop" :round="10" closeable @close="sortInforPop = false">
<view style="padding: 40rpx 60rpx">
<view>
景区名称:
<text class="sortPoptext" style="font-size: 28rpx">{{ productIfo.merchantName }}</text>
</view>
<view style="margin-top: 40rpx">
排队人数:
<text class="sortPoptext">{{ sortIfo.peopleNumber }}</text>
</view>
<view style="margin-top: 40rpx">
当前可排队:
<text class="sortPoptext">{{ sortIfo.showStart }}-</text>
<text class="sortPoptext">{{ sortIfo.showEnd }}</text>
</view>
<view style="margin-top: 40rpx">
当前排号至:
<text class="sortPoptext">{{ sortIfo.sortTotalCapacity }}</text>
</view>
<view style="margin-top: 40rpx; text-align: center" @click="sortInforPop = false">
<text class="middle-btn">确定</text>
</view>
</view>
</u-popup> -->
</view>
</template>
<
script
>
import
calendar
from
'../scenicComponents/calendar'
//日历组件
import
buyKnow
from
'@/components/buyKnow.vue'
//购票须知
import
orderCoupon
from
'@/components/orderCoupon'
//优惠券
import
detail
from
'../scenicComponents/detail.vue'
//明细弹窗
import
chooseArea
from
'../scenicComponents/chooseArea'
//选择站点
import
contactList
from
'../scenicComponents/contactList'
//联系人弹窗
import
editContacts
from
'../scenicComponents/editContacts'
//编辑联系人弹窗
import
times
from
'../scenicComponents/times'
//更多时间弹窗
export
default
{
components
:
{
calendar
,
buyKnow
,
detail
,
contactList
,
editContacts
,
times
,
chooseArea
,
orderCoupon
},
data
()
{
return
{
defaultAreaCode
:
''
,
//默认站点
sortArr
:
[],
//多个站点排号信息列表
sortIfo
:
''
,
//单个站点排号信息
sortInforPop
:
false
,
//一个站点时获取排队信息弹窗
showErmai
:
true
,
//临时的,选择了南站不显示耳麦
showArea
:
false
,
//控制选择站点显示隐藏
areaUp
:
false
,
//排号是否上架
active
:
10000
,
//日期下标
timeActive
:
10000
,
//时间下标,默认不选中
buyNum
:
1
,
//订单数量
maxBookNum
:
999
,
//最大预订数量
dateList
:
[],
//日期列表
timeList
:
[],
//时间列表
buyKnowData
:
''
,
//购买须知数据
editContact
:
''
,
//编辑联系人传值对象
productId
:
''
,
//产品Id
merchantId
:
''
,
//商户Id
ticketPhone
:
''
,
//联系电话
productIfo
:
''
,
//初始化产品基本信息
originalPrice
:
0
,
//原价单价
sellingPrice
:
0
,
//卖价单价
interfaceCode
:
''
,
//接口编号
merchantCode
:
''
,
//商户code
productCode
:
''
,
//产品code
contactTotal
:
[],
//所有联系人列表
chooseContact
:
[],
//选中的游客信息列表
contactNum
:
1
,
//需要选择几位联系人数量
cruisePlanId
:
''
,
//班次Id
timeNumber
:
''
,
//当前时间转化为数字
startDate
:
''
,
//开始日期
endDate
:
''
,
//结束日期
startPlayTime
:
''
,
//开始时间
endPlayTime
:
''
,
//结束时间
areaObj
:
{},
//区域组件的传值
templateList
:
[],
//该产品联系人必须要填写的信息
timeFlag
:
''
,
//setTimeout函数
savedMoney
:
0
,
//优惠价格
serviceList
:
[],
//所有额外服务
chooseService
:
[],
//选中的额外服务
extraPrice
:
0
,
//额外服务总价格
showExtraPop
:
false
,
//控制支付时有额外服务,没有选中额外服务的弹窗显示隐藏
orderProductList
:
[],
//额外服务,儿童票等入参
productDepositTotal
:
0
,
//产品总押金
orderSource
:
''
,
//订单来源 1公众号平台、2公众号组合页面1、3公众号组合页面2、4胖丁伙伴app、5第三方自助机、6第三方票房窗口
thirdOpenid
:
''
,
//第三方openid
beforeBookDays
:
''
,
//需提前预定天数
companyId
:
''
,
//公司Id
docQuery
:
''
,
//元素变量
dateScroll
:
''
,
//日期滚动值
timeScroll
:
''
,
//时间滚动值
openid
:
uni
.
getStorageSync
(
'openid'
)
||
''
,
//openid
couponData
:[],
//所有劵数据
chooseCouponObj
:
''
,
//默认选中最优价格优惠券
ableConpon
:
''
,
//没有可用优惠券时,达到一定条件可用,显示达到的条件
}
},
onLoad
(
option
)
{
let
times
=
new
Date
().
Format
(
'yyyy-MM-dd hh:mm:ss'
)
this
.
timeNumber
=
parseInt
(
this
.
$commonjs
.
changeTime
(
times
))
//将当前时间转化为数字
this
.
companyId
=
option
.
companyId
||
''
this
.
orderSource
=
option
.
orderSource
||
''
this
.
thirdOpenid
=
option
.
thirdOpenid
||
''
//第三方openid
this
.
productId
=
option
.
productId
||
''
this
.
initData
()
//页面初始化数据
this
.
docQuery
=
uni
.
createSelectorQuery
().
in
(
this
)
},
computed
:
{
originalTotal
()
{
//原价总价
if
(
this
.
chooseService
.
length
>
0
)
{
//额外服务价格和押金总价格
let
singleProduct
=
0
//单个产品押金
this
.
extraPrice
=
0
this
.
extraDepositTotal
=
0
//总押金
for
(
let
i
=
0
;
i
<
this
.
chooseService
.
length
;
i
++
)
{
this
.
extraPrice
+=
parseFloat
((
this
.
chooseService
[
i
].
sellingPrice
*
this
.
buyNum
).
toFixed
(
2
))
if
(
this
.
chooseService
[
i
].
depositType
==
1
)
{
//等于1,押金金额跟数量没关系
singleProduct
=
this
.
chooseService
[
i
].
deposit
}
else
if
(
this
.
chooseService
[
i
].
depositType
==
2
)
{
//等于2,押金单价乘购买数量
singleProduct
=
parseFloat
((
this
.
chooseService
[
i
].
deposit
*
this
.
buyNum
).
toFixed
(
2
))
}
this
.
extraDepositTotal
+=
singleProduct
}
}
else
{
this
.
extraPrice
=
0
this
.
extraDepositTotal
=
0
}
if
(
this
.
productIfo
.
deposit
)
{
//如果有押金
if
(
this
.
productIfo
.
depositType
==
1
)
{
//等于1,押金金额跟数量没关系
this
.
productDepositTotal
=
this
.
productIfo
.
deposit
}
else
if
(
this
.
productIfo
.
depositType
==
2
)
{
//等于2,押金单价乘购买数量
this
.
productDepositTotal
=
parseFloat
((
this
.
productIfo
.
deposit
*
this
.
buyNum
).
toFixed
(
2
))
}
}
else
{
this
.
productDepositTotal
=
0
}
return
parseFloat
((
this
.
originalPrice
*
this
.
buyNum
+
this
.
productDepositTotal
+
this
.
extraPrice
+
this
.
extraDepositTotal
).
toFixed
(
2
))
//产品总价+产品押金+额外产品总价+额外产品押金-优惠价格
},
sellTotal
()
{
//卖价总价
if
(
this
.
chooseService
.
length
==
0
)
{
this
.
extraPrice
=
0
this
.
extraDepositTotal
=
0
}
return
parseFloat
(
(
this
.
sellingPrice
*
this
.
buyNum
+
this
.
productDepositTotal
+
this
.
extraPrice
+
this
.
extraDepositTotal
-
this
.
savedMoney
).
toFixed
(
2
)
)
//产品总价+产品押金+额外产品总价+额外产品押金-优惠价格
}
},
methods
:
{
//---页面初始化数据,获取产品基本信息
initData
()
{
let
data
=
{
id
:
this
.
productId
//产品id
}
uni
.
showLoading
({
title
:
'加载中'
,
mask
:
true
})
this
.
$request
(
'scenic/groupGood/loadProduct'
,
data
).
then
(
res
=>
{
if
(
res
.
code
==
'00'
)
{
this
.
productIfo
=
res
.
data
this
.
defaultAreaCode
=
this
.
productIfo
.
defaultAreaCode
||
''
this
.
merchantCode
=
this
.
productIfo
.
merchantVo
.
code
,
//商户code
this
.
productId
=
res
.
data
.
id
//产品id变化,重新赋值产品id
this
.
merchantId
=
res
.
data
.
merchantId
//重新赋值商户id
this
.
beforeBookDays
=
res
.
data
.
beforeBookDays
||
0
//提前预定天数
this
.
buyKnowData
=
res
.
data
//购买须知,传给子组件
this
.
serviceList
=
res
.
data
.
loadProductResVoList
//额外服务
//this.chooseService=res.data.data.loadProductResVoList//默认全部选中
if
(
this
.
productIfo
.
status
==
1
)
{
//下架状态
return
}
if
(
this
.
productIfo
.
productType
!=
3
)
{
//不为班次票时,开始时间为当前时间,结束时间为23:59:59
this
.
startPlayTime
=
new
Date
().
Format
(
'hh:mm:ss'
)
this
.
endPlayTime
=
'23:59:59'
}
this
.
getPriceList
()
}
else
{
uni
.
showToast
({
title
:
res
.
message
,
icon
:
'none'
})
}
})
},
//---获取产品价格库存列表
getPriceList
()
{
let
data
=
{
productId
:
this
.
productId
//产品id
}
this
.
$request
(
'scenic/user/product/priceStockList'
,
data
).
then
(
res
=>
{
if
(
res
.
code
==
'00'
)
{
this
.
dateList
=
res
.
data
//日期列表
if
(
this
.
dateList
.
length
>
0
)
{
let
time1
=
this
.
dateList
[
0
].
startTime
.
substr
(
0
,
10
)
+
this
.
productIfo
.
bookTime
//获取价格列表的第一个日期+预订最晚时间
let
timeNum1
=
parseInt
(
this
.
$commonjs
.
changeTime
(
time1
))
let
time2
=
new
Date
().
Format
(
'yyyy-MM-dd hh:mm:ss'
)
let
timeNum2
=
parseInt
(
this
.
$commonjs
.
changeTime
(
time2
))
//将当前时间转化为数字
if
(
timeNum2
>
timeNum1
)
{
//如果当前时间大于价格列表第一个日期+预订最晚时间,第一个价格不显示
this
.
dateList
.
splice
(
0
,
1
)
}
this
.
dateList
.
forEach
((
item
,
index
)
=>
{
//价格上面时间小于当前时间加上需预定天数之后的需删除
let
date
=
new
Date
()
date
.
setDate
(
date
.
getDate
()
+
this
.
beforeBookDays
)
let
newDate
=
date
.
Format
(
'yyyy-MM-dd'
)
let
priceTime
=
this
.
$commonjs
.
changeTime
(
item
.
endTime
.
substr
(
0
,
10
))
let
newTime
=
this
.
$commonjs
.
changeTime
(
newDate
)
if
(
priceTime
<
newTime
)
{
delete
this
.
dateList
[
index
]
}
})
this
.
dateList
=
this
.
dateList
.
filter
(
val
=>
{
return
val
})
if
(
this
.
dateList
.
length
==
0
)
{
uni
.
showToast
({
title
:
'没有库存'
,
icon
:
'none'
})
this
.
maxBookNum
=
0
return
}
if
(
this
.
productIfo
.
isFetch
==
1
)
{
this
.
sortUpDown
()
}
if
(
this
.
productIfo
.
tripTemplateFlag
!=
2
)
{
//等于2时不需要填写联系人信息和手机号码
this
.
getContactList
()
}
if
(
this
.
dateList
.
length
==
1
&&
this
.
beforeBookDays
==
0
)
{
//长度为1而且只能预订当天,默认选中
this
.
$nextTick
(()
=>
{
this
.
dateChoose
(
0
)
})
}
}
else
{
uni
.
showToast
({
title
:
'没有库存'
,
icon
:
'none'
})
this
.
maxBookNum
=
0
return
}
let
today
=
this
.
$commonjs
.
today
()
//今天
let
tomorrow
=
this
.
$commonjs
.
tomorrow
()
//明天
let
afterTomorrow
=
this
.
$commonjs
.
afterTomorrow
()
//后天
this
.
dateList
.
forEach
((
item
,
index
)
=>
{
item
.
week
=
'日一二三四五六'
.
charAt
(
new
Date
(
item
.
startTime
.
substr
(
0
,
10
)).
getDay
())
if
(
item
.
startTime
.
substr
(
0
,
10
)
==
today
)
{
item
.
week
=
'今天'
}
if
(
item
.
startTime
.
substr
(
0
,
10
)
==
tomorrow
)
{
item
.
week
=
'明天'
}
if
(
item
.
startTime
.
substr
(
0
,
10
)
==
afterTomorrow
)
{
item
.
week
=
'后天'
}
})
}
else
{
uni
.
showToast
({
title
:
res
.
message
,
icon
:
'none'
})
}
})
},
//---排号是否上下架
sortUpDown
()
{
let
data
=
{
merchantCode
:
this
.
merchantCode
//商户code
}
uni
.
showLoading
({
title
:
'加载中'
,
mask
:
true
})
this
.
$request
(
'distribution/distribution/findNewFetchInfoFromSceinc'
,
data
).
then
(
res
=>
{
if
(
res
.
code
==
'00'
)
{
this
.
sortArr
=
res
.
data
.
data
let
data
=
res
.
data
let
areaList
=
this
.
productIfo
.
productAreaList
if
(
areaList
.
length
>
1
)
{
//有库存并且需要选择两个站点以上的票种,显示区域组件
for
(
let
item
in
data
.
main
)
{
if
(
data
.
main
[
item
].
sceneSortStatus
==
'1'
){
//上架
this
.
areaUp
=
true
this
.
showArea
=
true
//通过默认站点找到站点数据
if
(
this
.
defaultAreaCode
)
{
areaList
.
forEach
(
item
=>
{
if
(
item
.
areaCode
==
this
.
defaultAreaCode
)
{
this
.
areaObj
.
areaCode
=
item
.
areaCode
this
.
areaObj
.
areaName
=
item
.
areaName
}
})
}
}
}
}
else
if
(
areaList
.
length
==
1
)
{
//只有一个站点时,直接选中站点(现目前还没有一个站点的景区)
for
(
let
item
in
data
.
main
)
{
if
(
data
.
main
[
item
].
sceneSortStatus
==
'1'
)
{
//上架
this
.
areaUp
=
true
this
.
areaObj
.
areaCode
=
areaList
[
0
].
areaCode
this
.
areaObj
.
areaName
=
areaList
[
0
].
areaName
}
}
}
}
})
},
//---获取班次票
getTimeStock
()
{
this
.
timeList
=
[]
let
data
=
{
endDate
:
this
.
endDate
,
//结束日期
startDate
:
this
.
startDate
,
//开始日期
interfaceCode
:
this
.
productIfo
.
merchantVo
.
interfaceCompanyId
,
//接口编号
merchantCode
:
this
.
merchantCode
,
//商户code
productCode
:
this
.
productIfo
.
code
//产品code
}
uni
.
showLoading
({
title
:
'加载中'
,
mask
:
true
})
this
.
$request
(
'distribution/distribution/getTimeStock'
,
data
).
then
(
res
=>
{
if
(
res
.
code
==
'00'
)
{
this
.
timeList
=
res
.
data
||
[]
this
.
timeList
.
forEach
((
item
,
index
)
=>
{
//增加一个时间Number字段,用于判断当前时间大于班次结束时间时,显示售罄
let
text
=
parseFloat
((
item
.
last
/
item
.
total
).
toFixed
(
2
))
||
0
if
(
text
>
0.4
){
item
.
copyLast
=
'余票充足'
}
else
{
item
.
copyLast
=
item
.
last
}
item
.
timeNumber
=
parseInt
(
this
.
$commonjs
.
changeTime
(
item
.
planDate
.
substr
(
0
,
10
)
+
item
.
endPlanTime
))
if
(
this
.
timeNumber
>
item
.
timeNumber
||
item
.
last
<=
0
)
{
item
.
copyLast
=
'售罄'
}
})
}
else
{
uni
.
showToast
({
title
:
res
.
message
,
icon
:
'none'
})
}
})
},
//---获取排号信息
getSortInfor
()
{
let
data
=
{
areaCode
:
this
.
areaObj
.
areaCode
,
merchantCode
:
this
.
merchantCode
//商户code
}
uni
.
showLoading
({
title
:
'加载中'
,
mask
:
true
})
this
.
$request
(
'distribution/distribution/findNewFetchInfoFromSceinc'
,
data
).
then
(
res
=>
{
if
(
res
.
code
==
'00'
)
{
this
.
sortInforPop
=
true
res
.
data
.
forEach
(
item
=>
{
item
.
peopleNumber
=
Math
.
max
(
item
.
sortTotalCapacity
-
item
.
showEnd
,
0
)
})
let
index
=
res
.
data
.
findIndex
(
item
=>
{
return
item
.
projectId
==
this
.
areaObj
.
areaCode
})
this
.
sortIfo
=
res
.
data
[
index
]
}
})
},
//---获取子组件的传值
areaSure
(
data
)
{
this
.
areaObj
=
data
if
(
this
.
areaObj
.
areaCode
==
'cjsd_project_0001'
)
{
//选择了南站不显示耳麦
this
.
showErmai
=
false
this
.
chooseService
=
[]
//多选框状态设置成未选中
this
.
serviceList
.
forEach
(
item
=>
{
item
.
ifChoose
=
false
})
}
else
{
this
.
showErmai
=
true
}
},
//---展示选择站点
openArea
()
{
this
.
showArea
=
true
},
//---关闭选择站点
closeArea
()
{
this
.
showArea
=
false
},
//---展示详情弹窗
showDetail
()
{
this
.
$refs
.
detail
.
showPop
=
true
},
//---展示日历
showCalendar
()
{
this
.
$refs
.
calendar
.
showPop
=
true
},
//---日期选择
dateChoose
(
index
)
{
this
.
active
=
index
//修改选中样式
this
.
maxBookNum
=
Math
.
min
(
this
.
dateList
[
index
].
surplus
,
this
.
productIfo
.
maxBookNum
)
//剩余量变化
this
.
originalPrice
=
this
.
dateList
[
index
].
originalPrice
//原价变化
this
.
sellingPrice
=
this
.
dateList
[
index
].
sellingPrice
//卖价变化
this
.
endDate
=
this
.
dateList
[
index
].
endTime
//开始日期
this
.
startDate
=
this
.
dateList
[
index
].
startTime
//结束日期
this
.
$refs
.
calendar
.
defaultDate
=
this
.
dateList
[
index
].
startTime
.
substr
(
0
,
10
)
//日历组件选中日期
this
.
initCoupon
()
if
(
this
.
productIfo
.
productType
==
3
){
//productType=3为场次票
this
.
cruisePlanId
=
''
//清空班次id
this
.
timeActive
=
10000
this
.
getTimeStock
()
}
// uni.$u.throttle(()=>{
// 1.通过日历插件选择日期之后未执行该方法
// 2.用了该方法之后点击其他日期也会3秒之内无效果,
// },3000)
},
//---日历确认事件
dateConfig
(
data
)
{
let
index
=
this
.
dateList
.
findIndex
(
item
=>
{
return
item
.
startTime
.
substr
(
0
,
10
)
==
data
})
this
.
dateChoose
(
index
)
this
.
docQuery
.
selectAll
(
'.date-list'
).
boundingClientRect
(
data
=>
{
this
.
dateScroll
=
(
data
[
index
].
width
+
6
)
*
index
}).
exec
()
},
//---展示更多时间
showTime
()
{
this
.
$refs
.
times
.
showPop
=
true
},
//---时间选择
chooseTime
(
i
)
{
if
(
this
.
timeList
[
i
].
copyLast
!=
'售罄'
){
this
.
timeActive
=
i
this
.
cruisePlanId
=
this
.
timeList
[
i
].
cruisePlanId
//获取班次Id
this
.
maxBookNum
=
Math
.
min
(
this
.
timeList
[
i
].
last
,
this
.
maxBookNum
)
//获取剩余库存
//如果为班次票,开始时间为班次时间的开始时间,结束时间为班次时间的结束时间,班次时间的结束时间为空时,结束时间为班次时间的开始时间
this
.
startPlayTime
=
this
.
timeList
[
i
].
startPlanTime
this
.
endPlayTime
=
this
.
timeList
[
i
].
endPlanTime
||
this
.
timeList
[
i
].
startPlanTime
}
},
//---时间确认事件
timeConfig
(
index
)
{
this
.
chooseTime
(
index
)
//选中确认的日期
this
.
docQuery
.
selectAll
(
'.time-list'
).
boundingClientRect
(
data
=>
{
this
.
timeScroll
=
(
data
[
index
].
width
+
6
)
*
index
}).
exec
()
},
//---获取点击的编辑联系人信息,传给编辑联系人组件
getEditContact
(
data
)
{
this
.
editContact
=
data
},
//---删除选中的联系人
delChooseContact
(
item
,
index
)
{
//所有联系人中找到删除联系人下标,改成未选中状态
let
sub
=
this
.
contactTotal
.
findIndex
(
item2
=>
item2
.
id
==
item
.
id
)
this
.
contactTotal
[
sub
].
ifChoose
=
false
this
.
chooseContact
.
splice
(
index
,
1
)
//删除数组
},
//---展示编辑联系人
showEdit
(
obj
)
{
this
.
$refs
.
editContacts
.
showEdit
=
true
this
.
editContact
=
obj
},
//---展示新增联系人,并获取联系人列表
showContacts
()
{
this
.
$refs
.
contactList
.
showPop
=
true
},
//---游客选择
visitorChoose
(
i
)
{
let
chooseList
=
this
.
chooseContact
let
data
=
this
.
contactTotal
data
[
i
].
ifChoose
=
!
data
[
i
].
ifChoose
if
(
data
[
i
].
ifChoose
)
{
if
(
chooseList
.
length
==
this
.
contactNum
)
{
//需要人数满足时,点击增加联系人时,删除最后一个,增加点击的那个人
chooseList
[
chooseList
.
length
-
1
].
ifChoose
=
false
chooseList
.
splice
(
chooseList
.
length
-
1
,
1
)
}
chooseList
.
push
(
data
[
i
])
//加入数组
}
else
{
let
index
=
chooseList
.
findIndex
(
items
=>
{
return
items
.
id
==
data
[
i
].
id
})
chooseList
.
splice
(
index
,
1
)
//删除数组
}
this
.
$forceUpdate
()
},
//---订单数量变化
buyNumChange
(
e
)
{
if
(
e
.
value
>=
this
.
maxBookNum
)
{
uni
.
showToast
({
title
:
'最大可预订数量为'
+
this
.
maxBookNum
,
icon
:
'none'
})
}
if
(
this
.
productIfo
.
tripTemplateFlag
==
1
)
{
//实名制
this
.
contactNum
=
e
.
value
if
(
this
.
chooseContact
.
length
>
this
.
contactNum
)
{
//当选中联系人数量大于购买数量时
this
.
chooseContact
.
splice
(
this
.
chooseContact
.
length
-
1
,
1
)
//删除多余的联系人
//联系人列表重新判断是否选中
this
.
contactTotal
.
forEach
(
item
=>
{
item
.
ifChoose
=
false
})
this
.
chooseContact
.
forEach
(
item
=>
{
this
.
contactTotal
.
forEach
(
item2
=>
{
if
(
item
.
id
==
item2
.
id
){
item2
.
ifChoose
=
true
}
})
})
}
}
if
(
this
.
productIfo
.
tripTemplateFlag
==
0
)
{
//非实名制
this
.
contactNum
=
1
}
clearTimeout
(
this
.
timeFlag
)
this
.
timeFlag
=
setTimeout
(()
=>
{
this
.
initCoupon
()
},
1500
)
},
//---展示购票须知
showBuyKnow
()
{
this
.
$refs
.
buyKnow
.
showPop
=
true
},
//---初始化联系人列表
getContactList
()
{
let
data
=
{
openid
:
this
.
openid
}
this
.
$request
(
'wechatUser/contact/findContactList'
,
data
).
then
(
res
=>
{
if
(
res
.
code
==
'00'
)
{
this
.
contactTotal
=
res
.
data
this
.
contactTotal
.
forEach
(
item
=>
{
//用于判断是否被选中
item
.
ifChoose
=
false
})
//编辑成功重新调该方法时,把之前选中的游客,设为选中状态
this
.
contactTotal
.
forEach
(
item
=>
{
this
.
chooseContact
.
forEach
(
item2
=>
{
if
(
item
.
id
==
item2
.
id
)
{
item
.
ifChoose
=
true
}
})
})
//删除联系人成功重新调该方法时,之前选中的联系人,数据库可能被删除,删除该联系人
this
.
chooseContact
.
forEach
((
item
,
index
)
=>
{
if
(
!
this
.
contactTotal
.
find
(
item2
=>
item
.
id
==
item2
.
id
))
{
this
.
chooseContact
.
splice
(
index
,
1
)
}
})
}
else
{
uni
.
showToast
({
title
:
res
.
message
,
icon
:
'none'
})
}
})
},
//---添加并选中联系人--用于添加联系人之后直接从联系人列表选出需要填写的几位联系人
addChoose
()
{
let
data
=
{
openid
:
this
.
openid
}
this
.
$request
(
'wechatUser/contact/findContactList'
,
data
).
then
(
res
=>
{
if
(
res
.
code
==
'00'
)
{
this
.
contactTotal
=
res
.
data
for
(
let
i
=
0
;
i
<
this
.
contactNum
;
i
++
)
{
let
item
=
this
.
contactTotal
[
i
]
||
null
if
(
item
)
{
item
.
ifChoose
=
true
}
}
this
.
chooseContact
=
this
.
contactTotal
.
slice
(
0
,
this
.
contactNum
)
}
else
{
uni
.
showToast
({
title
:
res
.
message
,
icon
:
'none'
})
}
})
},
//---加载优惠券
initCoupon
()
{
let
savedMoneyList
=
[]
this
.
chooseCouponObj
=
''
this
.
ableConpon
=
''
this
.
couponData
=
[]
let
data
=
{
productId
:
this
.
productId
,
//产品id
tickets
:
this
.
buyNum
,
//房间数量
singleMoney
:
this
.
sellingPrice
,
//单价
money
:
parseFloat
((
this
.
buyNum
*
this
.
sellingPrice
).
toFixed
(
2
)),
//订单总价,不算券,和现金红包
merchantId
:
this
.
merchantId
,
//商户Id
openid
:
this
.
openid
}
this
.
$request
(
'wechatUser/myPage/usableCouponList'
,
data
).
then
((
res
)
=>
{
if
(
res
.
code
==
'00'
)
{
this
.
couponData
=
res
.
data
let
masterSlaveCouponList
=
res
.
data
.
masterSlaveCouponList
if
(
masterSlaveCouponList
&&
masterSlaveCouponList
.
length
>
0
)
{
masterSlaveCouponList
.
forEach
((
item
)
=>
{
//获取最优券
savedMoneyList
.
push
(
item
.
savedMoney
)
})
let
maxMoney
=
Math
.
max
.
apply
(
null
,
savedMoneyList
)
let
arr
=
masterSlaveCouponList
.
filter
((
item
)
=>
{
//找到最大值的数组
return
item
.
savedMoney
==
maxMoney
})
if
(
arr
.
length
==
1
){
this
.
chooseCouponObj
=
arr
[
0
]
}
else
{
let
index
=
arr
.
findIndex
((
item
)
=>
{
//如果有多个,找到是否有平台券,平台劵优先
return
item
.
createSource
==
1
})
if
(
index
>-
1
){
this
.
chooseCouponObj
=
arr
[
index
]
}
else
{
this
.
chooseCouponObj
=
arr
[
0
]
}
}
this
.
savedMoney
=
this
.
chooseCouponObj
.
savedMoney
}
else
{
if
(
res
.
data
.
unusableCouponList
.
length
>
0
)
{
res
.
data
.
unusableCouponList
.
forEach
((
item
,
i
)
=>
{
//没有可用优惠券,有达到条件可以用的优惠券,先显示条件,达到条件时显示可用优惠券
if
(
item
.
isProduct
==
1
)
{
this
.
ableConpon
=
item
}
})
}
}
}
})
},
//---获取优惠价格
getDiscountPrice
()
{
let
data
=
{
productId
:
this
.
productId
,
//产品ID
merchantId
:
this
.
merchantId
,
//商家ID
companyId
:
this
.
companyId
,
//公司ID
openid
:
this
.
openid
//openid
}
this
.
$request
(
'scenic/user/productRule/getProductRule'
,
data
).
then
(
res
=>
{})
},
//---子组件券选择之后触发的事件
couponChoose
(
data
)
{
if
(
data
){
this
.
chooseCouponObj
=
data
this
.
savedMoney
=
this
.
chooseCouponObj
.
savedMoney
||
0
}
else
{
this
.
chooseCouponObj
=
''
this
.
savedMoney
=
0
}
},
//---展示券列表
showCoupon
()
{
this
.
$refs
.
orderCoupon
.
showPop
=
true
},
//---额外服务多选框变化
extraChange
(
e
)
{
this
.
chooseService
=
[]
//解决数据修改之后,多选框未选中bug
this
.
serviceList
.
forEach
(
item
=>
{
item
.
ifChoose
=
false
})
let
value
=
e
.
detail
.
value
value
.
forEach
(
item
=>
{
this
.
chooseService
.
push
(
JSON
.
parse
(
item
))
})
//获取选中的多选框为选中状态
this
.
serviceList
.
forEach
(
item
=>
{
this
.
chooseService
.
forEach
(
item2
=>
{
if
(
item
.
id
==
item2
.
id
){
item
.
ifChoose
=
true
}
})
})
},
//---不需要享受耳麦服务
extraNo
()
{
this
.
showExtraPop
=
false
this
.
placeOrder
()
},
//---需要享受耳麦服务
extraYes
()
{
this
.
showExtraPop
=
false
this
.
serviceList
.
forEach
(
item
=>
{
item
.
ifChoose
=
true
})
this
.
chooseService
=
this
.
serviceList
this
.
placeOrder
()
},
//---点击去支付
goPay
()
{
if
(
this
.
serviceList
.
length
==
0
)
{
//没有额外服务,直接支付
this
.
placeOrder
()
}
if
(
this
.
serviceList
.
length
>
0
)
{
//有额外服务,并且选择了额外服务的,直接支付
if
(
this
.
chooseService
.
length
>
0
)
{
this
.
placeOrder
()
}
}
if
(
this
.
serviceList
.
length
>
0
)
{
//有额外服务,没有选中额外服务的,弹出提示框
if
(
this
.
productIfo
.
tripTemplateFlag
!=
2
)
{
if
(
!
this
.
$commonjs
.
phoneReg
().
test
(
this
.
ticketPhone
))
{
//未填写正确手机号码
uni
.
showToast
({
title
:
'请填写正确的手机号码'
,
icon
:
'none'
})
return
}
}
if
(
this
.
productIfo
.
tripTemplateFlag
==
1
)
{
//实名制
if
(
this
.
chooseContact
.
length
!=
this
.
buyNum
)
{
uni
.
showToast
({
title
:
'需要添加'
+
this
.
buyNum
+
'位出行人'
,
icon
:
'none'
})
return
}
}
else
if
(
this
.
productIfo
.
tripTemplateFlag
==
0
)
{
//非实名制
if
(
this
.
chooseContact
.
length
<
1
)
{
uni
.
showToast
({
title
:
'需要添加一位出行人'
,
icon
:
'none'
})
return
}
}
if
(
this
.
productIfo
.
productType
==
3
)
{
//如果为班次票,需要选择班次
if
(
this
.
cruisePlanId
==
''
)
{
uni
.
showToast
({
title
:
'该票为班次票,请选择游玩时间'
,
icon
:
'none'
})
return
}
}
if
(
this
.
productIfo
.
isFetch
==
1
&&
this
.
areaUp
)
{
//需要选择站点的票种,必须选择站点
if
(
!
this
.
areaObj
.
areaCode
)
{
uni
.
showToast
({
title
:
'请选择站点'
,
icon
:
'none'
})
return
}
}
if
(
this
.
chooseService
.
length
==
0
&&
this
.
showErmai
)
{
//没有购买额外服务,并且选择的北站,跳出弹窗
this
.
showExtraPop
=
true
}
if
(
this
.
chooseService
.
length
==
0
&&
!
this
.
showErmai
)
{
//没有购买额外服务,并且选择的南站,直接购买
this
.
placeOrder
()
}
}
},
//---下单
placeOrder
()
{
if
(
this
.
dateList
.
length
==
0
)
{
//价格库存为空时,点击无效
return
}
if
(
this
.
productIfo
.
status
==
1
)
{
//下架状态,点击无效
return
}
if
(
this
.
productIfo
.
tripTemplateFlag
!=
2
)
{
//需要填写电话号码
if
(
!
this
.
$commonjs
.
phoneReg
().
test
(
this
.
ticketPhone
)
&&
this
.
productIfo
.
tripTemplateFlag
!=
2
)
{
//未填写正确手机号码
uni
.
showToast
({
title
:
'请填写正确的手机号码'
,
icon
:
'none'
})
return
}
}
if
(
!
this
.
startDate
||
!
this
.
endDate
)
{
uni
.
showToast
({
title
:
'请选择游玩日期'
,
icon
:
'none'
})
return
}
if
(
this
.
productIfo
.
tripTemplateFlag
==
1
)
{
//实名制
if
(
this
.
chooseContact
.
length
!=
this
.
buyNum
)
{
uni
.
showToast
({
title
:
'需要添加'
+
this
.
buyNum
+
'位出行人'
,
icon
:
'none'
})
return
}
}
else
if
(
this
.
productIfo
.
tripTemplateFlag
==
0
)
{
//非实名制
if
(
this
.
chooseContact
.
length
<
1
)
{
uni
.
showToast
({
title
:
'需要添加一位出行人'
,
icon
:
'none'
})
return
}
}
if
(
this
.
productIfo
.
productType
==
3
)
{
//如果为班次票,需要选择班次
if
(
this
.
cruisePlanId
==
''
)
{
uni
.
showToast
({
title
:
'该票为班次票,请选择游玩时间'
,
icon
:
'none'
})
return
}
}
if
(
this
.
productIfo
.
isFetch
==
1
&&
this
.
areaUp
)
{
//需要选择站点的票种,必须选择站点
if
(
!
this
.
areaObj
.
areaCode
)
{
uni
.
showToast
({
title
:
'请选择站点'
,
icon
:
'none'
})
return
}
}
this
.
preOrder
()
},
//---预下单
preOrder
()
{
//参数游客信息组装
let
orderTouristList
=
this
.
chooseContact
.
map
((
item
)
=>
{
return
{
category
:
0
,
name
:
item
.
name
,
credentialNumber
:
item
.
credentialNumber
}
})
let
couponList
=
[]
if
(
this
.
chooseCouponObj
)
{
if
(
this
.
chooseCouponObj
.
slaveList
.
length
>
0
){
//有从券取值从券,没有从券取值主劵
couponList
=
[
//券列表
{
couponId
:
this
.
chooseCouponObj
.
slaveCouponId
,
//券id
isMerchant
:
this
.
chooseCouponObj
.
slaveCreateSource
,
//是否是商户的券
myCouponId
:
this
.
chooseCouponObj
.
slaveId
,
//领取人编号
couponType
:
this
.
chooseCouponObj
.
couponType
,
//券类型
couponPrice
:
this
.
chooseCouponObj
.
savedMoney
,
//券价格
}
]
}
else
{
couponList
=
[
{
couponId
:
this
.
chooseCouponObj
.
couponId
,
//券id
isMerchant
:
this
.
chooseCouponObj
.
createSource
,
//是否是商户的券
myCouponId
:
this
.
chooseCouponObj
.
id
,
//领取人编号
couponType
:
this
.
chooseCouponObj
.
couponType
,
//券类型
couponPrice
:
this
.
chooseCouponObj
.
savedMoney
,
//券价格
}
]
}
}
//额外服务不为空,联票购买不为空,带有儿童票,组合购买不为空,单品购买为空
if
(
this
.
chooseService
.
length
>
0
)
{
this
.
orderProductList
=
this
.
chooseService
.
map
((
item
)
=>
{
return
{
distributionPrice
:
item
.
sellingPrice
,
//临时用
productId
:
item
.
id
,
//产品Id
buyNum
:
this
.
buyNum
,
//购买数量
subOrderType
:
0
,
//产品类型,网络
unitPrice
:
item
.
sellingPrice
,
//产品单价
merchantId
:
item
.
merchantId
,
//商户id
orderTouristList
,
//游客信息
playDate
:
this
.
startDate
.
substr
(
0
,
10
),
//开始日期
endPlayDate
:
this
.
endDate
.
substr
(
0
,
10
),
//结束日期
isMaster
:
1
,
//是否主产品 1 否, 0 是
startPlayTime
:
this
.
startPlayTime
,
//开始时间
endPlayTime
:
this
.
endPlayTime
,
//结束时间
}
})
}
else
{
this
.
orderProductList
=
[]
}
let
data
=
{
companyId
:
this
.
companyId
,
//公司Id
buyMethod
:
1
,
// 单品购买,2套票、联票购买,3组合购买
userId
:
this
.
openid
,
//用户id
ticketPhone
:
this
.
ticketPhone
,
//联系电话
cash
:
0
,
//现金红包
orderMoney
:
this
.
sellTotal
,
//订单总价 = 订单原价 - 优惠券价格 - 现金抵扣价格
orderType
:
1
,
//订单类型,景区
orderSource
:
this
.
orderSource
||
1
,
//订单来源 1公众号平台、2公众号组合页面1、3公众号组合页面2、4胖丁伙伴app、5第三方自助机、6第三方票房窗口
orderProductList
:
this
.
orderProductList
,
//额外服务不为空,联票购买不为空,带有儿童票,组合购买不为空,单品购买为空
orderProductVo
:
//产品信息列表
{
bookTime
:
this
.
productIfo
.
bookTime
,
//最晚预定时间
earlyBookTime
:
this
.
productIfo
.
earlyBookTime
,
//最早预定时间
extendContent
:
'{"openid":'
+
'"'
+
this
.
openid
+
'"'
+
','
+
'"zr":'
+
'"'
+
this
.
thirdOpenid
+
'"'
+
'}'
,
productId
:
this
.
productId
,
//产品Id
buyNum
:
this
.
buyNum
,
//购买数量
subOrderType
:
0
,
//产品类型,网络
cruisePlanId
:
this
.
cruisePlanId
,
//班次id
unitPrice
:
this
.
sellingPrice
,
//产品单价
distributionPrice
:
this
.
sellingPrice
,
//临时用
merchantId
:
this
.
merchantId
,
//商户id
orderTouristList
,
//游客信息
playDate
:
this
.
startDate
.
substr
(
0
,
10
),
//开始日期
endPlayDate
:
this
.
endDate
.
substr
(
0
,
10
),
//结束日期
isMaster
:
0
,
//是否主产品 1 否, 0 是
startPlayTime
:
this
.
startPlayTime
,
//开始时间
endPlayTime
:
this
.
endPlayTime
,
//结束时间
productAreaCode
:
this
.
areaObj
.
areaCode
,
//选择的站点编码
couponList
,
//券列表
}
}
uni
.
showLoading
({
title
:
'加载中'
,
mask
:
true
})
this
.
$request
(
'orderc/order/createOrder'
,
data
).
then
((
res
)
=>
{
if
(
res
.
code
==
'00'
)
{
if
(
res
.
data
.
id
)
{
uni
.
navigateTo
({
url
:
'/pages/payment/orderPayment/orderPayment?orderId='
+
res
.
data
.
id
})
}
else
{
uni
.
showToast
({
title
:
'下单失败'
,
icon
:
'none'
})
}
}
else
{
uni
.
showToast
({
title
:
res
.
message
,
icon
:
'none'
})
}
})
}
}
}
</
script
>
<
style
lang=
"scss"
scoped=
"scoped"
>
.head
{
height
:
160rpx
;
background
:
linear-gradient
(
to
bottom
,
#2984ef
,
#d8eaf6
);
}
.orderBox
{
min-height
:
100%
;
background
:
#f5f5f5
;
}
.middle
{
position
:
relative
;
top
:
-100rpx
;
padding
:
30rpx
20rpx
;
background
:
#ffffff
;
}
.title-text
{
font-size
:
32rpx
;
font-weight
:
bold
;
}
/*中间上面部分*/
.merchantName
{
display
:
flex
;
align-items
:
center
;
}
.merchantName
text
:nth-child
(
2
)
{
color
:
#666666
;
margin-left
:
20rpx
;
}
.buyKnow
{
margin-top
:
20rpx
;
background
:
#fef0e6
;
height
:
56rpx
;
font-size
:
24rpx
;
display
:
flex
;
justify-content
:
space-between
;
padding-left
:
10rpx
;
align-items
:
center
;
border-radius
:
5rpx
;
color
:
$red
;
}
.buyKnow
view
:nth-child
(
2
)
{
display
:
flex
;
}
.middle-place
{
height
:
100rpx
;
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
}
.middle-place
view
:nth-child
(
2
)
{
flex
:
1
;
margin-left
:
20rpx
;
color
:
$theme
;
font-size
:
28rpx
;
font-weight
:
bolder
;
}
.middle-Date
{
margin-top
:
40rpx
;
}
.middle-Datelist
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
margin-top
:
30rpx
;
}
.date-content
{
flex
:
1
;
overflow-x
:
scroll
;
white-space
:
nowrap
;
}
.
date-content
:
:-
webkit-scrollbar
{
display
:
none
;
}
.date-list
{
width
:
140rpx
;
text-align
:
center
;
margin-right
:
12rpx
;
border-radius
:
10rpx
;
position
:
relative
;
display
:
inline-block
;
background
:
#f2f2f2
;
padding-bottom
:
8rpx
;
}
.date-list.on
{
border
:
1px
solid
$theme
;
background
:
#DAE6F6
;
}
.date-list
>
view
{
margin-top
:
6rpx
;
}
.date-price
{
font-size
:
32rpx
;
color
:
$red
;
}
.no-date
{
color
:
$red
;
flex
:
1
;
margin-left
:
30rpx
;
font-weight
:
bolder
;
}
.date-icon
{
position
:
absolute
;
right
:
-1px
;
bottom
:
-1px
;
display
:
inline-block
;
width
:
30rpx
;
height
:
28rpx
;
background
:
$theme
;
border-radius
:
10rpx
0
;
}
.dateMore
{
flex-shrink
:
0
;
padding
:
20rpx
0
;
width
:
120rpx
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.date-more-content
{
margin-right
:
8rpx
;
}
.middle-time
{
margin-top
:
40rpx
;
}
.middle-timelist
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
margin-top
:
30rpx
;
}
.time-content
{
flex
:
1
;
overflow-x
:
scroll
;
white-space
:
nowrap
;
height
:
90rpx
;
}
.
time-content
:
:-
webkit-scrollbar
{
display
:
none
;
}
.time-list
{
width
:
200rpx
;
height
:
90rpx
;
line-height
:
30rpx
;
text-align
:
center
;
margin-right
:
8rpx
;
border-radius
:
15rpx
;
display
:
inline-block
;
background
:
#f2f2f2
;
position
:
relative
;
padding-bottom
:
8rpx
;
}
.time-list
view
{
margin-top
:
10rpx
;
}
.time-list.on
{
border
:
1px
solid
$theme
;
background
:
#DAE6F6
;
}
.timeMore
{
flex-shrink
:
0
;
width
:
120rpx
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.time-more-content
{
margin-right
:
8rpx
;
}
.no-time
{
color
:
$red
;
flex
:
1
;
font-weight
:
bolder
;
}
.middle-divider
{
height
:
2rpx
;
background
:
$divider
;
margin
:
40rpx
0
;
}
.middle-Number
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
}
.number-minus
{
width
:
52rpx
;
height
:
52rpx
;
background
:
#ccc
;
border-radius
:
50%
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.number-input
{
padding
:
0
20rpx
;
width
:
100rpx
;
text-align
:
center
;
font-size
:
40rpx
;
}
.number-plus
{
width
:
52rpx
;
height
:
52rpx
;
background
:
$theme
;
border-radius
:
50%
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.middle-coupon
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
padding
:
30rpx
0
;
}
.middle-coupon
view
:first-child
{
width
:
36rpx
;
height
:
36rpx
;
background
:
$theme
;
color
:
#FFFFFF
;
text-align
:
center
;
line-height
:
32rpx
;
border-radius
:
4rpx
;
}
.middle-coupon
view
:nth-child
(
2
)
{
flex
:
1
;
margin-left
:
10rpx
;
}
.middle-coupon
view
:nth-child
(
3
)
{
display
:
flex
;
color
:
$theme
;
font-weight
:
bold
;
}
/*中间下面部分*/
.middle-visitor
{
padding-bottom
:
40rpx
;
border-bottom
:
1px
solid
$divider
;
}
.visitorTitle
>
text
:nth-child
(
2
)
{
font-size
:
24rpx
;
color
:
#666666
;
margin-left
:
10rpx
;
}
.title-bold
{
color
:
#f9690e
;
font-weight
:
bolder
;
font-size
:
28rpx
;
}
.visitorBtn
{
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
height
:
88rpx
;
background
:
#ECF3FE
;
margin-top
:
40rpx
;
color
:
$theme
;
font-size
:
32rpx
;
border-radius
:
20rpx
;
}
.visitorPlus
{
margin-top
:
20rpx
;
display
:
flex
;
flex-wrap
:
wrap
;
}
.plus-list
{
height
:
70rpx
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
flex-wrap
:
wrap
;
padding
:
5rpx
0
;
width
:
145rpx
;
text-align
:
center
;
background
:
#f2f2f2
;
border-radius
:
5rpx
;
position
:
relative
;
margin
:
20rpx
15rpx
0
0
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
}
.plus-list-last
{
color
:
$theme
;
background
:
#efefef
;
width
:
170rpx
;
border
:
none
;
}
.plus-list.on
{
border
:
1px
solid
$theme
;
background
:
#DAE6F6
;
}
.visitorEdit
{
margin-top
:
40rpx
;
}
.visitorEdit
>
view
:not
(
first-child
)
{
margin-top
:
25rpx
;
}
.edit-list
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
}
.edit-list
view
:nth-child
(
2
)
{
display
:
inline-block
;
width
:
120rpx
;
white-space
:
nowrap
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
margin-left
:
30rpx
;
}
.edit-list
view
:nth-child
(
3
)
{
flex
:
1
;
}
.middle-phone
{
margin-top
:
30rpx
;
display
:
flex
;
align-items
:
center
;
}
.middle-phone
input
{
flex
:
1
;
}
/*押金部分*/
.productDeposit
{
padding
:
40rpx
15rpx
;
background
:
#ffffff
;
border-radius
:
10rpx
;
margin-top
:
20rpx
;
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
}
/*额外服务部分*/
.extraService
{
padding
:
20rpx
;
background
:
#DAE6F6
;
margin-top
:
30rpx
;
border-radius
:
10rpx
;
}
.extraService
label
{
width
:
100%
;
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
font-weight
:
bold
;
color
:
#f45803
;
}
.extra-wrap
{
text-align
:
center
;
padding-top
:
100rpx
;
height
:
65vh
;
}
/*底部部分*/
.bottom
{
height
:
100rpx
;
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
background
:
#ffffff
;
position
:
fixed
;
bottom
:
0
;
width
:
100%
;
max-width
:
750rpx
;
z-index
:
10
;
padding
:
0
24rpx
0
40rpx
;
box-shadow
:
0px
4px
12px
rgba
(
0
,
0
,
0
,
0
.16
)
}
.bottom-left
>
text
:first-child
{
font-size
:
28rpx
;
text-decoration
:
line-through
;
margin-right
:
16rpx
;
}
.bottom-left
text
:nth-child
(
2
)
{
font-size
:
40rpx
;
font-weight
:
bolder
;
color
:
#f45803
;
}
.bottom-left
text
:nth-child
(
2
)
text
{
font-size
:
32rpx
;
}
.bottom-right
{
display
:
flex
;
align-items
:
center
;
}
.bottom-detail
{
display
:
flex
;
}
.bottom-btn
{
position
:
relative
;
width
:
240rpx
;
height
:
80rpx
;
margin-left
:
20rpx
;
line-height
:
80rpx
;
font-size
:
32rpx
;
font-weight
:
bolder
;
text-align
:
center
;
}
.bottom-btn
text
{
position
:
absolute
;
width
:
100%
;
height
:
100%
;
display
:
inline-block
;
left
:
0
;
color
:
#ffffff
;
top
:
0
;
background
:
#C0C0C0
;
border-radius
:
24rpx
;
}
.sortPoptext
{
font-size
:
30rpx
;
font-weight
:
bolder
;
color
:
#f32048
;
}
</
style
>
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