新页面的添加

This commit is contained in:
not-like-juvenile
2026-01-22 17:26:53 +08:00
parent 75fad97d5d
commit d5a3a4e8f0
5 changed files with 2094 additions and 389 deletions

View File

@@ -63,6 +63,41 @@
"navigationStyle": "custom"
}
},
{
"path": "pages/mall/delivery/order-detail",
"style": {
"navigationBarTitleText": "订单详情页",
"navigationStyle": "custom"
}
},
{
"path": "pages/mall/delivery/profile",
"style": {
"navigationBarTitleText": "配送个人中心",
"navigationStyle": "custom"
}
},
{
"path": "pages/mall/delivery/order-history",
"style": {
"navigationBarTitleText": "历史记录",
"navigationStyle": "custom"
}
},
{
"path": "pages/mall/delivery/earnings",
"style": {
"navigationBarTitleText": "历史记录",
"navigationStyle": "custom"
}
},
{
"path": "pages/mall/delivery/settings",
"style": {
"navigationBarTitleText": "设置",
"navigationStyle": "custom"
}
},
{
"path": "pages/mall/admin/index",
"style": {

View File

@@ -0,0 +1,544 @@
<template>
<view class="earnings-container">
<!-- 顶部导航栏 -->
<view class="page-header">
<!-- 左上角:返回主页按钮(箭头+文字 垂直排列) -->
<view class="nav-left" @click="goBackToHome">
<text class="nav-icon">←</text>
<text class="nav-title">返回主页</text>
</view>
<!-- 页面标题居中 -->
<text class="page-title">收入明细</text>
<!-- 右上角留空 -->
<view class="nav-right"></view>
</view>
<!-- 顶部统计卡片 -->
<view class="stats-section">
<view class="stat-card">
<text class="stat-value">¥{{ totalEarnings }}</text>
<text class="stat-label">总收入</text>
</view>
<view class="stat-card">
<text class="stat-value">¥{{ totalUserTips }}</text>
<text class="stat-label">用户打赏</text>
</view>
<view class="stat-card">
<text class="stat-value">¥{{ totalMerchantTips }}</text>
<text class="stat-label">商家打赏</text>
</view>
<view class="stat-card">
<text class="stat-value">{{ totalOrders }}</text>
<text class="stat-label">总订单数</text>
</view>
</view>
<!-- 主要内容区域 -->
<view class="content-wrapper">
<!-- 订单收入列表 -->
<view v-if="orderEarningsList.length > 0" class="order-earnings-list">
<view v-for="order in orderEarningsList" :key="order.order_no" class="order-earnings-item">
<!-- 订单总收入 -->
<view class="order-total">
<text class="order-total-label">订单收入:</text>
<text class="order-total-amount">¥{{ order.totalAmount.toFixed(2) }}</text>
</view>
<!-- 订单基础信息 -->
<view class="order-info">
<text class="info-item">订单号: {{ order.order_no }}</text>
<text class="info-item">时间: {{ formatTime(order.date) }}</text>
<text class="info-item" v-if="order.distance !== undefined">距离: {{ order.distance }}km</text>
</view>
<!-- 收入明细 -->
<view class="earning-details">
<view v-for="detail in order.details" :key="detail.id" class="detail-item">
<text class="detail-type">{{ getSourceText(detail.source) }}</text>
<text class="detail-amount">+¥{{ detail.amount.toFixed(2) }}</text>
</view>
</view>
</view>
</view>
<!-- 无数据时显示 -->
<view v-else class="no-data">
<text class="no-data-text">暂无收入记录</text>
</view>
<!-- 加载更多按钮 -->
<view v-if="hasMore" class="load-more">
<button @click="loadMoreEarnings" class="load-more-btn">加载更多</button>
</view>
</view>
</view>
</template>
<script lang="uts">
export default {
data() {
return {
// 统计数据
totalEarnings: '266.10',
totalUserTips: '12.00',
totalMerchantTips: '8.50',
totalOrders: 8,
// 按订单聚合后的收入数据
orderEarningsList: [] as Array<OrderEarningType>,
allOrderEarnings: [] as Array<OrderEarningType>,
pageSize: 10,
currentPage: 1,
}
},
onLoad() {
this.loadAllEarnings()
},
computed: {
hasMore(): boolean {
return this.allOrderEarnings.length > this.orderEarningsList.length
}
},
methods: {
// 加载所有收入明细并按订单聚合
loadAllEarnings() {
const rawEarnings = [
// 配送费
{
id: '1',
date: '2025-01-08T14:30:00Z',
amount: 8.5,
source: 'delivery_fee',
order_no: 'D202501081234',
distance: 12.5
},
{
id: '2',
date: '2025-01-08T15:00:00Z',
amount: 12.0,
source: 'delivery_fee',
order_no: 'D202501081235',
distance: 8.2
},
// 用户打赏
{
id: '3',
date: '2025-01-08T15:30:00Z',
amount: 5.0,
source: 'user_tip',
order_no: 'D202501081236'
},
{
id: '4',
date: '2025-01-08T16:00:00Z',
amount: 7.0,
source: 'user_tip',
order_no: 'D202501081237'
},
// 商家打赏
{
id: '5',
date: '2025-01-08T16:30:00Z',
amount: 3.5,
source: 'merchant_tip',
order_no: 'D202501081238'
},
{
id: '6',
date: '2025-01-08T17:00:00Z',
amount: 5.0,
source: 'merchant_tip',
order_no: 'D202501081239'
},
{
id: '7',
date: '2025-01-08T17:30:00Z',
amount: 6.0,
source: 'delivery_fee',
order_no: 'D202501081240',
distance: 3.5
},
{
id: '8',
date: '2025-01-08T18:00:00Z',
amount: 10.0,
source: 'user_tip',
order_no: 'D202501081241'
},
{
id: '9',
date: '2025-01-08T18:30:00Z',
amount: 8.5,
source: 'merchant_tip',
order_no: 'D202501081242'
},
{
id: '10',
date: '2025-01-08T19:00:00Z',
amount: 12.0,
source: 'delivery_fee',
order_no: 'D202501081243',
distance: 5.0
},
{
id: '11',
date: '2025-01-08T19:30:00Z',
amount: 5.0,
source: 'user_tip',
order_no: 'D202501081244'
},
{
id: '12',
date: '2025-01-08T20:00:00Z',
amount: 3.5,
source: 'merchant_tip',
order_no: 'D202501081245'
}
]
// 按订单号聚合数据
const orderMap = new Map<string, OrderEarningType>()
rawEarnings.forEach(item => {
if (!orderMap.has(item.order_no)) {
orderMap.set(item.order_no, {
order_no: item.order_no,
date: item.date,
distance: item.distance,
totalAmount: 0,
details: []
})
}
const order = orderMap.get(item.order_no)!
order.totalAmount += item.amount
order.details.push(item)
})
/* ---------- 新增:把「配送费」「商家打赏」「用户打赏」三种类型全部补齐 ---------- */
const allTypes: Array<'delivery_fee' | 'merchant_tip' | 'user_tip'> = ['delivery_fee', 'merchant_tip', 'user_tip']
orderMap.forEach(order => {
// 看当前订单已存在的类型
const existSet = new Set(order.details.map(d => d.source))
// 缺哪种就补 0 的占位,保证顺序:配送费 / 商家打赏 / 用户打赏
allTypes.forEach(type => {
if (!existSet.has(type)) {
order.details.push({
id: `${order.order_no}_${type}`, // 唯一 key
date: order.date,
amount: 0,
source: type,
order_no: order.order_no,
distance: order.distance
})
}
})
// 按固定顺序排个序(可选)
order.details.sort((a, b) =>
allTypes.indexOf(a.source as any) - allTypes.indexOf(b.source as any)
)
})
this.allOrderEarnings = Array.from(orderMap.values())
this.calculateTotalStats()
this.loadPage()
},
// 计算总统计数据
calculateTotalStats() {
let totalEarnings = 0
let totalUserTips = 0
let totalMerchantTips = 0
this.allOrderEarnings.forEach(order => {
order.details.forEach(detail => {
totalEarnings += detail.amount || 0
if (detail.source === 'user_tip') {
totalUserTips += detail.amount || 0
} else if (detail.source === 'merchant_tip') {
totalMerchantTips += detail.amount || 0
}
})
})
this.totalEarnings = totalEarnings.toFixed(2)
this.totalUserTips = totalUserTips.toFixed(2)
this.totalMerchantTips = totalMerchantTips.toFixed(2)
this.totalOrders = this.allOrderEarnings.length
},
// 加载当前页数据
loadPage() {
const start = (this.currentPage - 1) * this.pageSize
const end = start + this.pageSize
const newOrders = this.allOrderEarnings.slice(start, end)
this.orderEarningsList.push(...newOrders)
},
// 加载更多
loadMoreEarnings() {
this.currentPage++
this.loadPage()
},
// 获取收入来源文本
getSourceText(source: string): string {
switch (source) {
case 'delivery_fee': return '配送费'
case 'user_tip': return '用户打赏'
case 'merchant_tip': return '商家打赏'
default: return '其他'
}
},
// 格式化时间
formatTime(timeStr: string): string {
const date = new Date(timeStr)
const now = new Date()
const diff = now.getTime() - date.getTime()
const minutes = Math.floor(diff / (1000 * 60))
if (minutes < 60) {
return `${minutes}分钟前`
} else {
return `${Math.floor(minutes / 60)}小时前`
}
},
// 返回主页
goBackToHome() {
uni.reLaunch({
url: '/pages/mall/delivery/index'
})
}
}
}
// 定义聚合后的订单收入类型
type OrderEarningType = {
order_no: string
date: string
distance?: number
totalAmount: number
details: Array<EarningType>
}
type EarningType = {
id: string
date: string
amount?: number
source: 'delivery_fee' | 'user_tip' | 'merchant_tip' | string
order_no?: string
distance?: number
}
</script>
<style>
/* 全局样式 */
.earnings-container {
background-color: #f5f5f5;
min-height: 100vh;
padding: 20rpx 30rpx;
}
.page-header {
background-color: #fff;
padding: 20rpx 30rpx;
border-bottom: 1rpx solid #e9ecef;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
position: relative;
min-height: 80rpx; /* 确保有足够空间放垂直排列的按钮和标题 */
}
.nav-left {
position: absolute;
top: 20rpx;
left: 30rpx;
display: flex;
flex-direction: column;
align-items: center;
cursor: pointer;
}
.nav-icon {
font-size: 36rpx;
margin-right: 10rpx;
color: #333;
}
.nav-title {
font-size: 28rpx;
color: #000000; /* 红色 */
font-weight: 500;
}
.page-title {
font-size: 32rpx;
font-weight: bold;
color: #333; /* 黑色 */
text-align: center;
margin-top: 20rpx; /* 与 nav-left 保持一定距离 */
}
.nav-right {
/* 为了保持左右对齐,右侧需要一个占位元素 */
width: 1rpx;
height: 1rpx;
}
.stats-section {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 20rpx;
margin: 20rpx;
padding: 20rpx;
background-color: #fff;
border-radius: 16rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
}
.stat-card {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 20rpx;
background-color: #f8f9fa;
border-radius: 12rpx;
}
.stat-value {
font-size: 36rpx;
font-weight: bold;
color: #4CAF50;
margin-bottom: 10rpx;
}
.stat-label {
font-size: 24rpx;
color: #666;
text-align: center;
}
.content-wrapper {
margin-top: 20rpx;
}
.order-earnings-list {
display: flex;
flex-direction: column;
gap: 20rpx;
}
.order-earnings-item {
background-color: #fff;
border-radius: 16rpx;
padding: 20rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
border-left: 6rpx solid #4CAF50;
}
.order-total {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15rpx;
}
.order-total-label {
font-size: 28rpx;
font-weight: 500;
color: #333;
}
.order-total-amount {
font-size: 32rpx;
font-weight: bold;
color: #4CAF50;
}
.order-info {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
gap: 10rpx;
font-size: 24rpx;
color: #666;
margin-bottom: 15rpx;
padding-bottom: 10rpx;
border-bottom: 1rpx solid #f0f0f0;
}
.info-item {
flex: 1 1 45%;
min-width: 120rpx;
word-break: break-all;
}
.earning-details {
display: flex;
flex-direction: column;
gap: 10rpx;
}
.detail-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8rpx 12rpx;
border-radius: 8rpx;
background-color: #f8f9fa;
}
.detail-type {
font-size: 24rpx;
color: #555;
}
.detail-amount {
font-size: 24rpx;
color: #4CAF50;
font-weight: 500;
}
.load-more {
text-align: center;
margin-top: 20rpx;
}
.load-more-btn {
background-color: #4CAF50;
color: #fff;
border: none;
border-radius: 8rpx;
padding: 20rpx 40rpx;
font-size: 28rpx;
font-weight: bold;
cursor: pointer;
transition: background-color 0.2s ease;
}
.load-more-btn:hover {
background-color: #45a049; /* 按钮悬停效果 */
}
.load-more-btn:active {
background-color: #3d8b40; /* 按钮点击效果 */
}
.no-data {
text-align: center;
padding: 80rpx 30rpx;
border-radius: 16rpx;
background-color: #fff;
}
.no-data-text {
font-size: 32rpx;
color: #999;
margin-bottom: 15rpx;
}
</style>

View File

@@ -531,393 +531,481 @@
</script>
<style>
.delivery-container {
background-color: #f5f5f5;
min-height: 100vh;
padding-bottom: 40rpx;
}
.header {
background-color: #fff;
padding: 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1rpx solid #e5e5e5;
}
.driver-info {
display: flex;
align-items: center;
}
.avatar {
width: 80rpx;
height: 80rpx;
border-radius: 40rpx;
margin-right: 20rpx;
}
.driver-details {
display: flex;
flex-direction: column;
}
.driver-name {
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-bottom: 8rpx;
}
.work-status {
font-size: 24rpx;
padding: 6rpx 12rpx;
border-radius: 12rpx;
}
.status-online {
background-color: #E8F5E8;
color: #4CAF50;
}
.status-offline {
background-color: #FFF3E0;
color: #FF9800;
}
.status-switch {
display: flex;
flex-direction: column;
align-items: center;
}
.switch-label {
font-size: 22rpx;
color: #666;
margin-top: 8rpx;
}
.stats-section {
background-color: #fff;
margin: 20rpx;
padding: 30rpx;
border-radius: 16rpx;
}
.section-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-bottom: 30rpx;
}
.stats-grid {
display: flex;
justify-content: space-between;
}
.stat-item {
display: flex;
flex-direction: column;
align-items: center;
flex: 1;
}
.stat-value {
font-size: 36rpx;
font-weight: bold;
color: #4CAF50;
margin-bottom: 10rpx;
}
.stat-label {
font-size: 24rpx;
color: #666;
}
.current-task-section {
background-color: #fff;
margin: 20rpx;
padding: 30rpx;
border-radius: 16rpx;
}
.task-card {
border: 1rpx solid #e5e5e5;
border-radius: 12rpx;
padding: 20rpx;
}
.task-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
padding-bottom: 15rpx;
border-bottom: 1rpx solid #f0f0f0;
}
.task-id {
font-size: 28rpx;
font-weight: bold;
color: #333;
}
.task-status {
font-size: 24rpx;
padding: 8rpx 16rpx;
border-radius: 20rpx;
}
.task-accepted {
background-color: #E3F2FD;
color: #1976D2;
}
.task-picking {
background-color: #FFF3E0;
color: #F57C00;
}
.task-delivering {
background-color: #E8F5E8;
color: #388E3C;
}
.task-addresses {
margin-bottom: 20rpx;
}
.address-item {
display: flex;
align-items: flex-start;
margin-bottom: 15rpx;
}
.address-icon {
font-size: 28rpx;
margin-right: 15rpx;
margin-top: 5rpx;
}
.address-info {
display: flex;
flex-direction: column;
flex: 1;
}
.address-label {
font-size: 24rpx;
color: #666;
margin-bottom: 8rpx;
}
.address-text {
font-size: 28rpx;
color: #333;
margin-bottom: 8rpx;
}
.contact-info {
font-size: 24rpx;
color: #666;
}
.address-line {
width: 2rpx;
height: 30rpx;
background-color: #ddd;
margin: 10rpx 0 10rpx 14rpx;
}
.task-details {
display: flex;
justify-content: space-between;
margin-bottom: 20rpx;
padding: 15rpx;
background-color: #f8f9fa;
border-radius: 8rpx;
}
.task-info {
font-size: 24rpx;
color: #666;
}
.task-actions {
display: flex;
flex-wrap: wrap;
gap: 15rpx;
}
.action-btn {
flex: 1;
height: 80rpx;
border-radius: 8rpx;
font-size: 28rpx;
border: none;
}
.primary {
background-color: #4CAF50;
color: #fff;
}
.secondary {
background-color: #f0f0f0;
color: #333;
}
.available-orders-section {
margin: 20rpx;
}
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
}
.refresh-btn {
font-size: 26rpx;
color: #4CAF50;
}
.empty-orders {
background-color: #fff;
padding: 80rpx 30rpx;
border-radius: 16rpx;
text-align: center;
}
.empty-text {
font-size: 32rpx;
color: #999;
margin-bottom: 15rpx;
}
.empty-subtitle {
font-size: 24rpx;
color: #ccc;
}
.order-card {
background-color: #fff;
border-radius: 12rpx;
padding: 20rpx;
margin-bottom: 15rpx;
}
.order-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15rpx;
}
.order-id {
font-size: 28rpx;
color: #333;
font-weight: bold;
}
.order-fee {
font-size: 32rpx;
color: #4CAF50;
font-weight: bold;
}
.order-route {
display: flex;
align-items: center;
margin-bottom: 15rpx;
}
.route-item {
display: flex;
align-items: center;
flex: 1;
}
.route-icon {
font-size: 24rpx;
margin-right: 8rpx;
}
.route-text {
font-size: 26rpx;
color: #333;
}
.route-arrow {
font-size: 24rpx;
color: #999;
margin: 0 15rpx;
}
.order-info {
display: flex;
justify-content: space-between;
margin-bottom: 15rpx;
}
.info-item {
font-size: 22rpx;
color: #666;
}
.order-actions {
display: flex;
gap: 15rpx;
}
.order-btn {
flex: 1;
height: 70rpx;
border-radius: 8rpx;
font-size: 26rpx;
border: none;
}
.accept {
background-color: #4CAF50;
color: #fff;
}
.detail {
background-color: #f0f0f0;
color: #333;
}
.quick-actions-section {
background-color: #fff;
margin: 20rpx;
padding: 30rpx;
border-radius: 16rpx;
}
.actions-grid {
display: flex;
justify-content: space-between;
}
.action-item {
display: flex;
flex-direction: column;
align-items: center;
flex: 1;
}
.action-icon {
font-size: 48rpx;
margin-bottom: 15rpx;
}
.action-text {
font-size: 24rpx;
color: #333;
text-align: center;
}
.delivery-container {
background-color: #f8f9fa;
min-height: 100vh;
padding-bottom: 40rpx;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.header {
background-color: #fff;
padding: 20rpx 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1rpx solid #e9ecef;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
}
.driver-info {
display: flex;
align-items: center;
}
.avatar {
width: 80rpx;
height: 80rpx;
border-radius: 40rpx;
margin-right: 20rpx;
border: 2rpx solid #dee2e6;
}
.driver-details {
display: flex;
flex-direction: column;
justify-content: center;
}
.driver-name {
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-bottom: 8rpx;
}
.work-status {
font-size: 24rpx;
padding: 6rpx 12rpx;
border-radius: 12rpx;
font-weight: 500;
}
.status-online {
background-color: #E8F5E8;
color: #4CAF50;
}
.status-offline {
background-color: #FFF3E0;
color: #FF9800;
}
.status-switch {
display: flex;
align-items: center;
gap: 10rpx;
}
.switch-label {
font-size: 22rpx;
color: #666;
}
/* 今日统计 */
.stats-section {
background-color: #fff;
margin: 20rpx;
padding: 20rpx 30rpx;
border-radius: 16rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
}
.section-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-bottom: 20rpx;
text-align: center;
}
.stats-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 15rpx;
justify-items: center;
}
.stat-item {
display: flex;
flex-direction: column;
align-items: center;
padding: 15rpx;
background-color: #f8f9fa;
border-radius: 12rpx;
min-width: 120rpx;
}
.stat-value {
font-size: 36rpx;
font-weight: bold;
color: #4CAF50;
margin-bottom: 10rpx;
line-height: 1.2;
}
.stat-label {
font-size: 24rpx;
color: #666;
text-align: center;
}
/* 当前任务 */
.current-task-section {
background-color: #fff;
margin: 20rpx;
padding: 20rpx 30rpx;
border-radius: 16rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
}
.section-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-bottom: 20rpx;
text-align: center;
}
.task-card {
border: 1rpx solid #e9ecef;
border-radius: 12rpx;
padding: 20rpx;
background-color: #ffffff;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
}
.task-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15rpx;
padding-bottom: 15rpx;
border-bottom: 1rpx solid #f8f9fa;
}
.task-id {
font-size: 28rpx;
font-weight: bold;
color: #333;
}
.task-status {
font-size: 24rpx;
padding: 6rpx 12rpx;
border-radius: 12rpx;
font-weight: 500;
}
.task-accepted {
background-color: #E3F2FD;
color: #1976D2;
}
.task-picking {
background-color: #FFF3E0;
color: #F57C00;
}
.task-delivering {
background-color: #E8F5E8;
color: #388E3C;
}
.task-addresses {
margin-bottom: 20rpx;
}
.address-item {
display: flex;
align-items: flex-start;
margin-bottom: 15rpx;
padding: 10rpx 0;
border-bottom: 1rpx dashed #e9ecef;
}
.address-icon {
font-size: 28rpx;
margin-right: 15rpx;
margin-top: 5rpx;
color: #666;
}
.address-info {
display: flex;
flex-direction: column;
flex: 1;
}
.address-label {
font-size: 24rpx;
color: #666;
margin-bottom: 8rpx;
font-weight: 500;
}
.address-text {
font-size: 28rpx;
color: #333;
margin-bottom: 8rpx;
word-break: break-all;
}
.contact-info {
font-size: 24rpx;
color: #666;
font-weight: 500;
}
.address-line {
width: 2rpx;
height: 30rpx;
background-color: #ddd;
margin: 10rpx 0 10rpx 14rpx;
}
.task-details {
display: flex;
justify-content: space-between;
margin-bottom: 20rpx;
padding: 15rpx;
background-color: #f8f9fa;
border-radius: 8rpx;
font-size: 24rpx;
color: #666;
}
.task-info {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
font-size: 24rpx;
color: #666;
margin: 0 5rpx;
}
.task-actions {
display: flex;
flex-wrap: wrap;
gap: 10rpx;
margin-top: 10rpx;
}
.action-btn {
flex: 1;
height: 80rpx;
border-radius: 8rpx;
font-size: 28rpx;
border: none;
font-weight: 500;
padding: 0 10rpx;
box-sizing: border-box;
}
.primary {
background-color: #4CAF50;
color: #fff;
}
.secondary {
background-color: #f0f0f0;
color: #333;
border: 1rpx solid #ddd;
}
/* 可接取订单 */
.available-orders-section {
margin: 20rpx;
}
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
}
.refresh-btn {
font-size: 26rpx;
color: #4CAF50;
padding: 8rpx 16rpx;
background-color: #e8f5e8;
border-radius: 12rpx;
font-weight: 500;
}
.empty-orders {
background-color: #fff;
padding: 40rpx 30rpx;
border-radius: 16rpx;
text-align: center;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
}
.empty-text {
font-size: 32rpx;
color: #999;
margin-bottom: 15rpx;
}
.empty-subtitle {
font-size: 24rpx;
color: #ccc;
}
.order-card {
background-color: #fff;
border-radius: 12rpx;
padding: 20rpx;
margin-bottom: 15rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
border: 1rpx solid #e9ecef;
}
.order-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15rpx;
padding-bottom: 15rpx;
border-bottom: 1rpx solid #f8f9fa;
}
.order-id {
font-size: 28rpx;
color: #333;
font-weight: bold;
}
.order-fee {
font-size: 32rpx;
color: #4CAF50;
font-weight: bold;
}
.order-route {
display: flex;
align-items: center;
margin-bottom: 15rpx;
padding: 10rpx 0;
border-bottom: 1rpx solid #f8f9fa;
}
.route-item {
display: flex;
align-items: center;
flex: 1;
}
.route-icon {
font-size: 24rpx;
margin-right: 8rpx;
color: #666;
}
.route-text {
font-size: 26rpx;
color: #333;
word-break: break-all;
}
.route-arrow {
font-size: 24rpx;
color: #999;
margin: 0 15rpx;
}
.order-info {
display: flex;
justify-content: space-between;
margin-bottom: 15rpx;
padding: 10rpx 0;
border-bottom: 1rpx solid #f8f9fa;
font-size: 22rpx;
color: #666;
}
.info-item {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
font-size: 22rpx;
color: #666;
margin: 0 5rpx;
}
.order-actions {
display: flex;
gap: 10rpx;
margin-top: 10rpx;
}
.order-btn {
flex: 1;
height: 70rpx;
border-radius: 8rpx;
font-size: 26rpx;
border: none;
font-weight: 500;
padding: 0 10rpx;
box-sizing: border-box;
}
.accept {
background-color: #4CAF50;
color: #fff;
}
.detail {
background-color: #f0f0f0;
color: #333;
border: 1rpx solid #ddd;
}
/* 历史记录快捷入口 */
.quick-actions-section {
background-color: #fff;
margin: 20rpx;
padding: 20rpx 30rpx;
border-radius: 16rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
}
.actions-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 20rpx;
justify-items: center;
}
.action-item {
display: flex;
flex-direction: column;
align-items: center;
padding: 20rpx;
background-color: #f8f9fa;
border-radius: 12rpx;
min-width: 120rpx;
cursor: pointer;
transition: background-color 0.2s;
}
.action-item:hover {
background-color: #e8f5e8;
}
.action-icon {
font-size: 48rpx;
margin-bottom: 15rpx;
color: #666;
}
.action-text {
font-size: 24rpx;
color: #333;
text-align: center;
font-weight: 500;
}
</style>

View File

@@ -0,0 +1,544 @@
<template>
<view class="earnings-container">
<!-- 顶部导航栏 -->
<view class="page-header">
<!-- 左上角:返回主页按钮(箭头+文字 垂直排列) -->
<view class="nav-left" @click="goBackToHome">
<text class="nav-icon">←</text>
<text class="nav-title">返回主页</text>
</view>
<!-- 页面标题居中 -->
<text class="page-title">收入明细</text>
<!-- 右上角留空 -->
<view class="nav-right"></view>
</view>
<!-- 顶部统计卡片 -->
<view class="stats-section">
<view class="stat-card">
<text class="stat-value">¥{{ totalEarnings }}</text>
<text class="stat-label">总收入</text>
</view>
<view class="stat-card">
<text class="stat-value">¥{{ totalUserTips }}</text>
<text class="stat-label">用户打赏</text>
</view>
<view class="stat-card">
<text class="stat-value">¥{{ totalMerchantTips }}</text>
<text class="stat-label">商家打赏</text>
</view>
<view class="stat-card">
<text class="stat-value">{{ totalOrders }}</text>
<text class="stat-label">总订单数</text>
</view>
</view>
<!-- 主要内容区域 -->
<view class="content-wrapper">
<!-- 订单收入列表 -->
<view v-if="orderEarningsList.length > 0" class="order-earnings-list">
<view v-for="order in orderEarningsList" :key="order.order_no" class="order-earnings-item">
<!-- 订单总收入 -->
<view class="order-total">
<text class="order-total-label">订单收入:</text>
<text class="order-total-amount">¥{{ order.totalAmount.toFixed(2) }}</text>
</view>
<!-- 订单基础信息 -->
<view class="order-info">
<text class="info-item">订单号: {{ order.order_no }}</text>
<text class="info-item">时间: {{ formatTime(order.date) }}</text>
<text class="info-item" v-if="order.distance !== undefined">距离: {{ order.distance }}km</text>
</view>
<!-- 收入明细 -->
<view class="earning-details">
<view v-for="detail in order.details" :key="detail.id" class="detail-item">
<text class="detail-type">{{ getSourceText(detail.source) }}</text>
<text class="detail-amount">+¥{{ detail.amount.toFixed(2) }}</text>
</view>
</view>
</view>
</view>
<!-- 无数据时显示 -->
<view v-else class="no-data">
<text class="no-data-text">暂无收入记录</text>
</view>
<!-- 加载更多按钮 -->
<view v-if="hasMore" class="load-more">
<button @click="loadMoreEarnings" class="load-more-btn">加载更多</button>
</view>
</view>
</view>
</template>
<script lang="uts">
export default {
data() {
return {
// 统计数据
totalEarnings: '266.10',
totalUserTips: '12.00',
totalMerchantTips: '8.50',
totalOrders: 8,
// 按订单聚合后的收入数据
orderEarningsList: [] as Array<OrderEarningType>,
allOrderEarnings: [] as Array<OrderEarningType>,
pageSize: 10,
currentPage: 1,
}
},
onLoad() {
this.loadAllEarnings()
},
computed: {
hasMore(): boolean {
return this.allOrderEarnings.length > this.orderEarningsList.length
}
},
methods: {
// 加载所有收入明细并按订单聚合
loadAllEarnings() {
const rawEarnings = [
// 配送费
{
id: '1',
date: '2025-01-08T14:30:00Z',
amount: 8.5,
source: 'delivery_fee',
order_no: 'D202501081234',
distance: 12.5
},
{
id: '2',
date: '2025-01-08T15:00:00Z',
amount: 12.0,
source: 'delivery_fee',
order_no: 'D202501081235',
distance: 8.2
},
// 用户打赏
{
id: '3',
date: '2025-01-08T15:30:00Z',
amount: 5.0,
source: 'user_tip',
order_no: 'D202501081236'
},
{
id: '4',
date: '2025-01-08T16:00:00Z',
amount: 7.0,
source: 'user_tip',
order_no: 'D202501081237'
},
// 商家打赏
{
id: '5',
date: '2025-01-08T16:30:00Z',
amount: 3.5,
source: 'merchant_tip',
order_no: 'D202501081238'
},
{
id: '6',
date: '2025-01-08T17:00:00Z',
amount: 5.0,
source: 'merchant_tip',
order_no: 'D202501081239'
},
{
id: '7',
date: '2025-01-08T17:30:00Z',
amount: 6.0,
source: 'delivery_fee',
order_no: 'D202501081240',
distance: 3.5
},
{
id: '8',
date: '2025-01-08T18:00:00Z',
amount: 10.0,
source: 'user_tip',
order_no: 'D202501081241'
},
{
id: '9',
date: '2025-01-08T18:30:00Z',
amount: 8.5,
source: 'merchant_tip',
order_no: 'D202501081242'
},
{
id: '10',
date: '2025-01-08T19:00:00Z',
amount: 12.0,
source: 'delivery_fee',
order_no: 'D202501081243',
distance: 5.0
},
{
id: '11',
date: '2025-01-08T19:30:00Z',
amount: 5.0,
source: 'user_tip',
order_no: 'D202501081244'
},
{
id: '12',
date: '2025-01-08T20:00:00Z',
amount: 3.5,
source: 'merchant_tip',
order_no: 'D202501081245'
}
]
// 按订单号聚合数据
const orderMap = new Map<string, OrderEarningType>()
rawEarnings.forEach(item => {
if (!orderMap.has(item.order_no)) {
orderMap.set(item.order_no, {
order_no: item.order_no,
date: item.date,
distance: item.distance,
totalAmount: 0,
details: []
})
}
const order = orderMap.get(item.order_no)!
order.totalAmount += item.amount
order.details.push(item)
})
/* ---------- 新增:把「配送费」「商家打赏」「用户打赏」三种类型全部补齐 ---------- */
const allTypes: Array<'delivery_fee' | 'merchant_tip' | 'user_tip'> = ['delivery_fee', 'merchant_tip', 'user_tip']
orderMap.forEach(order => {
// 看当前订单已存在的类型
const existSet = new Set(order.details.map(d => d.source))
// 缺哪种就补 0 的占位,保证顺序:配送费 / 商家打赏 / 用户打赏
allTypes.forEach(type => {
if (!existSet.has(type)) {
order.details.push({
id: `${order.order_no}_${type}`, // 唯一 key
date: order.date,
amount: 0,
source: type,
order_no: order.order_no,
distance: order.distance
})
}
})
// 按固定顺序排个序(可选)
order.details.sort((a, b) =>
allTypes.indexOf(a.source as any) - allTypes.indexOf(b.source as any)
)
})
this.allOrderEarnings = Array.from(orderMap.values())
this.calculateTotalStats()
this.loadPage()
},
// 计算总统计数据
calculateTotalStats() {
let totalEarnings = 0
let totalUserTips = 0
let totalMerchantTips = 0
this.allOrderEarnings.forEach(order => {
order.details.forEach(detail => {
totalEarnings += detail.amount || 0
if (detail.source === 'user_tip') {
totalUserTips += detail.amount || 0
} else if (detail.source === 'merchant_tip') {
totalMerchantTips += detail.amount || 0
}
})
})
this.totalEarnings = totalEarnings.toFixed(2)
this.totalUserTips = totalUserTips.toFixed(2)
this.totalMerchantTips = totalMerchantTips.toFixed(2)
this.totalOrders = this.allOrderEarnings.length
},
// 加载当前页数据
loadPage() {
const start = (this.currentPage - 1) * this.pageSize
const end = start + this.pageSize
const newOrders = this.allOrderEarnings.slice(start, end)
this.orderEarningsList.push(...newOrders)
},
// 加载更多
loadMoreEarnings() {
this.currentPage++
this.loadPage()
},
// 获取收入来源文本
getSourceText(source: string): string {
switch (source) {
case 'delivery_fee': return '配送费'
case 'user_tip': return '用户打赏'
case 'merchant_tip': return '商家打赏'
default: return '其他'
}
},
// 格式化时间
formatTime(timeStr: string): string {
const date = new Date(timeStr)
const now = new Date()
const diff = now.getTime() - date.getTime()
const minutes = Math.floor(diff / (1000 * 60))
if (minutes < 60) {
return `${minutes}分钟前`
} else {
return `${Math.floor(minutes / 60)}小时前`
}
},
// 返回主页
goBackToHome() {
uni.reLaunch({
url: '/pages/mall/delivery/index'
})
}
}
}
// 定义聚合后的订单收入类型
type OrderEarningType = {
order_no: string
date: string
distance?: number
totalAmount: number
details: Array<EarningType>
}
type EarningType = {
id: string
date: string
amount?: number
source: 'delivery_fee' | 'user_tip' | 'merchant_tip' | string
order_no?: string
distance?: number
}
</script>
<style>
/* 全局样式 */
.earnings-container {
background-color: #f5f5f5;
min-height: 100vh;
padding: 20rpx 30rpx;
}
.page-header {
background-color: #fff;
padding: 20rpx 30rpx;
border-bottom: 1rpx solid #e9ecef;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
position: relative;
min-height: 80rpx; /* 确保有足够空间放垂直排列的按钮和标题 */
}
.nav-left {
position: absolute;
top: 20rpx;
left: 30rpx;
display: flex;
flex-direction: column;
align-items: center;
cursor: pointer;
}
.nav-icon {
font-size: 36rpx;
margin-right: 10rpx;
color: #333;
}
.nav-title {
font-size: 28rpx;
color: #000000; /* 红色 */
font-weight: 500;
}
.page-title {
font-size: 32rpx;
font-weight: bold;
color: #333; /* 黑色 */
text-align: center;
margin-top: 20rpx; /* 与 nav-left 保持一定距离 */
}
.nav-right {
/* 为了保持左右对齐,右侧需要一个占位元素 */
width: 1rpx;
height: 1rpx;
}
.stats-section {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 20rpx;
margin: 20rpx;
padding: 20rpx;
background-color: #fff;
border-radius: 16rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
}
.stat-card {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 20rpx;
background-color: #f8f9fa;
border-radius: 12rpx;
}
.stat-value {
font-size: 36rpx;
font-weight: bold;
color: #4CAF50;
margin-bottom: 10rpx;
}
.stat-label {
font-size: 24rpx;
color: #666;
text-align: center;
}
.content-wrapper {
margin-top: 20rpx;
}
.order-earnings-list {
display: flex;
flex-direction: column;
gap: 20rpx;
}
.order-earnings-item {
background-color: #fff;
border-radius: 16rpx;
padding: 20rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
border-left: 6rpx solid #4CAF50;
}
.order-total {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15rpx;
}
.order-total-label {
font-size: 28rpx;
font-weight: 500;
color: #333;
}
.order-total-amount {
font-size: 32rpx;
font-weight: bold;
color: #4CAF50;
}
.order-info {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
gap: 10rpx;
font-size: 24rpx;
color: #666;
margin-bottom: 15rpx;
padding-bottom: 10rpx;
border-bottom: 1rpx solid #f0f0f0;
}
.info-item {
flex: 1 1 45%;
min-width: 120rpx;
word-break: break-all;
}
.earning-details {
display: flex;
flex-direction: column;
gap: 10rpx;
}
.detail-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8rpx 12rpx;
border-radius: 8rpx;
background-color: #f8f9fa;
}
.detail-type {
font-size: 24rpx;
color: #555;
}
.detail-amount {
font-size: 24rpx;
color: #4CAF50;
font-weight: 500;
}
.load-more {
text-align: center;
margin-top: 20rpx;
}
.load-more-btn {
background-color: #4CAF50;
color: #fff;
border: none;
border-radius: 8rpx;
padding: 20rpx 40rpx;
font-size: 28rpx;
font-weight: bold;
cursor: pointer;
transition: background-color 0.2s ease;
}
.load-more-btn:hover {
background-color: #45a049; /* 按钮悬停效果 */
}
.load-more-btn:active {
background-color: #3d8b40; /* 按钮点击效果 */
}
.no-data {
text-align: center;
padding: 80rpx 30rpx;
border-radius: 16rpx;
background-color: #fff;
}
.no-data-text {
font-size: 32rpx;
color: #999;
margin-bottom: 15rpx;
}
</style>

View File

@@ -0,0 +1,494 @@
<template>
<view class="settings-container">
<!-- 顶部导航栏 -->
<view class="header-bar">
<view class="nav-left" @click="goBack">
<text class="nav-icon">←</text>
<text class="nav-title">设置</text>
</view>
</view>
<!-- 设置列表 -->
<scroll-view class="settings-list" scroll-y="true">
<!-- 基础设置 -->
<view class="setting-section">
<text class="section-title">基础设置</text>
<view class="setting-item" @click="toggleDarkMode">
<text class="item-label">深色模式</text>
<switch :checked="darkModeEnabled" color="#4CAF50" />
</view>
<view class="setting-item" @click="toggleAutoUpdate">
<text class="item-label">自动更新</text>
<switch :checked="autoUpdateEnabled" color="#4CAF50" />
</view>
<view class="setting-item" @click="openLanguagePicker">
<text class="item-label">语言</text>
<text class="item-value">{{ selectedLanguage }}</text>
<text class="item-arrow"></text>
</view>
</view>
<!-- 通知设置 -->
<view class="setting-section">
<text class="section-title">通知设置</text>
<view class="setting-item" @click="toggleOrderNotifications">
<text class="item-label">订单通知</text>
<switch :checked="orderNotificationsEnabled" color="#4CAF50" />
</view>
<view class="setting-item" @click="toggleSystemNotifications">
<text class="item-label">系统通知</text>
<switch :checked="systemNotificationsEnabled" color="#4CAF50" />
</view>
<view class="setting-item" @click="openNotificationTimeRange">
<text class="item-label">通知时段</text>
<text class="item-value">{{ notificationTimeRange }}</text>
<text class="item-arrow"></text>
</view>
</view>
<!-- 隐私与安全 -->
<view class="setting-section">
<text class="section-title">隐私与安全</text>
<view class="setting-item" @click="openPasswordChange">
<text class="item-label">修改密码</text>
<text class="item-arrow"></text>
</view>
<view class="setting-item" @click="toggleLocationSharing">
<text class="item-label">位置共享</text>
<switch :checked="locationSharingEnabled" color="#4CAF50" />
</view>
<view class="setting-item" @click="clearCache">
<text class="item-label">清除缓存</text>
<text class="item-value">{{ cacheSize }}</text>
<text class="item-arrow"></text>
</view>
</view>
<!-- 关于与帮助 -->
<view class="setting-section">
<text class="section-title">关于与帮助</text>
<view class="setting-item" @click="openAboutPage">
<text class="item-label">关于我们</text>
<text class="item-value">{{ appVersion }}</text>
<text class="item-arrow"></text>
</view>
<view class="setting-item" @click="openHelpCenter">
<text class="item-label">帮助中心</text>
<text class="item-arrow"></text>
</view>
<view class="setting-item" @click="openFeedback">
<text class="item-label">意见反馈</text>
<text class="item-arrow"></text>
</view>
</view>
<!-- 登出按钮 -->
<view class="logout-section">
<button class="logout-btn" @click="logout">退出登录</button>
</view>
</scroll-view>
<!-- 语言选择弹窗 -->
<view v-if="showLanguagePicker" class="picker-overlay" @click="closeLanguagePicker">
<view class="picker-panel" @click.stop="noop">
<text class="picker-title">选择语言</text>
<scroll-view scroll-y="true" class="picker-options">
<view v-for="(lang, index) in languageOptions" :key="index"
class="picker-option"
:class="{ 'picker-option-selected': selectedLanguage === lang.label }"
@click="selectLanguage(lang)">
<text>{{ lang.label }}</text>
</view>
</scroll-view>
<view class="picker-actions">
<button size="mini" @click="closeLanguagePicker">取消</button>
<button size="mini" type="primary" @click="confirmLanguageSelection">确定</button>
</view>
</view>
</view>
<!-- 通知时段选择弹窗 -->
<view v-if="showTimeRangePicker" class="picker-overlay" @click="closeTimeRangePicker">
<view class="picker-panel" @click.stop="noop">
<text class="picker-title">选择通知时段</text>
<view class="time-range-picker">
<text class="range-label">从</text>
<picker mode="time" :value="startTime" @change="onStartTimeChange">
<view class="time-input">{{ startTime }}</view>
</picker>
<text class="range-label">到</text>
<picker mode="time" :value="endTime" @change="onEndTimeChange">
<view class="time-input">{{ endTime }}</view>
</picker>
</view>
<view class="picker-actions">
<button size="mini" @click="closeTimeRangePicker">取消</button>
<button size="mini" type="primary" @click="confirmTimeRange">确定</button>
</view>
</view>
</view>
</view>
</template>
<script lang="uts">
type LanguageOption = {
value: string
label: string
}
export default {
data() {
return {
darkModeEnabled: false,
autoUpdateEnabled: true,
orderNotificationsEnabled: true,
systemNotificationsEnabled: true,
locationSharingEnabled: true,
selectedLanguage: '简体中文',
languageOptions: [
{ value: 'zh-CN', label: '简体中文' },
{ value: 'en-US', label: 'English' },
{ value: 'ja-JP', label: '日本語' },
{ value: 'ko-KR', label: '한국어' }
] as Array<LanguageOption>,
showLanguagePicker: false,
notificationTimeRange: '全天接收',
startTime: '08:00',
endTime: '22:00',
showTimeRangePicker: false,
cacheSize: '15.2 MB',
appVersion: 'v1.2.3'
}
},
methods: {
goBack() {
uni.navigateBack()
},
toggleDarkMode() {
this.darkModeEnabled = !this.darkModeEnabled
// TODO: 保存设置到本地存储或同步到服务器
console.log('Dark mode toggled:', this.darkModeEnabled)
},
toggleAutoUpdate() {
this.autoUpdateEnabled = !this.autoUpdateEnabled
console.log('Auto update toggled:', this.autoUpdateEnabled)
},
toggleOrderNotifications() {
this.orderNotificationsEnabled = !this.orderNotificationsEnabled
console.log('Order notifications toggled:', this.orderNotificationsEnabled)
},
toggleSystemNotifications() {
this.systemNotificationsEnabled = !this.systemNotificationsEnabled
console.log('System notifications toggled:', this.systemNotificationsEnabled)
},
toggleLocationSharing() {
this.locationSharingEnabled = !this.locationSharingEnabled
console.log('Location sharing toggled:', this.locationSharingEnabled)
},
openLanguagePicker() {
this.showLanguagePicker = true
},
closeLanguagePicker() {
this.showLanguagePicker = false
},
selectLanguage(lang: LanguageOption) {
// 可以在这里高亮选中项,但确认还需点击确定
this.selectedLanguage = lang.label
},
confirmLanguageSelection() {
// 实际应用中,这里会保存选中的语言设置
console.log('Language confirmed:', this.selectedLanguage)
this.closeLanguagePicker()
// TODO: 调用API或本地存储更新语言设置
},
openNotificationTimeRange() {
this.showTimeRangePicker = true
},
closeTimeRangePicker() {
this.showTimeRangePicker = false
},
onStartTimeChange(e: UniEvent<HTMLInputElement>) {
this.startTime = e.detail.value
},
onEndTimeChange(e: UniEvent<HTMLInputElement>) {
this.endTime = e.detail.value
},
confirmTimeRange() {
this.notificationTimeRange = `${this.startTime} - ${this.endTime}`
console.log('Time range confirmed:', this.notificationTimeRange)
this.closeTimeRangePicker()
},
openPasswordChange() {
uni.navigateTo({
url: '/pages/mall/delivery/change-password'
})
},
clearCache() {
// TODO: 调用API或本地方法清除缓存
uni.showModal({
title: '清除缓存',
content: `确定要清除 ${this.cacheSize} 的缓存吗?`,
success: (res) => {
if (res.confirm) {
console.log('Cache cleared')
this.cacheSize = '0.0 MB'
uni.showToast({ title: '缓存已清除', icon: 'success' })
}
}
})
},
openAboutPage() {
uni.navigateTo({
url: '/pages/mall/delivery/about'
})
},
openHelpCenter() {
uni.navigateTo({
url: '/pages/mall/delivery/help-center'
})
},
openFeedback() {
uni.navigateTo({
url: '/pages/mall/delivery/feedback'
})
},
logout() {
uni.showModal({
title: '退出登录',
content: '确定要退出当前账号吗?',
success: (res) => {
if (res.confirm) {
// TODO: 调用登出API
console.log('Logging out...')
uni.reLaunch({
url: '/pages/user/login'
})
}
}
})
},
noop() {
// 阻止事件冒泡的空函数
}
}
}
</script>
<style>
.settings-container {
background-color: #f8f9fa;
min-height: 100vh;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.header-bar {
background-color: #fff;
padding: 20rpx 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1rpx solid #e9ecef;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
}
.nav-left {
display: flex;
align-items: center;
}
.nav-icon {
font-size: 36rpx;
margin-right: 10rpx;
color: #333;
}
.nav-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
}
.settings-list {
flex: 1;
padding: 20rpx 0;
}
.setting-section {
background-color: #fff;
margin: 20rpx;
padding: 0 30rpx;
border-radius: 16rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
}
.section-title {
font-size: 28rpx;
color: #999;
padding: 20rpx 0 10rpx 0;
border-bottom: 1rpx solid #f0f0f0;
}
.setting-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20rpx 0;
border-bottom: 1rpx solid #f8f9fa;
}
.setting-item:last-child {
border-bottom: none;
}
.item-label {
font-size: 28rpx;
color: #333;
flex: 1;
}
.item-value {
font-size: 26rpx;
color: #999;
margin-right: 10rpx;
}
.item-arrow {
font-size: 28rpx;
color: #ccc;
}
.logout-section {
margin: 40rpx 20rpx 20rpx 20rpx;
}
.logout-btn {
width: 100%;
height: 80rpx;
background-color: #f44336;
color: #fff;
border-radius: 12rpx;
font-size: 32rpx;
font-weight: bold;
border: none;
}
/* 弹窗遮罩 */
.picker-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
z-index: 1000;
}
.picker-panel {
background-color: #fff;
width: 80%;
max-width: 600rpx;
border-radius: 16rpx;
overflow: hidden;
}
.picker-title {
display: block;
text-align: center;
padding: 20rpx;
font-size: 32rpx;
font-weight: bold;
color: #333;
border-bottom: 1rpx solid #eee;
}
.picker-options {
max-height: 400rpx;
}
.picker-option {
padding: 20rpx 30rpx;
font-size: 28rpx;
color: #333;
border-bottom: 1rpx solid #f8f9fa;
}
.picker-option:last-child {
border-bottom: none;
}
.picker-option-selected {
background-color: #E8F5E8;
color: #4CAF50;
font-weight: bold;
}
.time-range-picker {
display: flex;
align-items: center;
justify-content: space-around;
padding: 30rpx;
}
.range-label {
font-size: 28rpx;
color: #666;
}
.time-input {
font-size: 28rpx;
padding: 10rpx 20rpx;
border: 1rpx solid #ddd;
border-radius: 8rpx;
background-color: #f9f9f9;
margin: 0 10rpx;
}
.picker-actions {
display: flex;
justify-content: space-around;
padding: 20rpx;
border-top: 1rpx solid #eee;
}
</style>