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
5c5c61ca
Commit
5c5c61ca
authored
Jun 02, 2023
by
潘永坪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支付页面参数修改
parent
3ad0f954
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
441 additions
and
430 deletions
+441
-430
App.vue
App.vue
+71
-70
login.vue
pages/login/login.vue
+17
-15
orderPayment.vue
pages/payment/orderPayment/orderPayment.vue
+13
-11
ourPayment.vue
pages/payment/ourPayment/ourPayment.vue
+339
-333
paySuccess.vue
pages/payment/paySuccess/paySuccess.vue
+1
-1
No files found.
App.vue
View file @
5c5c61ca
<
script
>
// 1、uni-app的页面生命周期仅在page页面有效,而单独封装的组件中【页面周期无效】,
//但是Vue的生命周期依然有效 【Vue的生命周期在任何地方都是有效的,即你仍然可以在uni-app项目中使用Vue生命周期,但是不建议这么做】
// 2、推荐使用uni-app里面的onLoad 代替 vue 里面的 created
// 3、推荐使用uni-app里面的onReady 代替 vue 里面的 mounted
//4.setStorageSync与setStorage的区别:如果后续的操作需要使用更新storage后保存的data,则使用setStorageSync使用异步性能更好,使用同步数据更安全
export
default
{
onLaunch
:
function
(
options
)
{
//初始化完成时触发(全局只触发一次
let
today
=
this
.
$commonjs
.
today
()
let
oldDate
=
uni
.
getStorageSync
(
'oldDate'
)
//大于7天重新登录
if
(
oldDate
)
{
let
number
=
this
.
$commonjs
.
dateDifference
(
today
,
oldDate
)
if
(
number
>
7
)
{
uni
.
clearStorageSync
()
}
}
else
{
//用于处理这个功能之前登录过的用户,未保存登录时间
uni
.
clearStorageSync
()
}
let
path
=
options
.
path
uni
.
setStorageSync
(
'enterOptions'
,
options
)
let
token
=
uni
.
getStorageSync
(
'token'
)
if
(
!
token
&&
path
.
indexOf
(
'pages/payment/ourPayment/ourPayment'
)
==
-
1
)
{
//扫码支付页面不需要在此登录
setTimeout
(()
=>
{
//解决关联普通二维码扫码首次进入时一直显示登录中
uni
.
navigateTo
({
url
:
'/pages/login/login'
})
},
300
)
}
//#ifdef MP-WEIXIN
uni
.
setStorageSync
(
'appid'
,
'wxe678d5240e98a7b8'
)
//#endif
// 1、uni-app的页面生命周期仅在page页面有效,而单独封装的组件中【页面周期无效】,
//但是Vue的生命周期依然有效 【Vue的生命周期在任何地方都是有效的,即你仍然可以在uni-app项目中使用Vue生命周期,但是不建议这么做】
// 2、推荐使用uni-app里面的onLoad 代替 vue 里面的 created
// 3、推荐使用uni-app里面的onReady 代替 vue 里面的 mounted
//4.setStorageSync与setStorage的区别:如果后续的操作需要使用更新storage后保存的data,则使用setStorageSync使用异步性能更好,使用同步数据更安全
export
default
{
onLaunch
:
function
(
options
)
{
//初始化完成时触发(全局只触发一次
let
today
=
this
.
$commonjs
.
today
()
let
oldDate
=
uni
.
getStorageSync
(
'oldDate'
)
//大于7天重新登录
if
(
oldDate
)
{
let
number
=
this
.
$commonjs
.
dateDifference
(
today
,
oldDate
)
if
(
number
>
7
)
{
uni
.
clearStorageSync
()
}
}
else
{
//用于处理这个功能之前登录过的用户,未保存登录时间
uni
.
clearStorageSync
()
}
let
path
=
options
.
path
uni
.
setStorageSync
(
'enterOptions'
,
options
)
let
token
=
uni
.
getStorageSync
(
'token'
)
if
(
!
token
&&
path
.
indexOf
(
'pages/payment/ourPayment/ourPayment'
)
==
-
1
)
{
//扫码支付页面不需要在此登录
setTimeout
(()
=>
{
//解决关联普通二维码扫码首次进入时一直显示登录中
uni
.
navigateTo
({
url
:
'/pages/login/login'
})
},
300
)
}
//#ifdef MP-WEIXIN
uni
.
setStorageSync
(
'appid'
,
'wxe678d5240e98a7b8'
)
//#endif
//#ifdef MP-ALIPAY
if
(
options
.
query
&&
options
.
query
.
qrCode
)
{
uni
.
setStorageSync
(
'alipayQrCode'
,
options
.
query
.
qrCode
)
}
else
{
uni
.
removeStorageSync
(
'alipayQrCode'
)
}
//#endif
/* 版本自动更新代码 */
const
updateManager
=
uni
.
getUpdateManager
()
updateManager
.
onCheckForUpdate
(
function
(
res
)
{
console
.
log
(
'是否有更新:'
+
res
.
hasUpdate
)
// 请求完新版本信息的回调 true说明有更新
})
updateManager
.
onUpdateReady
(
function
()
{
uni
.
showModal
({
title
:
'更新检测'
,
// 此处可自定义提示标题
content
:
'检测到新版本,是否重启小程序?'
,
// 此处可自定义提示消息内容
success
:
function
(
res
)
{
if
(
res
.
confirm
)
{
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager
.
applyUpdate
()
}
}
})
})
updateManager
.
onUpdateFailed
(
function
()
{
// 新的版本下载失败
uni
.
showModal
({
title
:
'更新提示'
,
content
:
'新版本下载失败'
,
showCancel
:
false
})
})
},
onShow
:
function
()
{
//#ifdef MP-ALIPAY
uni
.
setStorageSync
(
'appid'
,
'2021001194629244'
)
if
(
options
.
query
&&
options
.
query
.
qrCode
)
{
uni
.
setStorageSync
(
'alipayQrCode'
,
options
.
query
.
qrCode
)
}
else
{
uni
.
removeStorageSync
(
'alipayQrCode'
)
}
//#endif
/* 版本自动更新代码 */
const
updateManager
=
uni
.
getUpdateManager
()
updateManager
.
onCheckForUpdate
(
function
(
res
)
{
console
.
log
(
'是否有更新:'
+
res
.
hasUpdate
)
// 请求完新版本信息的回调 true说明有更新
})
updateManager
.
onUpdateReady
(
function
()
{
uni
.
showModal
({
title
:
'更新检测'
,
// 此处可自定义提示标题
content
:
'检测到新版本,是否重启小程序?'
,
// 此处可自定义提示消息内容
success
:
function
(
res
)
{
if
(
res
.
confirm
)
{
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager
.
applyUpdate
()
}
}
})
})
updateManager
.
onUpdateFailed
(
function
()
{
// 新的版本下载失败
uni
.
showModal
({
title
:
'更新提示'
,
content
:
'新版本下载失败'
,
showCancel
:
false
})
})
},
onShow
:
function
()
{
},
onHide
:
function
()
{
},
onHide
:
function
()
{
}
}
}
}
</
script
>
<
style
lang=
"scss"
>
...
...
pages/login/login.vue
View file @
5c5c61ca
...
...
@@ -6,20 +6,20 @@
export
default
{
data
()
{
return
{
timer
:
null
,
}
timer
:
null
,
}
},
onLoad
()
{
this
.
login
()
},
// 一般页面用onUnload
// tabbar页面用onHide
onUnload
()
{
if
(
this
.
timer
)
{
clearTimeout
(
this
.
timer
)
this
.
timer
=
null
}
},
// 一般页面用onUnload
// tabbar页面用onHide
onUnload
()
{
if
(
this
.
timer
)
{
clearTimeout
(
this
.
timer
)
this
.
timer
=
null
}
},
methods
:{
//---登录
login
(){
...
...
@@ -40,8 +40,10 @@ export default {
let
data
=
{
code
:
res
.
code
,
source
,
//微信小程序3,支付宝小程序4
companyId
:
uni
.
getStorageSync
(
'enterOptions'
).
query
.
companyId
||
''
,
appid
:
uni
.
getStorageSync
(
'appid'
)
||
''
appid
:
uni
.
getStorageSync
(
'appid'
)
||
''
}
if
(
uni
.
getStorageSync
(
'enterOptions'
).
query
){
data
.
companyId
=
uni
.
getStorageSync
(
'enterOptions'
).
query
.
companyId
||
''
}
_this
.
$request
(
'wechat/wx/getUserInfoByCode'
,
data
).
then
(
res
=>
{
if
(
res
.
code
==
'00'
)
{
...
...
@@ -68,9 +70,9 @@ export default {
uni
.
redirectTo
({
url
:
'/'
+
enterOptions
.
path
+
'?'
+
queryTotal
})
//保存当前日期
let
oldDate
=
_this
.
$commonjs
.
today
()
uni
.
setStorageSync
(
'oldDate'
,
oldDate
)
//保存当前日期
let
oldDate
=
_this
.
$commonjs
.
today
()
uni
.
setStorageSync
(
'oldDate'
,
oldDate
)
// uni.navigateBack({
// delta:1
// })
...
...
pages/payment/orderPayment/orderPayment.vue
View file @
5c5c61ca
...
...
@@ -140,8 +140,10 @@ export default {
let
data
=
{
code
:
res
.
code
,
source
,
//微信小程序3,支付宝小程序4
companyId
:
uni
.
getStorageSync
(
'enterOptions'
).
query
.
companyId
||
''
,
appid
:
uni
.
getStorageSync
(
'appid'
)
||
''
appid
:
uni
.
getStorageSync
(
'appid'
)
||
''
}
if
(
uni
.
getStorageSync
(
'enterOptions'
).
query
){
data
.
companyId
=
uni
.
getStorageSync
(
'enterOptions'
).
query
.
companyId
||
''
}
_this
.
$request
(
'wechat/wx/getUserInfoByCode'
,
data
)
.
then
(
res
=>
{
...
...
@@ -177,13 +179,13 @@ export default {
}
this
.
$request
(
'orderc/order/findOrderInfo'
,
data
).
then
(
res
=>
{
if
(
res
.
code
==
'00'
)
{
if
(
res
.
data
.
orderType
==
'10'
){
//组合票和联票跳订单列表
this
.
afterBuyUrl
=
'/pages/my/order/orderList/orderList'
}
else
{
//单票跳详情
this
.
afterBuyUrl
=
'/pages/my/order/electronicTicket/electronicTicket'
}
if
(
res
.
data
.
orderType
==
'10'
){
//组合票和联票跳订单列表
this
.
afterBuyUrl
=
'/pages/my/order/orderList/orderList'
}
else
{
//单票跳详情
this
.
afterBuyUrl
=
'/pages/my/order/electronicTicket/electronicTicket'
}
this
.
bodyShow
=
true
//支付参数开始
this
.
timeStamp
=
res
.
data
.
timestamp
...
...
@@ -196,9 +198,9 @@ export default {
//支付参数结束
this
.
pdOrderMoney
=
res
.
data
.
pdOrderMoney
if
(
this
.
pdOrderMoney
==
0
&&
res
.
data
.
subOrderType
==
-
1
)
{
this
.
afterBuyUrl
=
'/pages/my/order/electronicTicket/electronicTicket'
this
.
afterBuyUrl
=
'/pages/my/order/electronicTicket/electronicTicket'
uni
.
navigateTo
({
url
:
'/pages/payment/paySuccess/paySuccess?orderId='
+
_this
.
orderId
+
'&afterBuyUrl='
+
_this
.
afterBuyUrl
+
'&ifyukuaiCode='
+
_this
.
ifyukuaiCode
url
:
'/pages/payment/paySuccess/paySuccess?orderId='
+
_this
.
orderId
+
'&afterBuyUrl='
+
_this
.
afterBuyUrl
+
'&ifyukuaiCode='
+
_this
.
ifyukuaiCode
})
}
this
.
errorMessage
=
res
.
data
.
errorMessage
...
...
pages/payment/ourPayment/ourPayment.vue
View file @
5c5c61ca
This diff is collapsed.
Click to expand it.
pages/payment/paySuccess/paySuccess.vue
View file @
5c5c61ca
...
...
@@ -37,7 +37,7 @@
}
this
.
ticketStatus
()
intFun
()
},
12
00
)
},
20
00
)
}
intFun
()
},
...
...
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