index.jsx 6.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. import Taro from '@tarojs/taro'
  2. import { ScrollView, Image } from '@tarojs/components'
  3. import AuthRole from '@/components/Auth/AuthRole'
  4. import { ROLE_CODE } from '@/constants/user'
  5. import classNames from 'classnames'
  6. import useFavor from '@/utils/hooks/useFavor'
  7. import { formatDate } from '@/utils/chatDate'
  8. import '@/assets/css/iconfont.css'
  9. import './index.scss'
  10. export default function BasicInfo (props) {
  11. const { Info = {}, trackData } = props
  12. const { buildingId, isSave } = Info
  13. const [isSaved, handleFavor] = useFavor(isSave, { id: buildingId, buildingId, ...trackData })
  14. const goto = (url) => Taro.navigateTo({ url })
  15. const handleSubscribeMessage = () => {
  16. Taro.showToast({
  17. title: '该功能即将上线!',
  18. icon: 'none',
  19. })
  20. }
  21. return (
  22. <view className='components BasicInfo'>
  23. {/* 标题名称 */}
  24. <view className='Title flex-h'>
  25. <view className='flex-item'>
  26. <text>{Info.buildingName}</text>
  27. </view>
  28. <view className='Collect' onClick={handleFavor}>
  29. <text className={classNames(['iconfont icon-shoucang'], { active: isSaved })}></text>
  30. <text>{isSaved ? '取消收藏' : '收藏'}</text>
  31. </view>
  32. </view>
  33. {/* 标签 */}
  34. <view className='Tags'>
  35. {
  36. (Info.buildingTag || []).map((item, index) => (
  37. <text key={`TagItem-${index}`}>{item.tagName}</text>
  38. ))
  39. }
  40. </view>
  41. {/* 项目列表 */}
  42. {
  43. (Info.buildingProjectType || []).length > 0 &&
  44. <view className='ProjectList'>
  45. <ScrollView scroll-x show-scrollbar={false}>
  46. {
  47. (Info.buildingProjectType || []).map((item, index) => {
  48. const priceUnit = item.priceType === 'average' ? '元/㎡' : '万元/套'
  49. let price = item.startPrice === item.endPrice ? item.startPrice : `${item.startPrice}-${item.endPrice}`
  50. if (!item.startPrice && !item.endPrice) {
  51. price = '暂无'
  52. } else {
  53. price = `约${price}${priceUnit}`
  54. }
  55. return (
  56. <view className='ListItem' key={`List-${index}`}>
  57. <Image mode='heightFix' src={require('@/assets/buildingDetail-icon4.jpg')} />
  58. <view>
  59. <view>
  60. <text>项目类型:</text>
  61. <text className='active black'>{item.buildingTypeName}</text>
  62. </view>
  63. <view>
  64. <text>房屋产权:</text>
  65. <text className='active'>{item.rightsYear}年</text>
  66. <text>装修标准:</text>
  67. <text className='active'>{item.decoration || '暂无'}</text>
  68. </view>
  69. <view>
  70. <text>项目参考价格:</text>
  71. <text className='active'>{price}</text>
  72. </view>
  73. <text className='SaleStatus active'>{item.marketStatus}</text>
  74. </view>
  75. </view>
  76. )
  77. })
  78. }
  79. </ScrollView>
  80. </view>
  81. }
  82. {/* 隔断 */}
  83. <view className='CutLine'></view>
  84. {/* 更多信息 */}
  85. <view className='MoreInfo'>
  86. <view className='flex-h'>
  87. <view style='width: 60px;'>
  88. <text>楼盘地址</text>
  89. </view>
  90. <text>:</text>
  91. <view className='flex-item3'>
  92. <text className='active'>{Info.address}</text>
  93. </view>
  94. </view>
  95. <view className='flex-h'>
  96. <view style='width: 60px;'>
  97. <text>开盘时间</text>
  98. </view>
  99. <text>:</text>
  100. <view className='flex-item3'>
  101. <text className='active'>{formatDate(Info.openingDate, 'yyyy-MM-dd' ) || '待定'}</text>
  102. </view>
  103. </view>
  104. <view className='flex-h'>
  105. <view style='width: 60px;'>
  106. <text>容积率</text>
  107. </view>
  108. <text>:</text>
  109. <view className='flex-item'>
  110. <text className='active'>{Info.volumeRate || '暂无'}</text>
  111. </view>
  112. <view style='width: 60px;'>
  113. <text>车位数量</text>
  114. </view>
  115. <text>:</text>
  116. <view className='flex-item'>
  117. <text className='active'>{Info.parkingRate || '暂无'}</text>
  118. </view>
  119. </view>
  120. <view className='flex-h'>
  121. <view style='width: 60px;'>
  122. <text>绿化率</text>
  123. </view>
  124. <text>:</text>
  125. <view className='flex-item'>
  126. <text className='active'>{Info.greeningRate || '暂无'}</text>
  127. </view>
  128. <view style='width: 60px;'>
  129. <text>物业费</text>
  130. </view>
  131. <text>:</text>
  132. <view className='flex-item'>
  133. <text className='active'>{Info.serviceFee || '暂无'}</text>
  134. </view>
  135. </view>
  136. <view className='flex-h'>
  137. <view style='width: 60px;'>
  138. <text>规划户数</text>
  139. </view>
  140. <text>:</text>
  141. <view className='flex-item'>
  142. <text className='active'>{Info.familyNum || '暂无'}</text>
  143. </view>
  144. <view style='width: 60px;'>
  145. <text>物业</text>
  146. </view>
  147. <text>:</text>
  148. <view className='flex-item'>
  149. <text className='active'>{Info.serviceCompany || '暂无'}</text>
  150. </view>
  151. </view>
  152. </view>
  153. {/* 围观 */}
  154. <view className='Views flex-h'>
  155. <text>{Info.pvNum || 0}人围观</text>
  156. <view className='flex-item'>
  157. {
  158. (Info?.uvList?.records || []).slice(0, 8).map((item, index) => (
  159. <view key={`ViewsItem-${index}`}>
  160. <Image mode='aspectFill' className='centerLabel' src={item.photoOravatar} />
  161. </view>
  162. ))
  163. }
  164. {
  165. (Info?.uvList?.records || []).length > 8 &&
  166. <text>...</text>
  167. }
  168. </view>
  169. </view>
  170. {/* 互动 */}
  171. <view className='Interact flex-h'>
  172. <text className='flex-item' onClick={() => goto(`/pages/index/buildingInfo/index?id=${buildingId}`)}>更多楼盘信息</text>
  173. <text className='flex-item active' onClick={handleSubscribeMessage}>订阅活动通知</text>
  174. </view>
  175. {/* 提示 */}
  176. <AuthRole role={ROLE_CODE.CHANNEL_AGENT}>
  177. <view className='Tips'>
  178. <text className='iconfont icon-bangzhu'></text>
  179. <text onClick={() => goto(`/pages/index/buildingRules/index?buildingId=${buildingId}`)}>查看报备规则?</text>
  180. </view>
  181. </AuthRole>
  182. </view>
  183. )
  184. }