Zlpt_Portal/src/components/equipCardHall/index.vue

243 lines
5.8 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="equipCard" @click="cardClick">
<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>
<!-- <span>{{ typeName }}</span> -->
<span class="item_2_span">
{{ manageMode == '0' ? statusText : `在库数量: ${deviceCount}` }}
</span>
</li>
<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>
<span>{{ person }}</span> {{ personPhone }}
</li>
</ul>
<div style="margin: 10px 0; padding-right: 15px; text-align: right">
<span style="text-align: right; color: #ff4800" v-if="isShowPrice">
<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>
import { computed } from 'vue'
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: '',
},
person: {
type: String,
default: '',
},
personPhone: {
type: String,
default: '',
},
typeName: {
type: String,
default: '',
},
ma_status: {
type: [String, Number],
default: '',
},
manageMode: {
type: [String, Number],
default: '',
},
deviceCount: {
type: [String, Number],
default: '',
},
price: {
type: [String, Number],
default: '',
},
})
const emit = defineEmits(['onClick'])
const cardClick = () => {
const data = {
id: props.id,
}
emit('onClick', data)
}
const onHandelLessee = () => {
console.log('立即租赁')
}
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 '未知'
}
})
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 {
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 {
font-size: 20px;
font-weight: bold;
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;
font-weight: 400;
color: #005af2;
padding: 2px 3px;
border: 1px solid #005af2;
margin-right: 10px;
border-radius: 4px;
}
}
.company {
margin-top: 10px;
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>