guoshilong
2023-11-02 f32cff008d5ebdf1fdf3c8369fb8f7b0c2b4448e
subPackage/bs/views/zhsb.vue
@@ -2,22 +2,24 @@
   <view class="container">
      <view class="content-box">
         <view class="info">
            <view class="item location">
               <u-icon name="map" color="#000000" size="16"></u-icon>
            <view class="item location">
               <u-icon name="map" color="#AAAAAA" size="15"></u-icon>
               <text>当前小区:</text>
               <view class="location">
                  {{location}}
                  {{ location }}{{ room }}{{ `(共${num}人)` }}
               </view>
            </view>
            <view class="item statistics">
               <view class="room">{{room}}</view>
               <view class="num">{{`(共${num}人)`}}</view>
            </view>
            <!-- <view class="item statistics">
               <view class="room">{{ room }}</view>
               <view class="num">{{ `(共${num}人)` }}</view>
            </view> -->
         </view>
         <view class="box-title">
            <box-title title="出租管理"></box-title>
            <view class="line"></view>
            <view class="title">出租管理</view>
         </view>
         <view class="list">
            <rentList :list="rentList"></rentList>
@@ -34,136 +36,134 @@
</template>
<script>
   import rentList from "@/subPackage/bs/components/list/rentList.vue"
   import {
      getHouseRentInfo
   } from "@/api/doorplateAddress/doorplateAddress";
   import {
      logAdd
   } from "../../../api/system/logManage";
   export default {
      components: {
         rentList
      },
      data() {
         return {
            houseCode: '',
            location: "万达晶座:11栋楼",
            room: "一单元303室",
            num: "1",
import rentList from "@/subPackage/bs/components/list/rentList.vue"
import {
   getHouseRentInfo
} from "@/api/doorplateAddress/doorplateAddress";
import {
   logAdd
} from "../../../api/system/logManage";
export default {
   components: {
      rentList
   },
   data() {
      return {
         houseCode: '',
         location: "",
         room: "",
         num: 0,
            //出租列表
            rentList: [{
               name: "张三",
               num: "1",
               startTime: "2022-01-01",
               endTime: "2023-12-23",
               status: "未到期"
            }]
         }
      },
      created() {
      },
      mounted() {
         console.log(this.$store)
      },
      onLoad(option) {
         //出租列表
         rentList: []
      }
   },
   onLoad(option) {
      const {
         houseCode
      } = option
      this.houseCode = houseCode
   },
   onShow() {
      this.getHouseRent()
   },
   methods: {
      async getHouseRent() {
         const res = await getHouseRentInfo(this.houseCode)
         const {
            houseCode
         } = option
         this.houseCode = houseCode
            aoiName,
            buildingName,
            doorplateName,
            unitName,
            houseRentalList
         } = res.data
         this.rentList = []
         this.location = (!!aoiName ? aoiName : '') + buildingName
         this.room = (!!unitName ? unitName : '') + doorplateName + "室"
         houseRentalList !== 0 && houseRentalList.forEach(item => {
            const { houseTenantVOList, dueTime, rentalTime } = item
            item.num = houseTenantVOList.length
            this.num += item.num
            if (item.num !== 0) {
               item.name = houseTenantVOList[0].name
            }
            this.rentList = houseRentalList
         })
      },
      onShow() {
         this.getHouseRent()
      },
      methods: {
         async getHouseRent() {
            const res = await getHouseRentInfo(this.houseCode)
            const {
               aoiName,
               buildingName,
               doorplateName,
               unitName,
               houseRentalList: {
                  houseTenantVOList
               }
            } = res.data
            console.log(res.data)
            this.location = aoiName + buildingName
            this.room = unitName + doorplateName + "室"
            this.rentList = houseTenantVOList || []
            this.rentList.length !== 0 && this.rentList.forEach(item => {
               if (!item.houseTenantVOList) {
                  num += item.houseTenantVOList.length
               }
               // 事件格式处理
               item.startTime = item.rentalTime.split(' ')[0]
               item.endTime = item.dueTime.split(' ')[0]
               item.status === 1 ? '未到期' : '到期'
               item.num = item.houseTenantVOList.length
            })
         },
         addRent() {
            this.$u.func.globalNavigator("/subPackage/bs/views/rentDetail?houseCode="+this.houseCode)
         }
      addRent() {
         this.$u.func.globalNavigator("/subPackage/bs/views/rentDetail?houseCode=" + this.houseCode)
      }
   }
}
</script>
<style scoped lang="scss">
   .container {
      position: relative;
      width: 100%;
      height: 100%;
.container {
   position: relative;
   width: 100%;
   height: 100%;
   display: flex;
   flex-direction: column;
   background: #F6F6F6;
   .content-box {
      height: 0;
      flex: 1;
      overflow-y: auto;
      margin: 20rpx 30rpx;
   }
   .list {
      // padding-bottom: 20px;
   }
   .item {
      display: flex;
      flex-direction: column;
      background: #F9F9FA;
      .content-box {
         height: 0;
         flex: 1;
         overflow-y: auto;
      }
      .list {
         // padding-bottom: 20px;
      }
      .item {
         display: flex;
         padding: 30rpx 20rpx;
         background-color: #ffffff;
         border-bottom: 1px solid #eff1f3;
      }
      .location {
         font-weight: 700;
      }
      .room {
         font-weight: 700;
      }
      .bottom {
         padding: 20rpx;
         background-color: #ffffff;
         display: flex;
         justify-content: center;
         align-items: center;
         .btn {
            // width: calc(100% - 40rpx);
         }
      }
      padding: 30rpx 20rpx;
      background-color: #ffffff;
      border-bottom: 1px solid #eff1f3;
   }
   .box-title {
      padding: 40rpx 0;
   .location {
      font-weight: 700;
      font-size: 27rpx;
      text {
         color: #AAAAAA;
      }
   }
   view {
      font-size: 32rpx;
   .room {
      font-weight: 700;
   }
   .bottom {
      padding: 20rpx;
      background-color: #ffffff;
      display: flex;
      justify-content: center;
      align-items: center;
      .btn {
         // width: calc(100% - 40rpx);
      }
   }
}
.box-title {
   margin: 25rpx 0;
   display: flex;
   .line {
      width: 8rpx;
      margin-right: 10rpx;
      background-color: #2978FF;
   }
   .title {
      font-weight: 700;
   }
}
view {
   font-size: 32rpx;
}
</style>