From 3608a12291971036434b3a822a24233eb9f9a4ca Mon Sep 17 00:00:00 2001 From: dzq Date: Mon, 7 Jul 2025 17:11:44 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=94=AF=E4=BB=98):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=80=9F=E5=91=97=E4=BD=99=E9=A2=9D=E6=94=AF=E6=8C=81=E5=B9=B6?= =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=94=AF=E4=BB=98=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在用户DTO中添加借呗余额字段,并在微信商店中处理借呗用户数据 添加支付方式可用性检查,当无可用支付方式时提示用户 在个人中心页面计算并显示借呗余额(当前注释掉) --- src/common/apis/shop/type.ts | 2 ++ src/pages/me/index.vue | 13 ++++++++++++- src/pages/product/components/checkout.vue | 8 ++++++++ src/pinia/stores/wx.ts | 4 ++++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/common/apis/shop/type.ts b/src/common/apis/shop/type.ts index 4f0c723..da2b66f 100644 --- a/src/common/apis/shop/type.ts +++ b/src/common/apis/shop/type.ts @@ -200,6 +200,8 @@ export interface ab98UserDTO { address?: string; /** 是否已注册(0未注册 1已注册) */ registered?: boolean; + /** 借呗余额 单位分 */ + ab98Balance?: number; } export interface OpenCabinetApiData { diff --git a/src/pages/me/index.vue b/src/pages/me/index.vue index ee7796a..311a707 100644 --- a/src/pages/me/index.vue +++ b/src/pages/me/index.vue @@ -11,7 +11,7 @@ const route = useRoute(); const wxStore = useWxStore(); const ab98UserStore = useAb98UserStore(); -const { balance, useBalance, balanceLimit, name: qyName } = storeToRefs(wxStore); +const { balance, useBalance, balanceLimit, name: qyName, ab98User } = storeToRefs(wxStore); const { name: userName, sex: userSex, face_img } = storeToRefs(ab98UserStore); const name = computed(() => { @@ -20,6 +20,13 @@ const name = computed(() => { const userAvatar = face_img.value ? face_img.value : `${publicPath}img/1.jpg`; +const ab98BalanceInYuan = computed(() => { + if (ab98User.value && ab98User.value.ab98Balance !== undefined) { + return (ab98User.value.ab98Balance / 100).toFixed(2); + } + return '0.00'; +}); + const handleLogout = () => { showConfirmDialog({ title: '退出登录', @@ -77,6 +84,10 @@ wxStore.refreshBalance();
剩余借呗
{{ balance }}
+ diff --git a/src/pages/product/components/checkout.vue b/src/pages/product/components/checkout.vue index 14df125..a9b8ad0 100644 --- a/src/pages/product/components/checkout.vue +++ b/src/pages/product/components/checkout.vue @@ -121,6 +121,14 @@ async function handleSubmit() { } } + // 检查是否有可用支付方式 + if (supportedPayments.value.length === 0) { + return showConfirmDialog({ + title: "提示", + message: "没有支持的支付方法,请从微信进入智借还" + }); + } + if (!openid.value && !wxStore.isFakeQyLogin) { return showConfirmDialog({ title: "登录提示", diff --git a/src/pinia/stores/wx.ts b/src/pinia/stores/wx.ts index 1bb010b..3ef2bc7 100644 --- a/src/pinia/stores/wx.ts +++ b/src/pinia/stores/wx.ts @@ -68,6 +68,10 @@ export const useWxStore = defineStore("wx", () => { balance.value = res.data.balance; useBalance.value = res.data.useBalance; balanceLimit.value = res.data.balanceLimit; + + if (res.data.ab98User) { + setAb98User(res.data.ab98User); + } } } }