Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
de0fa709
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6373
Star
108
Fork
184
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
24
列表
看板
标记
里程碑
合并请求
2
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
24
Issue
24
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
de0fa709
编写于
3月 07, 2025
作者:
dcloud_wdl
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/alpha'
上级
39da9bd1
0c407d1b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
41 addition
and
13 deletion
+41
-13
changelog.md
changelog.md
+2
-2
package.json
package.json
+1
-1
pages/API/request-payment/request-payment.uvue
pages/API/request-payment/request-payment.uvue
+1
-1
pages/API/request-payment/request-payment/request-payment-uni-pay.uvue
...uest-payment/request-payment/request-payment-uni-pay.uvue
+36
-5
uni_modules/uni-pay-x/components/uni-pay/uni-pay.uvue
uni_modules/uni-pay-x/components/uni-pay/uni-pay.uvue
+1
-4
未找到文件。
changelog.md
浏览文件 @
de0fa709
## 1.0.4
6
## 1.0.4
7
*
update 4.5
3.2025022409
-alpha
*
update 4.5
4.2025030608
-alpha
package.json
浏览文件 @
de0fa709
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
"id"
:
"hello-uniapp-x-alpha"
,
"id"
:
"hello-uniapp-x-alpha"
,
"name"
:
"hello-uniapp-x-alpha"
,
"name"
:
"hello-uniapp-x-alpha"
,
"displayName"
:
"hello-uniapp-x-alpha"
,
"displayName"
:
"hello-uniapp-x-alpha"
,
"version"
:
"1.0.4
6
"
,
"version"
:
"1.0.4
7
"
,
"description"
:
"演示 uni-app x 框架的组件、接口、模板"
,
"description"
:
"演示 uni-app x 框架的组件、接口、模板"
,
"scripts"
:
{
"scripts"
:
{
"check-commit"
:
"node ./git-hooks/check-commit.cjs"
"check-commit"
:
"node ./git-hooks/check-commit.cjs"
...
...
pages/API/request-payment/request-payment.uvue
浏览文件 @
de0fa709
...
@@ -67,7 +67,7 @@
...
@@ -67,7 +67,7 @@
this.payWX(provider)
this.payWX(provider)
}
}
// #endif
// #endif
// #ifdef APP-IOS
// #ifdef APP-IOS
|| APP-HARMONY
if (e.provider != null && ((e.provider as UniPaymentWxpayProvider).isWeChatInstalled == undefined || ((e.provider as UniPaymentWxpayProvider).isWeChatInstalled != null && (e.provider as UniPaymentWxpayProvider).isWeChatInstalled == false))) {
if (e.provider != null && ((e.provider as UniPaymentWxpayProvider).isWeChatInstalled == undefined || ((e.provider as UniPaymentWxpayProvider).isWeChatInstalled != null && (e.provider as UniPaymentWxpayProvider).isWeChatInstalled == false))) {
uni.showToast({
uni.showToast({
title: "微信没有安装",
title: "微信没有安装",
...
...
pages/API/request-payment/request-payment/request-payment-uni-pay.uvue
浏览文件 @
de0fa709
<template>
<template>
<view class="app">
<view class="app">
<view v-if="errMsg != ''">
<text class="err-msg">注意:{{ errMsg }}</text>
</view>
<view>
<view>
<view class="label">支付单号:</view>
<view class="label">支付单号:</view>
<view><input class="input" v-model="out_trade_no" placeholder="点击发起支付会自动生成" /></view>
<view><input class="input" v-model="out_trade_no" placeholder="点击发起支付会自动生成" /></view>
...
@@ -121,11 +124,14 @@
...
@@ -121,11 +124,14 @@
adpid: "1000000001", // uni-ad的广告位id
adpid: "1000000001", // uni-ad的广告位id
transaction_id: "", // 查询订单接口的查询条件
transaction_id: "", // 查询订单接口的查询条件
getOrderRes: {} as UTSJSONObject, // 查询订单支付成功后的返回值
getOrderRes: {} as UTSJSONObject, // 查询订单支付成功后的返回值
useUniCloud: true,
errMsg: ""
}
}
},
},
onLoad(options) {
onLoad(options) {
console.log('onLoad: ', options)
console.log('onLoad: ', options);
this.useUniCloud = this.checkUniCloud();
// #ifdef H5
// #ifdef H5
// 微信公众号特殊逻辑开始-----------------------------------------------------------
// 微信公众号特殊逻辑开始-----------------------------------------------------------
// 以下代码仅为获取openid,正常你自己项目应该是登录后才能支付,登录后已经拿到openid,无需编写下面的代码
// 以下代码仅为获取openid,正常你自己项目应该是登录后才能支付,登录后已经拿到openid,无需编写下面的代码
...
@@ -156,7 +162,7 @@
...
@@ -156,7 +162,7 @@
// 微信公众号特殊逻辑结束-----------------------------------------------------------
// 微信公众号特殊逻辑结束-----------------------------------------------------------
// #endif
// #endif
},
},
methods: {
methods: {
/**
/**
* 发起支付(唤起收银台,如果只有一种支付方式,则收银台不会弹出来,会直接使用此支付方式)
* 发起支付(唤起收银台,如果只有一种支付方式,则收银台不会弹出来,会直接使用此支付方式)
* 在调用此api前,你应该先创建自己的业务系统订单,并获得订单号 order_no,把order_no当参数传给此api,而示例中为了简化跟支付插件无关的代码,这里直接已时间戳生成了order_no
* 在调用此api前,你应该先创建自己的业务系统订单,并获得订单号 order_no,把order_no当参数传给此api,而示例中为了简化跟支付插件无关的代码,这里直接已时间戳生成了order_no
...
@@ -376,7 +382,10 @@
...
@@ -376,7 +382,10 @@
// 监听事件 - 取消支付
// 监听事件 - 取消支付
onCancel(err : UTSJSONObject) {
onCancel(err : UTSJSONObject) {
console.log('cancel: ', err)
console.log('cancel: ', err)
uni.showToast({
title: "用户取消了支付",
icon: "none"
});
},
},
// 页面跳转
// 页面跳转
pageTo(url : string) {
pageTo(url : string) {
...
@@ -404,6 +413,23 @@
...
@@ -404,6 +413,23 @@
} else {
} else {
return (totalFee / 100).toFixed(2)
return (totalFee / 100).toFixed(2)
}
}
},
checkUniCloud() : boolean {
let useUniCloud = false;
if (typeof uniCloud != 'undefined' && typeof uniCloud.config == "object" && uniCloud.config.spaceId != "") {
useUniCloud = true;
}
if (!useUniCloud) {
let errMsg = "本示例依赖 uniCloud,请先关联服务空间,填写正确的支付配置,支付配置文件地址:/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-pay/config.js";
this.errMsg = errMsg;
uni.showModal({
title: "提示",
content: errMsg,
showCancel: false
})
console.error(errMsg);
}
return useUniCloud;
}
}
},
},
computed: {
computed: {
...
@@ -521,5 +547,10 @@
...
@@ -521,5 +547,10 @@
.text {
.text {
font-size: 24rpx;
font-size: 24rpx;
}
}
}
.err-msg {
color: red;
font-size: 14px;
}
}
</style>
</style>
uni_modules/uni-pay-x/components/uni-pay/uni-pay.uvue
浏览文件 @
de0fa709
...
@@ -419,10 +419,7 @@
...
@@ -419,10 +419,7 @@
console.log("requestPaymentFail", JSON.stringify(err))
console.log("requestPaymentFail", JSON.stringify(err))
let errCode = err.errCode;
let errCode = err.errCode;
let errMsg = err.errMsg;
let errMsg = err.errMsg;
if (errCode == 701110) {
if (errCode == 700601 || errMsg.indexOf("fail cancel") > -1) {
// 用户取消支付
this.$emit("cancel", err);
} else if (errMsg.indexOf("fail cancel") > -1) {
// 用户取消支付
// 用户取消支付
this.$emit("cancel", err);
this.$emit("cancel", err);
} else {
} else {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录