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
de038472
Commit
de038472
authored
Dec 11, 2023
by
潘永坪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
组合填写订单页面开发
parent
1da98847
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
314 additions
and
393 deletions
+314
-393
albumOrderdetail.vue
pages/album/albumOrderdetail/albumOrderdetail.vue
+1
-2
combinationProduct.vue
pages/scenic/combinationProduct/combinationProduct.vue
+1
-1
scenicCombiOrder.vue
pages/scenic/scenicCombiOrder/scenicCombiOrder.vue
+310
-388
scenicOrder.vue
pages/scenic/scenicOrder/scenicOrder.vue
+2
-2
No files found.
pages/album/albumOrderdetail/albumOrderdetail.vue
View file @
de038472
...
...
@@ -213,8 +213,7 @@ export default {
getDetail
(){
let
data
=
{
orderId
:
this
.
orderId
,
//订单ID
// userId:uni.getStorageSync('openid')||'',//用户Id
userId
:
'oroHZ5FaUQ_SOOC_uQQP92fJpBRE'
,
//用户Id
userId
:
uni
.
getStorageSync
(
'openid'
)
||
''
,
//用户Id
}
this
.
$request
(
'order/userOrder/findOrderDetail'
,
data
).
then
(
res
=>
{
if
(
res
.
code
==
'00'
)
{
...
...
pages/scenic/combinationProduct/combinationProduct.vue
View file @
de038472
...
...
@@ -585,7 +585,7 @@ export default {
})
let
query
=
'?productIdList='
+
JSON
.
stringify
(
productIdList
)
+
'&groupId='
+
this
.
groupId
+
'&groupChannelId='
+
this
.
groupChannelId
+
'&orderSource=3'
uni
.
navigateTo
({
url
:
'/pages/
combination/combiOrder/c
ombiOrder'
+
query
url
:
'/pages/
scenic/scenicCombiOrder/scenicC
ombiOrder'
+
query
})
}
},
...
...
pages/scenic/scenicCombiOrder/scenicCombiOrder.vue
View file @
de038472
...
...
@@ -123,7 +123,7 @@
<view
class=
"list-Number"
>
<view
class=
"title-text"
>
购买数量
</view>
<view>
<u-number-box
v-model=
"item.buyNum"
@
change=
'buyNumChange'
>
<u-number-box
:max=
"item.maxBookNum"
v-model=
"item.buyNum"
@
change=
'buyNumChange'
>
<view
slot=
"minus"
class=
"number-minus"
>
<u-icon
name=
"minus"
color=
"#FFFFFF"
size=
"32"
></u-icon>
</view>
...
...
@@ -449,6 +449,270 @@ export default {
}
},
methods
:
{
//---页面初始化数据,获取产品基本信息---已修改
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
.
tripTemplateFlag
!=
2
){
this
.
showTelephone
=
true
}
if
(
item
.
defaultAreaCode
){
item
.
areaObj
=
{}
item
.
areaObj
.
areaCode
=
item
.
areaCode
item
.
areaObj
.
areaName
=
item
.
areaName
}
else
{
item
.
areaObj
=
{}
}
item
.
dateActive
=
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
.
showTelephone
)
{
//需要填写联系人信息和手机号码
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
,
index
)
=>
{
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
]
}
//把价格列表合并到对应的产品上面
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
()
+
item
.
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
.
chooseDate
=
item
.
priceStockList
[
0
].
startTime
.
substr
(
0
,
10
)
//日历选中的日期
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
)
//最大购买数量
console
.
log
(
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
.
$forceUpdate
()
}
else
{
uni
.
showToast
({
title
:
res
.
message
,
icon
:
'none'
})
}
})
},
//---排号是否上下架---已修改
sortUpDown
(
merchantCode
)
{
let
data
=
{
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
this
.
productList
.
forEach
(
item
=>
{
if
(
item
.
productAreaList
.
length
>
1
){
//有库存并且需要选择两个站点以上的票种,显示区域组件
for
(
let
item2
in
data
.
main
)
{
if
(
data
.
main
[
item2
].
sceneSortStatus
==
'1'
){
//暂时下面只适应长江索道
this
.
showChooseArea
=
true
//上架
item
.
areaUp
=
true
}
}
}
else
if
(
item
.
productAreaList
.
length
==
1
)
{
//只有一个站点时,直接选中站点(现目前还没有一个站点的景区)
for
(
let
item
in
data
.
main
)
{
if
(
data
.
main
[
item
].
sceneSortStatus
==
'1'
)
{
item
.
areaObj
=
item
.
productAreaList
[
0
]
item
.
areaUp
=
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'
})
}
})
},
//---获取排号信息---暂时未使用
getSortInfor
(
merchantCode
)
{
let
data
=
{
...
...
@@ -491,9 +755,6 @@ export default {
},
//---展示日历---已修改
showCalendar
(
index
)
{
// if(!this.productList[index].chooseDate){//没有选择时,默认第一个日期
// this.productList[index].chooseDate=this.productList[index].priceStockList[0].startTime.substr(0,10)
// }
this
.
$refs
.
calendar
.
setDefaultDate
(
this
.
productList
[
index
].
chooseDate
)
//日历组件选中日期
this
.
moreDateIndex
=
index
this
.
chooseDateList
=
this
.
productList
[
index
].
priceStockList
...
...
@@ -514,25 +775,29 @@ export default {
item
.
cruisePlanId
=
''
item
.
timeActive
=
10000
this
.
timeActive
=
10000
uni
.
$u
.
throttle
(
this
.
getTimeStock
(
item
),
3000
)
uni
.
$u
.
throttle
(()
=>
{
this
.
getTimeStock
(
item
)
this
.
initCoupon
(
item
)
},
3000
)
}
// this.initCoupon(Item.id,Item.buyNum,Item.sellingPrice,Item.merchantId,Index)
uni
.
$u
.
throttle
(()
=>
{
this
.
initCoupon
(
item
)
},
3000
)
//解决点击日期无反应的情况
this
.
$forceUpdate
()
},
//---日历确认事件
dateConfig
(
data
)
{
let
index2
=
chooseDateList
.
findIndex
(
item
=>
{
let
index2
=
this
.
chooseDateList
.
findIndex
(
item
=>
{
return
item
.
startTime
.
substr
(
0
,
10
)
==
data
})
let
item
=
this
.
productList
[
this
.
moreDateIndex
]
let
item2
=
item
.
priceStockList
[
index2
]
this
.
dateChoose
(
item
,
item2
,
index2
)
//选中确认的日期
let
width
=
0
this
.
docQuery
.
select
(
'.date-list'
).
boundingClientRect
(
data
=>
{
width
=
data
.
width
item
.
dateScroll
=
(
data
.
width
+
6
)
*
index2
this
.
$forceUpdate
()
}).
exec
()
item
.
dateScroll
=
(
width
+
6
)
*
index2
},
//---展示更多时间---已改好
showTime
(
item
,
index
)
{
...
...
@@ -564,11 +829,9 @@ export default {
let
item2
=
this
.
chooseTimeList
[
index2
]
this
.
chooseTime
(
item
,
item2
,
index2
)
//由于没有数据需要测试
let
width
=
0
this
.
docQuery
.
select
(
'.time-list'
).
boundingClientRect
(
data
=>
{
width
=
data
.
width
item
.
timeScroll
=
(
data
.
width
+
6
)
*
index2
}).
exec
()
item
.
timeScroll
=
(
width
+
6
)
*
index2
},
//---获取点击的编辑联系人信息,传给编辑联系人组件
getEditContact
(
data
)
{
...
...
@@ -611,387 +874,46 @@ export default {
//先注释
// 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
)
//---订单数量变化---正在修改
buyNumChange
(
value
,
index
)
{
console
.
log
(
value
)
console
.
log
(
index
)
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
)
//解决数量显示不及时更新问题
this
.
$forceUpdate
()
},
//---展示购票须知---已修改
showBuyKnow
(
index
)
{
this
.
buyKnowData
=
this
.
productList
[
index
]
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
.
tripTemplateFlag
!=
2
){
this
.
showTelephone
=
true
}
if
(
item
.
defaultAreaCode
){
item
.
areaObj
=
{}
item
.
areaObj
.
areaCode
=
item
.
areaCode
item
.
areaObj
.
areaName
=
item
.
areaName
}
else
{
item
.
areaObj
=
{}
}
item
.
dateActive
=
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
.
showTelephone
)
{
//需要填写联系人信息和手机号码
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
,
index
)
=>
{
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
]
}
//把价格列表合并到对应的产品上面
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
()
+
item
.
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
.
$forceUpdate
()
// 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.showChooseArea = 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.showChooseArea = 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
(
merchantCode
)
{
let
data
=
{
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
this
.
productList
.
forEach
(
item
=>
{
if
(
item
.
productAreaList
.
length
>
1
){
//有库存并且需要选择两个站点以上的票种,显示区域组件
for
(
let
item2
in
data
.
main
)
{
if
(
data
.
main
[
item2
].
sceneSortStatus
==
'1'
){
//暂时下面只适应长江索道
this
.
showChooseArea
=
true
//上架
item
.
areaUp
=
true
}
}
}
else
if
(
item
.
productAreaList
.
length
==
1
)
{
//只有一个站点时,直接选中站点(现目前还没有一个站点的景区)
for
(
let
item
in
data
.
main
)
{
if
(
data
.
main
[
item
].
sceneSortStatus
==
'1'
)
{
item
.
areaObj
=
item
.
productAreaList
[
0
]
item
.
areaUp
=
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
=
{
...
...
pages/scenic/scenicOrder/scenicOrder.vue
View file @
de038472
...
...
@@ -456,7 +456,6 @@ export default {
this
.
orderSource
=
option
.
orderSource
||
''
this
.
thirdOpenid
=
option
.
thirdOpenid
||
''
//第三方openid
this
.
productId
=
option
.
productId
||
''
this
.
merchantId
=
option
.
merchantId
||
''
this
.
initData
()
//页面初始化数据
this
.
docQuery
=
uni
.
createSelectorQuery
().
in
(
this
)
},
...
...
@@ -579,7 +578,8 @@ export default {
this
.
timeActive
=
10000
uni
.
$u
.
throttle
(
this
.
getTimeStock
,
3000
)
}
this
.
initCoupon
()
uni
.
$u
.
throttle
(
this
.
initCoupon
,
3000
)
},
//---日历确认事件
dateConfig
(
data
)
{
...
...
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