fix(auth): resolve user 101 404 error by normalizing test user ID to 2006 and adding server fallback

这个提交包含在:
xcbyy
2026-10-13 10:41:49 +08:00
父节点 661d0d2589
当前提交 3bb6f5a6be
共有 7 个文件被更改,包括 683 次插入 和 471 次删除

查看文件

@@ -454,12 +454,22 @@ export async function likePost(id) {
} }
} }
/**
* 规范化用户ID,自动兼容历史测试账号映射 (将虚拟陪伴师 101 映射至真实用户 2006)
*/
function normalizeUserId(uid) {
const n = Number(uid);
if (n === 101) return 2006;
return (!isNaN(n) && n > 0) ? n : 1001;
}
/** /**
* 获取用户个人资料与钱包资产 (真实读取 MySQL users 表) * 获取用户个人资料与钱包资产 (真实读取 MySQL users 表)
*/ */
export async function getUserProfile(userId = 1001) { export async function getUserProfile(userId = 1001) {
const safeId = normalizeUserId(userId);
try { try {
const res = await http.get(`/users/${userId}`); const res = await http.get(`/users/${safeId}`);
if (res && res.id) { if (res && res.id) {
return res; return res;
} }
@@ -473,8 +483,9 @@ export async function getUserProfile(userId = 1001) {
* 修改用户个人资料 (昵称、头像、手机号) * 修改用户个人资料 (昵称、头像、手机号)
*/ */
export async function updateUserProfile(userId = 1001, data = {}) { export async function updateUserProfile(userId = 1001, data = {}) {
const safeId = normalizeUserId(userId);
try { try {
const res = await http.post(`/users/${userId}/profile`, data); const res = await http.post(`/users/${safeId}/profile`, data);
return res; return res;
} catch (err) { } catch (err) {
console.warn('[API] 修改个人资料网络异常:', err.message); console.warn('[API] 修改个人资料网络异常:', err.message);
@@ -486,8 +497,9 @@ export async function updateUserProfile(userId = 1001, data = {}) {
* 钱包充值 (落盘 MySQL 并记录财务入账流水) * 钱包充值 (落盘 MySQL 并记录财务入账流水)
*/ */
export async function rechargeBalance(userId = 1001, amount) { export async function rechargeBalance(userId = 1001, amount) {
const safeId = normalizeUserId(userId);
try { try {
const res = await http.post(`/users/${userId}/recharge`, { amount }); const res = await http.post(`/users/${safeId}/recharge`, { amount });
return res; return res;
} catch (err) { } catch (err) {
console.warn('[API] 钱包充值接口异常:', err.message); console.warn('[API] 钱包充值接口异常:', err.message);
@@ -495,8 +507,6 @@ export async function rechargeBalance(userId = 1001, amount) {
} }
} }
/**
* 佣金提现申请 (支持微信零钱、支付宝、银行卡多渠道及账号信息)
/** /**
* 佣金提现申请 (支持多渠道: 微信 WECHAT / 支付宝 ALIPAY / 银行卡 BANK) * 佣金提现申请 (支持多渠道: 微信 WECHAT / 支付宝 ALIPAY / 银行卡 BANK)
* 支持 (userId, amount, options) 与 (amount, channel, userId) 两种调用签名 * 支持 (userId, amount, options) 与 (amount, channel, userId) 两种调用签名
@@ -517,10 +527,11 @@ export async function withdrawCommission(arg1, arg2, arg3 = {}) {
uid = Number(arg3) || 1001; uid = Number(arg3) || 1001;
} }
const safeId = normalizeUserId(uid);
const payload = typeof opt === 'string' const payload = typeof opt === 'string'
? { amount: amt, channel: opt } ? { amount: amt, channel: opt }
: { amount: amt, ...opt }; : { amount: amt, ...opt };
const res = await http.post(`/users/${uid}/withdraw`, payload); const res = await http.post(`/users/${safeId}/withdraw`, payload);
return res; return res;
} catch (err) { } catch (err) {
console.warn('[API] 提现申请接口异常:', err.message); console.warn('[API] 提现申请接口异常:', err.message);
@@ -532,8 +543,9 @@ export async function withdrawCommission(arg1, arg2, arg3 = {}) {
* 查询用户提现记录与审批状态 (待审核/处理中/已打款/已驳回) * 查询用户提现记录与审批状态 (待审核/处理中/已打款/已驳回)
*/ */
export async function getUserWithdrawals(userId = 1001) { export async function getUserWithdrawals(userId = 1001) {
const safeId = normalizeUserId(userId);
try { try {
const res = await http.get(`/users/${userId}/withdrawals`); const res = await http.get(`/users/${safeId}/withdrawals`);
return res || []; return res || [];
} catch (err) { } catch (err) {
console.warn('[API] 获取提现记录异常:', err.message); console.warn('[API] 获取提现记录异常:', err.message);
@@ -545,8 +557,9 @@ export async function getUserWithdrawals(userId = 1001) {
* 查询用户财务收支流水 * 查询用户财务收支流水
*/ */
export async function getUserFinanceRecords(userId = 1001) { export async function getUserFinanceRecords(userId = 1001) {
const safeId = normalizeUserId(userId);
try { try {
const res = await http.get(`/users/${userId}/finance-records`); const res = await http.get(`/users/${safeId}/finance-records`);
return res || []; return res || [];
} catch (err) { } catch (err) {
console.warn('[API] 获取财务流水异常:', err.message); console.warn('[API] 获取财务流水异常:', err.message);

查看文件

@@ -125,12 +125,12 @@ const DEMO_ACCOUNTS = [
avatar: 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=200' avatar: 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=200'
}, },
{ {
id: 101, id: 2006,
nickname: '糖心小糯米', nickname: '苏苏学姐',
roleTag: 'expert', roleTag: 'expert',
roleDesc: '金牌陪伴师', roleDesc: '金牌陪伴师',
desc: '工作台接单 · 雷达抢单 · 现场核销', desc: '工作台接单 · 雷达抢单 · 现场核销',
avatar: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=200' avatar: 'https://images.unsplash.com/photo-1524504388940-b1c1722653e1?w=200'
} }
]; ];

查看文件

@@ -315,6 +315,7 @@
</view> </view>
</scroll-view> </scroll-view>
<view class="empty-records-box" v-else> <view class="empty-records-box" v-else>
<image class="empty-icon-svg" :src="ICONS.fileText" mode="aspectFit" />
<text class="empty-txt">暂无提现申请记录</text> <text class="empty-txt">暂无提现申请记录</text>
</view> </view>
</view> </view>
@@ -580,12 +581,12 @@ const DEMO_ACCOUNTS = [
avatar: 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=200' avatar: 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=200'
}, },
{ {
id: 101, id: 2006,
nickname: '苏苏学姐', nickname: '苏苏学姐',
roleTag: 'expert', roleTag: 'expert',
roleDesc: '金牌陪伴师', roleDesc: '金牌陪伴师',
desc: '接单工作台 · 4位核销', desc: '接单工作台 · 4位核销',
avatar: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=200' avatar: 'https://images.unsplash.com/photo-1524504388940-b1c1722653e1?w=200'
} }
]; ];
@@ -721,7 +722,11 @@ const loadUserProfile = async (targetId) => {
} }
isLoggedIn.value = true; isLoggedIn.value = true;
const uid = targetId || uni.getStorageSync('userId') || 1001; let uid = targetId || uni.getStorageSync('userId') || 1001;
if (uid == 101) {
uid = 2006;
uni.setStorageSync('userId', 2006);
}
try { try {
const profile = await getUserProfile(uid); const profile = await getUserProfile(uid);
if (profile) { if (profile) {
@@ -1074,13 +1079,9 @@ const navToWithdraw = () => {
const openWithdrawRecordsModal = async () => { const openWithdrawRecordsModal = async () => {
if (!ensureLoggedIn()) return; if (!ensureLoggedIn()) return;
try { uni.navigateTo({
const list = await getUserWithdrawals(user.value.id || 1001); url: '/pages/user/withdraw-records'
userWithdrawalsList.value = Array.isArray(list) ? list : []; });
} catch (_) {
userWithdrawalsList.value = [];
}
showWithdrawRecordsModal.value = true;
}; };
// 手机号脱敏展示 // 手机号脱敏展示
@@ -2291,6 +2292,8 @@ const navTo = (url) => {
} }
} }
} }
}
.withdraw-modal-box { .withdraw-modal-box {
max-width: 640rpx; max-width: 640rpx;
@@ -2465,8 +2468,19 @@ const navTo = (url) => {
} }
.empty-records-box { .empty-records-box {
padding: 60rpx 0; padding: 60rpx 20rpx;
text-align: center; text-align: center;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.empty-icon-svg {
width: 64rpx;
height: 64rpx;
margin-bottom: 16rpx;
opacity: 0.45;
}
.empty-txt { .empty-txt {
font-size: 24rpx; font-size: 24rpx;
@@ -3007,6 +3021,32 @@ const navTo = (url) => {
} }
.withdraw-records-modal-box {
background: #FFFFFF;
border: 1px solid #FED7AA;
box-shadow: 0 16rpx 48rpx rgba(234, 88, 12, 0.08);
.modal-header .modal-title {
color: #1C1917;
}
.records-modal-scroll .wd-card-row {
background: #FAFAF9;
border-color: #E7E5E4;
.wd-row-center .wd-val { color: #1C1917; }
.wd-row-top .wd-no { color: #78716C; }
}
.empty-records-box {
.empty-icon-svg {
opacity: 0.6;
}
.empty-txt {
color: #78716C;
}
}
}
.dist-modal-box { .dist-modal-box {
.dist-summary-banner { .dist-summary-banner {
background: linear-gradient(135deg, #FFF7ED, #FFEDD5); background: linear-gradient(135deg, #FFF7ED, #FFEDD5);
@@ -3027,7 +3067,6 @@ const navTo = (url) => {
} }
} }
} }
}
</style> </style>

查看文件

@@ -9,11 +9,12 @@
<view class="nav-title-wrap"> <view class="nav-title-wrap">
<text class="nav-title">提现审批明细</text> <text class="nav-title">提现审批明细</text>
</view> </view>
<!-- 胶囊右侧对称避让占位 -->
<view class="nav-capsule-placeholder"></view> <view class="nav-capsule-placeholder"></view>
</view> </view>
</view> </view>
<!-- 主滚动区域 --> <!-- 主滚动区域 (准确避让顶部导航栏高度) -->
<scroll-view <scroll-view
scroll-y scroll-y
class="records-scroll-view" class="records-scroll-view"
@@ -21,14 +22,20 @@
:refresher-triggered="isRefreshing" :refresher-triggered="isRefreshing"
@refresherrefresh="onRefresh" @refresherrefresh="onRefresh"
> >
<!-- 1. 资产与提现统计流光总览卡片 --> <view class="records-content-body">
<!-- 1. 资产与提现统计总览卡片 -->
<view class="summary-stat-card"> <view class="summary-stat-card">
<view class="card-bg-glow"></view> <view class="card-bg-glow"></view>
<view class="summary-inner"> <view class="summary-inner">
<view class="summary-title-row"> <view class="summary-title-row">
<view class="title-left"> <view class="title-left">
<view class="wallet-icon-box">
<image class="wallet-icon-svg" :src="ICONS.wallet" mode="aspectFit" /> <image class="wallet-icon-svg" :src="ICONS.wallet" mode="aspectFit" />
</view>
<view class="title-text-wrap">
<text class="summary-card-title">提现资产总览</text> <text class="summary-card-title">提现资产总览</text>
<text class="summary-card-sub">官方结算 · 极速直达</text>
</view>
</view> </view>
<view class="btn-new-withdraw btn-active" @click="goToWithdraw"> <view class="btn-new-withdraw btn-active" @click="goToWithdraw">
<text class="btn-txt">去提现</text> <text class="btn-txt">去提现</text>
@@ -38,7 +45,7 @@
<view class="summary-numbers-grid"> <view class="summary-numbers-grid">
<view class="stat-col"> <view class="stat-col">
<text class="stat-num-val">¥{{ stats.totalSuccessAmount }}</text> <text class="stat-num-val green">¥{{ stats.totalSuccessAmount }}</text>
<text class="stat-num-label">累计成功到账</text> <text class="stat-num-label">累计成功到账</text>
</view> </view>
<view class="col-divider"></view> <view class="col-divider"></view>
@@ -48,7 +55,7 @@
</view> </view>
<view class="col-divider"></view> <view class="col-divider"></view>
<view class="stat-col"> <view class="stat-col">
<text class="stat-num-val purple">{{ allRecords.length }} 笔</text> <text class="stat-num-val count">{{ allRecords.length }} 笔</text>
<text class="stat-num-label">申请总记录</text> <text class="stat-num-label">申请总记录</text>
</view> </view>
</view> </view>
@@ -56,6 +63,7 @@
</view> </view>
<!-- 2. 状态分类筛选选项卡 (Tabs) --> <!-- 2. 状态分类筛选选项卡 (Tabs) -->
<view class="filter-tabs-card">
<view class="filter-tabs-row"> <view class="filter-tabs-row">
<view <view
v-for="tab in tabList" v-for="tab in tabList"
@@ -69,6 +77,7 @@
<view class="tab-indicator" v-if="currentTab === tab.key"></view> <view class="tab-indicator" v-if="currentTab === tab.key"></view>
</view> </view>
</view> </view>
</view>
<!-- 3. 加载骨架屏 --> <!-- 3. 加载骨架屏 -->
<view class="skeleton-wrap" v-if="isLoading"> <view class="skeleton-wrap" v-if="isLoading">
@@ -92,8 +101,7 @@
<view <view
class="status-pill" class="status-pill"
:class="{ :class="{
pending: item.status === '待审核', pending: item.status === '待审核' || item.status === '处理中',
processing: item.status === '处理中',
success: item.status === '已打款', success: item.status === '已打款',
rejected: item.status === '已驳回' rejected: item.status === '已驳回'
}" }"
@@ -136,7 +144,7 @@
<view class="reject-title-row"> <view class="reject-title-row">
<text class="reject-title">审核未通过说明:</text> <text class="reject-title">审核未通过说明:</text>
</view> </view>
<text class="reject-reason">{{ item.reason || '收款信息不完整或账户异常,请联系在线客服核验。' }}</text> <text class="reject-reason">{{ item.reason || '收款信息不完整或账户异常,请核对后重试。' }}</text>
<button class="btn-re-withdraw btn-active" @click="goToWithdraw">重新发起申请</button> <button class="btn-re-withdraw btn-active" @click="goToWithdraw">重新发起申请</button>
</view> </view>
</view> </view>
@@ -151,7 +159,9 @@
<!-- 5. 暂无数据空状态 --> <!-- 5. 暂无数据空状态 -->
<view class="empty-state-card" v-else> <view class="empty-state-card" v-else>
<image class="empty-icon-svg" :src="ICONS.orderList" mode="aspectFit" /> <view class="empty-icon-wrap">
<image class="empty-icon-svg" :src="ICONS.fileText" mode="aspectFit" />
</view>
<text class="empty-title">暂无相关的提现申请记录</text> <text class="empty-title">暂无相关的提现申请记录</text>
<text class="empty-sub">接单赚取的佣金收益满额后即可随时发起零钱提现</text> <text class="empty-sub">接单赚取的佣金收益满额后即可随时发起零钱提现</text>
<button class="btn-empty-withdraw btn-active" @click="goToWithdraw">立即去提现</button> <button class="btn-empty-withdraw btn-active" @click="goToWithdraw">立即去提现</button>
@@ -159,6 +169,7 @@
<!-- 底部安全垫高 --> <!-- 底部安全垫高 -->
<view class="bottom-spacer"></view> <view class="bottom-spacer"></view>
</view>
</scroll-view> </scroll-view>
</view> </view>
</template> </template>
@@ -183,13 +194,12 @@ const stats = ref({
pendingAmount: '0.00' pendingAmount: '0.00'
}); });
// 顶部导航栏安全距离避让与胶囊对称计算
const navStyle = computed(() => { const navStyle = computed(() => {
const info = navInfo.value;
return { return {
paddingTop: `${info.statusBarHeight}px`, '--safe-header-gap': `${navInfo.value.totalHeaderHeight}px`,
'--nav-bar-height': `${info.navBarHeight}px`, '--capsule-right-space': `${navInfo.value.capsuleRightSpace}px`,
'--status-bar-height': `${info.statusBarHeight}px`, '--capsule-height': `${navInfo.value.capsuleHeight}px`
'--header-height': `${info.headerHeight}px`
}; };
}); });
@@ -291,13 +301,16 @@ const onRefresh = async () => {
}; };
onMounted(() => { onMounted(() => {
currentThemeKey.value = getCurrentThemeKey();
applyThemeToNativeUI(); applyThemeToNativeUI();
navInfo.value = getNavBarInfo();
loadWithdrawals(); loadWithdrawals();
}); });
onShow(() => { onShow(() => {
currentThemeKey.value = getCurrentThemeKey(); currentThemeKey.value = getCurrentThemeKey();
applyThemeToNativeUI(); applyThemeToNativeUI();
navInfo.value = getNavBarInfo();
loadWithdrawals(); loadWithdrawals();
}); });
</script> </script>
@@ -318,13 +331,18 @@ onShow(() => {
left: 0; left: 0;
right: 0; right: 0;
z-index: 100; z-index: 100;
background: rgba(10, 15, 29, 0.95); height: var(--safe-header-gap);
backdrop-filter: blur(12px); background: rgba(10, 15, 29, 0.92);
border-bottom: 1px solid rgba(255, 255, 255, 0.06); backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
.nav-content { .nav-content {
height: var(--nav-bar-height); position: absolute;
margin-top: var(--status-bar-height); bottom: 0;
left: 0;
right: 0;
height: var(--capsule-height);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
@@ -333,46 +351,55 @@ onShow(() => {
.btn-nav-back { .btn-nav-back {
width: 64rpx; width: 64rpx;
height: 64rpx; height: 64rpx;
border-radius: 50%; border-radius: 32rpx;
background: rgba(255, 255, 255, 0.08); background: rgba(255, 255, 255, 0.08);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
.nav-back-icon { .nav-back-icon {
width: 36rpx; width: 38rpx;
height: 36rpx; height: 38rpx;
} }
} }
.nav-title-wrap { .nav-title-wrap {
position: absolute;
left: 50%;
transform: translateX(-50%);
text-align: center;
.nav-title { .nav-title {
font-size: 32rpx; font-size: 32rpx;
font-weight: 700; font-weight: 700;
color: #F8FAFC; color: #F8FAFC;
letter-spacing: 1rpx; letter-spacing: 0.5rpx;
} }
} }
.nav-capsule-placeholder { .nav-capsule-placeholder {
width: 64rpx; width: var(--capsule-right-space);
} }
} }
} }
/* 滚动主视图 */ /* 滚动主视图 (精准规避顶部导航栏高度) */
.records-scroll-view { .records-scroll-view {
flex: 1; flex: 1;
margin-top: var(--header-height); margin-top: var(--safe-header-gap);
box-sizing: border-box;
}
.records-content-body {
padding: 24rpx 28rpx 60rpx;
box-sizing: border-box; box-sizing: border-box;
padding: 24rpx;
} }
/* 1. 总览统计流光卡片 */ /* 1. 总览统计流光卡片 */
.summary-stat-card { .summary-stat-card {
position: relative; position: relative;
border-radius: 28rpx; border-radius: 28rpx;
padding: 32rpx 28rpx; padding: 30rpx 28rpx;
margin-bottom: 24rpx; margin-bottom: 24rpx;
background: linear-gradient(135deg, #1E1B4B 0%, #0F172A 100%); background: linear-gradient(135deg, #1E1B4B 0%, #0F172A 100%);
border: 1px solid rgba(99, 102, 241, 0.25); border: 1px solid rgba(99, 102, 241, 0.25);
@@ -399,22 +426,44 @@ onShow(() => {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-bottom: 24rpx; margin-bottom: 28rpx;
.title-left { .title-left {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 12rpx; gap: 16rpx;
.wallet-icon-box {
width: 60rpx;
height: 60rpx;
border-radius: 16rpx;
background: rgba(99, 102, 241, 0.2);
display: flex;
align-items: center;
justify-content: center;
.wallet-icon-svg { .wallet-icon-svg {
width: 36rpx; width: 34rpx;
height: 36rpx; height: 34rpx;
}
} }
.title-text-wrap {
display: flex;
flex-direction: column;
gap: 4rpx;
.summary-card-title { .summary-card-title {
font-size: 26rpx; font-size: 30rpx;
color: #CBD5E1; font-weight: 700;
font-weight: 600; color: #F8FAFC;
letter-spacing: 0.5rpx;
}
.summary-card-sub {
font-size: 20rpx;
color: #818CF8;
}
} }
} }
@@ -422,20 +471,21 @@ onShow(() => {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 6rpx; gap: 6rpx;
background: rgba(99, 102, 241, 0.2); background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.25));
border: 1px solid rgba(99, 102, 241, 0.4); border: 1px solid rgba(99, 102, 241, 0.4);
padding: 6rpx 18rpx; padding: 10rpx 20rpx;
border-radius: 24rpx; border-radius: 26rpx;
.btn-txt { .btn-txt {
font-size: 22rpx; font-size: 22rpx;
color: #A5B4FC;
font-weight: 600; font-weight: 600;
color: #A5B4FC;
} }
.btn-arrow { .btn-arrow {
width: 20rpx; width: 22rpx;
height: 20rpx; height: 22rpx;
opacity: 0.8;
} }
} }
} }
@@ -443,26 +493,29 @@ onShow(() => {
.summary-numbers-grid { .summary-numbers-grid {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-around; justify-content: space-between;
background: rgba(15, 23, 42, 0.6); background: rgba(15, 23, 42, 0.7);
border: 1px solid rgba(255, 255, 255, 0.06);
border-radius: 20rpx; border-radius: 20rpx;
padding: 20rpx 12rpx; padding: 24rpx 16rpx;
border: 1px solid rgba(255, 255, 255, 0.05);
.stat-col { .stat-col {
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
gap: 6rpx; gap: 8rpx;
.stat-num-val { .stat-num-val {
font-size: 32rpx; font-size: 32rpx;
font-weight: 800; font-weight: 800;
color: #F8FAFC; color: #F8FAFC;
font-family: -apple-system, BlinkMacSystemFont, 'DIN Alternate', Roboto, sans-serif;
font-variant-numeric: tabular-nums;
&.gold { color: #FBBF24; } &.green { color: #10B981; }
&.purple { color: #818CF8; } &.gold { color: #F59E0B; }
&.count { color: #818CF8; }
} }
.stat-num-label { .stat-num-label {
@@ -473,51 +526,53 @@ onShow(() => {
.col-divider { .col-divider {
width: 1px; width: 1px;
height: 48rpx; height: 44rpx;
background: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.08);
} }
} }
} }
/* 2. 状态切换选项卡 */ /* 2. 状态分类筛选选项卡 */
.filter-tabs-card {
background: #0F172A;
border: 1px solid rgba(255, 255, 255, 0.07);
border-radius: 22rpx;
padding: 10rpx;
margin-bottom: 24rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.2);
.filter-tabs-row { .filter-tabs-row {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between;
background: #151D30;
border-radius: 20rpx;
padding: 8rpx;
margin-bottom: 24rpx;
border: 1px solid rgba(255, 255, 255, 0.06);
.tab-item { .tab-item {
flex: 1; flex: 1;
position: relative; position: relative;
text-align: center;
padding: 16rpx 0;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: 8rpx; gap: 8rpx;
border-radius: 14rpx; height: 72rpx;
border-radius: 16rpx;
transition: all 0.2s ease; transition: all 0.2s ease;
.tab-label { .tab-label {
font-size: 24rpx; font-size: 26rpx;
color: #94A3B8;
font-weight: 500; font-weight: 500;
color: #94A3B8;
} }
.tab-badge { .tab-badge {
font-size: 18rpx; font-size: 18rpx;
color: #CBD5E1; color: #94A3B8;
background: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.08);
padding: 2rpx 10rpx; padding: 2rpx 8rpx;
border-radius: 12rpx; border-radius: 12rpx;
line-height: 1.2;
} }
&.active { &.active {
background: rgba(99, 102, 241, 0.2); background: rgba(99, 102, 241, 0.15);
.tab-label { .tab-label {
color: #818CF8; color: #818CF8;
@@ -527,21 +582,21 @@ onShow(() => {
.tab-badge { .tab-badge {
background: #6366F1; background: #6366F1;
color: #FFFFFF; color: #FFFFFF;
font-weight: 700;
} }
.tab-indicator { .tab-indicator {
position: absolute; position: absolute;
bottom: 2rpx; bottom: 6rpx;
left: 50%;
transform: translateX(-50%);
width: 32rpx; width: 32rpx;
height: 4rpx; height: 4rpx;
background: #6366F1; background: #818CF8;
border-radius: 2rpx; border-radius: 2rpx;
} }
} }
} }
} }
}
/* 3. 骨架屏 */ /* 3. 骨架屏 */
.skeleton-wrap { .skeleton-wrap {
@@ -551,38 +606,38 @@ onShow(() => {
.skeleton-card { .skeleton-card {
height: 220rpx; height: 220rpx;
background: #151D30;
border-radius: 24rpx; border-radius: 24rpx;
animation: pulse 1.5s infinite; background: linear-gradient(90deg, #1E293B 25%, #334155 37%, #1E293B 63%);
background-size: 400% 100%;
animation: skeleton-loading 1.4s ease infinite;
} }
} }
@keyframes pulse { @keyframes skeleton-loading {
0% { opacity: 0.6; } 0% { background-position: 100% 50%; }
50% { opacity: 0.3; } 100% { background-position: 0 50%; }
100% { opacity: 0.6; }
} }
/* 4. 记录列表卡片 */ /* 4. 记录列表 */
.records-list-wrap { .records-list-wrap {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 20rpx; gap: 20rpx;
.record-card { .record-card {
background: #151D30; background: #0F172A;
border: 1px solid rgba(255, 255, 255, 0.07);
border-radius: 24rpx; border-radius: 24rpx;
padding: 24rpx; padding: 26rpx;
border: 1px solid rgba(255, 255, 255, 0.06); box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.25);
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.2);
.card-head-row { .card-head-row {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-bottom: 16rpx; padding-bottom: 20rpx;
padding-bottom: 14rpx; border-bottom: 1px solid rgba(255, 255, 255, 0.05);
border-bottom: 1px dashed rgba(255, 255, 255, 0.08); margin-bottom: 20rpx;
.order-no-wrap { .order-no-wrap {
display: flex; display: flex;
@@ -596,14 +651,14 @@ onShow(() => {
.order-no-val { .order-no-val {
font-size: 22rpx; font-size: 22rpx;
color: #F8FAFC;
font-family: monospace; font-family: monospace;
color: #CBD5E1;
} }
.copy-tag { .copy-tag {
font-size: 18rpx; font-size: 18rpx;
color: #6366F1; color: #818CF8;
background: rgba(99, 102, 241, 0.12); background: rgba(99, 102, 241, 0.15);
padding: 2rpx 8rpx; padding: 2rpx 8rpx;
border-radius: 6rpx; border-radius: 6rpx;
margin-left: 6rpx; margin-left: 6rpx;
@@ -625,22 +680,36 @@ onShow(() => {
border-radius: 50%; border-radius: 50%;
} }
&.pending, &.processing { &.pending {
color: #FBBF24; background: rgba(245, 158, 11, 0.12);
background: rgba(251, 191, 36, 0.12); color: #F59E0B;
.status-dot { background: #FBBF24; } border: 1px solid rgba(245, 158, 11, 0.3);
.status-dot {
background: #F59E0B;
box-shadow: 0 0 8rpx #F59E0B;
}
} }
&.success { &.success {
color: #34D399; background: rgba(16, 185, 129, 0.12);
background: rgba(52, 211, 153, 0.12); color: #10B981;
.status-dot { background: #34D399; } border: 1px solid rgba(16, 185, 129, 0.3);
.status-dot {
background: #10B981;
box-shadow: 0 0 8rpx #10B981;
}
} }
&.rejected { &.rejected {
color: #F87171; background: rgba(239, 68, 68, 0.12);
background: rgba(248, 113, 113, 0.12); color: #EF4444;
.status-dot { background: #F87171; } border: 1px solid rgba(239, 68, 68, 0.3);
.status-dot {
background: #EF4444;
}
} }
} }
} }
@@ -649,7 +718,7 @@ onShow(() => {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-bottom: 16rpx; margin-bottom: 20rpx;
.amount-col { .amount-col {
display: flex; display: flex;
@@ -657,64 +726,72 @@ onShow(() => {
gap: 4rpx; gap: 4rpx;
.amount-symbol { .amount-symbol {
font-size: 28rpx; font-size: 32rpx;
font-weight: 700; font-weight: 700;
color: #F8FAFC; color: #10B981;
} }
.amount-number { .amount-number {
font-size: 44rpx; font-size: 48rpx;
font-weight: 800; font-weight: 800;
color: #F8FAFC; color: #F8FAFC;
letter-spacing: 0.5rpx; font-family: -apple-system, BlinkMacSystemFont, 'DIN Alternate', Roboto, sans-serif;
font-variant-numeric: tabular-nums;
} }
} }
.channel-pill { .channel-pill {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 8rpx; gap: 10rpx;
background: rgba(16, 185, 129, 0.1); background: rgba(16, 185, 129, 0.1);
border: 1px solid rgba(16, 185, 129, 0.25); border: 1px solid rgba(16, 185, 129, 0.25);
padding: 6rpx 16rpx; border-radius: 20rpx;
border-radius: 18rpx; padding: 8rpx 18rpx;
.channel-icon { .channel-icon {
width: 26rpx; width: 32rpx;
height: 26rpx; height: 32rpx;
} }
.channel-name { .channel-name {
font-size: 22rpx; font-size: 22rpx;
color: #34D399;
font-weight: 600; font-weight: 600;
color: #34D399;
} }
} }
} }
.card-timeline-box { .card-timeline-box {
background: rgba(0, 0, 0, 0.2); background: rgba(255, 255, 255, 0.02);
border-radius: 14rpx; border: 1px solid rgba(255, 255, 255, 0.05);
padding: 12rpx 16rpx; border-radius: 16rpx;
padding: 16rpx 20rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 8rpx; gap: 10rpx;
.timeline-row { .timeline-row {
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 20rpx; justify-content: space-between;
font-size: 22rpx;
.timeline-label { .timeline-label {
color: #64748B; color: #64748B;
width: 140rpx;
} }
.timeline-val { .timeline-val {
color: #94A3B8; color: #94A3B8;
&.success { color: #34D399; font-weight: 600; } &.success {
&.notice { color: #FBBF24; font-weight: 500; } color: #10B981;
font-weight: 600;
}
&.notice {
color: #F59E0B;
}
} }
} }
} }
@@ -722,38 +799,37 @@ onShow(() => {
.card-rejected-box { .card-rejected-box {
margin-top: 16rpx; margin-top: 16rpx;
background: rgba(239, 68, 68, 0.08); background: rgba(239, 68, 68, 0.08);
border: 1px solid rgba(239, 68, 68, 0.25); border: 1px dashed rgba(239, 68, 68, 0.3);
border-radius: 14rpx; border-radius: 16rpx;
padding: 14rpx 16rpx; padding: 16rpx 20rpx;
.reject-title-row { .reject-title-row {
margin-bottom: 6rpx; margin-bottom: 6rpx;
.reject-title { .reject-title {
font-size: 20rpx; font-size: 22rpx;
font-weight: 700; font-weight: 600;
color: #EF4444; color: #EF4444;
} }
} }
.reject-reason { .reject-reason {
font-size: 20rpx; font-size: 22rpx;
color: #F87171; color: #FCA5A5;
line-height: 1.5; line-height: 1.4;
display: block; display: block;
margin-bottom: 12rpx; margin-bottom: 14rpx;
} }
.btn-re-withdraw { .btn-re-withdraw {
height: 48rpx; height: 52rpx;
line-height: 46rpx; line-height: 50rpx;
font-size: 20rpx; font-size: 22rpx;
font-weight: 600; font-weight: 600;
color: #EF4444; color: #EF4444;
background: rgba(239, 68, 68, 0.12); background: rgba(239, 68, 68, 0.15);
border: 1px solid rgba(239, 68, 68, 0.4); border: 1px solid rgba(239, 68, 68, 0.4);
border-radius: 24rpx; border-radius: 26rpx;
padding: 0 20rpx;
display: inline-block;
margin: 0; margin: 0;
} }
} }
@@ -764,7 +840,7 @@ onShow(() => {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: 16rpx; gap: 16rpx;
padding: 30rpx 0; padding: 30rpx 0 10rpx;
.tip-line { .tip-line {
width: 60rpx; width: 60rpx;
@@ -779,69 +855,77 @@ onShow(() => {
} }
} }
/* 5. 空状态区 */ /* 5. 空状态展示 */
.empty-state-card { .empty-state-card {
padding: 100rpx 40rpx; padding: 80rpx 40rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
text-align: center; text-align: center;
.empty-icon-wrap {
width: 140rpx;
height: 140rpx;
border-radius: 70rpx;
background: rgba(99, 102, 241, 0.1);
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 30rpx;
.empty-icon-svg { .empty-icon-svg {
width: 100rpx; width: 72rpx;
height: 100rpx; height: 72rpx;
margin-bottom: 24rpx; opacity: 0.8;
opacity: 0.35; }
} }
.empty-title { .empty-title {
font-size: 28rpx; font-size: 30rpx;
font-weight: 700; font-weight: 700;
color: #94A3B8; color: #F8FAFC;
margin-bottom: 12rpx; margin-bottom: 12rpx;
} }
.empty-sub { .empty-sub {
font-size: 22rpx; font-size: 24rpx;
color: #64748B; color: #64748B;
line-height: 1.5; line-height: 1.5;
margin-bottom: 36rpx; margin-bottom: 40rpx;
max-width: 520rpx;
} }
.btn-empty-withdraw { .btn-empty-withdraw {
height: 72rpx; height: 84rpx;
line-height: 70rpx; line-height: 84rpx;
font-size: 26rpx; padding: 0 60rpx;
font-size: 28rpx;
font-weight: 700; font-weight: 700;
color: #FFFFFF; color: #FFFFFF;
background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%); background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
box-shadow: 0 8rpx 24rpx rgba(99, 102, 241, 0.35); border-radius: 42rpx;
border-radius: 36rpx; box-shadow: 0 8rpx 28rpx rgba(99, 102, 241, 0.4);
padding: 0 48rpx;
margin: 0; margin: 0;
} }
} }
.bottom-spacer { .bottom-spacer {
height: 60rpx; height: 40rpx;
}
} }
/* ========================================================================== /* 暖阳浅色模式适配 (theme-warm) */
浅色暖阳晨曦模式专属高对比度适配 (theme-warm) &.theme-warm {
========================================================================== */ background-color: #FFFDF9;
.theme-warm {
background-color: #F7F5F0;
color: #1C1917; color: #1C1917;
.custom-nav-bar { .custom-nav-bar {
background: rgba(247, 245, 240, 0.95); background: rgba(255, 253, 249, 0.95);
border-bottom-color: #E7E2D8; border-bottom-color: rgba(234, 88, 12, 0.1);
.nav-content { .nav-content {
.btn-nav-back { .btn-nav-back {
background: #FFFFFF; background: #FFF7ED;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05); border: 1px solid #FED7AA;
} }
.nav-title-wrap .nav-title { .nav-title-wrap .nav-title {
@@ -856,13 +940,26 @@ onShow(() => {
box-shadow: 0 8rpx 28rpx rgba(234, 88, 12, 0.08); box-shadow: 0 8rpx 28rpx rgba(234, 88, 12, 0.08);
.summary-title-row { .summary-title-row {
.title-left .summary-card-title { .title-left {
.wallet-icon-box {
background: #FFEDD5;
}
.title-text-wrap {
.summary-card-title {
color: #9A3412; color: #9A3412;
} }
.summary-card-sub {
color: #EA580C;
}
}
}
.btn-new-withdraw { .btn-new-withdraw {
background: rgba(234, 88, 12, 0.12); background: #FFFFFF;
border-color: rgba(234, 88, 12, 0.35); border-color: #FED7AA;
box-shadow: 0 2rpx 8rpx rgba(234, 88, 12, 0.1);
.btn-txt { .btn-txt {
color: #EA580C; color: #EA580C;
@@ -873,13 +970,13 @@ onShow(() => {
.summary-numbers-grid { .summary-numbers-grid {
background: #FFFFFF; background: #FFFFFF;
border-color: #FED7AA; border-color: #FED7AA;
box-shadow: 0 2rpx 10rpx rgba(234, 88, 12, 0.04);
.stat-col { .stat-col {
.stat-num-val { .stat-num-val {
color: #1C1917; &.green { color: #059669; }
&.gold { color: #D97706; } &.gold { color: #D97706; }
&.purple { color: #EA580C; } &.count { color: #EA580C; }
} }
.stat-num-label { .stat-num-label {
@@ -893,12 +990,12 @@ onShow(() => {
} }
} }
.filter-tabs-row { .filter-tabs-card {
background: #FFFFFF; background: #FFFFFF;
border-color: #EAE5DC; border-color: #FED7AA;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.03); box-shadow: 0 4rpx 16rpx rgba(234, 88, 12, 0.04);
.tab-item { .filter-tabs-row .tab-item {
.tab-label { .tab-label {
color: #78716C; color: #78716C;
} }
@@ -930,8 +1027,8 @@ onShow(() => {
.records-list-wrap { .records-list-wrap {
.record-card { .record-card {
background: #FFFFFF; background: #FFFFFF;
border-color: #EAE5DC; border-color: #FED7AA;
box-shadow: 0 4rpx 20rpx rgba(28, 25, 23, 0.04); box-shadow: 0 4rpx 20rpx rgba(234, 88, 12, 0.05);
.card-head-row { .card-head-row {
border-bottom-color: #F5F0E8; border-bottom-color: #F5F0E8;
@@ -948,9 +1045,8 @@ onShow(() => {
.card-main-row { .card-main-row {
.amount-col { .amount-col {
.amount-symbol, .amount-number { .amount-symbol { color: #059669; }
color: #1C1917; .amount-number { color: #1C1917; }
}
} }
.channel-pill { .channel-pill {
@@ -965,12 +1061,13 @@ onShow(() => {
.card-timeline-box { .card-timeline-box {
background: #FAFAF9; background: #FAFAF9;
border: 1px solid #F5F5F4; border-color: #F5F5F4;
.timeline-row { .timeline-row {
.timeline-label { color: #78716C; } .timeline-label { color: #78716C; }
.timeline-val { .timeline-val {
color: #44403C; color: #44403C;
&.success { color: #059669; } &.success { color: #059669; }
&.notice { color: #D97706; } &.notice { color: #D97706; }
} }
@@ -998,12 +1095,27 @@ onShow(() => {
} }
.empty-state-card { .empty-state-card {
.empty-title { color: #44403C; } .empty-icon-wrap {
background: #FFF7ED;
border: 1px solid #FED7AA;
}
.empty-title { color: #1C1917; }
.empty-sub { color: #78716C; } .empty-sub { color: #78716C; }
.btn-empty-withdraw { .btn-empty-withdraw {
background: linear-gradient(135deg, #F97316 0%, #EA580C 100%); background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
box-shadow: 0 8rpx 24rpx rgba(234, 88, 12, 0.35); box-shadow: 0 8rpx 24rpx rgba(234, 88, 12, 0.3);
} }
} }
} }
}
.btn-active {
transition: opacity 0.15s ease, transform 0.15s ease;
&:active {
opacity: 0.8;
transform: scale(0.98);
}
}
</style> </style>

查看文件

@@ -427,6 +427,14 @@ export async function initDatabase(): Promise<void> {
try { try {
await conn.query("ALTER TABLE users ADD COLUMN signature VARCHAR(64) DEFAULT ''"); await conn.query("ALTER TABLE users ADD COLUMN signature VARCHAR(64) DEFAULT ''");
} catch (_) {} } catch (_) {}
// 确保存在 demo 账号 101 (金牌陪伴师/认证大神体验账号)
try {
await conn.query(`
INSERT INTO users (id, user_no, nickname, avatar, phone, gender, role, balance, commission, invited_count, order_count, activity_count, status, wechat_openid, signature)
VALUES (101, 'U101', '糖心小糯米', 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=200', '138****0101', '女', '认证大神', 2580.00, 128.50, 6, 88, 16, '正常', 'wx_openid_101', '人美声甜,擅长各类同城陪伴与开黑互动')
ON DUPLICATE KEY UPDATE nickname = VALUES(nickname)
`);
} catch (_) {}
// 21. 用户举报工单表 (涉黄/涉赌/线下欺诈等不良陪玩举报) // 21. 用户举报工单表 (涉黄/涉赌/线下欺诈等不良陪玩举报)
await conn.query(` await conn.query(`

查看文件

@@ -1979,9 +1979,29 @@ export class MysqlRepository {
role, balance, commission, invited_count as invitedCount, role, balance, commission, invited_count as invitedCount,
order_count as orderCount, activity_count as activityCount, order_count as orderCount, activity_count as activityCount,
status, wechat_openid as wechatOpenid, created_at as createdAt status, wechat_openid as wechatOpenid, created_at as createdAt
FROM users WHERE id = ?
`, [id]); `, [id]);
if (!rows || rows.length === 0) return null; if (!rows || rows.length === 0) {
if (id === 101) {
return {
id: 101,
userNo: 'U101',
nickname: '糖心小糯米',
avatar: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=200',
phone: '138****0101',
gender: '女',
signature: '人美声甜,擅长各类同城陪伴与开黑互动',
role: '认证大神',
balance: '2580.00',
commission: '128.50',
invitedCount: 6,
orderCount: 88,
activityCount: 16,
isExpert: true,
status: '正常'
};
}
return null;
}
const u = rows[0]; const u = rows[0];
return { return {
id: u.id, id: u.id,

查看文件

@@ -1564,10 +1564,30 @@ app.get('/api/users/:id/detail', async (req: Request, res: Response) => {
app.get('/api/users/:id', async (req: Request, res: Response) => { app.get('/api/users/:id', async (req: Request, res: Response) => {
try { try {
const userId = Number(req.params.id); const userId = Number(req.params.id);
const user = await repo.getUserById(userId); let user = await repo.getUserById(userId);
if (!user) { if (!user) {
if (userId === 101) {
user = {
id: 101,
userNo: 'U101',
nickname: '糖心小糯米',
avatar: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=200',
phone: '138****0101',
gender: '女',
signature: '人美声甜,擅长各类同城陪伴与开黑互动',
role: '认证大神',
balance: '2580.00',
commission: '128.50',
invitedCount: 6,
orderCount: 88,
activityCount: 16,
isExpert: true,
status: '正常'
};
} else {
return res.status(404).json({ code: 40400, message: '用户未找到' }); return res.status(404).json({ code: 40400, message: '用户未找到' });
} }
}
res.json({ code: 20000, data: user }); res.json({ code: 20000, data: user });
} catch (err: any) { } catch (err: any) {
res.status(500).json({ code: 50000, message: err.message }); res.status(500).json({ code: 50000, message: err.message });