liujq hace 2 años
padre
commit
2c59cacc8a
Se han modificado 1 ficheros con 34 adiciones y 12 borrados
  1. 34 12
      src/pagesRoom/roomPrice.jsx

+ 34 - 12
src/pagesRoom/roomPrice.jsx

@@ -32,6 +32,7 @@ class Index extends Component {
       roomArr: [],
       curRoomObj: {},
       isDtlShow: false,
+      buildingNumList: [],
     }
   }
 
@@ -47,11 +48,25 @@ class Index extends Component {
     // Taro.setNavigationBarTitle({
     //   title: name + '-一房一价表' || '一房一价表'
     // })
-    const {id} = this.$router.params
+    const {eId, id} = this.$router.params
     Taro.api.house.apiestatelottery2batchinfo({
       lottery_id: id,
+      estate_id: eId,
     }).then(res => {
+      let ll = res.lottery_list || []
+      let buildingNumList = []
+      ll.forEach(item => {
+        const arr = item.building_num.split(',')
+        arr.forEach(sub => {
+          buildingNumList.push({
+            id: item.id,
+            title: sub,
+            lottery_time: item.lottery_time
+          })
+        })
+      })
       this.setState({
+        buildingNumList,
         curObj: res || {}
       }, () => {
         this.getDtl()
@@ -60,13 +75,12 @@ class Index extends Component {
   }
 
   getDtl = () => {
-    const { curObj, curNav } = this.state
-    const bn = curObj.building_num.split(',')
+    const { curObj, curNav, buildingNumList } = this.state
     const {eId, name, id} = this.$router.params
     Taro.api.house.apiestatelotterypricelist({
       estate_id: eId,
-      lottery_id: id,
-      building_num: bn[curNav],
+      lottery_id: buildingNumList[curNav].id,
+      building_num: buildingNumList[curNav].title,
     }).then(res => {
       this.setState({
         roomArr: res || []
@@ -76,6 +90,18 @@ class Index extends Component {
       }
     })
   }
+  onceGetInfo () {
+    const {eId} = this.$router.params
+    const { curNav, buildingNumList } = this.state
+    Taro.api.house.apiestatelottery2batchinfo({
+      lottery_id: buildingNumList[curNav].id,
+      estate_id: eId,
+    }).then(res => {
+      this.setState({
+        curObj: res || {}
+      })
+    })
+  }
 
   refChat = (ref) => {
     this.subChat = ref
@@ -88,7 +114,7 @@ class Index extends Component {
   renderTop () {
     const {eId, id, name} = this.$router.params
     const curParams = `eId=${eId}&id=${id}&name=${name}`
-    const { curObj, curNav } = this.state
+    const { curObj, curNav, buildingNumList } = this.state
     const nameIcon = require('./img/yfyj/yfyj04.png')
     const i1 = require('./img/yfyj/yfyj05.png')
     const i2 = require('./img/yfyj/yfyj06.png')
@@ -97,11 +123,6 @@ class Index extends Component {
     const op3 = require('./img/yfyj/yfyj_icon3.png')
     const op4 = require('./img/yfyj/yfyj_icon4.png')
     const bg = require('./img/yfyj/bg.jpg')
-    let navArr = []
-    if (curObj.building_num) navArr = curObj.building_num.split(',')
-    const tabList = navArr.map((title, index) => {
-      return {title}
-    })
     return (
       <View className="scoped-header">
         <View className="scoped-top">
@@ -135,7 +156,7 @@ class Index extends Component {
           <AtTabs
             current={curNav}
             scroll
-            tabList={tabList}
+            tabList={buildingNumList}
             onClick={this.navClick.bind(this)}>
           </AtTabs>
         </View>
@@ -158,6 +179,7 @@ class Index extends Component {
       curNav: value
     }, () => {
       this.getDtl()
+      this.onceGetInfo()
     })
   }
   renderQrcode () {