myhome.vue 4.1 KB

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