gf-goods.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <view class="gf-goods">
  3. <view :class="type == 1 ? 'row-item u-flex' : 'col-item'" @click="toinfo">
  4. <image :src="data.logo" class="item-img" mode="aspectFill"></image>
  5. <view class="item-box">
  6. <view class="item-name u-line-1">
  7. {{data.name}}
  8. </view>
  9. <view class="item-tips u-flex">
  10. <text class="u-line-1" style="white-space: nowrap;" v-if="data.house_type">{{data.house_type.join('·')}}·</text>
  11. <text style="white-space: nowrap;">{{data.house_min_area || 0}}-{{data.house_max_area || 0}}㎡</text>
  12. </view>
  13. <view class="item-tips">
  14. {{data.area}}
  15. </view>
  16. <view class="price-box u-flex">
  17. <text>参考均价</text>
  18. <text v-if="Number(data.avg_price)">{{data.avg_price}}/㎡</text>
  19. <text v-else>{{data.avg_price}}</text>
  20. </view>
  21. <view class="u-flex label-box u-flex-wrap">
  22. <text v-for="(item,index) in data.trait" :key="index" v-if="index < 2">{{item}}</text>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. props: {
  31. // b布局1独占一行2一行两个
  32. type: {
  33. type: [Number, String],
  34. default: 2
  35. },
  36. data: {
  37. type: Object,
  38. default () {
  39. return {
  40. area: "鹿城区",
  41. avg_price: "27412",
  42. house_max_area: 212.06,
  43. house_min_area: 116.8,
  44. house_type: ["三房两厅两卫", "四房两厅三卫", "四房两厅两卫", "四房两厅四卫"],
  45. id: 1,
  46. logo: "https://shujuhuifu.oss-cn-beijing.aliyuncs.com/af20f05b337db210/1c354234c4e49d6c.jpg",
  47. name: "国鸿中心",
  48. trait: ["超级综合体", "一线江景", "约350米摩天超高层", "内外双公园"]
  49. }
  50. }
  51. }
  52. },
  53. data() {
  54. return {
  55. }
  56. },
  57. onLoad() {
  58. },
  59. methods: {
  60. toinfo(){
  61. uni.navigateTo({
  62. url:"/pages/index/houses-info?id=" + this.data.id
  63. })
  64. }
  65. }
  66. }
  67. </script>
  68. <style lang="scss">
  69. .gf-goods {
  70. .row-item {
  71. margin-bottom: 32rpx;
  72. .item-img {
  73. width: 280rpx;
  74. height: 240rpx;
  75. margin-right: 20rpx;
  76. border-radius: 20rpx;
  77. }
  78. .item-box {
  79. flex: 1;
  80. min-width: 1rpx;
  81. .label-box {
  82. text {
  83. margin-right: 10rpx;
  84. padding: 0 12rpx;
  85. line-height: 40rpx;
  86. height: 40rpx;
  87. background: #F5F5F5;
  88. border-radius: 8rpx;
  89. font-size: 18rpx;
  90. font-family: PingFangSC-Regular, PingFang SC;
  91. font-weight: 400;
  92. color: #999999;
  93. white-space: nowrap;
  94. }
  95. }
  96. .price-box {
  97. margin-bottom: 8rpx;
  98. text:first-child {
  99. font-size: 20rpx;
  100. font-family: PingFangSC-Regular, PingFang SC;
  101. font-weight: 400;
  102. color: #999999;
  103. margin-right: 8rpx;
  104. }
  105. text:last-child {
  106. font-size: 32rpx;
  107. font-family: DINAlternate-Bold, DINAlternate;
  108. font-weight: bold;
  109. color: #FF3B30;
  110. }
  111. }
  112. .item-name {
  113. font-size: 28rpx;
  114. font-family: PingFangSC-Regular, PingFang SC;
  115. font-weight: 400;
  116. color: #131415;
  117. margin: 10rpx 0;
  118. }
  119. .item-tips {
  120. font-size: 18rpx;
  121. font-family: PingFangSC-Regular, PingFang SC;
  122. font-weight: 400;
  123. color: #999999;
  124. margin-bottom: 12rpx;
  125. }
  126. }
  127. }
  128. .col-item {
  129. width: 320rpx;
  130. background: #F8FBFF;
  131. border-radius: 20rpx;
  132. margin-bottom: 20rpx;
  133. padding-bottom: 24rpx;
  134. .item-box {
  135. padding: 0 20rpx;
  136. .label-box {
  137. text {
  138. margin-right: 10rpx;
  139. padding: 0 12rpx;
  140. line-height: 40rpx;
  141. height: 40rpx;
  142. background: #F5F5F5;
  143. border-radius: 8rpx;
  144. font-size: 18rpx;
  145. font-family: PingFangSC-Regular, PingFang SC;
  146. font-weight: 400;
  147. color: #999999;
  148. }
  149. }
  150. .price-box {
  151. margin-bottom: 8rpx;
  152. text:first-child {
  153. font-size: 20rpx;
  154. font-family: PingFangSC-Regular, PingFang SC;
  155. font-weight: 400;
  156. color: #999999;
  157. margin-right: 8rpx;
  158. }
  159. text:last-child {
  160. font-size: 32rpx;
  161. font-family: DINAlternate-Bold, DINAlternate;
  162. font-weight: bold;
  163. color: #FF3B30;
  164. }
  165. }
  166. .item-name {
  167. font-size: 28rpx;
  168. font-family: PingFangSC-Regular, PingFang SC;
  169. font-weight: 400;
  170. color: #131415;
  171. margin: 10rpx 0;
  172. }
  173. .item-tips {
  174. font-size: 18rpx;
  175. font-family: PingFangSC-Regular, PingFang SC;
  176. font-weight: 400;
  177. color: #999999;
  178. margin-bottom: 12rpx;
  179. }
  180. }
  181. .item-img {
  182. width: 320rpx;
  183. height: 240rpx;
  184. border-radius: 20rpx;
  185. }
  186. }
  187. }
  188. </style>