myhome.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <view class="">
  3. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
  4. <view class="data" v-for="(item, index) in room_list" :key="index">
  5. <view class="top">
  6. <view class="left">
  7. <u-icon name="home" :size="30" color="rgb(94,94,94)"></u-icon>
  8. <view class="title">{{item.residentialName}}</view>
  9. </view>
  10. <view class="right text-orange">
  11. <text v-if="item.relationshipType==0">业主</text>
  12. <text v-if="item.relationshipType==1">家属</text>
  13. <text v-if="item.relationshipType==2">租户</text>
  14. <text v-if="item.relationshipType==3">访客</text>
  15. </view>
  16. </view>
  17. <view class="item">
  18. <view class="left">
  19. <view style="padding: 0 30rpx;">
  20. <view class="content">
  21. <text>房屋信息:</text>
  22. <text >{{item.buildingName}},{{item.unitName}},{{item.name}}</text>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="bottom" >
  28. <view class="cu-btn sm round bg-red-btn" @click="jump(item.id)">
  29. 房屋成员
  30. </view>
  31. </view>
  32. </view>
  33. </mescroll-body>
  34. <view @tap="choosePlot" class="footer-fixed " >
  35. <view class="cu-btn flex text-lg bg-red-btn" style="padding: 46rpx 0;">
  36. 添加房屋认证
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. var app=getApp()
  43. import MescrollMixin from "@/comps/mescroll-body/mescroll-mixins.js";
  44. export default {
  45. mixins: [MescrollMixin], // 使用mixin
  46. name: '',
  47. data() {
  48. return {
  49. room_list:[],
  50. downOption:{
  51. auto:false,
  52. use:true
  53. },
  54. upOption:{
  55. auto:true,
  56. use:true,
  57. noMoreSize:5
  58. }
  59. };
  60. },
  61. onLoad() {
  62. },
  63. methods:{
  64. /**房屋成员
  65. * @param {Object} id
  66. */
  67. jump(id){
  68. uni.navigateTo({
  69. url:"./familyList?room_id="+id
  70. })
  71. },
  72. /**
  73. * 房屋认证
  74. */
  75. choosePlot() {
  76. if(!this.$isEmpty(getApp().globalData.totalStep)){
  77. getApp().globalData.totalStep=2
  78. }
  79. uni.navigateTo({
  80. url:"../auth/auth"
  81. })
  82. },
  83. /**
  84. * 下拉刷新回调
  85. * @param {Object} mescroll
  86. */
  87. downCallback(mescroll){
  88. setTimeout(()=>{
  89. uni.showToast({
  90. title:"刷新成功",
  91. icon:"none"
  92. })
  93. this.mescroll.resetUpScroll()
  94. },1500)
  95. },
  96. /**
  97. * 上拉加载回调
  98. */
  99. upCallback(mescroll){
  100. let that = this
  101. let parmas={
  102. member_id:getApp().globalData.member.id,
  103. pageNum:mescroll.num,
  104. pageSize:20
  105. }
  106. let operation = 'estate/getRoomByMemberId'
  107. try{
  108. getApp().globalData.postRequest(parmas,operation,(res)=>{
  109. if (res.data.result_code!=1) {
  110. mescroll.endErr()
  111. return
  112. }
  113. let data=[]
  114. if (uni.getStorageSync('plotName')) {
  115. //如果选择了当前小区,就只把当前小区的房屋列表展示出来
  116. res.data.list.map(item => {
  117. if (item.residentialName == uni.getStorageSync('plotName')) {
  118. data.push(item);
  119. }
  120. })
  121. } else {
  122. // 如果没有选择到小区,就把所有的房屋列表展示出来
  123. data = res.data.list;
  124. }
  125. //不推荐
  126. mescroll.endSuccess(data.length)
  127. //推荐用下面这个,但是后台没有给我返回total
  128. // this.mescroll.endBySize(data.length, total)
  129. if(mescroll.num == 1) that.room_list = []
  130. that.room_list = that.room_list.concat(data)
  131. getApp().globalData.room_list = that.room_list
  132. })
  133. }catch(e){
  134. mescroll.endErr()
  135. }
  136. }
  137. }
  138. };
  139. </script>
  140. <style lang="scss">
  141. view,
  142. button
  143. {
  144. box-sizing: border-box;
  145. }
  146. .data {
  147. width: 710rpx;
  148. background-color: #ffffff;
  149. margin: 20rpx auto;
  150. border-radius: 6rpx;
  151. box-sizing: border-box;
  152. padding: 20rpx;
  153. font-size: 28rpx;
  154. .top {
  155. display: flex;
  156. justify-content: space-between;
  157. border-bottom: 1rpx dashed #DDDDDD;
  158. padding-bottom: 20rpx;
  159. .left {
  160. display: flex;
  161. align-items: center;
  162. .title {
  163. margin: 0 10rpx;
  164. font-size: 32rpx;
  165. font-weight: bold;
  166. }
  167. }
  168. }
  169. .item {
  170. margin: 40rpx 0 20rpx 0;
  171. .content {
  172. display: flex;
  173. justify-content: space-between;
  174. padding: 10rpx 0;
  175. }
  176. }
  177. .bottom {
  178. display: flex;
  179. margin-top: 20rpx;
  180. justify-content: flex-end;
  181. align-items: center;
  182. }
  183. }
  184. </style>