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
cf7fe368
Commit
cf7fe368
authored
Sep 27, 2021
by
潘永坪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
公司Id新增
parent
890cf235
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
100 additions
and
41 deletions
+100
-41
launch.json
.hbuilderx/launch.json
+4
-0
common.js
common/common.js
+16
-3
distributionCombiChoose.vue
...ation/distributionCombiChoose/distributionCombiChoose.vue
+2
-1
index.vue
pages/index/index.vue
+36
-6
orderPayment.vue
pages/payment/orderPayment/orderPayment.vue
+2
-2
ourPayment.vue
pages/payment/ourPayment/ourPayment.vue
+40
-29
No files found.
.hbuilderx/launch.json
View file @
cf7fe368
...
...
@@ -6,6 +6,10 @@
{
"launchtype"
:
"local"
},
"mp-alipay"
:
{
"launchtype"
:
"local"
},
"mp-weixin"
:
{
"launchtype"
:
"local"
...
...
common/common.js
View file @
cf7fe368
export
default
{
//调用方法时--this.$commonjs.aaa()
getCurrentPageUrl
(){
//---获取当前页面url
let
pages
=
getCurrentPages
()
//获取加载的页面
let
currentPage
=
pages
[
pages
.
length
-
1
]
//获取当前页面的对象
let
url
=
currentPage
.
route
//当前页面url
let
options
=
currentPage
.
options
//如果要获取url中所带的参数可
let
queryTotal
=
""
for
(
let
key
in
options
){
queryTotal
+=
"&"
+
key
+
"="
+
options
[
key
]
}
queryTotal
=
queryTotal
.
substr
(
1
)
let
pageUrl
=
url
+
"?"
+
queryTotal
//请求的全路径
return
pageUrl
}
}
//调用方法时--this.$commonjs.aaa()
\ No newline at end of file
pages/combination/distributionCombiChoose/distributionCombiChoose.vue
View file @
cf7fe368
...
...
@@ -48,12 +48,13 @@
let
groupChannelId
=
option
.
groupChannelId
let
thirdOpenid
=
option
.
thirdOpenid
//第三方openid
let
touristType
=
option
.
touristType
//游客类型
let
pageCode
=
option
.
pageCode
//赠送优惠券接口参数
let
pdOpenid
=
uni
.
getStorageSync
(
"openid"
)
//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let
pdToken
=
uni
.
getStorageSync
(
"token"
)
let
pdCreateUserId
=
uni
.
getStorageSync
(
"createUserId"
)
let
pdUserId
=
uni
.
getStorageSync
(
"userId"
)
let
baseUrl
=
"https://wx.pangdly.com/#/distributionCombiChoose?thirdOpenid="
+
thirdOpenid
+
"&touristType="
+
touristType
this
.
outUrl
=
baseUrl
+
"&channelId="
+
channelId
+
"&merchantId="
+
merchantId
+
"&groupId="
+
groupId
+
"&groupChannelId="
+
groupChannelId
+
"&companyId="
+
companyId
+
"&pdOpenid="
+
pdOpenid
+
"&pdToken="
+
pdToken
+
"&pdCreateUserId="
+
pdCreateUserId
+
"&pdUserId="
+
pdUserId
this
.
outUrl
=
baseUrl
+
"&channelId="
+
channelId
+
"&merchantId="
+
merchantId
+
"&groupId="
+
groupId
+
"&groupChannelId="
+
groupChannelId
+
"&companyId="
+
companyId
+
"&pdOpenid="
+
pdOpenid
+
"&pdToken="
+
pdToken
+
"&pdCreateUserId="
+
pdCreateUserId
+
"&pdUserId="
+
pdUserId
+
"&pageCode"
+
pageCode
}
},
...
...
pages/index/index.vue
View file @
cf7fe368
...
...
@@ -77,14 +77,20 @@
data
()
{
return
{
outUrl
:
""
,
//跳出地址
companyId
:
""
,
//公司Id
}
},
onLoad
(){
onLoad
(
option
){
this
.
companyId
=
option
.
companyId
||
""
if
(
!
this
.
companyId
){
this
.
getCompanyId
()
}
else
{
let
pdOpenid
=
uni
.
getStorageSync
(
"openid"
)
//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let
pdToken
=
uni
.
getStorageSync
(
"token"
)
let
pdCreateUserId
=
uni
.
getStorageSync
(
"createUserId"
)
let
pdUserId
=
uni
.
getStorageSync
(
"userId"
)
this
.
outUrl
=
"https://wx.pangdly.com/#/home?pdOpenid="
+
pdOpenid
+
"&pdToken="
+
pdToken
+
"&pdCreateUserId="
+
pdCreateUserId
+
"&pdUserId="
+
pdUserId
this
.
outUrl
=
"https://wx.pangdly.com/#/home?pdOpenid="
+
pdOpenid
+
"&pdToken="
+
pdToken
+
"&pdCreateUserId="
+
pdCreateUserId
+
"&pdUserId="
+
pdUserId
+
"&companyId="
+
this
.
companyId
}
},
methods
:
{
getUserInfo
()
{
// 获取用户信息
...
...
@@ -98,6 +104,30 @@
}
})
},
getCompanyId
(){
//获取公司Id
let
pdOpenid
=
uni
.
getStorageSync
(
"openid"
)
//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let
pdToken
=
uni
.
getStorageSync
(
"token"
)
let
pdCreateUserId
=
uni
.
getStorageSync
(
"createUserId"
)
let
pdUserId
=
uni
.
getStorageSync
(
"userId"
)
let
data
=
{
openid
:
uni
.
getStorageSync
(
"openid"
)
}
this
.
$request
(
"wechatUser/wxUser/getLastRecord"
,
data
).
then
((
res
)
=>
{
if
(
res
.
code
==
"00"
){
this
.
companyId
=
res
.
data
.
companyId
||
""
this
.
outUrl
=
"https://wx.pangdly.com/#/home?pdOpenid="
+
pdOpenid
+
"&pdToken="
+
pdToken
+
"&pdCreateUserId="
+
pdCreateUserId
+
"&pdUserId="
+
pdUserId
+
"&companyId="
+
this
.
companyId
console
.
log
(
this
.
outUrl
)
}
else
{
this
.
outUrl
=
"https://wx.pangdly.com/#/home?pdOpenid="
+
pdOpenid
+
"&pdToken="
+
pdToken
+
"&pdCreateUserId="
+
pdCreateUserId
+
"&pdUserId="
+
pdUserId
+
"&companyId="
+
this
.
companyId
uni
.
showToast
({
title
:
res
.
message
,
icon
:
"none"
})
}
}).
catch
(()
=>
{
this
.
outUrl
=
"https://wx.pangdly.com/#/home?pdOpenid="
+
pdOpenid
+
"&pdToken="
+
pdToken
+
"&pdCreateUserId="
+
pdCreateUserId
+
"&pdUserId="
+
pdUserId
+
"&companyId="
+
this
.
companyId
})
}
}
...
...
pages/payment/orderPayment/orderPayment.vue
View file @
cf7fe368
...
...
@@ -139,7 +139,7 @@
this
.
pdOrderMoney
=
res
.
data
.
pdOrderMoney
if
(
this
.
pdOrderMoney
==
0
&&
res
.
data
.
subOrderType
==
-
1
){
//0元购直接跳电子门票页面
uni
.
navigateTo
({
url
:
"
..
/my/order/electronicTicket/electronicTicket?orderId="
+
this
.
orderId
url
:
"
/pages
/my/order/electronicTicket/electronicTicket?orderId="
+
this
.
orderId
})
}
this
.
errorMessage
=
res
.
data
.
errorMessage
...
...
@@ -187,7 +187,7 @@
paySign
:
this
.
paySign
,
success
:
function
(
res
)
{
uni
.
navigateTo
({
url
:
"
..
/my/order/electronicTicket/electronicTicket?orderId="
+
_this
.
orderId
url
:
"
/pages
/my/order/electronicTicket/electronicTicket?orderId="
+
_this
.
orderId
})
},
fail
:
function
(
err
)
{
...
...
pages/payment/ourPayment/ourPayment.vue
View file @
cf7fe368
...
...
@@ -77,6 +77,7 @@
</view>
<!-------------------------------------------券弹窗------------------------------>
<orderCoupon
:couponData=
"couponData"
ref=
"orderCoupon"
@
couponChoose=
"couponChoose"
:chooseCouponObj=
"chooseCouponObj"
></orderCoupon>
</view>
</
template
>
...
...
@@ -140,6 +141,7 @@
}
],
orderId
:
""
,
//订单Id
paydJumpUrl
:
""
,
//页面跳转路径
companyAttribute
:
""
,
//等于5时为出租车
}
},
...
...
@@ -162,6 +164,7 @@
}
if
(
uni
.
getStorageSync
(
"openid"
)){
this
.
openid
=
uni
.
getStorageSync
(
"openid"
)
this
.
getUserBrowse
()
if
(
this
.
merchantId
)
{
//大商家的有merchantId
this
.
init
()
}
else
{
//小商家没有merchantId
...
...
@@ -171,10 +174,22 @@
}
else
{
this
.
login
()
}
},
methods
:
{
login
(){
//---------------------------------------------------------------------登录
getUserBrowse
(){
//---获取浏览记录
let
queryUrl
=
this
.
$commonjs
.
getCurrentPageUrl
()
let
data
=
{
openid
:
uni
.
getStorageSync
(
"openid"
)
,
//用户Id
userName
:
""
,
//用户昵称
pageType
:
4
,
//页面类型(0首页,1商户页,2产品页,3售票页,4付款页,5付款完成页,6行记页,7评论页,8咨询页,9劵中心页,11订单页,12订单详情页,13IC卡出行页,14电子门票页,15常用信息页,16其他页)
queryUrl
,
//页面全地址
merchantType
:
""
//商户类型1景区,2酒店,3餐饮,4特产
}
this
.
$request
(
"wechatUser/wxUser/saveUserBrowse"
,
data
).
then
((
res
)
=>
{
})
},
login
(){
//---登录
let
_this
=
this
uni
.
getProvider
({
service
:
'oauth'
,
...
...
@@ -197,6 +212,7 @@
if
(
res
.
code
==
'00'
){
_this
.
openid
=
res
.
data
.
openid
uni
.
setStorageSync
(
'openid'
,
_this
.
openid
)
this
.
getUserBrowse
()
if
(
_this
.
merchantId
)
{
//大商家的有merchantId
_this
.
init
()
}
else
{
//小商家没有merchantId
...
...
@@ -245,10 +261,10 @@
}
})
},
getUrlKey
(
name
){
//---
------------------------------------------------------------
获取url
getUrlKey
(
name
){
//---获取url
return
(
new
RegExp
(
'[?|&]'
+
name
+
'='
+
'([^&;]+?)(&|#|;|$)'
).
exec
(
decodeURIComponent
(
this
.
enterUrl
))
||
[,
""
])[
1
].
replace
(
/
\+
/g
,
'%20'
)
||
""
;
},
clickNum
(
i
,
index
,
a
)
{
//---
------------------------------------------------------------------
输入数字
clickNum
(
i
,
index
,
a
)
{
//---输入数字
this
.
buyMoney
+=
i
this
.
leftList
[
index
].
child
[
a
].
background
=
"#dddddd"
setTimeout
(()
=>
{
...
...
@@ -259,7 +275,7 @@
this
.
initCoupon
()
},
1500
)
},
clickEnter
(){
//---
------------------------------------------------------------------
退格
clickEnter
(){
//---退格
this
.
buyMoney
=
this
.
buyMoney
.
substr
(
0
,
this
.
buyMoney
.
length
-
1
)
this
.
spaceBackground
=
"#dddddd"
setTimeout
(()
=>
{
...
...
@@ -270,15 +286,15 @@
this
.
initCoupon
()
},
1500
)
},
couponChoose
(
data
)
{
//---
------------------------------------------------------------
子组件券选择之后触发的事件
couponChoose
(
data
)
{
//---子组件券选择之后触发的事件
this
.
chooseCouponObj
=
data
this
.
savedMoney
=
this
.
chooseCouponObj
.
savedMoney
||
0
},
showCoupon
()
{
//---
------------------------------------------------------------------
展示券列表
showCoupon
()
{
//---展示券列表
this
.
$refs
.
orderCoupon
.
showCoupon
()
},
init
()
{
//---
------------------------------------------------------------------------
初始化获取商家名称,大商家
init
()
{
//---初始化获取商家名称,大商家
let
data
=
{
"merchantId"
:
this
.
merchantId
,
"companyId"
:
this
.
companyId
,
...
...
@@ -298,7 +314,7 @@
uni
.
hideLoading
()
})
},
initTwo
()
{
//---
-----------------------------------------------------------------------
初始化获取商家名称,没有merchantId的小商家
initTwo
()
{
//---初始化获取商家名称,没有merchantId的小商家
let
data
=
{
"id"
:
this
.
companyId
,
}
...
...
@@ -308,6 +324,7 @@
if
(
res
.
code
==
"00"
){
this
.
name
=
res
.
data
.
companyVo
.
companyName
this
.
companyAttribute
=
res
.
data
.
companyVo
.
companyAttribute
this
.
paydJumpUrl
=
res
.
data
.
paydJumpUrl
}
else
{
uni
.
showToast
({
title
:
res
.
message
,
...
...
@@ -318,7 +335,7 @@
uni
.
hideLoading
()
})
},
initCoupon
()
{
//---
----------------------------------------------------------------------
加载优惠券
initCoupon
()
{
//---加载优惠券
let
savedMoneyList
=
[]
this
.
chooseCouponObj
=
""
this
.
ableConpon
=
""
...
...
@@ -366,7 +383,7 @@
}
})
},
clickPay
(){
//---
------------------------------------------------------------
点击立即支付,获取支付需要的参数
clickPay
(){
//---点击立即支付,获取支付需要的参数
if
(
!
parseFloat
(
this
.
buyMoney
))
{
uni
.
showToast
({
title
:
"请输入正确金额"
,
...
...
@@ -440,7 +457,7 @@
this
.
payBackground
=
"#1dce2e"
})
},
goPay
(){
//---
---------------------------------------------------------------------------
去支付
goPay
(){
//---去支付
let
_this
=
this
// #ifdef MP-WEIXIN
uni
.
requestPayment
({
...
...
@@ -451,18 +468,15 @@
signType
:
this
.
signType
,
paySign
:
this
.
paySign
,
success
:
function
(
res
)
{
if
(
this
.
companyAttribute
==
5
){
//出租车跳转分销组合票页面
if
(
_
this
.
companyAttribute
==
5
){
//出租车跳转分销组合票页面
uni
.
navigateTo
({
url
:
"/pages/combination/distributionCombiChoose/distributionCombiChoose"
url
:
_this
.
paydJumpUrl
})
}
else
{
uni
.
navigateTo
({
url
:
"/pages/paySuccess/paySuccess?orderId="
+
_this
.
orderId
url
:
"/pages/pay
ment/pay
Success/paySuccess?orderId="
+
_this
.
orderId
})
}
// uni.redirectTo({
// url:"../paySuccess/paySuccess?orderId="+_this.orderId
// })
},
fail
:
function
(
err
)
{
uni
.
showToast
({
...
...
@@ -478,18 +492,15 @@
provider
:
'alipay'
,
// 服务提供商 支付宝支付: alipay 微信支付: wxpay
orderInfo
:
this
.
orderInfo
,
// 支付宝订单号
success
:
function
(
res
)
{
if
(
this
.
companyAttribute
==
5
){
//出租车跳转分销组合票页面
if
(
_
this
.
companyAttribute
==
5
){
//出租车跳转分销组合票页面
uni
.
navigateTo
({
url
:
"/pages/combination/distributionCombiChoose/distributionCombiChoose"
url
:
_this
.
paydJumpUrl
})
}
else
{
uni
.
navigateTo
({
url
:
"/pages/paySuccess/paySuccess?orderId="
+
_this
.
orderId
url
:
"/pages/pay
ment/pay
Success/paySuccess?orderId="
+
_this
.
orderId
})
}
// uni.redirectTo({
// url:"../paySuccess/paySuccess?orderId="+_this.orderId
// })
},
fail
:
function
(
err
)
{
uni
.
showToast
({
...
...
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