chooseUnit.vue 3.3 KB

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