index.jsx 7.2KB

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