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
0b3e33f9
Commit
0b3e33f9
authored
Nov 30, 2023
by
潘永坪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
单产品开发
parent
7a7e3a5b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1908 additions
and
32 deletions
+1908
-32
center.vue
pages/indexs/center/center.vue
+1
-0
combinationProduct.vue
pages/scenic/combinationProduct/combinationProduct.vue
+4
-6
scenicOrder-new.vue
pages/scenic/scenicOrder/scenicOrder-new.vue
+1876
-0
scenicOrder.vue
pages/scenic/scenicOrder/scenicOrder.vue
+27
-26
No files found.
pages/indexs/center/center.vue
View file @
0b3e33f9
<
template
>
<view>
<!-- tabbar页面不能放在分包里面,故放在indexs里面 -->
<view
class=
"head"
>
<image
src=
"@/static/img/common/pangdingLogo.png"
>
...
...
pages/scenic/combinationProduct/combinationProduct.vue
View file @
0b3e33f9
...
...
@@ -571,17 +571,16 @@ export default {
}
else
{
//普通票
uni
.
navigateTo
({
url
:
'/pages/scenic/scenic
SingleOrder/scenicSingleOrder'
+
query
url
:
'/pages/scenic/scenic
Order/scenicOrder'
+
query
})
}
}
else
{
let
productIdList
=
this
.
chooseProduct
.
map
(
item
=>
{
return
item
.
id
})
let
query
=
'?productIdList='
+
JSON
.
stringify
(
productIdList
)
+
'&groupId='
+
this
.
groupId
+
'&groupChannelId='
+
this
.
groupChannelId
+
'&orderSource=3'
let
query
=
'?productIdList='
+
JSON
.
stringify
(
productIdList
)
+
'&groupId='
+
this
.
groupId
+
'&groupChannelId='
+
this
.
groupChannelId
+
'&orderSource=3'
uni
.
navigateTo
({
url
:
'/pages/
combination/combiOrder/combi
Order'
+
query
url
:
'/pages/
scenic/scenicOrder/scenic
Order'
+
query
})
}
},
...
...
@@ -834,9 +833,8 @@ export default {
font-weight
:
bold
;
}
.btn
{
padding
:
16rpx
48rpx
;
border-radius
:
20rpx
;
font-size
:
32rpx
;
width
:
200rpx
;
}
//摄影、旅拍
.album-left
{
...
...
pages/scenic/scenicOrder/scenicOrder-new.vue
0 → 100644
View file @
0b3e33f9
<
template
>
<view
class=
"orderBox"
>
<view
class=
"head"
>
</view>
<view
class=
"middle"
>
<view
class=
"middle-top"
>
<!-- --------------------------------------------产品信息部分------------------------------------- -->
<view
class=
"middle-Product"
v-for=
"(item,Index) in productList"
:key=
'item.id'
>
<view
class=
"merchantName"
>
<text
class=
"title-text"
>
{{
item
.
merchantName
||
''
}}
</text>
<text>
{{
item
.
name
||
''
}}
</text>
</view>
<view
@
click=
"showBuyKnow()"
class=
"buyKnow"
>
<view>
<text
v-if=
"item.backChangeRule == 0"
>
不可退换
</text>
<text
v-if=
"item.backChangeRule == 1"
>
可退
</text>
<text
v-if=
"item.backChangeRule == 2"
>
随时可退
</text>
<text
v-if=
"item.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=
"item.isFetch == 1 && item.productAreaList.length > 1 && showOpenArea"
>
<view>
出发站点
</view>
<view>
{{
item
.
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 && showOpenArea"
@
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=
"item.priceStockList.length > 0"
>
<view
class=
"date-list"
v-for=
"(item2,index2) of item.priceStockList"
:class=
"
{ on: active == index2 }" @click="dateChoose(item,item2,index2)" :key="index2">
<view
v-if=
"item2.week"
>
<text
v-if=
"item2.week != '今天' && item2.week != '明天' && item2.week != '后天'"
>
周
</text>
{{
item2
.
week
}}
</view>
<view>
{{
item2
.
startTime
?
item2
.
startTime
.
substr
(
5
,
5
)
:
''
}}
</view>
<view
class=
"date-price"
>
¥
<text
style=
"font-weight: bold;"
>
{{
item2
.
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=
"item.timeList.length> 0"
>
<view
class=
"time-list"
v-for=
"(item2,index2) of item.timeList"
@
click=
"chooseTime(item,item2,index2)"
:class=
"
{ on:item.timeActive == index2 }" :key="index2">
<view>
{{
item2
.
startPlanTime
?
item2
.
startPlanTime
.
substr
(
0
,
5
)
:
''
}}
<text
v-if=
"item2.endPlanTime"
>
-
</text>
{{
item2
.
endPlanTime
?
item2
.
endPlanTime
.
substr
(
0
,
5
)
:
''
}}
</view>
<view>
剩余:
{{
item2
.
last
}}
</view>
<view
v-if=
"item.timeActive == index"
class=
"date-icon"
>
<u-icon
name=
"checkmark"
color=
"#ffffff"
></u-icon>
</view>
</view>
</scroll-view>
<text
class=
"no-time"
v-if=
"item.timeList&&item.timeList.length==0"
>
该日票种已售罄,请选择其他日期
</text>
<text
class=
"no-time"
v-if=
"!item.startDate || !item.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=
"item.buyNum"
@
change=
'buyNumChange'
>
<view
slot=
"minus"
class=
"number-minus"
>
<u-icon
name=
"minus"
color=
"#FFFFFF"
size=
"32"
></u-icon>
</view>
<text
slot=
"input"
class=
"number-input"
>
{{
item
.
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=
"item.couponData.masterSlaveCouponList&&item.couponData.masterSlaveCouponList.length>0&&!item.chooseCouponObj"
>
<view>
{{
item
.
couponData
.
masterSlaveCouponList
[
0
].
couponName
}}
</view>
<view
>
未使用优惠券
</view>
</
template
>
<!-- 有可用优惠券 -->
<
template
v-if=
"item.chooseCouponObj&&item.savedMoney>0"
>
<view>
{{
item
.
chooseCouponObj
.
couponName
}}
</view>
<view
style=
"font-size: 32rpx;"
>
<text
style=
"font-size: 24rpx;position: relative;top: 6rpx;"
>
¥
</text>
{{
parseFloat
(
item
.
savedMoney
.
toFixed
(
2
))
}}
</view>
</
template
>
<!-- 可用优惠券条件-->
<
template
v-if=
"item.ableConpon"
>
<view>
{{
item
.
ableConpon
.
couponName
}}
</view>
<view>
{{
item
.
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=
"item.tripTemplateFlag != 2"
>
<view
class=
"middle-visitor"
>
<view
class=
"visitorTitle"
>
<text
class=
"title-text"
>
用户信息
</text>
<text>
需填
<text
class=
"title-bold"
>
{{item.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=
"item.chooseContact.length > 0"
>
<view
class=
"edit-list"
v-for=
"(item2, index) of item.chooseContact"
:key=
"item.id"
>
<view
@
click=
"delChooseContact(item2, index)"
>
<u-icon
name=
"close-circle"
color=
"#3688ff"
size=
"40"
></u-icon>
</view>
<view>
{{ item2.name }}
</view>
<view>
{{ item2.credentialNumber ? item2.credentialNumber.substr(0, 3) + '****' + item2.credentialNumber.substr(14, 4) : '' }}
</view>
<view
@
click=
"showEdit(item2)"
>
<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=
"item.deposit"
>
<view>
{{ item.name }}
<text
style=
"color: #FC6703;margin-left: 10rpx;"
>
押金
</text>
</view>
<view
style=
"color: #FC6703"
>
{{ item.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"
:style=
"{ background: payBackground }"
>
<text
v-if=
"orderStatus == 1"
>
已下架
</text>
<text
v-if=
"parseInt(maxBookNum) <1"
style=
"background: #c0c0c0"
>
暂无库存
</text>
<text
v-if=
"orderStatus!= 1 && parseInt(maxBookNum) >= 1"
@
click=
"goPay()"
>
去支付
</text>
</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"
:chooseTimeData=
"chooseTimeData"
: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
{
sortArr
:
[],
//多个站点排号信息列表
sortIfo
:
''
,
//单个站点排号信息
sortInforPop
:
false
,
//一个站点时获取排队信息弹窗
showErmai
:
true
,
//临时的,选择了南站不显示耳麦
showArea
:
false
,
//控制选择站点显示隐藏
showOpenArea
:
false
,
//是否可以显示选择站点
chooseDate
:
''
,
//选择的日期
timeActive
:
10000
,
//时间下标,默认不选中
buyKnowData
:
''
,
//购买须知数据
editContact
:
''
,
//编辑联系人传值对象
merchantId
:
''
,
//商户Id
ticketPhone
:
''
,
//联系电话
interfaceCode
:
''
,
//接口编号
productCode
:
''
,
//产品code
chooseContact
:
[],
//选中的游客信息列表
cruisePlanId
:
''
,
//班次Id
chooseTimeData
:
''
,
//选中的时间传给子组件
timeNumber
:
''
,
//当前时间转化为数字
startPlayTime
:
''
,
//开始时间
endPlayTime
:
''
,
//结束时间
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
companyId
:
''
,
//公司Id
docQuery
:
''
,
//元素变量
payBackground
:
''
,
//支付按钮背景颜色
dateScroll
:
''
,
//日期滚动值
timeScroll
:
''
,
//时间滚动值
openid
:
uni
.
getStorageSync
(
'openid'
)
||
''
,
//openid
couponData
:[],
//所有劵数据
chooseCouponObj
:
''
,
//默认选中最优价格优惠券
ableConpon
:
''
,
//没有可用优惠券时,达到一定条件可用,显示达到的条件
productIdList
:[],
//产品id列表入参
productList
:[],
//初始化产品数据
orderStatus
:
''
,
//上下架状态,任何一个产品状态为下架,该状态为下架
}
},
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
.
merchantId
=
option
.
merchantId
||
''
let
idList
=
JSON
.
parse
(
option
.
productIdList
)
this
.
productIdList
=
idList
.
map
((
item
)
=>
{
return
{
productId
:
item
}
})
console
.
log
(
this
.
productIdList
)
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
:
{
//---获取排号信息
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
.
show
=
true
},
//---日期选择
dateChoose
(
item
,
item2
,
index
)
{
item
.
active
=
index
//修改选中样式
item
.
maxBookNum
=
Math
.
min
(
item2
.
maxBookNum
,
item2
.
surplus
)
//剩余量变化
item
.
originalPrice
=
item2
.
originalPrice
//产品原价为当前选中日期的原价
item
.
sellingPrice
=
item2
.
sellingPrice
//产品卖价为当前选中日期的卖价
item
.
chooseDate
=
item2
.
startTime
.
substr
(
0
,
10
)
this
.
$refs
.
calendar
.
getDefaultDate
(
item
.
chooseDate
)
//日历组件选中日期
item
.
endDate
=
item2
.
endTime
//开始日期
item
.
startDate
=
item2
.
startTime
//结束日期
this
.
chooseTimeData
=
''
//清除之前选中的时间
if
(
item
.
productType
==
3
){
//productType=3为场次票
item
.
cruisePlanId
=
''
item
.
timeActive
=
10000
this
.
timeActive
=
10000
this
.
getTimeStock
(
item
)
}
// this.computedPrice()
// this.initCoupon(Item.id,Item.buyNum,Item.sellingPrice,Item.merchantId,Index)
// this.$forceUpdate()
//下面是单票代码
// 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.chooseDate = this.dateList[index].startTime.substr(0, 10) //日历组件选中日期
// this.endDate = this.dateList[index].endTime //开始日期
// this.startDate = this.dateList[index].startTime //结束日期
// this.$refs.calendar.defaultDate = this.chooseDate
// if (this.productIfo.productType == 3) {
// //如果为班次票,点击时,请求班次票接口
// this.cruisePlanId = '' //清空班次id
// this.timeActive = 10000
// uni.$u.throttle(this.getTimeStock, 3000)
// }
// this.initCoupon()
},
//---日历确认事件
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
+
4
)
*
index
}).
exec
()
},
//---展示更多时间
showTime
()
{
this
.
$refs
.
times
.
showPop
=
true
},
//---时间选择
chooseTime
(
item
,
item2
,
index
)
{
if
(
item2
.
copyLast
!=
'售罄'
){
item
.
timeActive
=
index
item
.
cruisePlanId
=
item2
.
cruisePlanId
//获取班次Id
this
.
chooseTimeData
=
item2
.
startPlanTime
item
.
maxBookNum
=
Math
.
min
(
item
.
maxBookNum
,
item2
.
last
)
//如果为场次票,开始时间为班次时间的开始时间,结束时间为班次时间的结束时间,班次时间的结束时间为空时,结束时间为班次时间的开始时间
item
.
startPlayTime
=
item2
.
startPlanTime
item
.
endPlayTime
=
item2
.
endPlanTime
||
item2
.
startPlanTime
// this.$forceUpdate()
}
},
//---时间确认事件
timeConfig
(
data
)
{
let
index
=
this
.
timeList
.
findIndex
(
item
=>
{
return
item
.
startPlanTime
==
data
})
if
(
index
>
-
1
)
{
//子组件点击确认之后有选择的时间
this
.
chooseTime
(
index
)
//选中确认的日期
this
.
docQuery
.
selectAll
(
'.time-list'
).
boundingClientRect
(
data
=>
{
this
.
timeScroll
=
(
data
[
index
].
width
+
4
)
*
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
},
//---计算价格
computedPrice
(){
let
savedMoney
=
0
let
original
=
0
let
sell
=
0
let
deposit
=
0
this
.
productDepositTotal
=
0
this
.
productList
.
forEach
((
item
)
=>
{
original
+=
item
.
originalPrice
*
item
.
buyNum
sell
+=
item
.
sellingPrice
*
item
.
buyNum
if
(
item
.
chooseCouponObj
){
if
(
item
.
chooseCouponObj
.
slaveList
&&
item
.
chooseCouponObj
.
slaveList
.
length
>
0
){
savedMoney
+=
item
.
chooseCouponObj
.
slaveList
[
0
].
savedMoney
}
else
{
savedMoney
+=
item
.
chooseCouponObj
.
savedMoney
}
}
if
(
item
.
depositType
==
1
){
//等于1,押金金额跟数量没关系
deposit
=
item
.
deposit
}
else
if
(
item
.
depositType
==
2
){
//等于2,押金单价乘购买数量
deposit
=
item
.
deposit
*
item
.
buyNum
}
this
.
productDepositTotal
+=
deposit
})
this
.
originalTotal
=
parseFloat
((
original
+
this
.
productDepositTotal
).
toFixed
(
2
))
||
0
//产品总价+产品押金
this
.
sellTotal
=
parseFloat
((
sell
+
this
.
productDepositTotal
-
savedMoney
).
toFixed
(
2
))
||
0
},
//---游客选择
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
},
//---页面初始化数据,获取产品基本信息
initData
()
{
let
data
=
{
productList
:
this
.
productIdList
,
//产品id列表
}
uni
.
showLoading
({
title
:
'加载中'
,
mask
:
true
})
this
.
$request
(
'scenic/groupGood/loadProductList'
,
data
).
then
(
res
=>
{
if
(
res
.
code
==
'00'
){
this
.
productList
=
res
.
data
||
[]
this
.
productIdList
=
this
.
productList
.
map
((
item
)
=>
{
//id集合用于请求价格库存列表接口
return
item
.
id
})
for
(
let
i
=
0
;
i
<
this
.
productList
.
length
;
i
++
){
let
item
=
this
.
productList
[
i
]
if
(
item
.
defaultAreaCode
){
item
.
areaObj
=
{}
item
.
areaObj
.
areaCode
=
item
.
areaCode
item
.
areaObj
.
areaName
=
item
.
areaName
}
else
{
item
.
areaObj
=
{}
}
item
.
active
=
0
//默认选中第一个日期
item
.
buyNum
=
1
,
//默认为1
item
.
contactTotal
=
[]
//选中的游客信息列表
item
.
contactNum
=
1
//需要选择几位联系人数量
if
(
item
.
status
==
1
){
//任何一个产品下架,该组合票为下架状态
this
.
orderStatus
=
1
this
.
payBackground
=
'#C0C0C0'
return
}
if
(
item
.
productType
!=
3
){
//不为班次票时,开始时间为当前时间,结束时间为23:59:59
item
.
startPlayTime
=
new
Date
().
Format
(
'hh:mm:ss'
)
item
.
endPlayTime
=
'23:59:59'
}
}
this
.
getPriceList
()
// this.getDiscountPrice() //获取优惠价格
//---待处理
// if (this.productIfo.tripTemplateFlag != 2) {
// //等于2时不需要填写联系人信息和手机号码
// this.getContactList()
// }
}
else
{
uni
.
showToast
({
title
:
res
.
message
,
icon
:
'none'
})
}
})
},
//---获取产品价格库存列表
getPriceList
()
{
let
data
=
{
productIds
:
this
.
productIdList
,
//产品id集合
}
this
.
$request
(
'scenic/user/product/groupPriceStockList'
,
data
).
then
(
res
=>
{
if
(
res
.
code
==
'00'
)
{
//所有产品的价格库存列表
let
stockList
=
res
.
data
this
.
productList
.
forEach
(
item
=>
{
//待处理
// if(item.isFetch==1&&item.productAreaList.length>1){
// this.areaIndex=index
// this.merchantCode=this.productList[index].merchantVo.code
// this.sortUpDown()
//}else if(item.isFetch==1&&item.productAreaList.length==1){
// item.areaObj=item.productAreaList[0]
// }
//把价格列表合并到对应的产品上面
stockList
.
forEach
(
item2
=>
{
if
(
item
.
id
==
item2
.
productId
){
item
.
priceStockList
=
item2
.
priceStockList
||
[]
}
})
})
let
today
=
this
.
$commonjs
.
today
()
//今天
let
tomorrow
=
this
.
$commonjs
.
tomorrow
()
//明天
let
afterTomorrow
=
this
.
$commonjs
.
afterTomorrow
()
//后天
this
.
productList
.
forEach
(
item
=>
{
if
(
item
.
priceStockList
.
length
>
0
){
//获取价格列表的第一个日期+预订最晚时间
let
time1
=
item
.
priceStockList
[
0
].
startTime
.
substr
(
0
,
10
)
+
item
.
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
){
//如果当前时间大于价格列表第一个日期+预订最晚时间,第一个价格不显示
item
.
priceStockList
.
splice
(
0
,
1
)
}
item
.
priceStockList
.
forEach
((
item2
,
index
)
=>
{
//价格上面时间小于当前时间加上需预定天数之后的需删除
let
date
=
new
Date
()
date
.
setDate
(
date
.
getDate
()
+
item2
.
beforeBookDays
)
let
newDate
=
date
.
Format
(
'yyyy-MM-dd'
)
let
priceTime
=
this
.
$commonjs
.
changeTime
(
item2
.
endTime
.
substr
(
0
,
10
))
let
newTime
=
this
.
$commonjs
.
changeTime
(
newDate
)
if
(
priceTime
<
newTime
)
{
delete
item
.
priceStockList
[
index
]
}
})
item
.
priceStockList
=
item
.
priceStockList
.
filter
(
val
=>
{
return
val
})
if
(
item
.
priceStockList
.
length
==
0
){
uni
.
showToast
({
title
:
'没有库存'
,
icon
:
'none'
})
this
.
payBackground
=
'#C0C0C0'
return
}
item
.
startDate
=
item
.
priceStockList
[
0
].
startTime
//开始日期
item
.
endDate
=
item
.
priceStockList
[
0
].
endTime
//结束日期
item
.
originalPrice
=
item
.
priceStockList
[
0
].
originalPrice
//原价
item
.
sellingPrice
=
item
.
priceStockList
[
0
].
sellingPrice
//卖价
item
.
maxBookNum
=
Math
.
min
(
item
.
priceStockList
[
0
].
surplus
,
item
.
maxBookNum
)
//最大购买数量
item
.
priceStockList
.
forEach
(
item2
=>
{
//循环单个产品的价格列表
item2
.
week
=
'日一二三四五六'
.
charAt
(
new
Date
(
item2
.
startTime
.
substr
(
0
,
10
)).
getDay
())
if
(
item2
.
startTime
.
substr
(
0
,
10
)
==
today
){
item2
.
week
=
'今天'
}
if
(
item2
.
startTime
.
substr
(
0
,
10
)
==
tomorrow
){
item2
.
week
=
'明天'
}
if
(
item2
.
startTime
.
substr
(
0
,
10
)
==
afterTomorrow
){
item2
.
week
=
'后天'
}
})
//如果是班次票,并且班次票价格列表不为空
if
(
item
.
productType
==
3
&&
item
.
priceStockList
.
length
>
0
){
this
.
getTimeStock
(
item
)
}
}
else
{
uni
.
showToast
({
title
:
'没有库存'
,
icon
:
'none'
})
this
.
payBackground
=
'#C0C0C0'
}
})
// 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.showArea = false
// this.payBackground = '#C0C0C0'
// return
// }
// if (this.productIfo.isFetch == 1) {
// this.sortUpDown()
// }
// if (this.dateList.length == 1 && this.beforeBookDays == 0) {
// //长度为1而且只能预订当天,默认选中第一个日期
// //真机模拟的时候手机端不显示今天,明天后天,延迟执行
// setTimeout(item => {
// this.$refs.calendar.defaultDate = this.dateList[0].startTime.substr(0, 10)
// }, 1000)
// this.maxBookNum = Math.min(this.dateList[0].surplus, this.productIfo.maxBookNum) //剩余量
// this.startDate = this.dateList[0].startTime //开始日期
// this.endDate = this.dateList[0].endTime //结束日期
// this.originalPrice = this.dateList[0].originalPrice //原价
// this.sellingPrice = this.dateList[0].sellingPrice //卖价
// this.active = 0
// if (this.productIfo.productType == 3) {
// //如果为班次票,请求班次票接口
// this.getTimeStock()
// }
// this.initCoupon() //获取优惠券
// }
// } else {
// uni.showToast({
// title: '没有库存',
// icon: 'none'
// })
// this.showArea = false
// this.payBackground = '#C0C0C0'
// }
// 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
if
(
this
.
productIfo
.
productAreaList
.
length
>
1
)
{
//有库存并且需要选择两个站点以上的票种,显示区域组件
for
(
let
item
in
data
.
main
)
{
if
(
data
.
main
[
item
].
sceneSortStatus
==
'1'
){
this
.
showArea
=
true
this
.
showOpenArea
=
true
}
}
}
else
if
(
this
.
productIfo
.
productAreaList
.
length
==
1
)
{
//只有一个站点时,直接选中站点(现目前还没有一个站点的景区)
for
(
let
item
in
data
.
main
)
{
if
(
data
.
main
[
item
].
sceneSortStatus
==
'1'
)
{
this
.
areaObj
=
this
.
productIfo
.
productAreaList
[
0
]
this
.
showOpenArea
=
true
}
}
}
}
})
},
//---获取班次票
getTimeStock
(
item
)
{
let
data
=
{
endDate
:
item
.
endDate
,
//结束日期
startDate
:
item
.
startDate
,
//开始日期
interfaceCode
:
item
.
merchantVo
.
interfaceCompanyId
,
//接口编号
merchantCode
:
item
.
merchantVo
.
code
,
//商户code
productCode
:
item
.
code
//产品code
}
uni
.
showLoading
({
title
:
'加载中'
,
mask
:
true
})
this
.
$request
(
'distribution/distribution/getTimeStock'
,
data
).
then
(
res
=>
{
if
(
res
.
code
==
'00'
)
{
item
.
timeList
=
res
.
data
//增加一个时间Number字段,用于判断当前时间大于班次结束时间时,显示售罄
item
.
timeList
.
forEach
(
item2
=>
{
let
text
=
parseFloat
((
item2
.
last
/
item2
.
total
).
toFixed
(
2
))
||
0
if
(
text
>
0.4
){
item2
.
copyLast
=
'余票充足'
}
else
{
item2
.
copyLast
=
item2
.
last
}
item2
.
timeNumber
=
parseInt
(
this
.
commonjs
.
changeTime
(
item2
.
planDate
.
substr
(
0
,
10
)
+
item2
.
endPlanTime
))
if
(
this
.
timeNumber
>
item2
.
timeNumber
||
item2
.
last
<=
0
){
item2
.
copyLast
=
'售罄'
}
})
// this.$forceUpdate()
}
else
{
uni
.
showToast
({
title
:
res
.
message
,
icon
:
'none'
})
}
})
},
//---初始化联系人列表
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
.
showOpenArea
)
{
//需要选择站点的票种,必须选择站点
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
.
showOpenArea
)
{
//需要选择站点的票种,必须选择站点
if
(
!
this
.
areaObj
.
areaCode
)
{
uni
.
showToast
({
title
:
'请选择站点'
,
icon
:
'none'
})
return
}
}
this
.
preOrder
()
},
//---预下单
preOrder
()
{
//参数游客信息组装
let
orderTouristList
=
this
.
contactTotal
.
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-sizing
:
border-box
;
box-shadow
:
0
0
3rpx
#666666
;
}
.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
;
border-radius
:
24rpx
;
background
:
$red
;
text-align
:
center
;
}
.bottom-btn
text
{
position
:
absolute
;
width
:
100%
;
height
:
100%
;
display
:
inline-block
;
left
:
0
;
color
:
#ffffff
;
top
:
0
;
}
.sortPoptext
{
font-size
:
30rpx
;
font-weight
:
bolder
;
color
:
#f32048
;
}
</
style
>
pages/scenic/scenicOrder/scenicOrder.vue
View file @
0b3e33f9
...
...
@@ -91,10 +91,14 @@
<view
class=
"time-list"
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.endPlanTime"
>
-
</text>
{{
item
.
endPlanTime
?
item
.
endPlanTime
.
substr
(
0
,
5
)
:
''
}}
<text
v-if=
"item.endPlanTime&&!item.saleOnlyShowFromDate"
>
-
{{
item
.
endPlanTime
?
item
.
endPlanTime
.
substr
(
0
,
5
)
:
''
}}
</text>
</view>
<view>
<text
v-if=
"item.copyLast!='余票充足'&&item.copyLast!='售罄'"
>
剩余:
</text>
{{
item
.
last
}}
</view>
<view>
剩余:
{{
item
.
last
}}
</view>
<view
v-if=
"timeActive == index"
class=
"date-icon"
>
<u-icon
name=
"checkmark"
color=
"#ffffff"
></u-icon>
</view>
...
...
@@ -118,7 +122,7 @@
<view
class=
"middle-Number"
>
<view
class=
"title-text"
>
购买数量
</view>
<view>
<u-number-box
v-model=
"buyNum"
>
<u-number-box
v-model=
"buyNum"
@
change=
'buyNumChange'
>
<view
slot=
"minus"
class=
"number-minus"
>
<u-icon
name=
"minus"
color=
"#FFFFFF"
size=
"32"
></u-icon>
</view>
...
...
@@ -127,17 +131,6 @@
<u-icon
name=
"plus"
color=
"#FFFFFF"
size=
"32"
></u-icon>
</view>
</u-number-box>
<!--
<u-number-box
@
change=
'buyNumChange'
v-model=
"buyNum"
bg-color=
'#3688FF'
color=
'#ffffff'
iconStyle=
'color:#ffffff;font-size:32rpx;'
buttonSize=
'60'
input-width=
"100"
:min=
"1"
:max=
"maxBookNum"
>
</u-number-box>
-->
</view>
</view>
<view
class=
" middle-coupon"
v-if=
"couponData.length>0"
@
click=
"showCoupon()"
>
...
...
@@ -605,13 +598,15 @@ export default {
},
//---时间选择
chooseTime
(
i
)
{
this
.
timeActive
=
i
this
.
cruisePlanId
=
this
.
timeList
[
i
].
cruisePlanId
//获取班次Id
this
.
chooseTimeData
=
this
.
timeList
[
i
].
startPlanTime
this
.
maxBookNum
=
Math
.
min
(
this
.
timeList
[
i
].
last
,
this
.
productIfo
.
maxBookNum
)
//获取剩余库存
//如果为班次票,开始时间为班次时间的开始时间,结束时间为班次时间的结束时间,班次时间的结束时间为空时,结束时间为班次时间的开始时间
this
.
startPlayTime
=
this
.
timeList
[
i
].
startPlanTime
this
.
endPlayTime
=
this
.
timeList
[
i
].
endPlanTime
||
this
.
timeList
[
i
].
startPlanTime
if
(
this
.
timeList
[
i
].
copyLast
!=
'售罄'
){
this
.
timeActive
=
i
this
.
cruisePlanId
=
this
.
timeList
[
i
].
cruisePlanId
//获取班次Id
this
.
chooseTimeData
=
this
.
timeList
[
i
].
startPlanTime
this
.
maxBookNum
=
Math
.
min
(
this
.
timeList
[
i
].
last
,
this
.
productIfo
.
maxBookNum
)
//获取剩余库存
//如果为班次票,开始时间为班次时间的开始时间,结束时间为班次时间的结束时间,班次时间的结束时间为空时,结束时间为班次时间的开始时间
this
.
startPlayTime
=
this
.
timeList
[
i
].
startPlanTime
this
.
endPlayTime
=
this
.
timeList
[
i
].
endPlanTime
||
this
.
timeList
[
i
].
startPlanTime
}
},
//---时间确认事件
timeConfig
(
data
)
{
...
...
@@ -908,10 +903,16 @@ export default {
if
(
res
.
code
==
'00'
)
{
this
.
timeList
=
res
.
data
this
.
timeList
.
forEach
((
item
,
index
)
=>
{
//增加一个时间Number字段,用于判断当前时间大于班次结束时间时,不显示该班次
item
.
timeNumber
=
parseInt
(
this
.
$commonjs
.
changeTime
(
item
.
planDate
.
substr
(
0
,
10
)
+
item
.
endPlanTime
))
if
(
this
.
timeNumber
>
item
.
timeNumber
||
item
.
last
==
0
)
{
this
.
timeList
.
splice
(
index
,
1
)
//增加一个时间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
{
...
...
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