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
6e30a53d
Commit
6e30a53d
authored
Dec 12, 2023
by
潘永坪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
组合下单页面开发
parent
c8b91beb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
103 deletions
+96
-103
scenicCombiOrder.vue
pages/scenic/scenicCombiOrder/scenicCombiOrder.vue
+95
-102
scenicOrder.vue
pages/scenic/scenicOrder/scenicOrder.vue
+1
-1
No files found.
pages/scenic/scenicCombiOrder/scenicCombiOrder.vue
View file @
6e30a53d
...
...
@@ -123,7 +123,7 @@
<view
class=
"list-Number"
>
<view
class=
"title-text"
>
购买数量
</view>
<view>
<u-number-box
:max=
"item.maxBookNum"
v-model=
"item.buyNum"
@
change=
'buyNumChange'
:
index
=
'index'
>
<u-number-box
:max=
"item.maxBookNum"
v-model=
"item.buyNum"
@
change=
'buyNumChange'
:
name
=
'index'
>
<view
slot=
"minus"
class=
"number-minus"
>
<u-icon
name=
"minus"
color=
"#FFFFFF"
size=
"32"
></u-icon>
</view>
...
...
@@ -366,7 +366,6 @@ export default {
chooseContact
:
[],
//选中的游客信息列表
timeNumber
:
''
,
//当前时间转化为数字
timeFlag
:
''
,
//setTimeout函数
savedMoney
:
0
,
//优惠价格
productDepositTotal
:
0
,
//产品总押金
docQuery
:
''
,
//元素变量
payBackground
:
''
,
//支付按钮背景颜色
...
...
@@ -383,6 +382,8 @@ export default {
showTelephone
:
true
,
//用于判断是否显示输入联系人电话号码
areaIndex
:
0
,
//选择站点时对应的产品下标
contactTotal
:
[],
//所有联系人列表
originalTotal
:
0
,
//原价总价
sellTotal
:
0
,
//卖价总价
}
},
onLoad
(
option
)
{
...
...
@@ -400,54 +401,6 @@ export default {
this
.
initData
()
//页面初始化数据
this
.
docQuery
=
uni
.
createSelectorQuery
().
in
(
this
)
},
computed
:
{
originalTotal
()
{
let
savedMoney
=
0
let
original
=
0
let
deposit
=
0
this
.
productDepositTotal
=
0
this
.
productList
.
forEach
((
item
)
=>
{
original
+=
item
.
originalPrice
*
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
})
return
parseFloat
((
original
+
this
.
productDepositTotal
).
toFixed
(
2
))
||
0
//产品总价+产品押金
},
sellTotal
()
{
let
savedMoney
=
0
let
sell
=
0
let
deposit
=
0
this
.
productDepositTotal
=
0
this
.
productList
.
forEach
((
item
)
=>
{
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
})
return
parseFloat
((
sell
+
this
.
productDepositTotal
-
savedMoney
).
toFixed
(
2
))
||
0
}
},
methods
:
{
//---页面初始化数据,获取产品基本信息---已修改
initData
()
{
...
...
@@ -471,13 +424,22 @@ export default {
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
=
{}
}
//需要优化
// 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
.
buyNum
=
1
,
//默认为1
item
.
chooseContact
=
[]
//选中的游客信息列表
...
...
@@ -516,14 +478,6 @@ export default {
//所有产品的价格库存列表
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
){
...
...
@@ -571,7 +525,6 @@ export default {
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
){
...
...
@@ -593,6 +546,7 @@ export default {
this
.
payBackground
=
'#C0C0C0'
}
})
this
.
computedPrice
()
//计算价格
//解决初始化日期不显示的情况
this
.
$forceUpdate
()
}
else
{
...
...
@@ -713,6 +667,33 @@ export default {
}
})
},
//---计算价格---已修改
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
},
//---获取排号信息---暂时未使用
getSortInfor
(
merchantCode
)
{
let
data
=
{
...
...
@@ -783,10 +764,11 @@ export default {
uni
.
$u
.
throttle
(()
=>
{
this
.
initCoupon
(
item
)
},
3000
)
this
.
computedPrice
()
//解决点击日期无反应的情况
this
.
$forceUpdate
()
},
//---日历确认事件
//---日历确认事件
---已修改
dateConfig
(
data
)
{
let
index2
=
this
.
chooseDateList
.
findIndex
(
item
=>
{
return
item
.
startTime
.
substr
(
0
,
10
)
==
data
...
...
@@ -796,6 +778,7 @@ export default {
this
.
dateChoose
(
item
,
item2
,
index2
)
//选中确认的日期
this
.
docQuery
.
select
(
'.date-list'
).
boundingClientRect
(
data
=>
{
item
.
dateScroll
=
(
data
.
width
+
6
)
*
index2
//解决不滚动问题
this
.
$forceUpdate
()
}).
exec
()
},
...
...
@@ -831,6 +814,8 @@ export default {
//由于没有数据需要测试
this
.
docQuery
.
select
(
'.time-list'
).
boundingClientRect
(
data
=>
{
item
.
timeScroll
=
(
data
.
width
+
6
)
*
index2
//解决不滚动问题
this
.
$forceUpdate
()
}).
exec
()
},
//---获取点击的编辑联系人信息,传给编辑联系人组件
...
...
@@ -875,41 +860,47 @@ export default {
// this.$forceUpdate()
},
//---订单数量变化---正在修改
buyNumChange
(
value
,
index
)
{
console
.
log
(
value
)
console
.
log
(
index
)
// let item=this.productList[index]
// if(item.tripTemplateFlag == 1) {
// //实名制
// console.log(111)
// console.log(item.buyNum)
// item.contactNum = item.buyNum
// if (item.chooseContact.length>item.contactNum) {
// //当选中联系人数量大于购买数量时
// item.chooseContact.splice(item.chooseContact.length - 1, 1) //删除多余的联系人
// //联系人列表重新判断是否选中
// item.contactTotal.forEach(item=>{
// item.ifChoose=false
// })
// item.chooseContact.forEach(item=>{
// item.contactTotal.forEach(item2=>{
// if(item.id==item2.id){
// item2.ifChoose=true
// }
// })
// })
// }
// }
// if (item.tripTemplateFlag == 0) {
// //非实名制
// item.contactNum = 1
// }
// clearTimeout(this.timeFlag)
// this.timeFlag = setTimeout(()=>{
// this.initCoupon()
// }, 1500)
//解决数量显示不及时更新问题
this
.
$forceUpdate
()
buyNumChange
(
e
)
{
let
value
=
e
.
value
let
index
=
e
.
name
let
item
=
this
.
productList
[
index
]
//由于buyNum页面数据未及时更新,在这里进行赋值一遍
item
.
buyNum
=
value
//超过最大值时进行文字提示
if
(
value
>=
item
.
maxBookNum
)
{
uni
.
showToast
({
title
:
'最大可预订数量为'
+
item
.
maxBookNum
,
icon
:
'none'
})
}
if
(
item
.
tripTemplateFlag
==
1
)
{
//实名制
item
.
contactNum
=
value
if
(
item
.
chooseContact
.
length
>
item
.
contactNum
)
{
//当选中联系人数量大于购买数量时
item
.
chooseContact
.
splice
(
item
.
chooseContact
.
length
-
1
,
1
)
//删除多余的联系人
//联系人列表重新判断是否选中
item
.
contactTotal
.
forEach
(
item
=>
{
item
.
ifChoose
=
false
})
item
.
chooseContact
.
forEach
(
item
=>
{
item
.
contactTotal
.
forEach
(
item2
=>
{
if
(
item
.
id
==
item2
.
id
){
item2
.
ifChoose
=
true
}
})
})
}
}
if
(
item
.
tripTemplateFlag
==
0
)
{
//非实名制
item
.
contactNum
=
1
}
this
.
computedPrice
()
clearTimeout
(
this
.
timeFlag
)
this
.
timeFlag
=
setTimeout
(()
=>
{
this
.
initCoupon
()
},
1500
)
},
//---展示购票须知---已修改
showBuyKnow
(
index
)
{
...
...
@@ -987,6 +978,7 @@ export default {
})
}
}
this
.
computedPrice
()
//计算价格
}
})
},
...
...
@@ -1009,6 +1001,7 @@ export default {
this
.
chooseCouponObj
=
''
this
.
savedMoney
=
0
}
this
.
computedPrice
()
},
//---展示券列表
showCoupon
()
{
...
...
pages/scenic/scenicOrder/scenicOrder.vue
View file @
6e30a53d
...
...
@@ -122,7 +122,7 @@
<view
class=
"middle-Number"
>
<view
class=
"title-text"
>
购买数量
</view>
<view>
<u-number-box
v-model=
"buyNum"
@
change=
'buyNumChange'
>
<u-number-box
v-model=
"buyNum"
@
change=
'buyNumChange'
:max=
"maxBookNum"
>
<view
slot=
"minus"
class=
"number-minus"
>
<u-icon
name=
"minus"
color=
"#FFFFFF"
size=
"32"
></u-icon>
</view>
...
...
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