houseList.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <view class="house-list">
  3. <view class="house-item" v-for="(item,index) in houseList" :key="index"
  4. @click="$navigateTo('/pages/houseDetail/houseDetail?id='+item.id)">
  5. <view class="house-item-box">
  6. <view class="house-item-img">
  7. <image :src="item.privewImage" mode="aspectFill"></image>
  8. <view class="house-item-floor">
  9. <uni-icons type="location" color="#fff" size="12"></uni-icons>
  10. <text>{{item.projectItemName}}-{{item.projectItemTargetName}}</text>
  11. </view>
  12. </view>
  13. <view class="house-item-info">
  14. <view class="house-item-name">{{item.name}}</view>
  15. <view class="house-item-tag">
  16. <text v-for="(tag,i) in item.tagList" :key="i">
  17. <text>{{tag.name}}</text>
  18. <text class="line" v-if="i < item.tagList.length-1">|</text>
  19. </text>
  20. </view>
  21. <view class="house-item-price">
  22. <text>{{item.price}}</text>
  23. <view class="price-type">/{{item.payType === 0 ? '月' : '年'}}</view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. export default {
  32. name: 'houseList',
  33. props: {
  34. list: {
  35. type: Array,
  36. default: () => {
  37. return []
  38. }
  39. },
  40. },
  41. data() {
  42. return {
  43. houseList: []
  44. }
  45. },
  46. created() {
  47. this.houseList = this.list;
  48. },
  49. onLoad() {
  50. },
  51. watch: {
  52. list() {
  53. this.houseList = this.list;
  54. }
  55. },
  56. }
  57. </script>
  58. <style lang="scss">
  59. .house-list {
  60. display: flex;
  61. flex-wrap: wrap;
  62. margin-top: 30rpx;
  63. padding-bottom: 60rpx;
  64. .house-item {
  65. width: 50%;
  66. box-sizing: border-box;
  67. margin-bottom: 30rpx;
  68. &:nth-child(2n-1) {
  69. padding-right: 16rpx;
  70. }
  71. &:nth-child(2n) {
  72. padding-left: 16rpx;
  73. }
  74. .house-item-box {
  75. background: $uni-white;
  76. border-radius: 16rpx;
  77. overflow: hidden;
  78. .house-item-img {
  79. position: relative;
  80. image {
  81. width: 100%;
  82. height: 260rpx !important;
  83. }
  84. }
  85. .house-item-floor {
  86. position: absolute;
  87. left: 0;
  88. bottom: 20rpx;
  89. width: 100%;
  90. color: #FFFFFF;
  91. font-size: 24rpx;
  92. display: flex;
  93. align-items: center;
  94. padding-left: 10rpx;
  95. }
  96. .house-item-info {
  97. padding: 10rpx 0 20rpx 0;
  98. .house-item-name {
  99. font-size: 28rpx;
  100. padding: 0 20rpx;
  101. }
  102. .house-item-tag {
  103. display: flex;
  104. padding-top: 10rpx;
  105. padding-left: 20rpx;
  106. color: $uni-extra-color;
  107. overflow: hidden;
  108. white-space: nowrap;
  109. text {
  110. font-size: 24rpx;
  111. }
  112. .line {
  113. margin: 0 10rpx;
  114. }
  115. }
  116. .house-item-price {
  117. display: flex;
  118. align-items: center;
  119. padding-top: 6rpx;
  120. color: $uni-error;
  121. padding-left: 20rpx;
  122. text {
  123. font-weight: bold;
  124. font-size: 30rpx;
  125. }
  126. .price-type {
  127. display: inline-block;
  128. font-size: 24rpx;
  129. scale: 0.9;
  130. }
  131. }
  132. }
  133. }
  134. }
  135. }
  136. </style>