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
470be20f
Commit
470be20f
authored
Nov 22, 2023
by
潘永坪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单填写页面开发
parent
3c81b50e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
271 additions
and
164 deletions
+271
-164
detail.vue
pages/scenic/scenicComponents/detail.vue
+13
-50
scenicOrder.vue
pages/scenic/scenicOrder/scenicOrder.vue
+258
-114
No files found.
pages/scenic/scenicComponents/detail.vue
View file @
470be20f
<
template
>
<
template
>
<u-popup
:show=
"show
"
:round=
"20"
@
close=
"show
= false"
closeable
>
<u-popup
:show=
"show
Pop"
:round=
"20"
@
close=
"showPop
= false"
closeable
>
<view
class=
"son-wrap"
>
<view
class=
"son-wrap"
>
<view
class=
"detail-title"
>
<view
class=
"detail-title"
>
订单明细
订单明细
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
</view>
</view>
</view>
</view>
<!-- ---------------------------------------额外服务------------------------------------------- -->
<!-- ---------------------------------------额外服务------------------------------------------- -->
<view
class=
"content-box"
v-for=
"(item, index) of choo
oseServiceData
"
:key=
"index"
>
<view
class=
"content-box"
v-for=
"(item, index) of choo
seService
"
:key=
"index"
>
<text>
<text>
{{
item
.
name
}}
{{
item
.
name
}}
</text>
</text>
...
@@ -45,56 +45,19 @@
...
@@ -45,56 +45,19 @@
<
script
>
<
script
>
export
default
{
export
default
{
props
:
[
'merchantName'
,
'name'
,
'buyNum'
,
'sellingPrice'
,
'productDepositTotal'
,
'chooseCouponObj'
,
'choooseService'
],
props
:
[
watch
:
{
'merchantName'
,
choooseService
:
{
'name'
,
handler
(
newValue
,
oldValue
)
{
'buyNum'
,
if
(
newValue
)
{
'sellingPrice'
,
this
.
choooseServiceData
=
this
.
choooseService
'productDepositTotal'
,
}
'chooseCouponObj'
,
},
'chooseService'
,
deep
:
false
,
'sellTotal'
immediate
:
false
],
}
},
data
()
{
data
()
{
return
{
return
{
show
:
false
,
//控制弹窗显示隐藏
showPop
:
false
,
//控制弹窗显示隐藏
extraPrice
:
0
,
//额外服务价格
depositTotal
:
0
,
//额外服务总押金
choooseServiceData
:
[]
//选中的服务
}
},
computed
:
{
sellTotal
()
{
//卖价总价
let
savedMoney
=
0
if
(
this
.
chooseCouponObj
)
{
savedMoney
=
this
.
chooseCouponObj
.
savedMoney
}
if
(
this
.
choooseServiceData
.
length
>
0
)
{
//额外服务价格
let
singleMoney
=
0
//单个产品总押金,用于算出总押金
this
.
extraPrice
=
0
this
.
depositTotal
=
0
//总押金
for
(
let
i
=
0
;
i
<
this
.
choooseServiceData
.
length
;
i
++
)
{
this
.
extraPrice
+=
parseFloat
((
this
.
choooseServiceData
[
i
].
sellingPrice
*
this
.
buyNum
).
toFixed
(
2
))
if
(
this
.
choooseServiceData
[
i
].
depositType
==
1
)
{
//等于1,押金金额跟数量没关系
singleMoney
=
this
.
choooseServiceData
[
i
].
deposit
this
.
choooseServiceData
[
i
].
depositTotal
=
this
.
choooseServiceData
[
i
].
deposit
//单个产品总押金
}
else
if
(
this
.
choooseServiceData
[
i
].
depositType
==
2
)
{
//等于2,押金单价乘购买数量
singleMoney
=
parseFloat
((
this
.
choooseServiceData
[
i
].
deposit
*
this
.
buyNum
).
toFixed
(
2
))
this
.
choooseServiceData
[
i
].
depositTotal
=
parseFloat
((
this
.
choooseServiceData
[
i
].
deposit
*
this
.
buyNum
).
toFixed
(
2
))
//单个产品总押金
}
this
.
depositTotal
+=
singleMoney
}
}
else
{
this
.
extraPrice
=
0
this
.
depositTotal
=
0
}
return
parseFloat
((
this
.
sellingPrice
*
this
.
buyNum
+
this
.
extraPrice
+
this
.
depositTotal
+
this
.
productDepositTotal
-
savedMoney
).
toFixed
(
2
))
}
}
},
},
...
...
pages/scenic/scenicOrder/scenicOrder.vue
View file @
470be20f
...
@@ -123,6 +123,55 @@
...
@@ -123,6 +123,55 @@
</view>
</view>
</view>
</view>
</view>
</view>
<!-- -----------------------------有可用优惠券,并且未选中----------------------------------------------------- -->
<!--
<div
class=
"middle1Coupon"
v-if=
"couponData.masterSlaveCouponList&&couponData.masterSlaveCouponList.length>0&&chooseCouponObj==''"
@
click=
"showCoupon()"
>
<span>
券
</span>
<span>
{{
couponData
.
masterSlaveCouponList
[
0
].
couponName
}}
</span>
<span>
未选优惠券
<svg
class=
"icon"
aria-hidden=
"true"
style=
"font-size: 0.24rem;color: #666666;"
>
<use
xlink:href=
"#iconyou"
></use>
</svg>
</span>
</div>
-->
<!-- -----------------------------有可用优惠券----------------------------------------------------- -->
<!--
<div
class=
"middle1Coupon"
v-if=
"chooseCouponObj!=''&&savedMoney>0"
@
click=
"showCoupon()"
>
<span>
券
</span>
<span>
<b>
{{
chooseCouponObj
.
couponName
}}
</b>
</span>
<span>
<i>
-¥
</i><i>
{{
parseFloat
(
savedMoney
.
toFixed
(
2
))
}}
</i>
<svg
class=
"icon"
aria-hidden=
"true"
style=
"font-size: 0.24rem;color: #666666;"
>
<use
xlink:href=
"#iconyou"
></use>
</svg>
</span>
</div>
-->
<!-- -----------------------------------------------可用优惠券条件--------------------------------------- -->
<!--
<div
class=
"middle1Coupon"
v-if=
"ableConpon!=''"
@
click=
"showCoupon()"
>
<span>
券
</span>
<span>
<b>
{{
ableConpon
.
couponName
}}
</b>
</span>
<span>
{{
ableConpon
.
couponRule
}}
<svg
class=
"icon"
aria-hidden=
"true"
>
<use
xlink:href=
"#iconyou"
></use>
</svg>
</span>
</div>
-->
<!-- --------------------------------------------额外服务部分-------------------------------------------- -->
<!-- --------------------------------------------额外服务部分-------------------------------------------- -->
<view
class=
"extraService"
v-if=
"serviceList.length>0&&showErmai"
>
<view
class=
"extraService"
v-if=
"serviceList.length>0&&showErmai"
>
<checkbox-group
@
change=
"extraChange"
>
<checkbox-group
@
change=
"extraChange"
>
...
@@ -136,7 +185,7 @@
...
@@ -136,7 +185,7 @@
<view>
<view>
<text
style=
"font-size: 24rpx;"
>
¥
</text>
<text
style=
"font-size: 24rpx;"
>
¥
</text>
<text
style=
"font-size: 32rpx;margin-right: 20rpx;"
>
{{
item
.
sellingPrice
}}
</text>
<text
style=
"font-size: 32rpx;margin-right: 20rpx;"
>
{{
item
.
sellingPrice
}}
</text>
<checkbox
class=
"blue"
:value=
"JSON.stringify(item)"
style=
"transform: scale(0.7);"
/>
<checkbox
class=
"blue"
:value=
"JSON.stringify(item)"
style=
"transform: scale(0.7);"
:checked=
"item.ifChoose"
/>
</view>
</view>
</label>
</label>
</view>
</view>
...
@@ -265,12 +314,14 @@
...
@@ -265,12 +314,14 @@
<buyKnow
ref=
"buyKnow"
:buyKnowData=
"buyKnowData"
></buyKnow>
<buyKnow
ref=
"buyKnow"
:buyKnowData=
"buyKnowData"
></buyKnow>
<detail
<detail
ref=
"detail"
ref=
"detail"
:sellTotal=
'sellTotal'
:merchantName=
"productIfo.merchantName"
:merchantName=
"productIfo.merchantName"
:name=
"productIfo.name"
:name=
"productIfo.name"
:buyNum=
"buyNum"
:buyNum=
"buyNum"
:sellingPrice=
"sellingPrice"
:sellingPrice=
"sellingPrice"
:choo
oseService=
"cho
ooseService"
:choo
seService=
"ch
ooseService"
:productDepositTotal=
"productDepositTotal"
:productDepositTotal=
"productDepositTotal"
:chooseCouponObj=
"chooseCouponObj"
></detail>
></detail>
<chooseArea
<chooseArea
v-if=
"showArea"
v-if=
"showArea"
...
@@ -287,7 +338,7 @@
...
@@ -287,7 +338,7 @@
:contactTotal=
"contactTotal"
:contactTotal=
"contactTotal"
:contactNum=
"contactNum"
:contactNum=
"contactNum"
></contactList>
></contactList>
<orderCoupon
:couponData=
"couponData"
ref=
"orderCoupon"
@
couponChoose=
"couponChoose"
:chooseCouponObj=
"chooseCouponObj"
></orderCoupon>
<!--一个站点时获取排队信息弹窗-->
<!--一个站点时获取排队信息弹窗-->
<!--
<u-popup
:show=
"sortInforPop"
:round=
"10"
closeable
@
close=
"sortInforPop = false"
>
<!--
<u-popup
:show=
"sortInforPop"
:round=
"10"
closeable
@
close=
"sortInforPop = false"
>
<view
style=
"padding: 40rpx 60rpx"
>
<view
style=
"padding: 40rpx 60rpx"
>
...
@@ -321,6 +372,7 @@
...
@@ -321,6 +372,7 @@
<
script
>
<
script
>
import
calendar
from
'../scenicComponents/calendar'
//日历组件
import
calendar
from
'../scenicComponents/calendar'
//日历组件
import
buyKnow
from
'@/components/buyKnow.vue'
//购票须知
import
buyKnow
from
'@/components/buyKnow.vue'
//购票须知
import
orderCoupon
from
'@/components/orderCoupon'
//优惠券
import
detail
from
'../scenicComponents/detail.vue'
//明细弹窗
import
detail
from
'../scenicComponents/detail.vue'
//明细弹窗
import
chooseArea
from
'../scenicComponents/chooseArea'
//选择站点
import
chooseArea
from
'../scenicComponents/chooseArea'
//选择站点
import
contactList
from
'../scenicComponents/contactList'
//联系人弹窗
import
contactList
from
'../scenicComponents/contactList'
//联系人弹窗
...
@@ -335,7 +387,8 @@ export default {
...
@@ -335,7 +387,8 @@ export default {
contactList
,
contactList
,
editContacts
,
editContacts
,
times
,
times
,
chooseArea
chooseArea
,
orderCoupon
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -359,8 +412,8 @@ export default {
...
@@ -359,8 +412,8 @@ export default {
merchantId
:
''
,
//商户Id
merchantId
:
''
,
//商户Id
ticketPhone
:
''
,
//联系电话
ticketPhone
:
''
,
//联系电话
productIfo
:
''
,
//初始化产品基本信息
productIfo
:
''
,
//初始化产品基本信息
originalPrice
:
0
,
//原价
originalPrice
:
0
,
//原价
单价
sellingPrice
:
0
,
//卖价
sellingPrice
:
0
,
//卖价
单价
interfaceCode
:
''
,
//接口编号
interfaceCode
:
''
,
//接口编号
merchantCode
:
''
,
//商户code
merchantCode
:
''
,
//商户code
productCode
:
''
,
//产品code
productCode
:
''
,
//产品code
...
@@ -379,11 +432,10 @@ export default {
...
@@ -379,11 +432,10 @@ export default {
flag
:
''
,
//setTimeout函数
flag
:
''
,
//setTimeout函数
savedMoney
:
0
,
//优惠价格
savedMoney
:
0
,
//优惠价格
serviceList
:
[],
//所有额外服务
serviceList
:
[],
//所有额外服务
choo
o
seService
:
[],
//选中的额外服务
chooseService
:
[],
//选中的额外服务
extraPrice
:
0
,
//额外服务总价格
extraPrice
:
0
,
//额外服务总价格
showExtraPop
:
false
,
//控制支付时有额外服务,没有选中额外服务的弹窗显示隐藏
showExtraPop
:
false
,
//控制支付时有额外服务,没有选中额外服务的弹窗显示隐藏
orderProductList
:
[],
//额外服务,儿童票等入参
orderProductList
:
[],
//额外服务,儿童票等入参
extraextraDepositTotal
:
0
,
//额外服务总押金
productDepositTotal
:
0
,
//产品总押金
productDepositTotal
:
0
,
//产品总押金
orderSource
:
''
,
//订单来源 1公众号平台、2公众号组合页面1、3公众号组合页面2、4胖丁伙伴app、5第三方自助机、6第三方票房窗口
orderSource
:
''
,
//订单来源 1公众号平台、2公众号组合页面1、3公众号组合页面2、4胖丁伙伴app、5第三方自助机、6第三方票房窗口
thirdOpenid
:
''
,
//第三方openid
thirdOpenid
:
''
,
//第三方openid
...
@@ -392,7 +444,10 @@ export default {
...
@@ -392,7 +444,10 @@ export default {
docQuery
:
''
,
//元素变量
docQuery
:
''
,
//元素变量
payBackground
:
''
,
//支付按钮背景颜色
payBackground
:
''
,
//支付按钮背景颜色
dateScroll
:
''
,
//日期滚动值
dateScroll
:
''
,
//日期滚动值
timeScroll
:
''
//时间滚动值
timeScroll
:
''
,
//时间滚动值
openid
:
uni
.
getStorageSync
(
'openid'
)
||
''
,
//openid
couponData
:
''
,
//所有劵数据
chooseCouponObj
:
''
,
//默认选中最优价格优惠券
}
}
},
},
onLoad
(
option
)
{
onLoad
(
option
)
{
...
@@ -409,19 +464,19 @@ export default {
...
@@ -409,19 +464,19 @@ export default {
computed
:
{
computed
:
{
originalTotal
()
{
originalTotal
()
{
//原价总价
//原价总价
if
(
this
.
choo
o
seService
.
length
>
0
)
{
if
(
this
.
chooseService
.
length
>
0
)
{
//额外服务价格和押金总价格
//额外服务价格和押金总价格
let
singleProduct
=
0
//单个产品押金
let
singleProduct
=
0
//单个产品押金
this
.
extraPrice
=
0
this
.
extraPrice
=
0
this
.
extraDepositTotal
=
0
//总押金
this
.
extraDepositTotal
=
0
//总押金
for
(
let
i
=
0
;
i
<
this
.
choo
o
seService
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
chooseService
.
length
;
i
++
)
{
this
.
extraPrice
+=
parseFloat
((
this
.
choo
o
seService
[
i
].
sellingPrice
*
this
.
buyNum
).
toFixed
(
2
))
this
.
extraPrice
+=
parseFloat
((
this
.
chooseService
[
i
].
sellingPrice
*
this
.
buyNum
).
toFixed
(
2
))
if
(
this
.
choo
o
seService
[
i
].
depositType
==
1
)
{
if
(
this
.
chooseService
[
i
].
depositType
==
1
)
{
//等于1,押金金额跟数量没关系
//等于1,押金金额跟数量没关系
singleProduct
=
this
.
choo
o
seService
[
i
].
deposit
singleProduct
=
this
.
chooseService
[
i
].
deposit
}
else
if
(
this
.
choo
o
seService
[
i
].
depositType
==
2
)
{
}
else
if
(
this
.
chooseService
[
i
].
depositType
==
2
)
{
//等于2,押金单价乘购买数量
//等于2,押金单价乘购买数量
singleProduct
=
parseFloat
((
this
.
choo
o
seService
[
i
].
deposit
*
this
.
buyNum
).
toFixed
(
2
))
singleProduct
=
parseFloat
((
this
.
chooseService
[
i
].
deposit
*
this
.
buyNum
).
toFixed
(
2
))
}
}
this
.
extraDepositTotal
+=
singleProduct
this
.
extraDepositTotal
+=
singleProduct
}
}
...
@@ -445,7 +500,7 @@ export default {
...
@@ -445,7 +500,7 @@ export default {
},
},
sellTotal
()
{
sellTotal
()
{
//卖价总价
//卖价总价
if
(
this
.
choo
o
seService
.
length
==
0
)
{
if
(
this
.
chooseService
.
length
==
0
)
{
this
.
extraPrice
=
0
this
.
extraPrice
=
0
this
.
extraDepositTotal
=
0
this
.
extraDepositTotal
=
0
}
}
...
@@ -478,21 +533,13 @@ export default {
...
@@ -478,21 +533,13 @@ export default {
}
}
})
})
},
},
//---额外服务多选框变化
extraChange
(
e
)
{
this
.
choooseService
=
[]
let
value
=
e
.
detail
.
value
value
.
forEach
(
item
=>
{
this
.
choooseService
.
push
(
JSON
.
parse
(
item
))
})
},
//---获取子组件的传值
//---获取子组件的传值
areaSure
(
data
)
{
areaSure
(
data
)
{
this
.
areaObj
=
data
this
.
areaObj
=
data
if
(
this
.
areaObj
.
areaCode
==
'cjsd_project_0001'
)
{
if
(
this
.
areaObj
.
areaCode
==
'cjsd_project_0001'
)
{
//选择了南站不显示耳麦
//选择了南站不显示耳麦
this
.
showErmai
=
false
this
.
showErmai
=
false
this
.
choo
o
seService
=
[]
this
.
chooseService
=
[]
}
else
{
}
else
{
this
.
showErmai
=
true
this
.
showErmai
=
true
}
}
...
@@ -507,7 +554,7 @@ export default {
...
@@ -507,7 +554,7 @@ export default {
},
},
//---展示详情弹窗
//---展示详情弹窗
showDetail
()
{
showDetail
()
{
this
.
$refs
.
detail
.
show
=
true
this
.
$refs
.
detail
.
show
Pop
=
true
},
},
//---展示日历
//---展示日历
showCalendar
()
{
showCalendar
()
{
...
@@ -672,7 +719,7 @@ export default {
...
@@ -672,7 +719,7 @@ export default {
this
.
beforeBookDays
=
res
.
data
.
beforeBookDays
||
0
//提前预定天数
this
.
beforeBookDays
=
res
.
data
.
beforeBookDays
||
0
//提前预定天数
this
.
buyKnowData
=
res
.
data
//购买须知,传给子组件
this
.
buyKnowData
=
res
.
data
//购买须知,传给子组件
this
.
serviceList
=
res
.
data
.
loadProductResVoList
//额外服务
this
.
serviceList
=
res
.
data
.
loadProductResVoList
//额外服务
//this.choo
o
seService=res.data.data.loadProductResVoList//默认全部选中
//this.chooseService=res.data.data.loadProductResVoList//默认全部选中
if
(
this
.
productIfo
.
status
==
1
)
{
if
(
this
.
productIfo
.
status
==
1
)
{
//下架状态
//下架状态
this
.
payBackground
=
'#C0C0C0'
this
.
payBackground
=
'#C0C0C0'
...
@@ -861,7 +908,7 @@ export default {
...
@@ -861,7 +908,7 @@ export default {
//---初始化联系人列表
//---初始化联系人列表
getContactList
()
{
getContactList
()
{
let
data
=
{
let
data
=
{
openid
:
uni
.
getStorageSync
(
'openid'
)
||
''
openid
:
this
.
openid
}
}
this
.
$request
(
'wechatUser/contact/findContactList'
,
data
).
then
(
res
=>
{
this
.
$request
(
'wechatUser/contact/findContactList'
,
data
).
then
(
res
=>
{
if
(
res
.
code
==
'00'
)
{
if
(
res
.
code
==
'00'
)
{
...
@@ -895,7 +942,7 @@ export default {
...
@@ -895,7 +942,7 @@ export default {
//---添加并选中联系人--用于添加联系人之后直接从联系人列表选出需要填写的几位联系人
//---添加并选中联系人--用于添加联系人之后直接从联系人列表选出需要填写的几位联系人
addChoose
()
{
addChoose
()
{
let
data
=
{
let
data
=
{
openid
:
uni
.
getStorageSync
(
'openid'
)
||
''
openid
:
this
.
openid
}
}
this
.
$request
(
'wechatUser/contact/findContactList'
,
data
).
then
(
res
=>
{
this
.
$request
(
'wechatUser/contact/findContactList'
,
data
).
then
(
res
=>
{
if
(
res
.
code
==
'00'
)
{
if
(
res
.
code
==
'00'
)
{
...
@@ -915,15 +962,91 @@ export default {
...
@@ -915,15 +962,91 @@ export default {
}
}
})
})
},
},
//---加载优惠券(暂未开发)
initCoupon
()
{
let
savedMoneyList
=
[]
this
.
chooseCouponObj
=
''
this
.
ableConpon
=
''
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
.
$store
.
state
.
openId
}
this
.
axios
.
post
(
this
.
wechatUserJs
.
usableCouponList
(),
data
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
'00'
)
{
this
.
couponData
=
res
.
data
.
data
let
masterSlaveCouponList
=
res
.
data
.
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
.
data
.
unusableCouponList
.
length
>
0
)
{
res
.
data
.
data
.
unusableCouponList
.
forEach
((
item
,
i
)
=>
{
//没有可用优惠券,有达到条件可以用的优惠券,先显示条件,达到条件时显示可用优惠券
if
(
item
.
isProduct
==
1
)
{
this
.
ableConpon
=
item
}
})
}
}
}
})
},
//---获取优惠价格
//---获取优惠价格
getDiscountPrice
()
{
getDiscountPrice
()
{
let
data
=
{
let
data
=
{
productId
:
this
.
productId
,
//产品ID
productId
:
this
.
productId
,
//产品ID
merchantId
:
this
.
merchantId
,
//商家ID
merchantId
:
this
.
merchantId
,
//商家ID
companyId
:
this
.
companyId
,
//公司ID
companyId
:
this
.
companyId
,
//公司ID
openid
:
uni
.
getStorageSync
(
'openid'
)
||
''
//openid
openid
:
this
.
openid
//openid
}
}
this
.
$request
(
'scenic/user/productRule/getProductRule'
,
data
).
then
(
res
=>
{})
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
.
showCoupon
()
},
//---额外服务多选框变化
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
))
})
},
},
//---不需要享受耳麦服务
//---不需要享受耳麦服务
extraNo
()
{
extraNo
()
{
...
@@ -933,7 +1056,10 @@ export default {
...
@@ -933,7 +1056,10 @@ export default {
//---需要享受耳麦服务
//---需要享受耳麦服务
extraYes
()
{
extraYes
()
{
this
.
showExtraPop
=
false
this
.
showExtraPop
=
false
this
.
choooseService
=
this
.
serviceList
this
.
serviceList
.
forEach
(
item
=>
{
item
.
ifChoose
=
true
})
this
.
chooseService
=
this
.
serviceList
this
.
placeOrder
()
this
.
placeOrder
()
},
},
//---点击去支付
//---点击去支付
...
@@ -944,7 +1070,7 @@ export default {
...
@@ -944,7 +1070,7 @@ export default {
}
}
if
(
this
.
serviceList
.
length
>
0
)
{
if
(
this
.
serviceList
.
length
>
0
)
{
//有额外服务,并且选择了额外服务的,直接支付
//有额外服务,并且选择了额外服务的,直接支付
if
(
this
.
choo
o
seService
.
length
>
0
)
{
if
(
this
.
chooseService
.
length
>
0
)
{
this
.
placeOrder
()
this
.
placeOrder
()
}
}
}
}
...
@@ -999,11 +1125,11 @@ export default {
...
@@ -999,11 +1125,11 @@ export default {
return
return
}
}
}
}
if
(
this
.
choo
o
seService
.
length
==
0
&&
this
.
showErmai
)
{
if
(
this
.
chooseService
.
length
==
0
&&
this
.
showErmai
)
{
//没有购买额外服务,并且选择的北站,跳出弹窗
//没有购买额外服务,并且选择的北站,跳出弹窗
this
.
showExtraPop
=
true
this
.
showExtraPop
=
true
}
}
if
(
this
.
choo
o
seService
.
length
==
0
&&
!
this
.
showErmai
)
{
if
(
this
.
chooseService
.
length
==
0
&&
!
this
.
showErmai
)
{
//没有购买额外服务,并且选择的南站,直接购买
//没有购买额外服务,并且选择的南站,直接购买
this
.
placeOrder
()
this
.
placeOrder
()
}
}
...
@@ -1080,94 +1206,112 @@ export default {
...
@@ -1080,94 +1206,112 @@ export default {
},
},
//---预下单
//---预下单
preOrder
()
{
preOrder
()
{
//时间戳转化
let
bookStartTime
=
''
if
(
this
.
$commonjs
.
today
()
==
this
.
startDate
.
substr
(
0
,
10
))
{
//如果是当天就取当前时间+10秒
bookStartTime
=
new
Date
().
getTime
()
+
10
*
1000
}
else
{
//不是当天就取开始时间
//手机兼容
let
startDate
=
this
.
startDate
.
replace
(
/-/g
,
'/'
)
bookStartTime
=
new
Date
(
startDate
).
getTime
()
}
//手机兼容
let
endDate
=
this
.
endDate
.
replace
(
/-/g
,
'/'
)
let
bookEndTime
=
new
Date
(
endDate
).
getTime
()
//参数游客信息组装
//参数游客信息组装
let
reservationInfoList
=
[]
let
orderTouristList
=
this
.
contactTotal
.
map
((
item
)
=>
{
this
.
chooseContact
.
forEach
((
item
,
index
)
=>
{
return
{
reservationInfoList
.
push
({
category
:
0
,
category
:
0
,
name
:
item
.
name
,
name
:
item
.
name
,
identification
Number
:
item
.
credentialNumber
credential
Number
:
item
.
credentialNumber
}
)
}
})
})
//商品库 spu & 非商品库 sku
let
couponList
=
[]
tt
.
createOrder
({
if
(
this
.
chooseCouponObj
)
{
skuList
:
[
if
(
this
.
chooseCouponObj
.
slaveList
.
length
>
0
){
//有从卷取值从卷,没有从卷取值主劵
couponList
=
[
//券列表
{
{
skuId
:
this
.
productIfo
.
distributionProductId
,
// sku 商品Id 必传
couponId
:
this
.
chooseCouponObj
.
slaveCouponId
,
//券id
skuType
:
1
,
// sku 商品类型 必传 1-商品库商品 2-非商品库商品
isMerchant
:
this
.
chooseCouponObj
.
slaveCreateSource
,
//是否是商户的券
quantity
:
this
.
buyNum
,
// 数量 必传
myCouponId
:
this
.
chooseCouponObj
.
slaveId
,
//领取人编号
price
:
parseFloat
((
this
.
sellingPrice
*
100
).
toFixed
(
2
)),
// 价格 非商品库 sku 商品必传
couponType
:
this
.
chooseCouponObj
.
couponType
,
//券类型
goodsInfo
:
{
couponPrice
:
this
.
chooseCouponObj
.
savedMoney
,
//券价格
goodsName
:
this
.
productIfo
.
name
,
// 商品名称
}
goodsPhoto
:
'http://picture.pangdly.com/company/2022-02/2022-02-10/zip/z001644484223062b28c62cc60b0c65e.jpg'
,
// 商品图片链接
]
goodsId
:
this
.
productIfo
.
distributionProductId
,
// 商品ID
}
else
{
goodsType
:
1
,
//1-商品库商品2-非商品库商品
couponList
=
[
GoodsBookInfo
:
{
bookType
:
1
//预约类型:1. 不需要预约 2. 在线预约
}
}
// extraInfo: {
// ticketName: '成人票', // 票种,非商品库门票类 sku 必传
// date: '2023-05-16', // 日期,非商品库门票类 sku 必传
// },
}
],
bookInfo
:
{
itemBookInfoList
:
[
{
{
poiId
:
this
.
productIfo
.
poiId
,
// 预约门店的 poiId,必填
couponId
:
this
.
chooseCouponObj
.
couponId
,
//券id
shopName
:
this
.
productIfo
.
merchantName
,
// 预约店铺名称,必填
isMerchant
:
this
.
chooseCouponObj
.
createSource
,
//是否是商户的券
outShopId
:
this
.
productIfo
.
merchantId
,
// 预约门店的外部店铺id,必填
myCouponId
:
this
.
chooseCouponObj
.
id
,
//领取人编号
goodsId
:
this
.
productIfo
.
distributionProductId
,
// 商品id,必填
couponType
:
this
.
chooseCouponObj
.
couponType
,
//券类型
bookStartTime
,
// 预定开始时间(ms),13位毫秒时间戳,必填
couponPrice
:
this
.
chooseCouponObj
.
savedMoney
,
//券价格
bookEndTime
,
//预定结束时间(ms),13位毫秒时间戳,必填
reservationInfoList
// 留资信息 非必填
}
}
]
]
},
}
payment
:
{
}
totalAmount
:
parseFloat
((
this
.
buyNum
*
this
.
sellingPrice
*
100
).
toFixed
(
2
))
// 订单总价 必填
//额外服务不为空,联票购买不为空,带有儿童票,组合购买不为空,单品购买为空
},
if
(
this
.
chooseService
.
length
>
0
)
{
contactInfo
:
{
this
.
orderProductList
=
this
.
chooseService
.
map
((
item
)
=>
{
//联系人
return
{
phoneNumber
:
this
.
ticketPhone
// 手机号 非必传
distributionPrice
:
item
.
sellingPrice
,
//临时用
},
productId
:
item
.
id
,
//产品Id
callbackData
:
{
buyNum
:
this
.
buyNum
,
//购买数量
productAreaCode
:
this
.
areaObj
.
areaCode
||
this
.
defaultAreaCode
//站点信息
subOrderType
:
0
,
//产品类型,网络
},
unitPrice
:
item
.
sellingPrice
,
//产品单价
success
:
res
=>
{
merchantId
:
item
.
merchantId
,
//商户id
const
{
orderId
,
outOrderNo
}
=
res
orderTouristList
,
//游客信息
uni
.
navigateTo
({
playDate
:
this
.
startDate
.
substr
(
0
,
10
),
//开始日期
url
:
'/pages/salePay/paySuccess/paySuccess?orderId='
+
outOrderNo
endPlayDate
:
this
.
endDate
.
substr
(
0
,
10
),
//结束日期
isMaster
:
1
,
//是否主产品 1 否, 0 是
startPlayTime
:
this
.
startPlayTime
,
//开始时间
endPlayTime
:
this
.
endPlayTime
,
//结束时间
}
})
})
},
}
else
{
fail
:
res
=>
{
this
.
orderProductList
=
[]
const
{
orderId
,
outOrderNo
,
errNo
,
errMsg
,
errLogId
}
=
res
if
(
errLogId
)
{
console
.
log
(
'预下单失败'
,
errNo
,
errMsg
,
errLogId
)
}
}
if
(
errMsg
||
errNo
)
{
let
data
=
{
console
.
log
(
'支付失败'
,
errNo
,
errMsg
,
orderId
,
outOrderNo
)
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
({
uni
.
showToast
({
title
:
errMsg
,
title
:
res
.
message
,
icon
:
'none'
,
icon
:
'none'
duration
:
3000
})
})
}
}
})
})
...
@@ -1628,13 +1772,13 @@ export default {
...
@@ -1628,13 +1772,13 @@ export default {
.bottom-btn
{
.bottom-btn
{
position
:
relative
;
position
:
relative
;
width
:
2
0
0rpx
;
width
:
2
4
0rpx
;
height
:
80rpx
;
height
:
80rpx
;
margin-left
:
20rpx
;
margin-left
:
20rpx
;
line-height
:
80rpx
;
line-height
:
80rpx
;
font-size
:
32rpx
;
font-size
:
32rpx
;
font-weight
:
bolder
;
font-weight
:
bolder
;
border-radius
:
16
rpx
;
border-radius
:
24
rpx
;
background
:
$red
;
background
:
$red
;
text-align
:
center
;
text-align
:
center
;
}
}
...
...
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