chooseBuilding.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <view :class="$isEmpty(buiding_list)?'empty-wrap':''">
  3. <view class="bg-gray" style="padding: 16rpx 30rpx;">
  4. <text>当前选择小区:</text>
  5. </view>
  6. <view class="bg-white"
  7. style="padding:30rpx 30rpx 20rpx 30rpx;border-bottom: 1rpx solid #efefef;display: flex;justify-content: space-between;">
  8. <view class="text-blue">
  9. <text class="">{{residential_name}}</text>
  10. </view>
  11. <view class="cu-btn line-blue sm round" @tap="change">
  12. <text class="cuIcon-refresh padding-right-10"></text>
  13. <text>切换小区</text>
  14. </view>
  15. </view>
  16. <view class="bg-gray" style="padding: 12rpx 30rpx;">
  17. <text>选择楼栋:</text>
  18. </view>
  19. <u-cell-group v-if="!$isEmpty(buiding_list)">
  20. <u-cell-item @click="jump(item)" v-for="(item, index) in buiding_list" :key="index" :title="item.name"
  21. :arrow="false"></u-cell-item>
  22. </u-cell-group>
  23. <u-empty marginTop="200" icon-size="260" v-if="$isEmpty(buiding_list)&&!loading" text="暂无楼栋信息"
  24. src="https://szsq.nxzhsq.cn/community/miniofile/xlyq/empty/empty.png"></u-empty>
  25. <u-back-top :scroll-top="scrollTop"></u-back-top>
  26. </view>
  27. </template>
  28. <script>
  29. var app = getApp();
  30. export default {
  31. data() {
  32. return {
  33. loading: true,
  34. scrollTop: 0,
  35. buiding_list: null,
  36. //小区集合
  37. residential_name: null //小区名字
  38. };
  39. },
  40. onPageScroll(e) {
  41. this.scrollTop = e.scrollTop;
  42. },
  43. /**
  44. * 生命周期函数--监听页面加载
  45. */
  46. onLoad: function (options) {
  47. //小区名字
  48. this.residential_name = options.residential_name
  49. var residential_id = options.residential_id
  50. this.getBuilding(residential_id)
  51. },
  52. methods: {
  53. change() {
  54. uni.navigateBack({
  55. delta: 1
  56. })
  57. },
  58. jump(item) {
  59. app.globalData.building_id = item.id
  60. let params = {
  61. building_name: item.name,
  62. building_id: item.id,
  63. residential_name: this.residential_name
  64. }
  65. uni.navigateTo({
  66. url: "../chooseUnit/chooseUnit" + this.$u.queryParams(params)
  67. })
  68. },
  69. //根据小区id获取楼栋信息
  70. getBuilding: function (residential_id) {
  71. uni.showLoading({
  72. title: "数据加载中.."
  73. })
  74. let that = this;
  75. let params = {
  76. residential_id: residential_id
  77. };
  78. let operation = 'estate/getBuildingsByResidentialId';
  79. app.globalData.postRequest(params, operation, function (res) {
  80. //获取成功
  81. if (res.data.result_code == 1) {
  82. that.setData({
  83. buiding_list: res.data.list
  84. });
  85. } else {
  86. app.globalData.oneFailHint(res.data.result_msg);
  87. }
  88. uni.hideLoading()
  89. that.loading = false
  90. });
  91. }
  92. }
  93. };
  94. </script>
  95. <style>
  96. page {
  97. overflow-y: scroll
  98. }
  99. .isOver {
  100. width: 100%;
  101. height: 50px;
  102. line-height: 50px;
  103. text-align: center;
  104. font-size: 28 rpx;
  105. }
  106. .nav_section {
  107. width: 100%;
  108. background: #fff;
  109. }
  110. .nav_section_items {
  111. display: flex;
  112. flex-direction: row;
  113. justify-content: space-between;
  114. padding: 30 rpx;
  115. border-bottom: 2 rpx solid #ddd;
  116. position: relative;
  117. }
  118. .nav_section_items:active {
  119. background: #ddd;
  120. }
  121. .nav_section_items .section_cont view {
  122. overflow: hidden;
  123. text-overflow: ellipsis;
  124. white-space: nowrap;
  125. display: block;
  126. }
  127. .nav_section_items .section_cont .section_cont_sub {
  128. font-size: 30 rpx;
  129. line-height: 50 rpx;
  130. color: #000;
  131. margin-bottom: 10 rpx;
  132. }
  133. .section_cont_tel .info {
  134. width: 500 rpx;
  135. overflow: hidden;
  136. white-space: nowrap;
  137. text-overflow: ellipsis;
  138. display: inline-block;
  139. }
  140. .empty-wrap {
  141. background-color: #FFFFFF;
  142. min-height: 100vh;
  143. }
  144. </style>