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
Expand all
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
This diff is collapsed.
Click to expand it.
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