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