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
e93cc300
Commit
e93cc300
authored
Dec 18, 2023
by
潘永坪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
组合下单和单产品下单优化
parent
38e2578c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
339 additions
and
318 deletions
+339
-318
request.js
common/request.js
+2
-1
main.js
main.js
+1
-1
scenicCombiOrder.vue
pages/scenic/scenicCombiOrder/scenicCombiOrder.vue
+105
-86
scenicOrder.vue
pages/scenic/scenicOrder/scenicOrder.vue
+231
-230
No files found.
common/request.js
View file @
e93cc300
var
baseUrl
=
''
var
baseUrl
=
''
if
(
process
.
env
.
NODE_ENV
===
'development'
){
//开发环境
if
(
process
.
env
.
NODE_ENV
===
'development'
){
//开发环境
baseUrl
=
'http://pay.tuyoyoo.com/'
// baseUrl= 'http://pay.tuyoyoo.com/'
baseUrl
=
'http://192.168.0.213:7888/'
}
else
{
}
else
{
baseUrl
=
'https://manager.pangdly.com/'
baseUrl
=
'https://manager.pangdly.com/'
}
}
...
...
main.js
View file @
e93cc300
...
@@ -8,7 +8,7 @@ import commonjs from 'common/common.js'
...
@@ -8,7 +8,7 @@ import commonjs from 'common/common.js'
Vue
.
prototype
.
$commonjs
=
commonjs
Vue
.
prototype
.
$commonjs
=
commonjs
Vue
.
prototype
.
$request
=
request
Vue
.
prototype
.
$request
=
request
Vue
.
prototype
.
$wxurl
=
'https://
w
x.pangdly.com/#/'
Vue
.
prototype
.
$wxurl
=
'https://
l
x.pangdly.com/#/'
Vue
.
prototype
.
imageError
=
'@/static/img/common/pangdingLogo.png'
Vue
.
prototype
.
imageError
=
'@/static/img/common/pangdingLogo.png'
Vue
.
use
(
uView
)
Vue
.
use
(
uView
)
uni
.
$u
.
config
.
unit
=
'rpx'
uni
.
$u
.
config
.
unit
=
'rpx'
...
...
pages/scenic/scenicCombiOrder/scenicCombiOrder.vue
View file @
e93cc300
...
@@ -262,7 +262,10 @@
...
@@ -262,7 +262,10 @@
<view
class=
"bottom-btn"
:style=
"{ background: payBackground }"
>
<view
class=
"bottom-btn"
:style=
"{ background: payBackground }"
>
<text
v-if=
"orderStatus == 1"
>
已下架
</text>
<text
v-if=
"orderStatus == 1"
>
已下架
</text>
<text
v-if=
"orderStatus!= 1"
@
click=
"goPay()"
>
去支付
</text>
<
template
v-else
>
<text
v-if=
"parseInt(maxBookNum)
<1
"
>
暂无库存
</text>
<text
v-if=
"parseInt(maxBookNum)>0"
@
click=
"goPay()"
>
去支付
</text>
</
template
>
</view>
</view>
</view>
</view>
</view>
</view>
...
@@ -384,6 +387,7 @@ export default {
...
@@ -384,6 +387,7 @@ export default {
contactTotal
:
[],
//所有联系人列表
contactTotal
:
[],
//所有联系人列表
originalTotal
:
0
,
//原价总价
originalTotal
:
0
,
//原价总价
sellTotal
:
0
,
//卖价总价
sellTotal
:
0
,
//卖价总价
maxBookNum
:
999
,
//最大购买数量
}
}
},
},
onLoad
(
option
)
{
onLoad
(
option
)
{
...
@@ -417,29 +421,12 @@ export default {
...
@@ -417,29 +421,12 @@ export default {
this
.
productIdList
=
this
.
productList
.
map
((
item
)
=>
{
//id集合用于请求价格库存列表接口
this
.
productIdList
=
this
.
productList
.
map
((
item
)
=>
{
//id集合用于请求价格库存列表接口
return
item
.
id
return
item
.
id
})
})
for
(
let
i
=
0
;
i
<
this
.
productList
.
length
;
i
++
){
for
(
let
i
=
0
;
i
<
this
.
productList
.
length
;
i
++
){
let
item
=
this
.
productList
[
i
]
let
item
=
this
.
productList
[
i
]
//任何一个产品需要填写游客信息,下面的联系电话必须填写
//任何一个产品需要填写游客信息,下面的联系电话必须填写
if
(
item
.
tripTemplateFlag
!=
2
){
if
(
item
.
tripTemplateFlag
!=
2
){
this
.
showTelephone
=
true
this
.
showTelephone
=
true
}
}
//需要优化
// if(item.defaultAreaCode){
// item.areaObj={}
// item.areaObj.areaCode=item.areaCode
// item.areaObj.areaName=item.areaName
// }else{
// item.areaObj={}
// }
// if(item.isFetch==1&&item.productAreaList.length>1){
// //多个排号点
// this.areaIndex=index
// this.sortUpDown(item.merchantVo.code)
// }else if(item.isFetch==1&&item.productAreaList.length==1){
// //只有一个排号点
// item.areaObj=item.productAreaList[0]
// }
item
.
dateActive
=
0
//默认选中第一个日期
item
.
dateActive
=
0
//默认选中第一个日期
item
.
buyNum
=
1
,
//默认为1
item
.
buyNum
=
1
,
//默认为1
item
.
chooseContact
=
[]
//选中的游客信息列表
item
.
chooseContact
=
[]
//选中的游客信息列表
...
@@ -455,11 +442,6 @@ export default {
...
@@ -455,11 +442,6 @@ export default {
}
}
}
}
this
.
getPriceList
()
this
.
getPriceList
()
// this.getDiscountPrice() //获取优惠价格
if
(
this
.
showTelephone
)
{
//需要填写联系人信息和手机号码
this
.
getContactList
()
}
}
else
{
}
else
{
uni
.
showToast
({
uni
.
showToast
({
title
:
res
.
message
,
title
:
res
.
message
,
...
@@ -488,7 +470,8 @@ export default {
...
@@ -488,7 +470,8 @@ export default {
let
today
=
this
.
$commonjs
.
today
()
//今天
let
today
=
this
.
$commonjs
.
today
()
//今天
let
tomorrow
=
this
.
$commonjs
.
tomorrow
()
//明天
let
tomorrow
=
this
.
$commonjs
.
tomorrow
()
//明天
let
afterTomorrow
=
this
.
$commonjs
.
afterTomorrow
()
//后天
let
afterTomorrow
=
this
.
$commonjs
.
afterTomorrow
()
//后天
this
.
productList
.
forEach
(
item
=>
{
for
(
let
index
=
0
;
index
<
this
.
productList
.
length
;
index
++
){
let
item
=
this
.
productList
[
index
]
if
(
item
.
priceStockList
.
length
>
0
){
if
(
item
.
priceStockList
.
length
>
0
){
//获取价格列表的第一个日期+预订最晚时间
//获取价格列表的第一个日期+预订最晚时间
let
time1
=
item
.
priceStockList
[
0
].
startTime
.
substr
(
0
,
10
)
+
item
.
bookTime
let
time1
=
item
.
priceStockList
[
0
].
startTime
.
substr
(
0
,
10
)
+
item
.
bookTime
...
@@ -516,6 +499,7 @@ export default {
...
@@ -516,6 +499,7 @@ export default {
if
(
item
.
priceStockList
.
length
==
0
){
if
(
item
.
priceStockList
.
length
==
0
){
uni
.
showToast
({
title
:
'没有库存'
,
icon
:
'none'
})
uni
.
showToast
({
title
:
'没有库存'
,
icon
:
'none'
})
this
.
payBackground
=
'#C0C0C0'
this
.
payBackground
=
'#C0C0C0'
this
.
maxBookNum
=
0
return
return
}
}
//下面参数是默认选择每个产品第一个日期的值
//下面参数是默认选择每个产品第一个日期的值
...
@@ -541,11 +525,24 @@ export default {
...
@@ -541,11 +525,24 @@ export default {
if
(
item
.
productType
==
3
&&
item
.
priceStockList
.
length
>
0
){
if
(
item
.
productType
==
3
&&
item
.
priceStockList
.
length
>
0
){
this
.
getTimeStock
(
item
)
this
.
getTimeStock
(
item
)
}
}
//获取优惠券
this
.
initCoupon
(
item
)
//需要排号
if
(
item
.
isFetch
==
1
){
this
.
areaIndex
=
index
this
.
sortUpDown
(
item
.
merchantVo
.
code
)
}
}
else
{
}
else
{
uni
.
showToast
({
title
:
'没有库存'
,
icon
:
'none'
})
uni
.
showToast
({
title
:
'没有库存'
,
icon
:
'none'
})
this
.
payBackground
=
'#C0C0C0'
this
.
payBackground
=
'#C0C0C0'
this
.
maxBookNum
=
0
return
}
}
if
(
this
.
showTelephone
)
{
//需要填写联系人信息和手机号码
this
.
getContactList
()
}
}
})
this
.
computedPrice
()
//计算价格
this
.
computedPrice
()
//计算价格
//解决初始化日期不显示的情况
//解决初始化日期不显示的情况
this
.
$forceUpdate
()
this
.
$forceUpdate
()
...
@@ -575,18 +572,28 @@ export default {
...
@@ -575,18 +572,28 @@ export default {
//有库存并且需要选择两个站点以上的票种,显示区域组件
//有库存并且需要选择两个站点以上的票种,显示区域组件
for
(
let
item2
in
data
.
main
)
{
for
(
let
item2
in
data
.
main
)
{
if
(
data
.
main
[
item2
].
sceneSortStatus
==
'1'
){
if
(
data
.
main
[
item2
].
sceneSortStatus
==
'1'
){
//暂时下面只适应长江索道
this
.
showChooseArea
=
true
//上架
//上架
item
.
areaUp
=
true
item
.
areaUp
=
true
if
(
item
.
defaultAreaCode
){
//有默认的站点
item
.
areaObj
=
{}
item
.
areaObj
.
areaCode
=
item
.
areaCode
item
.
areaObj
.
areaName
=
item
.
areaName
}
else
{
item
.
areaObj
=
{}
}
//暂时下面只适应长江索道
this
.
showChooseArea
=
true
}
}
}
}
}
else
if
(
item
.
productAreaList
.
length
==
1
)
{
}
else
if
(
item
.
productAreaList
.
length
==
1
)
{
//只有一个站点时,直接选中站点(现目前还没有一个站点的景区)
//只有一个站点时,直接选中站点(现目前还没有一个站点的景区)
for
(
let
item
in
data
.
main
)
{
for
(
let
item
in
data
.
main
)
{
if
(
data
.
main
[
item
].
sceneSortStatus
==
'1'
)
{
if
(
data
.
main
[
item
].
sceneSortStatus
==
'1'
)
{
item
.
areaObj
=
item
.
productAreaList
[
0
]
//上架
item
.
areaUp
=
true
item
.
areaUp
=
true
item
.
areaObj
.
areaCode
=
item
.
productAreaList
[
0
].
areaCode
item
.
areaObj
.
areaName
=
item
.
productAreaList
[
0
].
areaName
}
}
}
}
}
}
...
@@ -1017,12 +1024,24 @@ export default {
...
@@ -1017,12 +1024,24 @@ export default {
let
item
=
this
.
productList
[
i
]
let
item
=
this
.
productList
[
i
]
//没有库存情况
//没有库存情况
if
(
!
item
.
priceStockList
||
item
.
priceStockList
.
length
==
0
){
if
(
!
item
.
priceStockList
||
item
.
priceStockList
.
length
==
0
){
uni
.
showToast
({
title
:
item
.
merchantName
+
'没有库存'
,
icon
:
'none'
})
return
}
//由于默认购买数量为1,没有判断产品的最大购买数量是否大于等于1,故下单的时候需要判断产品的最大购买数量大于1,才可以下单
if
(
parseFloat
(
item
.
maxBookNum
)
<
1
){
uni
.
showToast
({
title
:
item
.
merchantName
+
'没有库存'
,
icon
:
'none'
})
return
return
}
}
}
}
if
(
this
.
showTelephone
)
{
if
(
this
.
showTelephone
)
{
//需要填写电话号码
//需要填写电话号码
if
(
!
this
.
$commonjs
.
phoneReg
().
test
(
this
.
ticketPhone
)
&&
this
.
productIfo
.
tripTemplateFlag
!=
2
)
{
if
(
!
this
.
$commonjs
.
phoneReg
().
test
(
this
.
ticketPhone
))
{
//未填写正确手机号码
//未填写正确手机号码
uni
.
showToast
({
uni
.
showToast
({
title
:
'请填写正确的手机号码'
,
title
:
'请填写正确的手机号码'
,
...
@@ -1031,9 +1050,9 @@ export default {
...
@@ -1031,9 +1050,9 @@ export default {
return
return
}
}
}
}
// if (!
this.startDate || !this
.endDate) {
// if (!
item.startDate || !item
.endDate) {
// uni.showToast({
// uni.showToast({
// title:
'请选择游玩日期',
// title:
item.merchantName+
'请选择游玩日期',
// icon: 'none'
// icon: 'none'
// })
// })
// return
// return
...
...
pages/scenic/scenicOrder/scenicOrder.vue
View file @
e93cc300
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
</view>
</view>
</view>
</view>
<!--需要排队并且站点数大于1-->
<!--需要排队并且站点数大于1-->
<view
class=
"middle-place"
@
click=
"openArea()"
v-if=
"productIfo.isFetch == 1 && productIfo.productAreaList.length > 1 &&
showOpenArea
"
>
<view
class=
"middle-place"
@
click=
"openArea()"
v-if=
"productIfo.isFetch == 1 && productIfo.productAreaList.length > 1 &&
areaUp
"
>
<view>
出发站点
</view>
<view>
出发站点
</view>
<view>
<view>
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
</view>
</view>
</view>
</view>
<!--需要排队并且为一个站点-->
<!--需要排队并且为一个站点-->
<!--
<view
class=
"middle-place"
v-if=
"productIfo.isFetch == 1 && productIfo.productAreaList.length == 1 &&
showOpenArea
"
@
click=
"getSortInfor()"
>
<!--
<view
class=
"middle-place"
v-if=
"productIfo.isFetch == 1 && productIfo.productAreaList.length == 1 &&
areaUp
"
@
click=
"getSortInfor()"
>
<view>
获取排队信息
</view>
<view>
获取排队信息
</view>
<view>
<view>
...
@@ -304,8 +304,11 @@
...
@@ -304,8 +304,11 @@
<view
class=
"bottom-btn"
:style=
"{ background: payBackground }"
>
<view
class=
"bottom-btn"
:style=
"{ background: payBackground }"
>
<text
v-if=
"productIfo.status == 1"
>
已下架
</text>
<text
v-if=
"productIfo.status == 1"
>
已下架
</text>
<text
v-if=
"parseInt(maxBookNum) <1"
style=
"background: #c0c0c0"
>
暂无库存
</text>
<
template
v-else
>
<text
v-if=
"productIfo.status != 1 && parseInt(maxBookNum) >= 1"
@
click=
"goPay()"
>
去支付
</text>
<text
v-if=
"parseInt(maxBookNum)
<1
"
>
暂无库存
</text>
<text
v-if=
"parseInt(maxBookNum) >0"
@
click=
"goPay()"
>
去支付
</text>
</
template
>
</view>
</view>
</view>
</view>
</view>
</view>
...
@@ -397,7 +400,7 @@ export default {
...
@@ -397,7 +400,7 @@ export default {
sortInforPop
:
false
,
//一个站点时获取排队信息弹窗
sortInforPop
:
false
,
//一个站点时获取排队信息弹窗
showErmai
:
true
,
//临时的,选择了南站不显示耳麦
showErmai
:
true
,
//临时的,选择了南站不显示耳麦
showArea
:
false
,
//控制选择站点显示隐藏
showArea
:
false
,
//控制选择站点显示隐藏
showOpenArea
:
false
,
//是否可以显示选择站点
areaUp
:
false
,
//排号是否上架
chooseDate
:
''
,
//选择的日期
chooseDate
:
''
,
//选择的日期
active
:
10000
,
//日期下标
active
:
10000
,
//日期下标
timeActive
:
10000
,
//时间下标,默认不选中
timeActive
:
10000
,
//时间下标,默认不选中
...
@@ -425,7 +428,7 @@ export default {
...
@@ -425,7 +428,7 @@ export default {
endDate
:
''
,
//结束日期
endDate
:
''
,
//结束日期
startPlayTime
:
''
,
//开始时间
startPlayTime
:
''
,
//开始时间
endPlayTime
:
''
,
//结束时间
endPlayTime
:
''
,
//结束时间
areaObj
:
''
,
//区域组件的传值
areaObj
:
{}
,
//区域组件的传值
templateList
:
[],
//该产品联系人必须要填写的信息
templateList
:
[],
//该产品联系人必须要填写的信息
timeFlag
:
''
,
//setTimeout函数
timeFlag
:
''
,
//setTimeout函数
savedMoney
:
0
,
//优惠价格
savedMoney
:
0
,
//优惠价格
...
@@ -508,191 +511,6 @@ export default {
...
@@ -508,191 +511,6 @@ export default {
}
}
},
},
methods
:
{
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
.
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
.
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
)
}
uni
.
$u
.
throttle
(
this
.
initCoupon
,
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
.
productIfo
.
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
},
//---页面初始化数据,获取产品基本信息
//---页面初始化数据,获取产品基本信息
initData
()
{
initData
()
{
let
data
=
{
let
data
=
{
...
@@ -706,16 +524,6 @@ export default {
...
@@ -706,16 +524,6 @@ export default {
if
(
res
.
code
==
'00'
)
{
if
(
res
.
code
==
'00'
)
{
this
.
productIfo
=
res
.
data
this
.
productIfo
=
res
.
data
this
.
defaultAreaCode
=
this
.
productIfo
.
defaultAreaCode
||
''
this
.
defaultAreaCode
=
this
.
productIfo
.
defaultAreaCode
||
''
//通过默认站点找到站点数据
if
(
this
.
defaultAreaCode
)
{
this
.
productIfo
.
productAreaList
.
forEach
(
item
=>
{
if
(
item
.
areaCode
==
this
.
defaultAreaCode
)
{
this
.
areaObj
=
{}
this
.
areaObj
.
areaCode
=
item
.
areaCode
this
.
areaObj
.
areaName
=
item
.
areaName
}
})
}
this
.
merchantCode
=
this
.
productIfo
.
merchantVo
.
code
,
//商户code
this
.
merchantCode
=
this
.
productIfo
.
merchantVo
.
code
,
//商户code
this
.
productId
=
res
.
data
.
id
//产品id变化,重新赋值产品id
this
.
productId
=
res
.
data
.
id
//产品id变化,重新赋值产品id
this
.
merchantId
=
res
.
data
.
merchantId
//重新赋值商户id
this
.
merchantId
=
res
.
data
.
merchantId
//重新赋值商户id
...
@@ -726,25 +534,14 @@ export default {
...
@@ -726,25 +534,14 @@ export default {
if
(
this
.
productIfo
.
status
==
1
)
{
if
(
this
.
productIfo
.
status
==
1
)
{
//下架状态
//下架状态
this
.
payBackground
=
'#C0C0C0'
this
.
payBackground
=
'#C0C0C0'
return
}
}
if
(
this
.
productIfo
.
productType
!=
3
)
{
if
(
this
.
productIfo
.
productType
!=
3
)
{
//不为班次票时,开始时间为当前时间,结束时间为23:59:59
//不为班次票时,开始时间为当前时间,结束时间为23:59:59
this
.
startPlayTime
=
new
Date
().
Format
(
'hh:mm:ss'
)
this
.
startPlayTime
=
new
Date
().
Format
(
'hh:mm:ss'
)
this
.
endPlayTime
=
'23:59:59'
this
.
endPlayTime
=
'23:59:59'
}
}
if
(
this
.
productIfo
.
tripTemplateResList
.
length
>
0
)
{
//用于判断选中的联系人信息是否填写完善
this
.
productIfo
.
tripTemplateResList
.
forEach
(
item
=>
{
this
.
templateList
.
push
(
item
.
enumKey
)
})
}
this
.
getPriceList
()
this
.
getPriceList
()
this
.
getDiscountPrice
()
//获取优惠价格
if
(
this
.
productIfo
.
tripTemplateFlag
!=
2
)
{
//等于2时不需要填写联系人信息和手机号码
this
.
getContactList
()
}
}
else
{
}
else
{
uni
.
showToast
({
uni
.
showToast
({
title
:
res
.
message
,
title
:
res
.
message
,
...
@@ -789,13 +586,10 @@ export default {
...
@@ -789,13 +586,10 @@ export default {
title
:
'没有库存'
,
title
:
'没有库存'
,
icon
:
'none'
icon
:
'none'
})
})
this
.
showArea
=
false
this
.
payBackground
=
'#C0C0C0'
this
.
payBackground
=
'#C0C0C0'
this
.
maxBookNum
=
0
return
return
}
}
if
(
this
.
productIfo
.
isFetch
==
1
)
{
this
.
sortUpDown
()
}
if
(
this
.
dateList
.
length
==
1
&&
this
.
beforeBookDays
==
0
)
{
if
(
this
.
dateList
.
length
==
1
&&
this
.
beforeBookDays
==
0
)
{
//长度为1而且只能预订当天,默认选中第一个日期
//长度为1而且只能预订当天,默认选中第一个日期
//真机模拟的时候手机端不显示今天,明天后天,延迟执行
//真机模拟的时候手机端不显示今天,明天后天,延迟执行
...
@@ -812,15 +606,24 @@ export default {
...
@@ -812,15 +606,24 @@ export default {
//如果为班次票,请求班次票接口
//如果为班次票,请求班次票接口
this
.
getTimeStock
()
this
.
getTimeStock
()
}
}
this
.
initCoupon
()
//获取优惠券
//获取优惠券
this
.
initCoupon
()
}
if
(
this
.
productIfo
.
isFetch
==
1
)
{
this
.
sortUpDown
()
}
if
(
this
.
productIfo
.
tripTemplateFlag
!=
2
)
{
//等于2时不需要填写联系人信息和手机号码
this
.
getContactList
()
}
}
}
else
{
}
else
{
uni
.
showToast
({
uni
.
showToast
({
title
:
'没有库存'
,
title
:
'没有库存'
,
icon
:
'none'
icon
:
'none'
})
})
this
.
showArea
=
false
this
.
payBackground
=
'#C0C0C0'
this
.
payBackground
=
'#C0C0C0'
this
.
maxBookNum
=
0
return
}
}
let
today
=
this
.
$commonjs
.
today
()
//今天
let
today
=
this
.
$commonjs
.
today
()
//今天
let
tomorrow
=
this
.
$commonjs
.
tomorrow
()
//明天
let
tomorrow
=
this
.
$commonjs
.
tomorrow
()
//明天
...
@@ -858,20 +661,33 @@ export default {
...
@@ -858,20 +661,33 @@ export default {
if
(
res
.
code
==
'00'
)
{
if
(
res
.
code
==
'00'
)
{
this
.
sortArr
=
res
.
data
.
data
this
.
sortArr
=
res
.
data
.
data
let
data
=
res
.
data
let
data
=
res
.
data
if
(
this
.
productIfo
.
productAreaList
.
length
>
1
)
{
let
areaList
=
this
.
productIfo
.
productAreaList
if
(
areaList
.
length
>
1
)
{
//有库存并且需要选择两个站点以上的票种,显示区域组件
//有库存并且需要选择两个站点以上的票种,显示区域组件
for
(
let
item
in
data
.
main
)
{
for
(
let
item
in
data
.
main
)
{
if
(
data
.
main
[
item
].
sceneSortStatus
==
'1'
){
if
(
data
.
main
[
item
].
sceneSortStatus
==
'1'
){
//上架
this
.
areaUp
=
true
this
.
showArea
=
true
this
.
showArea
=
true
this
.
showOpenArea
=
true
//通过默认站点找到站点数据
if
(
this
.
defaultAreaCode
)
{
areaList
.
forEach
(
item
=>
{
if
(
item
.
areaCode
==
this
.
defaultAreaCode
)
{
this
.
areaObj
.
areaCode
=
item
.
areaCode
this
.
areaObj
.
areaName
=
item
.
areaName
}
})
}
}
}
}
}
}
else
if
(
this
.
productIfo
.
productA
reaList
.
length
==
1
)
{
}
else
if
(
a
reaList
.
length
==
1
)
{
//只有一个站点时,直接选中站点(现目前还没有一个站点的景区)
//只有一个站点时,直接选中站点(现目前还没有一个站点的景区)
for
(
let
item
in
data
.
main
)
{
for
(
let
item
in
data
.
main
)
{
if
(
data
.
main
[
item
].
sceneSortStatus
==
'1'
)
{
if
(
data
.
main
[
item
].
sceneSortStatus
==
'1'
)
{
this
.
areaObj
=
this
.
productIfo
.
productAreaList
[
0
]
//上架
this
.
showOpenArea
=
true
this
.
areaUp
=
true
this
.
areaObj
.
areaCode
=
areaList
[
0
].
areaCode
this
.
areaObj
.
areaName
=
areaList
[
0
].
areaName
}
}
}
}
}
}
...
@@ -915,6 +731,191 @@ export default {
...
@@ -915,6 +731,191 @@ export default {
}
}
})
})
},
},
//---获取排号信息
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
.
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
)
}
uni
.
$u
.
throttle
(
this
.
initCoupon
,
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
.
productIfo
.
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
()
{
getContactList
()
{
let
data
=
{
let
data
=
{
...
@@ -1134,7 +1135,7 @@ export default {
...
@@ -1134,7 +1135,7 @@ export default {
return
return
}
}
}
}
if
(
this
.
productIfo
.
isFetch
==
1
&&
this
.
showOpenArea
)
{
if
(
this
.
productIfo
.
isFetch
==
1
&&
this
.
areaUp
)
{
//需要选择站点的票种,必须选择站点
//需要选择站点的票种,必须选择站点
if
(
!
this
.
areaObj
.
areaCode
)
{
if
(
!
this
.
areaObj
.
areaCode
)
{
uni
.
showToast
({
uni
.
showToast
({
...
@@ -1211,7 +1212,7 @@ export default {
...
@@ -1211,7 +1212,7 @@ export default {
return
return
}
}
}
}
if
(
this
.
productIfo
.
isFetch
==
1
&&
this
.
showOpenArea
)
{
if
(
this
.
productIfo
.
isFetch
==
1
&&
this
.
areaUp
)
{
//需要选择站点的票种,必须选择站点
//需要选择站点的票种,必须选择站点
if
(
!
this
.
areaObj
.
areaCode
)
{
if
(
!
this
.
areaObj
.
areaCode
)
{
uni
.
showToast
({
uni
.
showToast
({
...
...
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