Files
QCN_rider/.svn/pristine/14/14a11b3f1ba4a494dd6d6c5dcc912484322fa129.svn-base
2026-02-12 12:19:20 +08:00

380 lines
8.0 KiB
Plaintext

<template>
<!-- 实际内容 -->
<view class="rider-home">
<!-- 统计数据区域 -->
<view class="stats-section">
<view class="stat-item">
<text class="stat-label">今日收入</text>
<text class="stat-value income">¥86.50</text>
</view>
<view class="stat-item">
<text class="stat-label">已完成</text>
<text class="stat-value completed">5单</text>
</view>
<view class="stat-item">
<text class="stat-label">进行中</text>
<text class="stat-value ongoing">6单</text>
</view>
</view>
<!-- 接单按钮 -->
<view class="action-section">
<up-button type="primary" shape="circle" size="default" class="accept-orders-btn"
@click="toggleAcceptOrders">{{ userStatus === '已上线' ? '接单中 · 点击暂停' : '点击开始接单' }}</up-button>
</view>
<view class="tab-bar">
<view v-for="(tab, index) in tabs" :key="index" class="tab-item" :class="{ active: activeTab === index }"
@click="switchTab(index)">
<text class="tab-text">{{ tab }}</text>
<view v-if="activeTab === index" class="active-line"></view>
</view>
</view>
<view class="" style="padding: 0 30rpx;">
<view @click="gopage()" v-for="(orderItem,orderIndex) in 3 " :key="orderIndex" class="task-section">
<!-- 高价单标签 -->
<view class="" style="display: flex; align-items: center; justify-content: space-between;">
<view class="high-price-tag" :style="{'border':activeTab==0?'1rpx solid #52C41A':'1rpx solid #FAAD14','color':activeTab==0?'#52C41A':'#FAAD14' }" style="background-color: #fff;" >
<text class="high-price-text">{{activeTab==0?'待取单':'配送中'}}</text>
</view>
<view class="" style="display: flex; align-items: baseline;">
<up-icon name="phone" color="var(--nav-mian)" size="20"></up-icon>
<text style="margin-left: 10rpx; color: var(--nav-mian); ">拨打商家</text>
</view>
</view>
<!-- 商家信息 -->
<view class="merchant-info">
<text class="merchant-name">老北京炸酱面</text>
<text v-if="activeTab==0" class="distance">500m</text>
</view>
<!-- 地址信息 -->
<view class="address-info">
<up-icon name="map" color="#999" size="24rpx" />
<text class="address-text">北京市朝阳区三里屯SOHO</text>
<text v-if="activeTab!==0" class="address-text">共3件商品</text>
</view>
<!-- 商品次数-->
<view class="address-info">
<text class="address-text">共3件商品</text>
<view class="">
<text class="price">¥5.50</text>
<text style="color: var(--nav-mian); font-weight: 600; margin-left: 10rpx; ">/单</text>
</view>
</view>
<!-- 价格和取餐时间 -->
<view class="price-time-row">
<view v-if="activeTab==0" class="">
<text style="font-size: 30rpx; font-weight: 600; color: #1890FF; ">取件码: </text>
<text style="color: var(--nav-mian); font-weight: 600; margin-left: 10rpx; ">A121</text>
</view>
<view v-if="activeTab==1" class="">
<text class="address-text">据您1.2km</text>
</view>
<view class="pickup-time">
<up-icon name="clock" color="#FF9500" size="24rpx" />
<text class="time-text" :style="{'color':activeTab==0?'#FAAD14':'#FF0000'}" >{{activeTab==0?'12:30 前取餐':'12:30 前送达'}}</text>
</view>
</view>
<!-- 立即抢单按钮 -->
<up-button type="primary" :color="activeTab==0?'#1890FF':'#52C41A'" size="large" class="grab-btn">{{ activeTab==0?'我已取餐':'确认送达'}}</up-button>
</view>
</view>
<up-loadmore :status="status" />
<view class="" style="width: 100%; height: 60rpx; ">
</view>
</view>
</template>
<script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app';
import { ref, onMounted } from 'vue';
import { Service } from '@/Service/Service';
// 加载状态
const isLoading = ref(true);
let userStatus = ref('已下线')
let status = ref('nomore')
const tabs = ['待取货', '配送中']
const activeTab = ref(0)
onLoad(() => {
setTimeout(() => {
isLoading.value = false
}, 1500)
})
// 切换标签
const switchTab = (index : number) => {
activeTab.value = index
}
// 切换接单状态
const toggleAcceptOrders = () => {
userStatus.value = userStatus.value === '已上线' ? '已下线' : '已上线';
};
// 页面跳转
const gopage = () => {
if (activeTab.value == 0) {
Service.GoPage('/pages/order/grabOrder')
} else {
Service.GoPage('/pages/order/orderDetail')
}
}
</script>
<style scoped lang="scss">
page {
background-color: #F6f6f6;
}
/* 统计数据区域 */
.stats-section {
background-color: #ffffff;
margin: 20rpx;
border-radius: 16rpx;
display: flex;
justify-content: space-around;
padding: 30rpx 0;
}
.stat-item {
display: flex;
flex-direction: column;
align-items: center;
}
.stat-label {
font-size: 28rpx;
color: #666666;
margin-bottom: 10rpx;
}
.stat-value {
font-size: 36rpx;
font-weight: 600;
}
.income {
color: var(--nav-diluted);
}
.completed {
color: var(--nav-vice);
}
.ongoing {
color: #FF9500;
}
/* 接单按钮 */
.action-section {
margin: 0 20rpx;
}
.accept-orders-btn {
width: 100%;
height: 90rpx;
font-size: 32rpx;
background-color: #52C41A;
}
/* 顶部标签栏 */
.tab-bar {
margin-top: 20rpx;
display: flex;
background-color: #FFFFFF;
padding: 20rpx 0 0;
border-bottom: 1rpx solid #E5E5E5;
width: 100vw;
background-color: #fff;
}
.tab-item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
padding: 20rpx 0;
position: relative;
}
.tab-text {
font-size: 28rpx;
color: #666666;
}
.tab-item.active .tab-text {
color: var(--nav-mian);
font-weight: 600;
}
.active-line {
position: absolute;
bottom: 0;
width: 110rpx;
height: 6rpx;
background-color: var(--nav-mian);
border-radius: 3rpx;
}
.task-section {
margin-top: 20rpx;
display: flex;
flex-direction: column;
background-color: #fff;
border-radius: 20rpx;
padding: 20rpx;
}
/* 标签样式 */
.high-price-tag {
width: fit-content;
background-color: #FF7875;
color: #FFFFFF;
padding: 5rpx 20rpx;
border-radius: 20rpx;
font-size: 24rpx;
display: flex;
align-items: center;
}
.status-tag {
position: absolute;
top: 20rpx;
left: 20rpx;
padding: 5rpx 20rpx;
border-radius: 20rpx;
font-size: 24rpx;
z-index: 10;
}
.status-tag.pending {
background-color: #4CD964;
color: #FFFFFF;
}
.status-tag.delivering {
background-color: #FF9500;
color: #FFFFFF;
}
/* 右侧操作按钮 */
.right-action {
position: absolute;
top: 20rpx;
right: 20rpx;
}
.call-btn {
padding: 5rpx 15rpx;
font-size: 24rpx;
line-height: 36rpx;
}
/* 信息展示 */
.merchant-info {
margin-top: 20rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.merchant-name {
font-size: 34rpx;
font-weight: 600;
color: #333333;
}
.distance {
font-size: 28rpx;
color: #666666;
}
.address-info {
display: flex;
align-items: baseline;
margin-top: 15rpx;
}
.address-text {
margin-left: 10rpx;
font-size: 28rpx;
color: #666666;
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* 价格和时间 */
.price-time-row {
margin-top: 20rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.price {
font-size: 36rpx;
font-weight: 600;
color: #FF3B30;
}
.pickup-code {
font-size: 28rpx;
color: #333333;
font-weight: 500;
}
.pickup-time {
display: flex;
align-items: center;
}
.time-text {
margin-left: 8rpx;
font-size: 26rpx;
}
/* 按钮样式 */
.grab-btn {
margin-top: 25rpx;
height: 80rpx;
line-height: 80rpx;
border-radius: 40rpx;
}
.grab-btn {
background-color: #007AFF;
}
/* uview组件样式覆盖 */
::v-deep .u-button--primary {
background-color: var(--nav-vice);
border-color: var(--nav-vice);
}
::v-deep .u-button--mini {
background-color: var(--nav-mian);
border-color: var(--nav-mian);
}
</style>