houseItem.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <view class="house-item" @click="$navigateTo('/pages/house/house?houseId=' + house.id)">
  3. <view class="house-image">
  4. <image class="image" :src="imageUrl(house.showPicture)" mode="aspectFill">
  5. </image>
  6. </view>
  7. <view class="house-level">9.1</view>
  8. <view class="house-content">
  9. <view class="title">{{house.name}}</view>
  10. <view class="space">
  11. {{house.projectName}}/{{house.projectItemName}}/{{house.projectItemTargetName}}/{{house.roomNumber}}
  12. </view>
  13. <view class="tag">
  14. <text style="margin-right: 6rpx;">{{house.area}}m²</text>
  15. <text v-for="(tag,index) in house.tagList" :key="index"> | {{tag.name || '-'}}</text>
  16. </view>
  17. <view class="pirce">
  18. <text class="number">{{house.price}}</text>
  19. <text class="label">/月</text>
  20. </view>
  21. <view class="location">{{house.distance || '-'}}km</view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. props: {
  28. house: {
  29. type: Object,
  30. default: () => {
  31. return {}
  32. }
  33. },
  34. },
  35. data() {
  36. return {}
  37. },
  38. methods: {
  39. imageUrl(data) {
  40. if (!data) return 'https://assets.api.uizard.io/api/cdn/stream/c05650d2-192b-4a56-ae97-05638f53804c.png';
  41. return JSON.parse(data)[0].url;
  42. }
  43. },
  44. }
  45. </script>
  46. <style lang="scss">
  47. .house-item {
  48. width: 100%;
  49. padding: 30rpx;
  50. background: #fff;
  51. border-radius: 16rpx;
  52. box-sizing: border-box;
  53. position: relative;
  54. box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.08);
  55. margin-bottom: 30rpx;
  56. .house-level {
  57. position: absolute;
  58. top: 50rpx;
  59. right: 50rpx;
  60. color: $uni-warning;
  61. font-weight: bold;
  62. background: rgba(255, 255, 255, 0.7);
  63. width: 80rpx;
  64. text-align: center;
  65. height: 40rpx;
  66. line-height: 40rpx;
  67. border-radius: 40rpx;
  68. }
  69. .house-image {
  70. height: 400rpx;
  71. width: 100%;
  72. overflow: hidden;
  73. border-radius: 8px;
  74. }
  75. .title {
  76. font-size: 20px;
  77. font-weight: 600;
  78. padding: 20rpx 0 10rpx 0;
  79. }
  80. .space {
  81. font-weight: 300;
  82. color: $uni-secondary-color;
  83. }
  84. .tag {
  85. font-size: 24rpx;
  86. font-weight: 300;
  87. color: $uni-secondary-color;
  88. padding: 12rpx 0;
  89. }
  90. .pirce {
  91. color: $uni-primary;
  92. .number {
  93. font-weight: 600;
  94. font-size: 48rpx;
  95. }
  96. .label {
  97. font-size: 24rpx;
  98. }
  99. }
  100. .location {
  101. font-size: 24rpx;
  102. color: $uni-secondary-color;
  103. position: absolute;
  104. bottom: 40rpx;
  105. right: 40rpx;
  106. }
  107. }
  108. </style>