Zlpt_Portal/src/components/equipCardHall/index.vue

243 lines
5.8 KiB
Vue
Raw Normal View History

<template>
<div class="equipCard" @click="cardClick">
2025-12-17 14:38:41 +08:00
<img v-if="url" :src="url" alt="" />
<img v-else src="@/assets/img/no-img.png" alt="" />
<ul class="item-details">
<li style="margin: 10px 0">
<span class="item_1_span"> {{ name }} </span>
2025-12-16 17:47:50 +08:00
<!-- <span>{{ typeName }}</span> -->
2025-12-12 17:11:49 +08:00
<span class="item_2_span">
{{ manageMode == '0' ? statusText : `在库数量: ${deviceCount}` }}
</span>
</li>
2024-12-23 13:52:38 +08:00
<li style="color: #b6b6b6; font-size: 14px">{{ company }}</li>
<li style="color: #b6b6b6; font-size: 14px">
<el-icon style="margin-right: 3px; color: #25ac9c"><PhoneFilled /></el-icon>
2025-12-18 10:42:13 +08:00
<span>{{ person }}</span> {{ personPhone }}
</li>
</ul>
2025-12-12 17:11:49 +08:00
<div style="margin: 10px 0; padding-right: 15px; text-align: right">
<span style="text-align: right; color: #ff4800" v-if="isShowPrice">
2024-12-23 13:52:38 +08:00
<i style="font-size: 14px"></i>
<i style="margin: 0 6px; font-size: 18px; font-weight: bold">{{ price }}</i>
<i style="font-size: 14px">/ </i>
</span>
</div>
</div>
</template>
<script lang="ts" setup>
2025-10-14 18:25:44 +08:00
import { computed } from 'vue'
2025-12-12 17:11:49 +08:00
import { getPriceShowConfigApi } from 'http/api/common'
const isShowPrice = ref(false) // 是否显示价格
const props: any = defineProps({
url: {
type: String,
default:
'https://img1.baidu.com/it/u=2080801041,3349735074&fm=253&app=120&size=w931&n=0&f=JPEG&fmt=auto?sec=1701536400&t=117e17eae3082b7b524f890245f7826f',
},
name: {
type: String,
default: '测试装备',
},
tags: {
type: Array,
default: ['待租', '合肥市'],
},
company: {
type: String,
default: '安徽某科技有限公司',
},
timeUnit: {
type: String,
default: '月',
},
id: {
type: [String, Number],
default: '',
},
2025-12-18 10:42:13 +08:00
person: {
type: String,
default: '',
},
personPhone: {
type: String,
default: '',
},
2024-12-26 13:57:12 +08:00
typeName: {
type: String,
default: '',
},
2025-10-14 18:25:44 +08:00
ma_status: {
type: [String, Number],
default: '',
},
2025-11-17 18:06:51 +08:00
manageMode: {
type: [String, Number],
default: '',
},
deviceCount: {
type: [String, Number],
default: '',
},
2025-12-12 17:11:49 +08:00
price: {
type: [String, Number],
default: '',
},
})
const emit = defineEmits(['onClick'])
const cardClick = () => {
const data = {
id: props.id,
}
emit('onClick', data)
}
const onHandelLessee = () => {
console.log('立即租赁')
}
2025-10-14 18:25:44 +08:00
const statusText = computed(() => {
const code = Number(props.ma_status)
switch (code) {
case 1:
return '在库中'
case 2:
return '租赁中(自用)'
case 3:
return '租赁中(共享)'
case 4:
return '已退役'
case 5:
return '维修中'
default:
return '未知'
}
})
2025-12-12 17:11:49 +08:00
const isShowPriceFun = async () => {
const res: any = await getPriceShowConfigApi()
isShowPrice.value = res?.rows[0].status == 0 ? true : false
}
isShowPriceFun()
</script>
<style lang="scss" scoped>
.equipCard {
width: 100%;
background: #f7f9fa;
display: flex;
flex-direction: column;
img {
2024-12-20 17:36:14 +08:00
height: 240px;
}
.title {
padding: 16px 2px;
font-size: 18px;
font-weight: bold;
color: #333333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.item-details {
padding: 0 10px 0 10px;
.address {
padding-right: 15px;
}
.address span {
width: 50%;
}
.item_1_span {
2024-12-23 13:52:38 +08:00
font-size: 20px;
font-weight: bold;
2025-12-16 16:25:29 +08:00
width: 210px;
}
.item_2_span {
margin-left: 20px;
padding: 4px 10px;
color: #005af2;
border-radius: 4px;
background-color: #fff;
border: 1px solid #005af2;
}
}
.item-details li {
padding: 4px 0;
display: flex;
align-items: center;
font-size: 12px;
span:first-child {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.avatar {
width: 37%;
overflow: hidden;
border-radius: 15px;
.showImg {
width: 100%;
padding-bottom: 100%;
position: relative;
img {
position: absolute;
left: 0;
top: 0;
object-fit: cover;
width: 100%;
height: 100%;
}
}
}
.desc {
box-sizing: border-box;
margin-left: 10px;
flex: 1;
overflow: hidden;
.tag {
display: flex;
margin-top: 8px;
.item {
background: white;
2024-12-23 13:52:38 +08:00
font-weight: 400;
color: #005af2;
padding: 2px 3px;
border: 1px solid #005af2;
margin-right: 10px;
border-radius: 4px;
}
}
.company {
margin-top: 10px;
2024-12-23 13:52:38 +08:00
font-weight: 400;
color: #a5a4a4;
line-height: 20px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.price {
font-weight: 400;
color: #ff4800;
margin-top: 20px;
span {
font-size: 25px;
font-weight: 600;
}
}
}
}
</style>