chooseRoom.vue 3.9 KB

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