Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-pay
提交
bfc1927c
U
uni-pay
项目概览
DCloud
/
uni-pay
通知
817
Star
4
Fork
5
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-pay
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
bfc1927c
编写于
8月 11, 2023
作者:
VK1688
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ref="uniPay" 改成 ref="pay" 兼容vue3
上级
ce092689
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
11 addition
and
11 deletion
+11
-11
pages/index/index.vue
pages/index/index.vue
+11
-11
未找到文件。
pages/index/index.vue
浏览文件 @
bfc1927c
...
...
@@ -87,8 +87,8 @@
<!-- #ifdef H5 -->
<button
v-if=
"h5Env === 'h5-weixin'"
@
click=
"getWeiXinJsCode('snsapi_base')"
>
公众号获取openid示例
</button>
<!-- #endif -->
<!-- 统一支付组件 -->
<uni-pay
ref=
"
uniP
ay"
:adpid=
"adpid"
height=
"70vh"
return-url=
"/pages/order-detail/order-detail"
logo=
"/static/logo.png"
@
success=
"onSuccess"
@
create=
"onCreate"
@
fail=
"onFail"
></uni-pay>
<!-- 统一支付组件
,注意:vue3下ref不可以等于组件名,因此这里ref="pay" 而不能是 ref="uniPay"
-->
<uni-pay
ref=
"
p
ay"
:adpid=
"adpid"
height=
"70vh"
return-url=
"/pages/order-detail/order-detail"
logo=
"/static/logo.png"
@
success=
"onSuccess"
@
create=
"onCreate"
@
fail=
"onFail"
></uni-pay>
</view>
</
template
>
...
...
@@ -151,7 +151,7 @@
this
.
order_no
=
`test`
+
Date
.
now
();
this
.
out_trade_no
=
`
${
this
.
order_no
}
-1`
;
// 打开支付收银台
this
.
$refs
.
uniP
ay
.
open
({
this
.
$refs
.
p
ay
.
open
({
total_fee
:
this
.
total_fee
,
// 支付金额,单位分 100 = 1元
order_no
:
this
.
order_no
,
// 业务系统订单号(即你自己业务系统的订单表的订单号)
out_trade_no
:
this
.
out_trade_no
,
// 插件支付单号
...
...
@@ -170,7 +170,7 @@
this
.
order_no
=
`test`
+
Date
.
now
();
this
.
out_trade_no
=
`
${
this
.
order_no
}
-1`
;
// 发起支付
this
.
$refs
.
uniP
ay
.
createOrder
({
this
.
$refs
.
p
ay
.
createOrder
({
provider
:
provider
,
// 支付供应商
total_fee
:
this
.
total_fee
,
// 支付金额,单位分 100 = 1元
order_no
:
this
.
order_no
,
// 业务系统订单号(即你自己业务系统的订单表的订单号)
...
...
@@ -190,7 +190,7 @@
this
.
order_no
=
`test`
+
Date
.
now
();
this
.
out_trade_no
=
`
${
this
.
order_no
}
-1`
;
// 发起支付
this
.
$refs
.
uniP
ay
.
createOrder
({
this
.
$refs
.
p
ay
.
createOrder
({
provider
:
provider
,
// 支付供应商
total_fee
:
this
.
total_fee
,
// 支付金额,单位分 100 = 1元
order_no
:
this
.
order_no
,
// 业务系统订单号(即你自己业务系统的订单表的订单号)
...
...
@@ -236,7 +236,7 @@
// 查询支付状态
async
getOrder
()
{
this
.
getOrderRes
=
{};
let
res
=
await
this
.
$refs
.
uniP
ay
.
getOrder
({
let
res
=
await
this
.
$refs
.
p
ay
.
getOrder
({
//out_trade_no: this.out_trade_no, // 插件支付单号 两者传1个即可
transaction_id
:
this
.
transaction_id
,
// 第三方单号 两者传1个即可
await_notify
:
true
...
...
@@ -258,7 +258,7 @@
},
// 发起退款
async
refund
()
{
let
res
=
await
this
.
$refs
.
uniP
ay
.
refund
({
let
res
=
await
this
.
$refs
.
p
ay
.
refund
({
out_trade_no
:
this
.
out_trade_no
,
// 插件支付单号
});
if
(
res
)
{
...
...
@@ -270,7 +270,7 @@
},
// 查询退款状态
async
getRefund
()
{
let
res
=
await
this
.
$refs
.
uniP
ay
.
getRefund
({
let
res
=
await
this
.
$refs
.
p
ay
.
getRefund
({
out_trade_no
:
this
.
out_trade_no
,
// 插件支付单号
});
if
(
res
)
{
...
...
@@ -282,7 +282,7 @@
},
// 关闭订单
async
closeOrder
()
{
let
res
=
await
this
.
$refs
.
uniP
ay
.
closeOrder
({
let
res
=
await
this
.
$refs
.
p
ay
.
closeOrder
({
out_trade_no
:
this
.
out_trade_no
,
// 插件支付单号
});
if
(
res
)
{
...
...
@@ -294,7 +294,7 @@
},
// 获取公众号code
async
getWeiXinJsCode
(
scope
=
"
snsapi_base
"
)
{
let
res
=
await
this
.
$refs
.
uniP
ay
.
getProviderAppId
({
let
res
=
await
this
.
$refs
.
p
ay
.
getProviderAppId
({
provider
:
"
wxpay
"
,
provider_pay_type
:
"
jsapi
"
});
...
...
@@ -307,7 +307,7 @@
},
// 获取公众号openid
async
getOpenid
(
data
=
{})
{
let
res
=
await
this
.
$refs
.
uniP
ay
.
getOpenid
(
data
);
let
res
=
await
this
.
$refs
.
p
ay
.
getOpenid
(
data
);
if
(
res
)
{
this
.
openid
=
res
.
openid
;
// 将openid缓存到本地
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录