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
b2fb13f6
Commit
b2fb13f6
authored
Sep 29, 2021
by
潘永坪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug处理
parent
37388f4b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
114 additions
and
48 deletions
+114
-48
request.js
common/request.js
+1
-1
index.vue
pages/index/index.vue
+1
-2
orderPayment.vue
pages/payment/orderPayment/orderPayment.vue
+99
-42
ourPayment.vue
pages/payment/ourPayment/ourPayment.vue
+13
-3
No files found.
common/request.js
View file @
b2fb13f6
...
@@ -15,7 +15,7 @@ const request = (url = '', data = {}, type = 'POST') => {
...
@@ -15,7 +15,7 @@ const request = (url = '', data = {}, type = 'POST') => {
dataType
:
'json'
,
dataType
:
'json'
,
}).
then
((
response
)
=>
{
}).
then
((
response
)
=>
{
uni
.
hideLoading
()
uni
.
hideLoading
()
let
[
error
,
res
]
=
response
;
let
[
error
,
res
]
=
response
;
resolve
(
res
.
data
);
resolve
(
res
.
data
);
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
uni
.
hideLoading
()
uni
.
hideLoading
()
...
...
pages/index/index.vue
View file @
b2fb13f6
...
@@ -111,13 +111,12 @@
...
@@ -111,13 +111,12 @@
let
pdCreateUserId
=
uni
.
getStorageSync
(
"createUserId"
)
let
pdCreateUserId
=
uni
.
getStorageSync
(
"createUserId"
)
let
pdUserId
=
uni
.
getStorageSync
(
"userId"
)
let
pdUserId
=
uni
.
getStorageSync
(
"userId"
)
let
data
=
{
let
data
=
{
openid
:
uni
.
getStorageSync
(
"openid"
)
openid
:
pdOpenid
}
}
this
.
$request
(
"wechatUser/wxUser/getLastRecord"
,
data
).
then
((
res
)
=>
{
this
.
$request
(
"wechatUser/wxUser/getLastRecord"
,
data
).
then
((
res
)
=>
{
if
(
res
.
code
==
"00"
){
if
(
res
.
code
==
"00"
){
this
.
companyId
=
res
.
data
.
companyId
||
""
this
.
companyId
=
res
.
data
.
companyId
||
""
this
.
outUrl
=
"https://wx.pangdly.com/#/home?pdOpenid="
+
pdOpenid
+
"&pdToken="
+
pdToken
+
"&pdCreateUserId="
+
pdCreateUserId
+
"&pdUserId="
+
pdUserId
+
"&companyId="
+
this
.
companyId
this
.
outUrl
=
"https://wx.pangdly.com/#/home?pdOpenid="
+
pdOpenid
+
"&pdToken="
+
pdToken
+
"&pdCreateUserId="
+
pdCreateUserId
+
"&pdUserId="
+
pdUserId
+
"&companyId="
+
this
.
companyId
console
.
log
(
this
.
outUrl
)
}
else
{
}
else
{
this
.
outUrl
=
"https://wx.pangdly.com/#/home?pdOpenid="
+
pdOpenid
+
"&pdToken="
+
pdToken
+
"&pdCreateUserId="
+
pdCreateUserId
+
"&pdUserId="
+
pdUserId
+
"&companyId="
+
this
.
companyId
this
.
outUrl
=
"https://wx.pangdly.com/#/home?pdOpenid="
+
pdOpenid
+
"&pdToken="
+
pdToken
+
"&pdCreateUserId="
+
pdCreateUserId
+
"&pdUserId="
+
pdUserId
+
"&companyId="
+
this
.
companyId
uni
.
showToast
({
uni
.
showToast
({
...
...
pages/payment/orderPayment/orderPayment.vue
View file @
b2fb13f6
...
@@ -117,54 +117,111 @@
...
@@ -117,54 +117,111 @@
paySign
:
""
,
paySign
:
""
,
background
:
""
,
//去支付的背景颜色
background
:
""
,
//去支付的背景颜色
orderId
:
""
,
//订单Id
orderId
:
""
,
//订单Id
openid
:
""
//用户Id
}
}
},
},
onLoad
(
option
){
onLoad
(
option
){
this
.
orderId
=
option
.
orderId
this
.
orderId
=
option
.
orderId
let
data
=
{
this
.
openid
=
uni
.
getStorageSync
(
"openid"
)
||
""
orderId
:
this
.
orderId
,
//订单Id
if
(
this
.
openid
){
userId
:
uni
.
getStorageSync
(
"openid"
),
//用户Id
this
.
initDetail
()
payType
:
42
,
//支付类型
}
else
{
}
this
.
login
()
//极个别手机从公众号跳转回来没有openid,再次获取openid
this
.
$request
(
"orderc/order/findOrderInfo"
,
data
).
then
((
res
)
=>
{
}
if
(
res
.
code
==
"00"
)
{
this
.
bodyShow
=
true
//支付参数开始
this
.
timeStamp
=
res
.
data
.
timestamp
this
.
nonceStr
=
res
.
data
.
noncestr
this
.
package
=
res
.
data
.
package
this
.
signType
=
res
.
data
.
signType
this
.
paySign
=
res
.
data
.
sign
//支付参数结束
this
.
pdOrderMoney
=
res
.
data
.
pdOrderMoney
if
(
this
.
pdOrderMoney
==
0
&&
res
.
data
.
subOrderType
==
-
1
){
//0元购直接跳电子门票页面
uni
.
navigateTo
({
url
:
"/pages/my/order/electronicTicket/electronicTicket?orderId="
+
this
.
orderId
})
}
this
.
errorMessage
=
res
.
data
.
errorMessage
this
.
totalMoney
=
res
.
data
.
totalMoney
this
.
orderList
=
res
.
data
.
orderList
if
(
typeof
(
this
.
orderList
)
==
"undefined"
)
{
//单票
this
.
orderList
=
""
this
.
merchantName
=
res
.
data
.
merchantName
this
.
productName
=
res
.
data
.
productName
this
.
unitPrice
=
res
.
data
.
unitPrice
this
.
orderNum
=
res
.
data
.
orderNum
this
.
depositReceived
=
res
.
data
.
depositReceived
this
.
pdDiscountMoney
=
res
.
data
.
pdDiscountMoney
}
}
else
{
uni
.
showToast
({
title
:
res
.
message
,
icon
:
"none"
})
}
})
},
},
methods
:{
methods
:{
login
(){
//---登录
let
_this
=
this
uni
.
getProvider
({
service
:
'oauth'
,
success
(
proRes
){
uni
.
login
({
provider
:
proRes
.
provider
[
0
],
success
:
function
(
res
)
{
if
(
res
.
code
){
let
source
=
""
if
(
proRes
.
provider
[
0
]
==
"weixin"
){
source
=
3
}
else
if
(
proRes
.
provider
[
0
]
==
"alipay"
){
source
=
4
}
let
data
=
{
code
:
res
.
code
,
source
,
//微信小程序3,支付宝小程序4
}
_this
.
$request
(
'wechat/wx/getUserInfoByCode'
,
data
).
then
(
res
=>
{
if
(
res
.
code
==
'00'
){
_this
.
openid
=
res
.
data
.
openid
uni
.
setStorageSync
(
'openid'
,
_this
.
openid
)
_this
.
initDetail
()
}
else
{
uni
.
showToast
({
title
:
res
.
message
,
icon
:
"none"
})
setTimeout
(()
=>
{
_this
.
login
()
},
2000
)
}
}).
catch
((
err
)
=>
{
uni
.
showToast
({
title
:
"登录失败"
,
icon
:
"none"
})
setTimeout
(()
=>
{
_this
.
login
()
},
2000
)
})
}
}
})
}
})
},
initDetail
(){
//---初始化产品信息,以及获取支付需要的参数
let
data
=
{
orderId
:
this
.
orderId
,
//订单Id
userId
:
this
.
openid
,
//用户Id
payType
:
42
,
//支付类型
}
this
.
$request
(
"orderc/order/findOrderInfo"
,
data
).
then
((
res
)
=>
{
if
(
res
.
code
==
"00"
)
{
this
.
bodyShow
=
true
//支付参数开始
this
.
timeStamp
=
res
.
data
.
timestamp
this
.
nonceStr
=
res
.
data
.
noncestr
this
.
package
=
res
.
data
.
package
this
.
signType
=
res
.
data
.
signType
this
.
paySign
=
res
.
data
.
sign
//支付参数结束
this
.
pdOrderMoney
=
res
.
data
.
pdOrderMoney
if
(
this
.
pdOrderMoney
==
0
&&
res
.
data
.
subOrderType
==
-
1
){
//0元购直接跳电子门票页面
uni
.
navigateTo
({
url
:
"/pages/my/order/electronicTicket/electronicTicket?orderId="
+
this
.
orderId
})
}
this
.
errorMessage
=
res
.
data
.
errorMessage
this
.
totalMoney
=
res
.
data
.
totalMoney
this
.
orderList
=
res
.
data
.
orderList
if
(
typeof
(
this
.
orderList
)
==
"undefined"
)
{
//单票
this
.
orderList
=
""
this
.
merchantName
=
res
.
data
.
merchantName
this
.
productName
=
res
.
data
.
productName
this
.
unitPrice
=
res
.
data
.
unitPrice
this
.
orderNum
=
res
.
data
.
orderNum
this
.
depositReceived
=
res
.
data
.
depositReceived
this
.
pdDiscountMoney
=
res
.
data
.
pdDiscountMoney
}
}
else
{
uni
.
showToast
({
title
:
res
.
message
,
icon
:
"none"
})
}
})
},
goPay
(){
//-------------------------------------------------------去支付
goPay
(){
//-------------------------------------------------------去支付
let
_this
=
this
let
_this
=
this
if
(
this
.
errorMessage
)
{
if
(
this
.
errorMessage
)
{
...
...
pages/payment/ourPayment/ourPayment.vue
View file @
b2fb13f6
...
@@ -213,7 +213,7 @@
...
@@ -213,7 +213,7 @@
if
(
res
.
code
==
'00'
){
if
(
res
.
code
==
'00'
){
_this
.
openid
=
res
.
data
.
openid
_this
.
openid
=
res
.
data
.
openid
uni
.
setStorageSync
(
'openid'
,
_this
.
openid
)
uni
.
setStorageSync
(
'openid'
,
_this
.
openid
)
this
.
getUserBrowse
()
_
this
.
getUserBrowse
()
if
(
_this
.
merchantId
)
{
//大商家的有merchantId
if
(
_this
.
merchantId
)
{
//大商家的有merchantId
_this
.
init
()
_this
.
init
()
}
else
{
//小商家没有merchantId
}
else
{
//小商家没有merchantId
...
@@ -249,12 +249,18 @@
...
@@ -249,12 +249,18 @@
title
:
res
.
message
,
title
:
res
.
message
,
icon
:
"none"
icon
:
"none"
})
})
setTimeout
(()
=>
{
_this
.
login
()
},
2000
)
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
uni
.
showToast
({
uni
.
showToast
({
title
:
"登录失败"
,
title
:
"登录失败"
,
icon
:
"none"
icon
:
"none"
})
})
setTimeout
(()
=>
{
_this
.
login
()
},
2000
)
})
})
}
}
}
}
...
@@ -323,9 +329,13 @@
...
@@ -323,9 +329,13 @@
this
.
$request
(
"user/company/detail"
,
data
).
then
((
res
)
=>
{
this
.
$request
(
"user/company/detail"
,
data
).
then
((
res
)
=>
{
uni
.
hideLoading
()
uni
.
hideLoading
()
if
(
res
.
code
==
"00"
){
if
(
res
.
code
==
"00"
){
this
.
name
=
res
.
data
.
companyVo
.
companyName
this
.
companyAttribute
=
res
.
data
.
companyVo
.
companyAttribute
this
.
companyAttribute
=
res
.
data
.
companyVo
.
companyAttribute
this
.
paydJumpUrl
=
res
.
data
.
paydJumpUrl
this
.
paydJumpUrl
=
res
.
data
.
paydJumpUrl
if
(
this
.
companyAttribute
==
5
){
//出租车显示联系人姓名,其他显示公司名称
this
.
name
=
res
.
data
.
companyVo
.
contactName
}
else
{
this
.
name
=
res
.
data
.
companyVo
.
companyName
}
}
else
{
}
else
{
uni
.
showToast
({
uni
.
showToast
({
title
:
res
.
message
,
title
:
res
.
message
,
...
...
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