This commit is contained in:
2026-04-29 11:39:08 +08:00
parent 121c7ffcf5
commit ac3bef4fa9
4 changed files with 36 additions and 63 deletions

View File

@@ -87,6 +87,14 @@ const useApiFetch = createFetch({
}, },
async afterFetch({ data, response }) { async afterFetch({ data, response }) {
closeToast(); closeToast();
// 检测会员过期响应头,自动刷新代理信息
const membershipExpired = response?.headers?.get?.('X-Membership-Expired');
if (membershipExpired === 'true') {
const agentStore = useAgentStore();
agentStore.fetchAgentStatus();
}
// 全局处理响应 // 全局处理响应
if (response.status === 401) { if (response.status === 401) {
// 清除本地存储的 token // 清除本地存储的 token

View File

@@ -14,14 +14,14 @@
累计收益¥ {{ (data?.total_earnings || 0).toFixed(2) }} 累计收益¥ {{ (data?.total_earnings || 0).toFixed(2) }}
</div> </div>
<div class="text-sm mb-6 flex items-center" style="color: var(--van-text-color-2);"> <div class="text-sm mb-6 flex items-center" style="color: var(--van-text-color-2);">
待结账金¥ {{ (data?.frozen_balance || 0).toFixed(2) }} 冻结余¥ {{ (data?.frozen_balance || 0).toFixed(2) }}
<van-popover v-model:show="showTooltip" placement="bottom-start" :offset="10"> <van-popover v-model:show="showTooltip" placement="bottom-start" :offset="10">
<template #reference> <template #reference>
<van-icon name="question-o" class="ml-2 cursor-help" @mouseenter="showTooltip = true" <van-icon name="question-o" class="ml-2 cursor-help" @mouseenter="showTooltip = true"
@mouseleave="showTooltip = false" /> @mouseleave="showTooltip = false" />
</template> </template>
<div class="p-2 text-sm" style="max-width: 200px;"> <div class="p-2 text-sm" style="max-width: 200px;">
待结账金额将在订单创建24小时后自动结账 冻结余额将在订单创建24小时后自动结账
</div> </div>
</van-popover> </van-popover>
</div> </div>

View File

@@ -96,12 +96,12 @@ function onConfirmTap() {
if (showBalanceWarning.value) { if (showBalanceWarning.value) {
showConfirmDialog({ showConfirmDialog({
title: '确认注销', title: '确认注销',
message: '您的代理账户仍有余额或待结账金额,注销后将无法通过本账号提现,确定继续注销?', message: '您的代理账户仍有余额或冻结余额,注销后将无法通过本账号提现,确定继续注销?',
confirmButtonText: '继续', confirmButtonText: '继续',
cancelButtonText: '取消', cancelButtonText: '取消',
}) })
.then(() => openSmsModal()) .then(() => openSmsModal())
.catch(() => {}) .catch(() => { })
} }
else { else {
openSmsModal() openSmsModal()
@@ -164,10 +164,8 @@ async function submitCancelAccount() {
<template> <template>
<!-- 减导航栏占位高度避免整页超出视口 PageLayout van-nav-bar placeholder 配合 --> <!-- 减导航栏占位高度避免整页超出视口 PageLayout van-nav-bar placeholder 配合 -->
<div <div class="box-border flex flex-col bg-gray-50"
class="box-border flex flex-col bg-gray-50" style="min-height: calc(100vh - var(--van-nav-bar-height, 46px)); height: calc(100vh - var(--van-nav-bar-height, 46px));">
style="min-height: calc(100vh - var(--van-nav-bar-height, 46px)); height: calc(100vh - var(--van-nav-bar-height, 46px));"
>
<div v-if="loading" class="flex flex-1 items-center justify-center py-20 text-gray-500"> <div v-if="loading" class="flex flex-1 items-center justify-center py-20 text-gray-500">
加载中... 加载中...
</div> </div>
@@ -177,25 +175,19 @@ async function submitCancelAccount() {
<AccountCancelAgreement /> <AccountCancelAgreement />
</div> </div>
<div <div v-if="showAnyReminder" class="flex-shrink-0 space-y-2 border-t border-gray-100 bg-gray-50 px-4 py-3">
v-if="showAnyReminder" <div v-if="showBalanceWarning"
class="flex-shrink-0 space-y-2 border-t border-gray-100 bg-gray-50 px-4 py-3" class="rounded-lg border border-amber-200 bg-amber-50 p-3 text-sm text-amber-900">
>
<div
v-if="showBalanceWarning"
class="rounded-lg border border-amber-200 bg-amber-50 p-3 text-sm text-amber-900"
>
<p class="font-medium"> <p class="font-medium">
钱包提示 钱包提示
</p> </p>
<p class="mt-1 leading-relaxed"> <p class="mt-1 leading-relaxed">
检测到您为代理且账户仍有余额¥{{ (revenueData?.balance ?? 0).toFixed(2) }}待结账金¥{{ (revenueData?.frozen_balance ?? 0).toFixed(2) }}注销后将无法通过本账号提现请确认已了解风险 检测到您为代理且账户仍有余额¥{{ (revenueData?.balance ?? 0).toFixed(2) }}冻结余¥{{ (revenueData?.frozen_balance ??
0).toFixed(2) }}注销后将无法通过本账号提现请确认已了解风险
</p> </p>
</div> </div>
<div <div v-if="showVipLevelReminder"
v-if="showVipLevelReminder" class="rounded-lg border border-violet-200 bg-violet-50 p-3 text-sm text-violet-900">
class="rounded-lg border border-violet-200 bg-violet-50 p-3 text-sm text-violet-900"
>
<p class="font-medium"> <p class="font-medium">
会员提示 会员提示
</p> </p>
@@ -206,31 +198,22 @@ async function submitCancelAccount() {
</div> </div>
</div> </div>
<div class="flex-shrink-0 border-t border-gray-200 bg-gray-50 px-4 pb-[max(1rem,env(safe-area-inset-bottom))] pt-3"> <div
class="flex-shrink-0 border-t border-gray-200 bg-gray-50 px-4 pb-[max(1rem,env(safe-area-inset-bottom))] pt-3">
<div class="flex gap-3"> <div class="flex gap-3">
<button <button type="button" class="flex-1 rounded-lg border border-gray-300 bg-white py-3 text-gray-800"
type="button" @click="onExit">
class="flex-1 rounded-lg border border-gray-300 bg-white py-3 text-gray-800"
@click="onExit"
>
退出 退出
</button> </button>
<button <button type="button" class="flex-1 rounded-lg bg-red-500 py-3 text-white" @click="onConfirmTap">
type="button"
class="flex-1 rounded-lg bg-red-500 py-3 text-white"
@click="onConfirmTap"
>
确认 确认
</button> </button>
</div> </div>
</div> </div>
</template> </template>
<div <div v-if="showSmsModal" class="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4"
v-if="showSmsModal" @click.self="closeSmsModal">
class="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4"
@click.self="closeSmsModal"
>
<div class="w-full max-w-sm rounded-xl bg-white p-5 shadow-lg" @click.stop> <div class="w-full max-w-sm rounded-xl bg-white p-5 shadow-lg" @click.stop>
<p class="mb-2 text-base font-medium text-gray-800"> <p class="mb-2 text-base font-medium text-gray-800">
验证手机号 验证手机号
@@ -238,37 +221,19 @@ async function submitCancelAccount() {
<p class="mb-4 text-sm text-gray-500"> <p class="mb-4 text-sm text-gray-500">
将向 {{ maskName(mobile) }} 发送验证码 将向 {{ maskName(mobile) }} 发送验证码
</p> </p>
<input <input v-model="cancelAccountCode" type="text" maxlength="6" inputmode="numeric" placeholder="请输入6位验证码"
v-model="cancelAccountCode" class="mb-4 w-full rounded-lg border border-gray-200 px-3 py-2 text-base">
type="text"
maxlength="6"
inputmode="numeric"
placeholder="请输入6位验证码"
class="mb-4 w-full rounded-lg border border-gray-200 px-3 py-2 text-base"
>
<div class="mb-4"> <div class="mb-4">
<button <button type="button" class="w-full rounded-lg bg-gray-100 py-2 text-sm text-gray-700 disabled:opacity-50"
type="button" :disabled="cancelSmsCountdown > 0" @click="sendCancelAccountSms">
class="w-full rounded-lg bg-gray-100 py-2 text-sm text-gray-700 disabled:opacity-50"
:disabled="cancelSmsCountdown > 0"
@click="sendCancelAccountSms"
>
{{ cancelSmsCountdown > 0 ? `${cancelSmsCountdown}s` : '获取验证码' }} {{ cancelSmsCountdown > 0 ? `${cancelSmsCountdown}s` : '获取验证码' }}
</button> </button>
</div> </div>
<div class="flex gap-2"> <div class="flex gap-2">
<button <button type="button" class="flex-1 rounded-lg bg-gray-200 py-2 text-gray-800" @click="closeSmsModal">
type="button"
class="flex-1 rounded-lg bg-gray-200 py-2 text-gray-800"
@click="closeSmsModal"
>
取消 取消
</button> </button>
<button <button type="button" class="flex-1 rounded-lg bg-red-500 py-2 text-white" @click="submitCancelAccount">
type="button"
class="flex-1 rounded-lg bg-red-500 py-2 text-white"
@click="submitCancelAccount"
>
确认注销 确认注销
</button> </button>
</div> </div>

View File

@@ -49,8 +49,8 @@ export default defineConfig({
strictPort: true, // 如果端口被占用则抛出错误而不是使用下一个可用端口 strictPort: true, // 如果端口被占用则抛出错误而不是使用下一个可用端口
proxy: { proxy: {
"/api/v1": { "/api/v1": {
// target: "http://127.0.0.1:8888", // 本地接口地址 target: "http://127.0.0.1:8888", // 本地接口地址
target: "https://chimei.ronsafe.cn/", // 本地接口地址 // target: "https://chimei.ronsafe.cn/", // 本地接口地址
changeOrigin: true, changeOrigin: true,
}, },
}, },