| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- <template>
- <view class="container ">
- <view class="tabs flex flex-direction u-border-bottom" >
- <view class="flex">
- <scroll-view scroll-x class="bg-white nav" :style="current==0?'width: 90%':''">
- <view class="flex text-center">
- <view class="cu-item flex-sub" :class="index==current?'text-blue text-xl text-bold':'text-lg'" v-for="(item,index) in tabs" :key="index" @tap="tabChange(index)" >
- {{item.name}}
- </view>
- </view>
- </scroll-view>
- <view v-if="current==0" @click="roomShow=!roomShow" class="flex justify-center padding-top-10 align-center" >
- <u-icon name="home" size="32" top="-4"></u-icon>
- <text class="text-blue padding-left-10 text-lg text-bold">{{roomName}}</text>
- <text v-if="!roomShow" class="text-blue cuIcon-unfold padding-left-10" ></text>
- <text v-else class="text-blue cuIcon-fold padding-left-10" ></text>
- </view>
- </view>
- </view>
- <view style="height: 100%;">
- <swiper style="height: 100%;" :current="current" @change="swiperChange"
- @animationfinish="animationfinish">
- <swiper-item v-for="(item, index) in tabs" :key="index">
- <scroll-view scroll-y style="height: 100%;">
- <item ref="mescrollItem" v-if="!$isEmpty(roomId)" :roomId="roomId" :i="index" :item="item" :current="current"></item>
- </scroll-view>
- </swiper-item>
- </swiper>
- </view>
-
- <u-picker mode="selector" v-model="roomShow" :range="realRoomList" range-key="fullRoomName" @confirm="roomChange"></u-picker>
- <!-- <u-select z-index="9999999" mode="single-column" value-name="id" label-name="name" v-model="roomShow" :list="roomList" @confirm="roomChange"></u-select> -->
- </view>
- </template>
- <script>
- import item from "./comps/item.vue"
- export default {
- components: {
- item
- },
- data() {
- return {
- roomShow:false,
- realRoomList:[],
- roomList:[],
- roomName:'',
- roomId:'',
-
- scrollLeft:0,
- current: 0,
- swiperCurrent:0,
- tabs: [
- {
- name: '审核通过',
- value:0
- },
- {
- name: '申请记录',
- value:1
- },
- {
- name: '住户审核',
- value:2
- }
- ],
- }
- },
- onShow(){
- this.canReset && this.refreshMescroll()
- this.canReset=true
- },
- onLoad() {
- this.getRoomByMemberId()
- },
- methods:{
- getRoomByMemberId(){
- let that=this
- let params={
- residential_id:uni.getStorageSync('residentialId'),
- member_id:getApp().globalData.member.id
- }
- // let operation = 'estate/getRoomByMemberId';
- that.$http.getRoomByMemberId(params).then(res =>{
- if (res.data.result_code == 1) {
- this.realRoomList=res.data.roomList
- that.roomList=res.data.list
-
- let own_room_list=[]
- that.roomList.forEach(item=>{
- if (item.relationshipType==0) {
- // own_room_list.push(item)
- }
- item.fullRoomName=item.buildingName+"-"+item.unitName+"-"+item.name
-
- })
- that.realRoomList.forEach(item=>{
- item.fullRoomName=item.buildingName+"-"+item.unitName+"-"+item.name
- own_room_list.push(item)
- })
- //业主自己的房子
- getApp().globalData.own_room_list = own_room_list;
- that.$u.vuex('vuex_own_room_list',own_room_list)
-
- that.roomName=that.roomList[0].name
- that.roomId=that.roomList[0].id
- that.$u.vuex('vuex_relationshipType', that.roomList[0].relationshipType)
- }
-
- })
- },
- roomChange(e){
- this.roomName=this.roomList[e[0]].name
- this.roomId=this.roomList[e[0]].id
- this.$u.vuex('vuex_relationshipType', this.roomList[e[0]].relationshipType)
- this.refreshMescroll()
- },
- /**
- * 刷新列表
- */
- refreshMescroll(){
- let curMescroll = this.getMescroll(this.current)
- this.$nextTick(function(){
- curMescroll && curMescroll.resetUpScroll()
- })
- },
- /**
- * 获取Mescroll对象
- * @param {Object} i
- */
- getMescroll(i){
- let mescrollItems = this.$refs.mescrollItem;
- if(mescrollItems){
- let item = mescrollItems[i]
- if(item) return item.mescroll
- }
- return null
- },
- tabChange(index) {
- this.current = index
- // this.scrollLeft = (index - 1) * 60
- },
- swiperChange(e) {
- uni.pageScrollTo({
- scrollTop: 0,
- duration: 0
- });
- this.current = e.detail.current
- // this.scrollLeft = (this.current - 1) * 60
- },
- animationfinish({detail: { current }}) {
- this.swiperCurrent = current;
- this.current = current;
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .text-xl{
- font-size: 34rpx;
- }
-
- .container {
- height: calc(100vh - 78rpx);
- background-color: #F6F6F6;
- padding: 78rpx 0rpx 0rpx;
- .tabs {
- position: fixed;
- top: -10rpx;
- left: 0;
- display: flex;
- align-items: center;
- width: 100%;
- background-color: #FFFFFF;
- box-sizing: border-box;
- z-index: 3;
- }
- }
- </style>
|