From d1127ab5f84b33c70a069192ad7decbdf9892470 Mon Sep 17 00:00:00 2001
From: dzc <2388224167@qq.com>
Date: Thu, 16 Apr 2026 20:21:21 +0800
Subject: [PATCH] 1
---
src/pages.json | 7 ++++
src/pages/pay/transferMoney.vue | 14 +++----
src/pages/tabbar/my.vue | 2 +-
src/pages/wallet/recharge-record.vue | 9 +++++
src/pages/wallet/recharge.vue | 57 ++++++++++++++++++++++++----
5 files changed, 73 insertions(+), 16 deletions(-)
create mode 100644 src/pages/wallet/recharge-record.vue
diff --git a/src/pages.json b/src/pages.json
index e7ea7da..1d5aaf8 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -158,6 +158,13 @@
"navigationBarTitleText": "",
"disableScroll": true
}
+ },
+ {
+ "path": "recharge-record",
+ "style": {
+ "navigationBarTitleText": "充值记录",
+ "disableScroll": true
+ }
}
]
},
diff --git a/src/pages/pay/transferMoney.vue b/src/pages/pay/transferMoney.vue
index ea1d97a..9653a67 100644
--- a/src/pages/pay/transferMoney.vue
+++ b/src/pages/pay/transferMoney.vue
@@ -3,23 +3,23 @@
-
+
{{ payStore.sourceWalletData.walletTypeName }}
- 余额:
- {{ hooks.useMoney(payStore.sourceWalletData.balance) + "元" }}
+ 余额:
+ {{ hooks.useMoney(payStore.sourceWalletData.balance) + "元" }}
-
+
转入到
{{ targetWalletType.name }}
-
+
@@ -51,13 +51,13 @@
:class="{ 'border-4 border-solid border-blue!': targetWalletType.id == v.walletTypeId }"
@click="selectTargetWalletType(v)">
-
+
{{ v.walletTypeName }}
{{ v.cardNumber }}
- 余额:{{ hooks.useMoney(v.balance) + "元" }}
+ 余额:{{ hooks.useMoney(v.balance) + "元" }}
diff --git a/src/pages/tabbar/my.vue b/src/pages/tabbar/my.vue
index 4c44cbb..ddd3624 100644
--- a/src/pages/tabbar/my.vue
+++ b/src/pages/tabbar/my.vue
@@ -3,7 +3,7 @@
-
diff --git a/src/pages/wallet/recharge-record.vue b/src/pages/wallet/recharge-record.vue
new file mode 100644
index 0000000..3a72bd7
--- /dev/null
+++ b/src/pages/wallet/recharge-record.vue
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/pages/wallet/recharge.vue b/src/pages/wallet/recharge.vue
index 42c4802..8793047 100644
--- a/src/pages/wallet/recharge.vue
+++ b/src/pages/wallet/recharge.vue
@@ -3,7 +3,7 @@ import { ref, reactive } from "vue"
import { onLoad, onShow } from "@dcloudio/uni-app"
import { isEmpty } from "radash"
-import { hooks, constant } from "@@/index"
+import { hooks, constant, router } from "@@/index"
import { walletApi, payApi, miniPlatformApi, type MiniPayDto } from "@@/api"
import { SERVICE_IMAGE, storageConstant } from "@@/constant/index"
import { filePath } from "@@/utils/file"
@@ -53,6 +53,7 @@ const getRechargeList = async () => {
const { data } = await walletApi.rechargeList(_pa)
state.rechargeList = data
}
+// 执行微信支付
const doPay = async () => {
if (state.currentRecharge == -1) {
uni.showToast({ title: "请选择充值金额", icon: "none" })
@@ -68,7 +69,6 @@ const doPay = async () => {
const targetPayType = data.payType[state.currentPayType]
if (isEmpty(targetRecharge)) throw new Error()
const uniqueCode = await getMiniUniqueCode(false)
- console.log("uniqueCode:", uniqueCode);
const payParams: MiniPayDto = {
bizType: "MINI_APP_WALLET_RECHARGE",
bizId: targetRecharge.id,
@@ -81,22 +81,38 @@ const doPay = async () => {
provider: 'wxpay',
...createData?.miniAppPayParams ?? {},
});
- console.log("paymentResult:", paymentResult);
+ console.log("执行微信支付success:", paymentResult);
getDetail()
uni.hideLoading()
- uni.showToast({ title: "充值成功", icon: "none" })
- } catch (error) {
- console.error(error)
+ // 支付成功
+ if (paymentResult.errMsg?.includes("requestPayment:ok")) {
+ uni.showToast({ title: "充值成功", icon: "none" })
+ }
+ // 未知支付状态
+ else { }
+ } catch (error: any) {
+ console.error("执行微信支付,error:", error)
uni.hideLoading()
- uni.showToast({ title: "充值失败", icon: "none" })
+ if (error?.errMsg && error?.errMsg.includes("fail cancel")) {
+ uni.showToast({ title: "用户取消支付", icon: "none" })
+ } else {
+ uni.showToast({ title: "充值失败", icon: "none" })
+ }
}
}
+
+const toRechargeRecord = () => {
+ return
+ router.jump("/pages/wallet/recharge-record", { walletId: state.walletId })
+}
+
-
+
@@ -108,6 +124,9 @@ const doPay = async () => {
¥{{ hooks.useMoney(state.detail.balance) }}
+
+ 充值记录
+
充值
@@ -132,6 +151,28 @@ const doPay = async () => {