Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mallapp
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
viitto
mallapp
Commits
46427d51
Commit
46427d51
authored
Oct 13, 2022
by
zhengke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
7dbfe420
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
140 additions
and
0 deletions
+140
-0
submit2Pay.vue
components/pay/submit2Pay.vue
+140
-0
No files found.
components/pay/submit2Pay.vue
0 → 100644
View file @
46427d51
<
template
>
<view>
<u-popup
close-icon-color=
"red"
v-model=
"show"
mode=
"center"
:mask-close-able=
"false"
length=
"auto"
:closeable=
"true"
close-icon=
"close"
:border-radius=
"20"
:z-index=
"9999"
>
<view
style=
"background:#fff;width:550rpx;padding:40rpx;border-radius:20px"
>
<u-icon
@
click=
"closePay"
name=
"close"
style=
"float:right;font-size:40rpx"
></u-icon>
<p
style=
"text-align: center;font-size: 26rpx;"
>
支付方式
</p>
<p
style=
"font-size: 36rpx;font-weight: 700;text-align: center;margin:30px 0"
>
支付金额
{{
payInfo
.
total_price
}}
元
</p>
<view>
<view
v-for=
"(item,index) in payList"
@
click=
"payType=item.Id"
style=
"display: flex;justify-content: space-between;"
>
<p
v-if=
"item.Name=='微信'||(item.Name=='支付宝'&&isAlipay==1)"
>
<img
style=
"width:50rpx;height:50rpx;margin-right:10px"
:src=
"item.src"
alt=
""
/>
<span
style=
"position:relative;top:-7px"
>
{{
item
.
Name
}}
</span>
</p>
<u-icon
v-if=
"isAlipay==1"
:name=
"payType==item.Id?'checked':'circle'"
:style=
"
{'color':payType==item.Id?'red':''}">
</u-icon>
</view>
</view>
<view
style=
"margin-top:30px"
>
<u-button
@
click=
"getDataInfo"
type=
"error"
shape=
"circle"
:loading=
"loading"
>
支付
</u-button>
</view>
</view>
</u-popup>
</view>
</
template
>
<
script
>
export
default
{
props
:
[
'payInfo'
,
'isAlipay'
],
data
()
{
return
{
loading
:
false
,
show
:
true
,
orderInfo
:
{},
payType
:
'wx_lite'
,
payList
:[
{
Name
:
'微信'
,
Id
:
'wx_lite'
,
src
:
'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/wx.png'
},
{
Name
:
'支付宝'
,
Id
:
'alipay_qr'
,
src
:
'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/zhifubao.png'
},
]
};
},
created
()
{
},
wacth
:{
payInfo
:
{
handler
:
function
(
val
,
oldval
)
{
},
deep
:
true
,
}
},
methods
:
{
closePay
()
{
this
.
$emit
(
'closePay'
);
},
getDataInfo
()
{
let
msg
=
{
'pay_channel'
:
this
.
payType
,
//网页打开支付宝支付:alipay_wap 支付宝正扫:alipay_qr 支付宝app:alipay 微信小程序:wx_lite 微信公众号:wx_pub
'open_id'
:
this
.
payType
==
'wx_lite'
?
this
.
payInfo
.
OpenId
:
''
,
'hb_fq_num'
:
''
,
'orderId'
:
this
.
payInfo
.
OrderId
,
};
this
.
loading
=
true
uni
.
showLoading
({
title
:
'正在调起支付'
})
this
.
request2
(
{
url
:
'/api/Adapay/GetAdapayInfo'
,
data
:
msg
},
res
=>
{
this
.
loading
=
false
uni
.
hideLoading
()
if
(
res
.
Data
!=
''
){
if
(
this
.
payType
!=
'wx_lite'
){
this
.
aliPay
(
res
.
Data
)
}
else
{
this
.
wxPay
(
JSON
.
parse
(
res
.
Data
))
}
}
else
{
uni
.
showToast
({
title
:
"调起支付失败,请重试"
,
icon
:
'error'
})
}
// uni.hideNavigationBarLoading();
}
);
},
// 支付宝支付
aliPay
(
url
)
{
window
.
location
.
href
=
url
},
// 微信支付
wxPay
(
payData
)
{
let
that
=
this
uni
.
showLoading
({
title
:
'支付中...'
})
WeixinJSBridge
.
invoke
(
'getBrandWCPayRequest'
,
{
"appId"
:
payData
.
appId
,
//公众号名称,由商户传入
"timeStamp"
:
payData
.
timeStamp
,
//时间戳,自1970年以来的秒数
"nonceStr"
:
payData
.
nonceStr
,
//随机串
"package"
:
payData
.
package
,
"signType"
:
payData
.
signType
,
//微信签名方式:
"paySign"
:
payData
.
paySign
//微信签名
},
function
(
res
)
{
if
(
res
.
errMsg
===
"get_brand_wcpay_request:ok"
)
{
// 使用以上方式判断前端返回,微信团队郑重提示:
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
that
.
isSuccess
=
true
that
.
isSuccessTitle
=
'支付成功!'
}
else
{
that
.
isSuccess
=
false
that
.
isSuccessTitle
=
'支付失败!'
}
uni
.
hideLoading
();
}
);
},
}
};
</
script
>
<
style
></
style
>
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