chooseUnit.vue 3.6 KB

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