feat(支付): 添加借呗余额支持并完善支付检查

在用户DTO中添加借呗余额字段,并在微信商店中处理借呗用户数据
添加支付方式可用性检查,当无可用支付方式时提示用户
在个人中心页面计算并显示借呗余额(当前注释掉)
This commit is contained in:
dzq 2025-07-07 17:11:44 +08:00
parent 528009e6d5
commit 3608a12291
4 changed files with 26 additions and 1 deletions

View File

@ -200,6 +200,8 @@ export interface ab98UserDTO {
address?: string;
/** 是否已注册0未注册 1已注册 */
registered?: boolean;
/** 借呗余额 单位分 */
ab98Balance?: number;
}
export interface OpenCabinetApiData {

View File

@ -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();
<div class="text-sm text-gray-700">剩余借呗</div>
<div class="text-lg font-bold text-primary">{{ balance }}</div>
</div>
<!-- <div class="flex-1 ml-1">
<div class="text-sm text-gray-700">余额</div>
<div class="text-lg font-bold text-primary">{{ ab98BalanceInYuan }}</div>
</div> -->
</div>
<!-- 个人中心按钮 -->

View File

@ -121,6 +121,14 @@ async function handleSubmit() {
}
}
//
if (supportedPayments.value.length === 0) {
return showConfirmDialog({
title: "提示",
message: "没有支持的支付方法,请从微信进入智借还"
});
}
if (!openid.value && !wxStore.isFakeQyLogin) {
return showConfirmDialog({
title: "登录提示",

View File

@ -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);
}
}
}
}