chooseUnit.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <view :class="$isEmpty(unit_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="">{{building_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="unit_list.length>0">
  20. <u-cell-item @click="jump(item)" v-for="(item, index) in unit_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(unit_list)" text="暂无单元信息"
  24. src="https://szsq.nxzhsq.cn/community/miniofile/xlyq/empty/empty.png"></u-empty>
  25. </view>
  26. </template>
  27. <script>
  28. var app = getApp();
  29. export default {
  30. data() {
  31. return {
  32. unit_list: null,
  33. //小区
  34. residential_name: null,
  35. //楼栋
  36. building_name: null
  37. };
  38. },
  39. components: {},
  40. props: {},
  41. /**
  42. * 生命周期函数--监听页面加载
  43. */
  44. onLoad: function (options) {
  45. //小区名字
  46. this.residential_name = options.residential_name
  47. //楼栋名字
  48. this.building_name = options.building_name;
  49. var buildingId = options.building_id;
  50. this.getUnit(buildingId);
  51. },
  52. methods: {
  53. change() {
  54. uni.navigateBack({
  55. delta: 1
  56. })
  57. },
  58. jump(item) {
  59. app.globalData.unitId = item.id
  60. let params = {
  61. residential_name: this.residential_name,//小区名称
  62. building_name: this.building_name,//楼栋名称
  63. building_id: this.building_id,//楼栋id
  64. unit_name: item.name,//单元名称
  65. unit_id: item.id,//单元id
  66. }
  67. uni.navigateTo({
  68. url: "/pages/choosePlot/chooseRoom/chooseRoom" + this.$u.queryParams(params)
  69. })
  70. },
  71. //根据楼栋id获取楼栋信息
  72. getUnit: function (buildingId) {
  73. let that = this;
  74. let params = {};
  75. params['building_id'] = buildingId;
  76. let operation = 'estate/getUnitsByBuildingId';
  77. app.globalData.postRequest(params, operation, function (res) {
  78. //获取成功
  79. if (res.data.result_code == 1) {
  80. that.setData({
  81. unit_list: res.data.list
  82. });
  83. } else {
  84. app.globalData.oneFailHint(res.data.result_msg);
  85. }
  86. });
  87. }
  88. }
  89. };
  90. </script>
  91. <style>
  92. /* pages/choosePlot/chooseUnit/chooseUnit.wxss */
  93. page {
  94. overflow-y: scroll
  95. }
  96. .nav_section {
  97. width: 100%;
  98. background: #fff;
  99. }
  100. .nav_section_items {
  101. display: flex;
  102. flex-direction: row;
  103. justify-content: space-between;
  104. padding: 30 rpx;
  105. border-bottom: 2 rpx solid #ddd;
  106. position: relative;
  107. }
  108. .nav_section_items:active {
  109. background: #ddd;
  110. }
  111. .nav_section_items .section_cont view {
  112. overflow: hidden;
  113. text-overflow: ellipsis;
  114. white-space: nowrap;
  115. display: block;
  116. }
  117. .nav_section_items .section_cont .section_cont_sub {
  118. font-size: 30 rpx;
  119. line-height: 50 rpx;
  120. color: #000;
  121. margin-bottom: 10 rpx;
  122. }
  123. .section_cont_tel .info {
  124. width: 500 rpx;
  125. overflow: hidden;
  126. white-space: nowrap;
  127. text-overflow: ellipsis;
  128. display: inline-block;
  129. }
  130. .empty-wrap {
  131. background-color: #FFFFFF;
  132. min-height: 100vh;
  133. }
  134. </style>