2025-08-13 11:10:19 +08:00
|
|
|
<template>
|
|
|
|
|
<view class="equipment-section">
|
|
|
|
|
<view class="section-title">{{ title }}</view>
|
2025-08-22 16:33:20 +08:00
|
|
|
<view v-if="!equipmentList || equipmentList.length === 0" class="empty-state">
|
|
|
|
|
<text class="empty-text">目前暂无租赁设备</text>
|
|
|
|
|
<button @click="goToLease">去租赁设备</button>
|
|
|
|
|
</view>
|
|
|
|
|
<view v-else class="equipment-list">
|
2025-08-13 11:10:19 +08:00
|
|
|
<view
|
|
|
|
|
v-for="equipment in equipmentList"
|
|
|
|
|
:key="equipment.id"
|
|
|
|
|
class="equipment-item"
|
|
|
|
|
@click="onEquipmentClick(equipment)"
|
|
|
|
|
>
|
2025-08-19 09:09:46 +08:00
|
|
|
<image :src="equipment.image" class="equipment-image" mode="aspectFit"></image>
|
2025-08-13 11:10:19 +08:00
|
|
|
<view class="equipment-info">
|
|
|
|
|
<view class="equipment-header">
|
|
|
|
|
<text class="equipment-name">{{ equipment.name }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="equipment-details">
|
|
|
|
|
<view class="detail-item-row">
|
|
|
|
|
<text class="detail-item-time">租赁时间:</text>
|
|
|
|
|
<text class="detail-item">{{ equipment.startTime }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="detail-item-row">
|
|
|
|
|
<text class="detail-item-time">到期时间:</text>
|
|
|
|
|
<text class="detail-item">{{ equipment.endTime }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<button class="renew-btn" @click.stop="onRenew(equipment)">去续费</button>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2025-08-22 16:33:20 +08:00
|
|
|
import lease from '../../pages/lease/lease.vue'
|
|
|
|
|
|
2025-08-13 11:10:19 +08:00
|
|
|
export default {
|
|
|
|
|
name: 'EquipmentList',
|
|
|
|
|
props: {
|
|
|
|
|
title: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: '我的租赁设备',
|
|
|
|
|
},
|
|
|
|
|
equipmentList: {
|
|
|
|
|
type: Array,
|
|
|
|
|
default: () => [],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
getStatusText(status) {
|
|
|
|
|
const statusMap = {
|
2025-08-19 08:58:59 +08:00
|
|
|
available: '可租用',
|
|
|
|
|
rented: '已出租',
|
|
|
|
|
maintenance: '维护中',
|
|
|
|
|
scrapped: '报废',
|
2025-08-13 11:10:19 +08:00
|
|
|
normal: '正常',
|
|
|
|
|
warning: '警告',
|
|
|
|
|
error: '异常',
|
|
|
|
|
}
|
|
|
|
|
return statusMap[status] || '未知'
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onEquipmentClick(equipment) {
|
|
|
|
|
this.$emit('equipment-click', equipment)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onRenew(equipment) {
|
|
|
|
|
this.$emit('renew', equipment)
|
|
|
|
|
},
|
2025-08-22 16:33:20 +08:00
|
|
|
|
|
|
|
|
goToLease() {
|
|
|
|
|
uni.switchTab({
|
|
|
|
|
url: '/pages/lease/lease', // 注意路径需以/开头
|
|
|
|
|
})
|
|
|
|
|
},
|
2025-08-13 11:10:19 +08:00
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2025-08-22 16:33:20 +08:00
|
|
|
.empty-state {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
|
|
|
|
button {
|
|
|
|
|
margin-top: 30rpx;
|
|
|
|
|
color: #fff;
|
|
|
|
|
background: #f15a04;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-13 11:10:19 +08:00
|
|
|
.equipment-section {
|
|
|
|
|
padding: 0 30rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.section-title {
|
|
|
|
|
width: 180rpx;
|
|
|
|
|
height: 33rpx;
|
|
|
|
|
background: #ffffff;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
color: #3d3d3d;
|
|
|
|
|
margin-bottom: 20rpx;
|
|
|
|
|
padding: 14rpx 20rpx;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.equipment-list {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: 20rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.equipment-item {
|
|
|
|
|
background: #fff;
|
|
|
|
|
border-radius: 20rpx;
|
|
|
|
|
padding: 30rpx;
|
|
|
|
|
display: flex;
|
|
|
|
|
gap: 30rpx;
|
|
|
|
|
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1);
|
|
|
|
|
transition: all 0.3s ease;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
|
|
.equipment-image {
|
|
|
|
|
width: 160rpx;
|
|
|
|
|
height: 106rpx;
|
|
|
|
|
border-radius: 10rpx;
|
|
|
|
|
background-color: #f8f9fa;
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.equipment-item:active {
|
|
|
|
|
transform: scale(0.98);
|
|
|
|
|
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.15);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.equipment-info {
|
|
|
|
|
flex: 1;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.equipment-header {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
margin-bottom: 15rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.equipment-name {
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
color: #3d3d3d;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.status-badge {
|
|
|
|
|
padding: 4rpx 26rpx;
|
|
|
|
|
border-radius: 5rpx;
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
color: #40c186;
|
|
|
|
|
|
2025-08-19 08:58:59 +08:00
|
|
|
&.available {
|
|
|
|
|
background-color: #e6f7ff;
|
|
|
|
|
color: #1890ff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.rented {
|
|
|
|
|
background-color: #ebfff6;
|
|
|
|
|
color: #40c186;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.maintenance {
|
|
|
|
|
background-color: #fff7e6;
|
|
|
|
|
color: #fa8c16;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.scrapped {
|
|
|
|
|
background-color: #fff1f0;
|
|
|
|
|
color: #ff4d4f;
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-13 11:10:19 +08:00
|
|
|
&.normal {
|
|
|
|
|
background-color: #ebfff6;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.warning {
|
|
|
|
|
background-color: #faad14;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.error {
|
|
|
|
|
background-color: #ff4d4f;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.equipment-details {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: 8rpx;
|
|
|
|
|
margin-bottom: 15rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.detail-item-row {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
|
|
|
|
.detail-item-time {
|
|
|
|
|
color: #817f7f;
|
|
|
|
|
font-size: 26rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.detail-item {
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
color: #666;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.renew-btn {
|
|
|
|
|
margin-right: 0;
|
|
|
|
|
background: #f15a04;
|
|
|
|
|
color: #fff;
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
padding: 0 57rpx;
|
|
|
|
|
font-size: 32rpx;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
margin-top: 10rpx;
|
|
|
|
|
}
|
|
|
|
|
</style>
|