Files
consumer-front/src/pages/index/index.vue
T

712 lines
25 KiB
Vue
Raw Normal View History

2026-04-29 11:51:57 +08:00
<template>
<view class="app-container">
2026-04-29 16:51:52 +08:00
<!-- ========== 首页内容 ========== -->
<view v-if="currentTab === 'home'" class="page-content home-page">
2026-04-30 15:07:56 +08:00
<scroll-view
class="product-area"
2026-04-29 16:51:52 +08:00
scroll-y
>
2026-04-30 15:07:56 +08:00
<!-- 热销商品标题 + 装饰 -->
<view class="section-title-wrap">
<view class="section-title">热销商品</view>
<view class="title-decoration">
<view class="deco-dot"></view>
<view class="deco-line"></view>
</view>
</view>
<!-- 分类 Tab 横向滚动 -->
<scroll-view class="category-tabs" scroll-x>
<view class="tabs-inner">
<view class="tab-item" :class="{ active: activeCategory === 'all' }" @click="switchCategory('all')">
<text class="tab-text">全部商品</text>
<view class="tab-underline"></view>
</view>
<view
v-for="(cat, idx) in categoryList"
:key="idx"
class="tab-item"
:class="{ active: activeCategory === cat.category }"
@click="switchCategory(cat.category)"
>
<text class="tab-text">{{ cat.category }}</text>
<view class="tab-underline"></view>
</view>
</view>
</scroll-view>
2026-04-29 16:51:52 +08:00
2026-04-30 15:07:56 +08:00
<!-- 商品网格 -->
<view class="product-grid">
2026-04-29 16:51:52 +08:00
<view
2026-04-30 15:07:56 +08:00
v-for="(item, idx) in displayProducts"
:key="idx"
2026-04-29 16:51:52 +08:00
class="product-card"
>
<image class="product-img" :src="item.image" mode="aspectFill" />
<view class="product-name">{{ item.name }}</view>
2026-04-30 15:07:56 +08:00
<view class="product-price">
<text class="price-yen">¥</text>
<text class="price-num">{{ getDisplayPrice(item) }}</text>
</view>
2026-04-29 16:51:52 +08:00
</view>
</view>
2026-04-30 15:07:56 +08:00
<!-- 无商品时 -->
<view v-if="categoryList.length === 0 && !loading" class="empty-tip">
<text>暂无商品</text>
</view>
<!-- loading -->
<view v-if="loading" class="loading-tip">
<text>加载中...</text>
</view>
<!-- 底部占位 -->
2026-04-29 16:51:52 +08:00
<view class="bottom-spacer"></view>
</scroll-view>
2026-04-29 11:51:57 +08:00
2026-04-29 16:51:52 +08:00
<!-- 底部导航栏 -->
<view class="tab-bar">
2026-06-30 12:07:21 +08:00
<view class="tab-bar-row">
<view class="tab-item" :class="{ active: currentTab === 'home' }" @click="switchTab('home')">
<view class="home-icon">
<view class="home-roof"></view>
<view class="home-body"></view>
</view>
<text class="tab-text">首页</text>
2026-06-15 09:46:17 +08:00
</view>
2026-04-29 16:51:52 +08:00
2026-06-30 12:07:21 +08:00
<view class="door-btn-wrapper" @click="handleOpenDoor">
<view class="door-btn">开门</view>
</view>
2026-04-29 11:51:57 +08:00
2026-06-30 12:07:21 +08:00
<view class="tab-item" :class="{ active: currentTab === 'mine' }" @click="switchTab('mine')">
<view class="mine-icon">
<view class="mine-head"></view>
<view class="mine-body"></view>
</view>
<text class="tab-text">我的</text>
2026-06-15 09:46:17 +08:00
</view>
2026-06-30 12:07:21 +08:00
</view>
<!-- 支付分信息仅微信环境显示 -->
<view v-if="isWechat" class="payscore-info">
<image class="payscore-logo" src="/static/payscore-logo.png" mode="aspectFit" />
<view class="payscore-divider"></view>
<text class="payscore-text">微信支付分 | 550分及以上优享</text>
2026-04-29 16:51:52 +08:00
</view>
2026-04-29 11:51:57 +08:00
</view>
2026-04-29 16:51:52 +08:00
</view>
2026-04-29 11:51:57 +08:00
2026-04-29 16:51:52 +08:00
<!-- ========== 我的内容 ========== -->
<view v-if="currentTab === 'mine'" class="page-content mine-page">
<!-- 蓝色个人信息区域 -->
<view class="user-header">
<view class="user-info">
2026-07-10 15:25:36 +08:00
<view class="avatar-wrapper" @click="handleAvatarClick">
2026-04-29 16:51:52 +08:00
<image class="avatar" :src="userInfo.avatar || '/static/default-avatar.png'" mode="aspectFill" />
</view>
<view class="user-detail">
<text class="nickname">{{ userInfo.nickname || '未登录' }}</text>
<text class="phone">{{ maskedPhone }}</text>
</view>
</view>
2026-04-29 11:51:57 +08:00
</view>
<!-- 菜单列表 -->
2026-04-29 16:51:52 +08:00
<view class="content-area">
<view class="menu-list">
<view class="menu-item" v-for="(item, index) in menuList" :key="index" @click="handleMenuClick(item)">
<text class="menu-text">{{ item.title }}</text>
<text class="menu-arrow">></text>
</view>
</view>
2026-06-16 14:42:36 +08:00
2026-07-10 15:25:36 +08:00
<!-- 退出登录 -->
<view class="menu-list logout-btn" @click="handleLogout">
<view class="menu-item">
<text class="menu-text" style="color: #e4393c; text-align: center; width: 100%;">退出登录</text>
</view>
</view>
2026-06-16 14:42:36 +08:00
<!-- 开发调试工具仅开发环境显示 -->
<view v-if="isDev" class="dev-tools">
<view class="dev-tools-title">开发工具</view>
<view class="menu-item">
<text class="menu-text">vConsole 调试</text>
<switch :checked="vconsoleEnabled" color="#2979ff" @change="onVConsoleChange" />
</view>
</view>
2026-04-29 11:51:57 +08:00
</view>
2026-04-29 16:51:52 +08:00
<!-- 底部左右箭头导航条 -->
<page-nav-bar
2026-07-10 16:20:00 +08:00
:hasPrev="canGoBack"
2026-04-29 16:51:52 +08:00
:hasNext="false"
@prev="handleNavPrev"
@next="handleNavNext"
/>
<!-- 公众号二维码弹窗 -->
<view v-if="showQrcodePopup" class="qrcode-popup-mask" @click="showQrcodePopup = false">
<view class="qrcode-popup-content" @click.stop>
<view class="qrcode-popup-title">关注公众号</view>
<image class="qrcode-img" src="/static/qrcode.png" mode="aspectFit" />
<view class="qrcode-popup-tip">扫码关注获取更多优惠信息</view>
<view class="qrcode-popup-close" @click="showQrcodePopup = false">关闭</view>
</view>
</view>
2026-04-29 11:51:57 +08:00
</view>
<!-- 开门流程组件 -->
<door-panel ref="doorPanel" :device-id="deviceId" :user-id="userId" />
2026-04-29 11:51:57 +08:00
</view>
</template>
<script>
2026-04-29 16:51:52 +08:00
import PageNavBar from '@/components/page-nav-bar/page-nav-bar.vue';
import DoorPanel from '@/components/door-panel/door-panel.vue';
2026-06-15 09:46:17 +08:00
import config from '@/config/env.js';
import { get, gatewayGet } from '@/utils/request.js';
2026-07-11 10:28:43 +08:00
import { checkLoginWithPrompt, getCachedUserInfo, isLoggedIn } from '@/utils/auth-guard.js';
2026-06-16 14:42:36 +08:00
import { isVConsoleEnabled, showVConsole, hideVConsole } from '@/utils/vconsole';
2026-04-30 15:07:56 +08:00
2026-04-29 11:51:57 +08:00
export default {
components: { PageNavBar, DoorPanel },
2026-04-29 11:51:57 +08:00
data() {
return {
2026-06-15 09:46:17 +08:00
deviceId: '',
2026-04-29 11:51:57 +08:00
currentTab: 'home',
showQrcodePopup: false,
2026-04-30 15:07:56 +08:00
loading: false,
categoryList: [],
activeCategory: 'all',
2026-07-11 20:29:00 +08:00
userInfo: { user_id: '', nickname: '', phone: '', avatar: '' },
2026-07-10 15:25:36 +08:00
avatarClickCount: 0,
avatarClickTimer: null,
2026-07-10 16:20:00 +08:00
fromPage: '', // 记录从哪个页面跳转过来的
2026-04-29 16:51:52 +08:00
menuList: [
{ title: '我的订单', action: 'order' },
{ title: '常见问题', action: 'faq' },
{ title: '联系客服', action: 'call' },
{ title: '公众号信息', action: 'qrcode' }
],
2026-06-16 14:42:36 +08:00
servicePhone: config.servicePhone,
2026-06-30 12:07:21 +08:00
isWechat: false,
2026-06-16 14:42:36 +08:00
isDev: process.env.NODE_ENV === 'development',
vconsoleEnabled: false
2026-04-29 11:51:57 +08:00
};
},
2026-04-29 16:51:52 +08:00
computed: {
userId() {
2026-07-11 20:29:00 +08:00
return this.userInfo.user_id || '';
},
2026-07-10 16:20:00 +08:00
canGoBack() {
// 有上一页,或者从 tab 切换过来的,都可以返回
return getCurrentPages().length > 1 || this.fromPage === 'tab';
},
2026-04-29 16:51:52 +08:00
maskedPhone() {
const p = this.userInfo.phone;
return p ? p.substring(0,3) + '****' + p.substring(7) : '';
2026-04-30 15:07:56 +08:00
},
// 全部商品:合并所有分类下的商品
allProducts() {
let all = [];
this.categoryList.forEach(cat => {
if (cat.products) all = all.concat(cat.products);
});
return all;
},
// 当前显示的商品列表(根据选中的分类 tab)
displayProducts() {
if (this.activeCategory === 'all') return this.allProducts;
const cat = this.categoryList.find(c => c.category === this.activeCategory);
return cat ? cat.products || [] : [];
2026-04-29 16:51:52 +08:00
}
},
2026-06-15 09:46:17 +08:00
onLoad(options) {
2026-06-30 12:07:21 +08:00
// 检测是否在微信环境中打开
// #ifdef MP-WEIXIN
this.isWechat = true;
// #endif
// #ifdef H5
this.isWechat = /MicroMessenger/i.test(navigator.userAgent);
// #endif
2026-07-11 10:28:43 +08:00
// 处理"我的"用户信息授权回调(从 loading 页跳回)
if (options.action === 'mine') {
this.currentTab = 'mine';
this.fromPage = 'navigate';
}
2026-06-15 09:46:17 +08:00
// 支持通过 tab 参数切换到"我的"页面
if (options.tab === 'mine') {
this.currentTab = 'mine';
2026-07-10 16:20:00 +08:00
this.fromPage = 'navigate';
2026-06-15 09:46:17 +08:00
}
if (options.device_id) {
this.deviceId = options.device_id;
uni.setNavigationBarTitle({ title: `智能货柜-${this.deviceId}` });
2026-06-15 09:46:17 +08:00
this.fetchProducts();
2026-07-11 10:28:43 +08:00
} else if (!options.tab && options.action !== 'mine') {
// 无设备编号且非 tab/action 跳转,提示并跳至扫码页
2026-07-10 16:20:00 +08:00
uni.showToast({ title: '请扫描设备二维码', icon: 'none' });
setTimeout(() => {
uni.redirectTo({ url: '/pages/index/scan' });
}, 1500);
return;
2026-06-15 09:46:17 +08:00
}
2026-06-16 14:42:36 +08:00
// 加载缓存的用户信息
this.loadUserInfo();
2026-06-16 14:42:36 +08:00
// 初始化 vConsole 状态
this.vconsoleEnabled = isVConsoleEnabled();
},
onShow() {
// 每次显示页面时刷新用户信息(授权回调后可能已更新)
this.loadUserInfo();
},
2026-06-16 14:42:36 +08:00
onReady() {
// 页面渲染完成后再次检查状态
this.vconsoleEnabled = isVConsoleEnabled();
2026-04-30 15:07:56 +08:00
},
2026-04-29 11:51:57 +08:00
methods: {
switchTab(tab) {
2026-07-10 16:20:00 +08:00
if (tab === 'mine') {
2026-07-11 10:28:43 +08:00
// 切换到"我的"Tab 时检查登录
if (!checkLoginWithPrompt('mine')) return;
this.currentTab = tab;
2026-07-10 16:20:00 +08:00
this.fromPage = 'tab';
2026-07-11 10:28:43 +08:00
// 已有缓存的用户信息则直接显示,否则发起非静默授权获取
const cached = getCachedUserInfo();
if (cached && cached.nickname) {
this.userInfo = { ...this.userInfo, ...cached };
} else {
this.startUserInfoAuth();
}
} else {
this.currentTab = tab;
2026-07-10 16:20:00 +08:00
}
},
2026-04-30 15:07:56 +08:00
switchCategory(cat) { this.activeCategory = cat; },
getDisplayPrice(item) {
// 优先显示促销价,没有促销价则显示销售价
if (item.promotion_price != null) return item.promotion_price;
return item.sale_price;
},
// 从缓存加载用户信息
loadUserInfo() {
const cached = getCachedUserInfo();
console.log('[index] getCachedUserInfo:', JSON.stringify(cached, null, 2));
if (cached) {
this.userInfo = { ...this.userInfo, ...cached };
} else {
2026-07-11 20:29:00 +08:00
this.userInfo = { user_id: '', nickname: '', phone: '', avatar: '' };
}
console.log('[index] this.userInfo:', JSON.stringify(this.userInfo, null, 2));
2026-04-30 15:07:56 +08:00
},
2026-07-11 10:28:43 +08:00
// 发起非静默授权获取用户信息(snsapi_userinfo
async startUserInfoAuth() {
// Mock 模式下,直接使用 mock 数据
if (config.mockWechatLogin) {
const cached = getCachedUserInfo();
2026-07-11 10:28:43 +08:00
if (cached && cached.nickname) {
this.userInfo = { ...this.userInfo, ...cached };
} else {
this.userInfo = {
2026-07-11 20:29:00 +08:00
user_id: config.mockUser.user_info.user_id || '',
nickname: config.mockUser.user_info.nickname || '',
phone: config.mockUser.user_info.phone || '',
avatar: config.mockUser.user_info.avatar || '',
};
uni.setStorageSync('user_info', this.userInfo);
}
return;
}
2026-07-11 10:28:43 +08:00
const appNo = uni.getStorageSync('app_no');
if (!appNo) {
console.warn('[index] 无法获取应用信息');
return;
}
try {
// 存入 localStorageloading 页面复用时 onLoad 不会重新触发,需要从 localStorage 读取)
localStorage.setItem('__auth_action', 'userinfo');
if (this.deviceId) {
localStorage.setItem('__auth_device_id', this.deviceId);
}
2026-07-11 11:37:53 +08:00
// 回调地址:必须与微信公众号后台注册地址一致,不能带自定义参数
const redirectUri = config.authRedirectUri || (
2026-07-11 11:01:22 +08:00
window.location.origin.replace(/^http:/, 'https:') + window.location.pathname
);
2026-07-11 10:28:43 +08:00
// 获取非静默授权链接(会弹窗确认)
const res = await gatewayGet('/api/v1/user/auth/url', {
app_no: appNo,
2026-07-11 10:28:43 +08:00
scopes: 'snsapi_userinfo',
redirect_uri: redirectUri,
});
const data = res.data || {};
2026-07-11 10:28:43 +08:00
if (data.code === 0 && data.data && data.data.auth_url) {
2026-07-11 11:37:53 +08:00
// 通过 state 传递 action 和 device_idOAuth 标准保证 state 原样回传)
const stateObj = { action: 'userinfo' };
if (this.deviceId) {
stateObj.device_id = this.deviceId;
}
2026-07-11 11:59:09 +08:00
const stateVal = encodeURIComponent(JSON.stringify(stateObj));
// 解析 auth_url,安全地设置 state 参数(避免重复)
2026-07-11 11:37:53 +08:00
let authUrl = data.data.auth_url;
2026-07-11 11:59:09 +08:00
try {
const urlObj = new URL(authUrl);
urlObj.searchParams.set('state', stateVal);
authUrl = urlObj.toString();
} catch (_) {
// URL 解析失败时直接拼接
authUrl += (authUrl.includes('?') ? '&' : '?') + 'state=' + stateVal;
}
console.log('[index] 跳转授权页:', authUrl);
2026-07-11 10:28:43 +08:00
// 跳转微信授权页(弹窗确认)
2026-07-11 11:37:53 +08:00
window.location.href = authUrl;
} else {
2026-07-11 10:28:43 +08:00
console.warn('[index] 获取授权链接失败:', data.message);
}
} catch (e) {
2026-07-11 10:28:43 +08:00
console.error('[index] startUserInfoAuth error:', e);
}
},
2026-04-30 15:07:56 +08:00
async fetchProducts() {
this.loading = true;
2026-06-15 09:46:17 +08:00
2026-04-30 15:07:56 +08:00
try {
const res = await get('/device-product/getProductList', {
device_id: this.deviceId,
2026-04-30 15:07:56 +08:00
});
2026-06-15 09:46:17 +08:00
2026-04-30 15:07:56 +08:00
const ret = res.data || {};
if (ret.code === 0 && Array.isArray(ret.data)) {
this.categoryList = ret.data;
} else {
uni.showToast({ title: ret.message || '获取商品失败', icon: 'none' });
}
} catch (e) {
uni.showToast({ title: '网络请求失败', icon: 'none' });
} finally {
this.loading = false;
}
},
async handleOpenDoor() {
// 检查登录状态
if (!isLoggedIn()) {
checkLoginWithPrompt('door');
return;
}
// 检查设备ID
if (!this.deviceId) {
uni.showToast({ title: '请先扫描设备二维码', icon: 'none' });
return;
}
// 检查用户信息,若缓存中没有则调接口获取
if (!this.userId) {
try {
2026-07-11 20:21:58 +08:00
const openId = uni.getStorageSync('openid') || '';
const infoRes = await gatewayGet('/api/v1/user/info', { open_id: openId });
const infoData = (infoRes.data || {}).data || {};
2026-07-11 20:33:58 +08:00
const userInfo = infoData.user_info || {};
if (userInfo.user_id) {
const existing = getCachedUserInfo() || {};
uni.setStorageSync('user_info', {
...existing,
2026-07-11 20:33:58 +08:00
user_id: userInfo.user_id,
nickname: userInfo.nickname || existing.nickname || '',
avatar: userInfo.avatar || existing.avatar || '',
phone: userInfo.phone || existing.phone || '',
});
this.loadUserInfo();
}
} catch (e) {
console.error('[handleOpenDoor] 获取用户信息失败:', e);
}
}
if (!this.userId) {
uni.showToast({ title: '无法获取用户信息,请重新登录', icon: 'none' });
return;
}
// 调用组件方法启动开门流程
2026-07-11 20:43:56 +08:00
this.$refs.doorPanel.open(this.userId);
2026-04-29 16:51:52 +08:00
},
handleMenuClick(item) {
switch (item.action) {
case 'order':
// 查看订单需要登录
if (!checkLoginWithPrompt('order')) return;
2026-04-30 15:07:56 +08:00
uni.navigateTo({ url: '/pages/order/order' });
break;
case 'faq':
uni.navigateTo({ url: '/pages/faq/faq' });
break;
case 'call':
2026-04-30 15:07:56 +08:00
uni.makePhoneCall({ phoneNumber: this.servicePhone, fail: () => {} });
break;
case 'qrcode':
this.showQrcodePopup = true;
break;
2026-04-29 16:51:52 +08:00
}
},
2026-07-10 16:20:00 +08:00
handleNavPrev() {
if (this.fromPage === 'navigate') {
// 从其他页面 navigateTo 过来的,返回上一页
uni.navigateBack();
} else if (this.fromPage === 'tab') {
// 从首页 tab 切换过来的,切换回首页
this.currentTab = 'home';
}
// 其他情况不执行操作
},
2026-06-16 14:42:36 +08:00
handleNavNext() { uni.showToast({ title: '暂无下一页', icon: 'none' }); },
2026-07-10 15:25:36 +08:00
handleAvatarClick() {
this.avatarClickCount++;
clearTimeout(this.avatarClickTimer);
if (this.avatarClickCount >= 10) {
// 点击10次,清除缓存
this.avatarClickCount = 0;
this.clearCacheAndReload();
} else {
// 2秒后重置计数
this.avatarClickTimer = setTimeout(() => {
this.avatarClickCount = 0;
}, 2000);
}
},
handleLogout() {
uni.showModal({
title: '退出登录',
content: '确定要退出登录吗?',
success: (res) => {
if (res.confirm) {
this.clearCacheAndReload();
}
}
});
},
clearCacheAndReload() {
uni.clearStorageSync();
uni.showToast({ title: '已退出登录', icon: 'success' });
setTimeout(() => {
2026-07-11 16:49:32 +08:00
uni.setStorageSync('__logout_flag', true);
uni.reLaunch({ url: '/pages/index/scan' });
2026-07-10 15:25:36 +08:00
}, 1000);
},
2026-06-16 14:42:36 +08:00
onVConsoleChange(e) {
const enabled = e.detail.value;
if (enabled) {
showVConsole();
} else {
hideVConsole();
}
this.vconsoleEnabled = enabled;
}
2026-04-29 11:51:57 +08:00
}
};
</script>
<style scoped>
2026-04-29 16:51:52 +08:00
page { height: 100%; background-color: #fff; }
.app-container { display: flex; flex-direction: column; height: 100vh; background-color: #fff; }
.page-content { flex: 1; overflow: hidden; display: flex; flex-direction: column; position: relative; }
/* ====== 首页样式 ====== */
.home-page { display: flex; flex-direction: column; height: 100%; }
2026-07-10 16:20:00 +08:00
2026-04-29 16:51:52 +08:00
.product-area { flex: 1; overflow-y: auto; height: 0; }
2026-04-30 15:07:56 +08:00
/* 热销商品标题 + 装饰 */
.section-title-wrap { display: flex; align-items: center; padding: 24rpx 28rpx 16rpx; }
.section-title { font-size: 36rpx; font-weight: bold; color: #333; }
.title-decoration { display: flex; align-items: center; margin-left: 16rpx; }
.deco-dot { width: 12rpx; height: 12rpx; background: #ff6b6b; border-radius: 50%; }
.deco-line { width: 40rpx; height: 6rpx; background: linear-gradient(90deg, #ff6b6b, transparent); margin-left: 6rpx; border-radius: 3rpx; }
/* 分类 Tab 横向滚动 */
.category-tabs { white-space: nowrap; padding: 0 20rpx; border-bottom: 1rpx solid #f0f0f0; }
.tabs-inner { display: inline-flex; padding: 0 8rpx; }
.tab-item { display: inline-flex; flex-direction: column; align-items: center; padding: 20rpx 24rpx; position: relative; }
.tab-text { font-size: 28rpx; color: #666; transition: color 0.2s; }
.tab-item.active .tab-text { color: #2979ff; font-weight: bold; }
.tab-underline { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 0; height: 4rpx; background: #2979ff; border-radius: 2rpx; transition: width 0.2s; }
.tab-item.active .tab-underline { width: 48rpx; }
/* 商品网格 */
2026-04-29 16:51:52 +08:00
.product-grid { display: flex; flex-wrap: wrap; padding: 12rpx; gap: 12rpx; }
.product-card { width: calc((100% - 24rpx) / 3); text-align: center; }
2026-04-30 15:20:06 +08:00
.product-img { width: 100%; height: 220rpx; border-radius: 8rpx; background-color: #fff; }
2026-04-29 16:51:52 +08:00
.product-name { font-size: 24rpx; color: #333; padding: 10rpx 8rpx 6rpx; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-price { font-size: 30rpx; font-weight: bold; color: #e4393c; padding: 0 8rpx 16rpx; }
2026-04-30 15:07:56 +08:00
.price-yen { font-size: 22rpx; }
.price-num { font-size: 32rpx; }
2026-04-29 16:51:52 +08:00
/* 底部占位 */
2026-06-30 12:07:21 +08:00
.bottom-spacer { height: 200rpx; }
2026-04-29 16:51:52 +08:00
/* 底部导航栏 */
2026-06-30 12:07:21 +08:00
.tab-bar { position: absolute; bottom: 0; left: 0; right: 0; background: #fff; display: flex; flex-direction: column; align-items: center; box-shadow: 0 -2rpx 16rpx rgba(0,0,0,0.08); z-index: 999; padding-bottom: constant(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom); }
.tab-bar-row { width: 100%; height: 120rpx; display: flex; align-items: center; justify-content: space-around; }
2026-04-30 15:07:56 +08:00
.tab-bar .tab-item { flex: 1; display: flex; align-items: center; justify-content: center; height: 100%; }
.tab-bar .tab-text { font-size: 28rpx; color: #999; font-weight: normal; }
.tab-bar .tab-item.active .tab-text { color: #2979ff; }
2026-06-15 09:46:17 +08:00
/* 首页图标 */
.tab-bar .home-icon {
width: 40rpx;
height: 36rpx;
position: relative;
margin-bottom: 6rpx;
}
.tab-bar .home-roof {
width: 0;
height: 0;
border-left: 22rpx solid transparent;
border-right: 22rpx solid transparent;
border-bottom: 18rpx solid #999;
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
}
.tab-bar .home-body {
width: 30rpx;
height: 18rpx;
background-color: #999;
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
border-radius: 0 0 3rpx 3rpx;
}
.tab-bar .tab-item.active .home-roof {
border-bottom-color: #2979ff;
}
.tab-bar .tab-item.active .home-body {
background-color: #2979ff;
}
/* 我的图标(与扫一扫页共用) */
.tab-bar .mine-icon {
width: 40rpx;
height: 36rpx;
position: relative;
margin-bottom: 6rpx;
}
.tab-bar .mine-head {
width: 16rpx;
height: 16rpx;
border-radius: 50%;
background-color: #999;
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
}
.tab-bar .mine-body {
width: 28rpx;
height: 16rpx;
border-radius: 14rpx 14rpx 0 0;
background-color: #999;
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
}
.tab-bar .tab-item.active .mine-head,
.tab-bar .tab-item.active .mine-body {
background-color: #2979ff;
}
2026-04-29 16:51:52 +08:00
.door-btn-wrapper { position: relative; display: flex; align-items: center; justify-content: center; margin-top: -80rpx; }
.door-btn { width: 160rpx; height: 160rpx; border-radius: 50%; background: linear-gradient(135deg, #2979ff, #1e60e0); color: #fff; font-size: 38rpx; font-weight: bold; display: flex; align-items: center; justify-content: center; box-shadow: 0 10rpx 36rpx rgba(41,121,255,0.55); }
2026-06-30 12:07:21 +08:00
.payscore-info { display: flex; align-items: center; padding-bottom: 16rpx; }
.payscore-logo { width: 34rpx; height: 34rpx; }
.payscore-divider { width: 2rpx; height: 24rpx; background-color: rgba(102, 102, 102, 0.6); margin: 0 10rpx; }
.payscore-text { font-size: 24rpx; color: #666; white-space: nowrap; }
2026-04-29 16:51:52 +08:00
2026-04-30 15:07:56 +08:00
/* 空状态 / Loading */
.empty-tip, .loading-tip { text-align: center; padding: 60rpx; color: #999; font-size: 28rpx; }
2026-04-29 16:51:52 +08:00
/* ====== 我的页面样式 ====== */
.mine-page { background-color: #f5f5f5; position: relative; overflow-y: auto; }
.user-header { background: linear-gradient(135deg, #2979ff, #1e60e0); padding: 60rpx 40rpx; }
.user-info { display: flex; align-items: center; }
.avatar { width: 120rpx; height: 120rpx; border-radius: 50%; border: 4rpx solid rgba(255,255,255,0.8); background-color: #e0e0e0; }
.avatar-wrapper { margin-right: 30rpx; }
.user-detail { display: flex; flex-direction: column; flex: 1; }
.nickname { font-size: 36rpx; font-weight: bold; color: #fff; margin-bottom: 12rpx; }
.phone { font-size: 28rpx; color: rgba(255,255,255,0.9); }
.content-area { padding: 20rpx; padding-bottom: 140rpx; }
.menu-list { background-color: #fff; border-radius: 16rpx; overflow: hidden; }
.menu-item { display: flex; justify-content: space-between; padding: 32rpx 28rpx; border-bottom: 1rpx solid #f0f0f0; }
.menu-item:last-child { border-bottom: none; }
.menu-text { font-size: 30rpx; color: #333; }
.menu-arrow { font-size: 28rpx; color: #ccc; }
2026-07-10 15:25:36 +08:00
.logout-btn { margin-top: 20rpx; }
2026-06-16 14:42:36 +08:00
/* 开发工具区域 */
.dev-tools { margin-top: 20rpx; background-color: #fff; border-radius: 16rpx; overflow: hidden; }
.dev-tools-title { padding: 20rpx 28rpx 10rpx; font-size: 24rpx; color: #999; }
.dev-tools .menu-item { align-items: center; }
.dev-tools switch { transform: scale(0.8); }
/* ====== 公众号二维码弹窗 ====== */
.qrcode-popup-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.55);
z-index: 2000;
display: flex;
align-items: center;
justify-content: center;
}
.qrcode-popup-content {
width: 560rpx;
background: #fff;
border-radius: 20rpx;
padding: 48rpx 40rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.qrcode-popup-title {
font-size: 34rpx;
font-weight: bold;
color: #333;
margin-bottom: 32rpx;
}
.qrcode-img {
width: 400rpx;
height: 400rpx;
margin-bottom: 24rpx;
}
.qrcode-popup-tip {
font-size: 26rpx;
color: #999;
margin-bottom: 32rpx;
}
.qrcode-popup-close {
font-size: 28rpx;
color: #2979ff;
padding: 16rpx 60rpx;
border: 2rpx solid #2979ff;
border-radius: 40rpx;
}
2026-04-29 11:51:57 +08:00
</style>