From 3c21dadeda7e9557a60d186ea7c04e6a852201d6 Mon Sep 17 00:00:00 2001 From: Yu <3037769318@qq.com> Date: Tue, 24 Mar 2026 10:58:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E6=94=BE=E9=93=B6=E8=A1=8C=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uniapp/src/api/pay.ts | 55 ++++++++++++++++++++++++++++++++ uniapp/src/config/index.ts | 27 +++++++++++++++- uniapp/src/pages.json | 6 ++++ uniapp/src/pages/index/index.vue | 15 +++++++++ 4 files changed, 102 insertions(+), 1 deletion(-) diff --git a/uniapp/src/api/pay.ts b/uniapp/src/api/pay.ts index cf56c8be..97aa97ad 100644 --- a/uniapp/src/api/pay.ts +++ b/uniapp/src/api/pay.ts @@ -14,3 +14,58 @@ export function prepay(data: any) { export function getPayResult(data: any) { return request.get({ url: '/pay/payStatus', data }, { isAuth: true }) } + +// 开放银行支付宝服务窗支付 +export function alipayJspay(data: any) { + return request.post({ + url: '/api/payment/wholeNetworkAcquiring/new/payAlipayJspay', + data, + header: { + 'Content-Type': 'application/x-www-form-urlencoded' + } + }, { isAuth: true }) +} + +// 开放银行微信支付(JSPay) +export function wechatJspay(data: any) { + return request.post({ + url: '/api/payment/wholeNetworkAcquiring/new/payWechatJspay', + data, + header: { + 'Content-Type': 'application/x-www-form-urlencoded' + } + }, { isAuth: true }) +} + +// 开放银行订单查询 +export function unifiedTradeQuery(data: any) { + return request.post({ + url: '/api/payment/wholeNetworkAcquiring/new/unifiedTradeQuery', + data, + header: { + 'Content-Type': 'application/x-www-form-urlencoded' + } + }, { isAuth: true }) +} + +// 开放银行订单关闭 +export function unifiedTradeClose(data: any) { + return request.post({ + url: '/api/payment/wholeNetworkAcquiring/new/unifiedTradeClose', + data, + header: { + 'Content-Type': 'application/x-www-form-urlencoded' + } + }, { isAuth: true }) +} + +// 开放银行订单撤销 +export function unifiedMicropayReverse(data: any) { + return request.post({ + url: '/api/payment/wholeNetworkAcquiring/new/unifiedMicropayReverse', + data, + header: { + 'Content-Type': 'application/x-www-form-urlencoded' + } + }, { isAuth: true }) +} diff --git a/uniapp/src/config/index.ts b/uniapp/src/config/index.ts index a39e6f28..c9a43e18 100644 --- a/uniapp/src/config/index.ts +++ b/uniapp/src/config/index.ts @@ -17,7 +17,32 @@ const config = { version: '1.9.0', //版本号 baseUrl, //请求接口域名 urlPrefix: 'api', //请求默认前缀 - timeout: 60 * 1000 //请求超时时长 + timeout: 60 * 1000, //请求超时时长 + + // 开放银行支付配置 + payment: { + // 商户号 - 由开放银行平台分配 + mch_id: '999111001001E03', + + // 终端设备号 - 由平台分配 + terminal_id: 'P0003093', + + // 微信支付配置 + wechat: { + // 公众号/小程序 appid + sub_appid: 'wx7f1c5b5343b1ce8e', + // 支付回调地址 + notify_url: 'http://your-domain.com/api/pay/wechat-notify' + }, + + // 支付宝配置 + alipay: { + // 支付宝 appid + appid: '2016081701760348', + // 支付回调地址 + notify_url: 'http://your-domain.com/api/pay/alipay-notify' + } + } } export default config diff --git a/uniapp/src/pages.json b/uniapp/src/pages.json index 29a2f61b..71dbd8ce 100644 --- a/uniapp/src/pages.json +++ b/uniapp/src/pages.json @@ -70,6 +70,12 @@ "style": { "navigationBarTitleText": "修改密码" } + }, + { + "path": "pages/payment/payment", + "style": { + "navigationBarTitleText": "缴费" + } } ], "globalStyle": { diff --git a/uniapp/src/pages/index/index.vue b/uniapp/src/pages/index/index.vue index 32dd6396..c80237f5 100644 --- a/uniapp/src/pages/index/index.vue +++ b/uniapp/src/pages/index/index.vue @@ -45,6 +45,12 @@ 我的招生 + + + + + 缴费 + @@ -189,6 +195,12 @@ const goToUser = () => { }) } +const goToPayment = () => { + uni.navigateTo({ + url: '/pages/payment/payment' + }) +} + const goToLogin = () => { uni.navigateTo({ url: '/pages/login/login' @@ -330,6 +342,9 @@ onShow(async () => { &.purple { background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%); } + &.orange { + background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%); + } } .action-text {