roomCard.vue
2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!--
* @Date: 2023-12-13 13:42:23
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-12-21 11:09:22
* @FilePath: /meihuaApp/src/components/roomCard.vue
* @Description: 房间详情组件
-->
<template>
<view class="room-card-component" @tap="handleTap">
<image class="room-cover" mode="aspectFill" src="https://cdn.ipadbiz.cn/meihua/img1@2x.png" />
<view class="room-info">
<nut-row>
<nut-col span="18" class="room-info-left">
<view class="room-info-title">非凡魅力豪华总统套房</view>
<view class="room-info-desc">两室 宜住3人</view>
</nut-col>
<nut-col span="6" class="room-info-right">
<view class="room-info-discount">¥980</view>
<view class="room-info-price">¥1280</view>
</nut-col>
</nut-row>
</view>
<view class="room-status">
<view class="room-status-wrapper">
<image mode="aspectFill" src="https://cdn.ipadbiz.cn/meihua/icon_checked@2x.png" />
</view>
</view>
</view>
</template>
<script setup>
import { ref, defineProps, onMounted } from 'vue'
import Taro from '@tarojs/taro'
const props = defineProps({
data: {
type: Object,
default: {},
},
});
const handleTap = () => {
Taro.navigateTo({
url: '../detail/index?id=123',
})
}
onMounted(() => {
console.warn('房间详情的属性', props.data);
})
</script>
<style lang="less">
.room-card-component {
position: relative;
margin: 1rem;
background-color: white;
box-shadow: 0px 0px 8px 0px rgba(0,0,0,0.1);
border: 1px solid #f9f9f9;
border-radius: 0.5rem;
overflow: hidden;
.room-cover {
width: 100%;
height: 10rem;
}
.room-info {
padding: 0.5rem;
.room-info-left {
.room-info-title {
color: #0B0B0B; font-weight: bold;
}
.room-info-desc {
color: #7D7C7C; font-size: 0.8rem;
}
}
.room-info-right {
.room-info-discount {
float: right;
color: #EB2E2E;
font-weight: bold;
font-size: 1.1rem;
}
.room-info-price {
float: right;
color: #7D7C7C;
font-size: 0.8rem;
text-decoration: line-through;
}
}
}
.room-status {
width: 100%;
height: 10rem;
position: absolute;
left: 0;
top: 0;
background-color: rgba(0, 0, 0, 0.5);
.room-status-wrapper {
position: absolute; left: calc(50% - 200rpx / 2); right: 0; top: 50rpx;
image {
width: 200rpx;
height: 200rpx;
}
}
}
}
</style>