Your Name 3 years ago
parent
commit
8edf5bd4ff

+ 2
- 0
config/prod.js View File

5
   defineConstants: {
5
   defineConstants: {
6
     HOST: '"https://xlj.newlandsh.com"', //正式
6
     HOST: '"https://xlj.newlandsh.com"', //正式
7
     WSS_HOST: '"wss://xlj.newlandsh.com"',
7
     WSS_HOST: '"wss://xlj.newlandsh.com"',
8
+    // HOST: '"https://xlk.njyz.tech"', //正式
9
+    // WSS_HOST: '"wss://xlk.njyz.tech"',
8
     OSS_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
10
     OSS_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
9
     OSS_FAST_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
11
     OSS_FAST_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
10
     ICON_FONT: '"https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/css/iconfont.ttf"',
12
     ICON_FONT: '"https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/css/iconfont.ttf"',

+ 0
- 2
src/components/FirstScreen/index.jsx View File

10
 
10
 
11
   }
11
   }
12
 
12
 
13
-  console.log('---------info------>', info, visible)
14
-
15
   return (
13
   return (
16
     <view className='components Adv' style={{display: visible ? 'block' : 'none'}}>
14
     <view className='components Adv' style={{display: visible ? 'block' : 'none'}}>
17
       <view className='centerLabel'>
15
       <view className='centerLabel'>

+ 1
- 1
src/constants/api.js View File

19
 export const API_MY_COLLECT_COURSE_LIST = resolvePath('curriculum/save') // 我收藏的课程列表
19
 export const API_MY_COLLECT_COURSE_LIST = resolvePath('curriculum/save') // 我收藏的课程列表
20
 
20
 
21
 // 特价房源
21
 // 特价房源
22
-export const API_SPECIAL_ROOM_LIST = resolvePath('buildingSpecialRoom') // 特价房源列表
22
+export const API_SPECIAL_ROOM_LIST = resolvePath('buildingSpecialRoom/building') // 特价房源列表
23
 
23
 
24
 // 项目动态
24
 // 项目动态
25
 export const API_PROJECT_TREND_LIST = resolvePath('trendList') // 项目动态
25
 export const API_PROJECT_TREND_LIST = resolvePath('trendList') // 项目动态

+ 0
- 2
src/layout/useScreen.js View File

31
 
31
 
32
   const show = canShow && firstScreen
32
   const show = canShow && firstScreen
33
 
33
 
34
-  console.log('------showshow--------->', show)
35
-
36
   return [firstScreen, show, toggle]
34
   return [firstScreen, show, toggle]
37
 }
35
 }

+ 2
- 2
src/pages/index/buildingList/index.jsx View File

15
 
15
 
16
 export default withLayout((props) => {
16
 export default withLayout((props) => {
17
   const { router } = props
17
   const { router } = props
18
-  const { isRecentOpening } = router.params
18
+  const { isRecentOpening, isCommerce } = router.params
19
 
19
 
20
   const city = useSelector(state => state.city)
20
   const city = useSelector(state => state.city)
21
   const [PageList, setPageList] = useState([])
21
   const [PageList, setPageList] = useState([])
89
         Data[key] = FilterData[key]
89
         Data[key] = FilterData[key]
90
       }
90
       }
91
     }
91
     }
92
-    fetch({ url: API_ITEMS_LIST, method: 'get', payload: { cityId: city.curCity.id, pageNumber, pageSize, isRecentOpening, ...Data } }).then((res) => {
92
+    fetch({ url: API_ITEMS_LIST, method: 'get', payload: { cityId: city.curCity.id, pageNumber, pageSize, isRecentOpening, isCommerce, ...Data } }).then((res) => {
93
       setPageList(pageNumber === 1 ? res.records || [] : PageList.concat(res.records || []))
93
       setPageList(pageNumber === 1 ? res.records || [] : PageList.concat(res.records || []))
94
       setHasNextPage(res.current < res.pages)
94
       setHasNextPage(res.current < res.pages)
95
       setPull(false)
95
       setPull(false)

+ 1
- 1
src/pages/index/components/Menu/index.jsx View File

15
     { name: '团房信息', id: 8, icon: require('../../../../assets/index-icon12.png'), router: '/pages/index/activityList/index?type=house' },
15
     { name: '团房信息', id: 8, icon: require('../../../../assets/index-icon12.png'), router: '/pages/index/activityList/index?type=house' },
16
     { name: '特价房', id: 9, icon: require('../../../../assets/index-icon11.png'), router: '/pages/index/specialPriceHouse/index' },
16
     { name: '特价房', id: 9, icon: require('../../../../assets/index-icon11.png'), router: '/pages/index/specialPriceHouse/index' },
17
     { name: '康养', id: 10, icon: require('../../../../assets/index-icon7.png'), router: '/pages/index/recovered/index' },
17
     { name: '康养', id: 10, icon: require('../../../../assets/index-icon7.png'), router: '/pages/index/recovered/index' },
18
-    { name: '文旅商办', id: 11, icon: require('../../../../assets/index-icon13.png'), router: `/pages/index/buildingList/index?type=3` },
18
+    { name: '文旅商办', id: 11, icon: require('../../../../assets/index-icon13.png'), router: `/pages/index/buildingList/index?isCommerce=1` },
19
     { name: '新闻资讯', id: 12, icon: require('../../../../assets/index-icon15.png'), router: '/pages/index/newsList/index' },
19
     { name: '新闻资讯', id: 12, icon: require('../../../../assets/index-icon15.png'), router: '/pages/index/newsList/index' },
20
     { name: '购房百科', id: 13, icon: require('../../../../assets/index-icon4.png'), router: '/pages/index/encyclopediasOfBuyHouse/index' },
20
     { name: '购房百科', id: 13, icon: require('../../../../assets/index-icon4.png'), router: '/pages/index/encyclopediasOfBuyHouse/index' },
21
     { name: '房贷计算', id: 14, icon: require('../../../../assets/index-icon3.png'), router: '/pages/index/mortgageCalculation/index' }
21
     { name: '房贷计算', id: 14, icon: require('../../../../assets/index-icon3.png'), router: '/pages/index/mortgageCalculation/index' }

+ 115
- 60
src/pages/index/specialPriceHouse/index.jsx View File

1
-import { useState } from 'react'
1
+import { useEffect, useState } from 'react'
2
+import Taro from '@tarojs/taro'
2
 import withLayout from '@/layout'
3
 import withLayout from '@/layout'
3
 import { ScrollView, Image } from '@tarojs/components'
4
 import { ScrollView, Image } from '@tarojs/components'
4
 import Disclaimer from '@/components/Disclaimer'
5
 import Disclaimer from '@/components/Disclaimer'
6
+import { getSpecialRoomList } from '@/services/project'
7
+import { getImgURL } from '@/utils/image'
8
+import { formateLeftTime } from '@/utils/tools'
5
 import '@/assets/css/iconfont.css'
9
 import '@/assets/css/iconfont.css'
6
 import './index.scss'
10
 import './index.scss'
7
 
11
 
8
 const defaultRuleImage = 'https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/index-icon19.jpg'
12
 const defaultRuleImage = 'https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/index-icon19.jpg'
9
 
13
 
10
-export default withLayout(() => {
14
+export default withLayout((props) => {
15
+  const { city } = props
11
 
16
 
17
+  const [list, setList] = useState([])
12
 
18
 
13
-  const [PageList, setPageList] = useState(['', '', ''])
19
+  const getRoomList = (params) => {
20
+    Taro.showLoading()
21
+    getSpecialRoomList({
22
+      cityId: city?.id,
23
+      ...params,
24
+    }).then((res) => {
25
+      const { records } = res
26
+      setList(records || [])
27
+      Taro.hideLoading()
28
+    }).catch((err) => {
29
+      console.error(err)
30
+      Taro.hideLoading()
31
+    })
32
+  }
33
+
34
+  const goto = (it) => {
35
+    Taro.navigateTo({
36
+      url: `/pages/index/buildingDetail/index?id=${it.buildingId}`
37
+    })
38
+  }
39
+
40
+  useEffect(() => {
41
+    console.log('------params---->', city, city?.id)
42
+    if (city?.id) {
43
+      getRoomList({ pageNum: 1 })
44
+    }
45
+  }, [city?.id])
14
 
46
 
15
   return (
47
   return (
16
     <view className='Page specialPriceHouse'>
48
     <view className='Page specialPriceHouse'>
25
           {/* 列表 */}
57
           {/* 列表 */}
26
           <view className='List'>
58
           <view className='List'>
27
             {
59
             {
28
-              PageList.map((item, index) => (
29
-                <view key={`ListItem-${index}`}>
30
-
31
-                  <view className='Title'>
32
-                    <view>
33
-                      <text className='iconfont icon-shoucang'></text>
34
-                      <text>{index + 1 > 9 ? index + 1 : `0${index + 1}`}</text>
35
-                      <text className='iconfont icon-shoucang'></text>
36
-                    </view>
37
-                  </view>
60
+              list.map((item, index) => {
61
+                const mainImg = getImgURL(item?.buildingListImg?.length ? item.buildingListImg[0].url : null)
62
+                const price = item.price || '价格待定'
63
+                const shareNum = item.shareList?.total || 0
64
+                const uvNum = item.uvList?.length || 0
38
 
65
 
39
-                  <view className='InfoContent'>
40
-                    <view className='Img'>
41
-                      <Image mode='scaleToFill' src={null} className='centerLabel'></Image>
42
-                    </view>
43
-                    <view className='Name flex-h'>
44
-                      <view className='flex-item'>
45
-                        <text>奥园金基天著尚居</text>
66
+                // 最多6个
67
+                const tags = (item.buildingTag || []).map(x => x.tagName).slice(0, 6)
68
+
69
+                //
70
+                const specialRoomList = item.specialRoomList || []
71
+                
72
+                return (
73
+                  <view key={item.buildingId}>
74
+                    <view className='Title'>
75
+                      <view>
76
+                        <text className='iconfont icon-shoucang'></text>
77
+                        <text>{index + 1 > 9 ? index + 1 : `0${index + 1}`}</text>
78
+                        <text className='iconfont icon-shoucang'></text>
46
                       </view>
79
                       </view>
47
-                      <text>约</text>
48
-                      <text>20000/㎡</text>
49
-                    </view>
50
-                    <text className='Address'>江宁禄口云熙99路号(诚信大道)</text>
51
-                    <view className='Tag'>
52
-                      <text>纯新盘</text>
53
-                      <text>纯新盘</text>
54
-                      <text>纯新盘</text>
55
                     </view>
80
                     </view>
56
-                    <view className='Views flex-h'>
57
-                      <view className='flex-item'>
58
-                        <text className='iconfont icon-fenxiang'></text>
59
-                        <text>3次分享</text>
81
+
82
+                    <view className='InfoContent'>
83
+                      <view className='Img' onClick={() => goto(item)}>
84
+                        <Image mode='scaleToFill' src={mainImg} className='centerLabel'></Image>
60
                       </view>
85
                       </view>
61
-                      <view className='Icons'>
62
-                        <view>
63
-                          <Image mode='scaleToFill' src={null} className='centerLabel'></Image>
64
-                        </view>
65
-                        <view>
66
-                          <Image mode='scaleToFill' src={null} className='centerLabel'></Image>
67
-                        </view>
68
-                        <view>
69
-                          <Image mode='scaleToFill' src={null} className='centerLabel'></Image>
86
+                      <view className='Name flex-h' onClick={() => goto(item)}>
87
+                        <view className='flex-item'>
88
+                          <text>{item.buildingName}</text>
70
                         </view>
89
                         </view>
90
+                        <text></text>
91
+                        <text>{price}</text>
71
                       </view>
92
                       </view>
72
-                      <text>...9人围观</text>
73
-                    </view>
74
-                    <view className='SpecialList'>
75
-                      <ScrollView scrollX>
93
+                      <text className='Address' onClick={() => goto(item)}>{item.address}</text>
94
+                      <view className='Tag' onClick={() => goto(item)}>
95
+                        {
96
+                          tags.map((x) => (<text key={x}>{x}</text>))
97
+                        }
98
+                      </view>
99
+                      <view className='Views flex-h' onClick={() => goto(item)}>
100
+                        <view className='flex-item'>
101
+                          <text className='iconfont icon-fenxiang'></text>
102
+                          <text>{`${shareNum} 次分享`}</text>
103
+                        </view>
76
                         {
104
                         {
77
-                          [{}, {}].map((subItem, subIndex) => (
78
-                            <view className='ListItem' key={`List-${subIndex}`}>
79
-                              <text className='Tips'>省17.6万</text>
80
-                              <view className='Price'>
81
-                                <text>879万</text>
82
-                                <text>932万</text>
83
-                              </view>
84
-                              <text className='Time'>距结束06天10时14分</text>
85
-                              <text className='HouseType'>4室2厅2卫 234/㎡</text>
86
-                              <text className='DoorNumber'>1#-5单元-401</text>
105
+                          uvNum > 0 && (
106
+                            <view className='Icons'>
107
+                              {
108
+                                item.uvList.map((x) => (
109
+                                  <view key={x.uvId}>
110
+                                    <Image mode='scaleToFill' src={getImgURL(x.photoOravatar)} className='centerLabel'></Image>
111
+                                  </view>
112
+                                ))
113
+                              }
87
                             </view>
114
                             </view>
88
-                          ))
115
+                          )
89
                         }
116
                         }
90
-                      </ScrollView>
117
+                        <text>{`...${uvNum}人围观`}</text>
118
+                      </view>
119
+                      <view className='SpecialList'>
120
+                        <ScrollView scrollX>
121
+                          {
122
+                            specialRoomList.map((it) => {
123
+                              const unitPrice = it.area ? it.currentPrice / it.area : undefined
124
+                              const unitW = unitPrice ? `${Number(unitPrice).toFixed(0)}/㎡` : '单价待定'
125
+                              const currentW = it.currentPrice ? `${Number(it.currentPrice / 10000).toFixed(1)}万` : '待定'
126
+                              const originalW = it.originalPrice ? `${Number(it.originalPrice / 10000).toFixed(1)}万` : '待定'
127
+                              const thriftW = it.thriftPrice ? `省${Number(it.thriftPrice / 10000).toFixed(1)}万` : '待定'
128
+                              const leftTime = formateLeftTime(new Date(it.endTime) - new Date(), 'min');
129
+
130
+                              return (
131
+                                <view className='ListItem' key={it.specialRoomId}>
132
+                                  <text className='Tips'>{thriftW}</text>
133
+                                  <view className='Price'>
134
+                                    <text>{currentW}</text>
135
+                                    <text>{originalW}</text>
136
+                                  </view>
137
+                                  <text className='Time'>{`距结束 ${leftTime}`}</text>
138
+                                  <text className='HouseType'>{`${it.unitType} ${unitW}`}</text>
139
+                                  <text className='DoorNumber'>{it.roomName}</text>
140
+                                </view>
141
+                              )
142
+                            })
143
+                          }
144
+                        </ScrollView>
145
+                      </view>
91
                     </view>
146
                     </view>
92
-                  </view>
93
 
147
 
94
-                </view>
95
-              ))
148
+                  </view>
149
+                )
150
+              })
96
             }
151
             }
97
           </view>
152
           </view>
98
 
153
 

+ 7
- 2
src/services/project.js View File

19
   API_CONTRACT_MANUAL,
19
   API_CONTRACT_MANUAL,
20
   API_CONTRACT_CHECK,
20
   API_CONTRACT_CHECK,
21
   API_INDEX_CUSTOMER,
21
   API_INDEX_CUSTOMER,
22
+  API_SPECIAL_ROOM_LIST,
22
 } from '@/constants/api'
23
 } from '@/constants/api'
23
 
24
 
24
 
25
 
126
  */
127
  */
127
 export const contractCheck = payload => fetch({ url: API_CONTRACT_CHECK, payload, method: 'POST' })
128
 export const contractCheck = payload => fetch({ url: API_CONTRACT_CHECK, payload, method: 'POST' })
128
 
129
 
129
-
130
-
130
+/**
131
+ * 获取特价房列表
132
+ * @param {*} payload 
133
+ * @returns 
134
+ */
135
+export const getSpecialRoomList = payload => fetch({ url: API_SPECIAL_ROOM_LIST, payload })

+ 1
- 1
src/utils/request.js View File

91
   const recommender = Taro.getStorageSync('recommender') || ''
91
   const recommender = Taro.getStorageSync('recommender') || ''
92
 
92
 
93
   // 去掉 null 跟 undefined 字段
93
   // 去掉 null 跟 undefined 字段
94
-  const data = typeof payload === 'Object'
94
+  const data = typeof payload === 'object'
95
     ? Object.keys(payload).reduce((acc, key) => {
95
     ? Object.keys(payload).reduce((acc, key) => {
96
         const val = payload[key]
96
         const val = payload[key]
97
         if (val === null || val === undefined) {
97
         if (val === null || val === undefined) {