混凝土运输管理微信小程序、替班
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

279 lines
5.9 KiB

<template>
<view class="content">
<!-- 顶部搜索和状态切换 -->
<view class="head flex-sb sticky box-shadow-light">
<view class="flex" @click="showFilter">
<view class="mr5">
<uv-icon v-if="showFilterIcon" name="funnel" size="24" color="#666"></uv-icon>
</view>
<view v-if="showFilterText" style="font-size:28rpx">筛选</view>
<input
:class="['search-input', searchActive && 'active']"
maxlength="10"
type="text"
confirm-type="search"
@confirm="onSearch"
v-model="searchValue"
@input="onInput"
placeholder="搜索订单"
/>
</view>
<!-- 在线状态切换 -->
<view v-if="showOnlineStatus" class="flex" @click="switchToOffline">
<view style="font-size:28rpx;color:#F40000;font-weight:bolder"> · 在线 </view>
<uv-icon v-if="showOnlineIcon" name="arrow-down" size="16" color="#F40000"></uv-icon>
</view>
<view v-if="showOfflineStatus" class="flex" @click="switchToOnline">
<view style="font-size:28rpx;color:#555555;font-weight:bolder"> · 离线 </view>
<uv-icon v-if="showOfflineIcon" name="arrow-down" size="16" color="#555"></uv-icon>
</view>
</view>
<!-- 订单列表 -->
<view class="m20">
<view v-if="isEmpty" class="re-empty">
<view>暂无数据</view>
</view>
<view v-for="(item, index) in orderList" :key="index" class="b-relative item-card mb20">
<view class="m10 flex-sb">
<view class="ellipsis">{{ item.title }}</view>
<view class="item-time">{{ item.time }}</view>
</view>
<view>到场时间:{{ item.arrivalTime }}</view>
<view>计划数量:{{ item.quantity }}m³/趟</view>
<view class="item-button" @click="grabOrder(item)">去接单</view>
</view>
</view>
</view>
</template>
<script>
import navbar from '@/components/base/navbar.vue'
export default {
name: 'UserHall',
components: {
navbar
},
data() {
return {
showFilterIcon: true,
showFilterText: true,
searchActive: false,
searchValue: '',
showOnlineStatus: true,
showOfflineStatus: false,
showOnlineIcon: true,
showOfflineIcon: true,
isEmpty: false,
orderList: [
{
id: 1,
title: '长沙市雨花区建设项目',
time: '2024-01-15 08:00',
arrivalTime: '2024-01-15 09:00',
quantity: '50'
},
{
id: 2,
title: '长沙市岳麓区商业中心',
time: '2024-01-15 10:00',
arrivalTime: '2024-01-15 11:00',
quantity: '30'
},
{
id: 3,
title: '长沙市开福区住宅项目',
time: '2024-01-15 14:00',
arrivalTime: '2024-01-15 15:00',
quantity: '40'
}
]
}
},
methods: {
showFilter() {
console.log('显示筛选');
uni.showActionSheet({
itemList: ['全部订单', '泵车订单', '搅拌车订单', '车载泵订单'],
success: (res) => {
const filters = ['全部订单', '泵车订单', '搅拌车订单', '车载泵订单'];
uni.showToast({
title: `已选择:${filters[res.tapIndex]}`,
icon: 'none'
});
}
});
},
onSearch() {
console.log('搜索:', this.searchValue);
uni.showToast({
title: `搜索:${this.searchValue}`,
icon: 'none'
});
},
onInput() {
this.searchActive = this.searchValue.length > 0;
},
switchToOffline() {
this.showOnlineStatus = false;
this.showOfflineStatus = true;
uni.showToast({
title: '已切换到离线状态',
icon: 'none'
});
},
switchToOnline() {
this.showOnlineStatus = true;
this.showOfflineStatus = false;
uni.showToast({
title: '已切换到在线状态',
icon: 'success'
});
},
grabOrder(item) {
uni.showModal({
title: '确认接单',
content: `确定要接取订单:${item.title} 吗?`,
success: (res) => {
if (res.confirm) {
uni.showToast({
title: '接单成功',
icon: 'success'
});
// 跳转到订单详情页
setTimeout(() => {
uni.navigateTo({
url: `/pages_order/order/orderDetail?id=${item.id}`
});
}, 1000);
}
}
});
},
// 供外部调用的方法
loadPage() {
console.log('用户抢单大厅页面刷新');
// 重新加载订单数据
this.loadOrderData();
},
loadOrderData() {
// 模拟加载订单数据
console.log('加载订单数据');
}
}
}
</script>
<style scoped lang="scss">
.content {
padding: 20rpx;
min-height: 100vh;
background-color: #f5f5f5;
}
.head {
background-color: #fff;
padding: 20rpx;
border-radius: 10rpx;
margin-bottom: 20rpx;
}
.sticky {
position: sticky;
top: 0;
z-index: 999;
}
.box-shadow-light {
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
}
.flex {
display: flex;
align-items: center;
}
.flex-sb {
display: flex;
justify-content: space-between;
align-items: center;
}
.mr5 {
margin-right: 5rpx;
}
.search-input {
flex: 1;
height: 60rpx;
padding: 0 20rpx;
border: 1rpx solid #e0e0e0;
border-radius: 30rpx;
margin-left: 20rpx;
font-size: 28rpx;
&.active {
border-color: #007AFF;
}
}
.m20 {
margin: 20rpx 0;
}
.m10 {
margin: 10rpx 0;
}
.mb20 {
margin-bottom: 20rpx;
}
.b-relative {
position: relative;
}
.item-card {
background-color: #fff;
border-radius: 10rpx;
padding: 30rpx;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
font-size: 28rpx;
line-height: 1.6;
}
.ellipsis {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
flex: 1;
font-weight: bold;
color: #333;
}
.item-time {
font-size: 24rpx;
color: #999;
}
.item-button {
position: absolute;
right: 30rpx;
bottom: 30rpx;
background-color: #ff6b35;
color: #fff;
padding: 15rpx 25rpx;
border-radius: 25rpx;
font-size: 26rpx;
font-weight: bold;
}
.re-empty {
text-align: center;
padding: 100rpx 0;
color: #999;
font-size: 28rpx;
}
</style>