venueMore.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <view class="content">
  3. <view class="filter-box">
  4. <u-search placeholder="请输入关键字" v-model="filterText" @search="setFilterText" @custom="setFilterText"></u-search>
  5. </view>
  6. <view class="venue-box">
  7. <u-card :head-border-bottom="false" :foot-border-top="false" title-size="32" padding="0" margin="10px" v-for="(item, index) in venueList"
  8. :key="index" class="venue-card" @click="goToVenueDetail(item)">
  9. <view class="venue-content" slot="head" style="padding-top: 10px;">
  10. <view class="venue-name">{{item.name}}</view>
  11. </view>
  12. <view class="venue-content" slot="body">
  13. <view class="info-text">
  14. <u-icon name="car"></u-icon>
  15. 距您{{item.distance}}
  16. </view>
  17. <view class="info-text">
  18. <u-icon name="map"></u-icon>
  19. {{item.address}}
  20. </view>
  21. </view>
  22. <view class="venue-content" slot="foot" style="text-align: right;">
  23. <u-button type="warning" shape="circle" :ripple="true" :custom-style="handleCustomStyle" size="mini" @click="goToVenueDetail(item)">预约</u-button>
  24. </view>
  25. </u-card>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. const NET = require('@/utils/request')
  31. const API = require('@/config/api')
  32. export default {
  33. data() {
  34. return {
  35. filterText: '',
  36. venueList: []
  37. }
  38. },
  39. onLoad() {
  40. this.getAllVenue()
  41. },
  42. methods: {
  43. // 获取全部场馆
  44. getAllVenue() {
  45. // 附件场馆
  46. NET.request(API.getVenueList, uni.getStorageSync('locationData'), 'POST').then(res => {
  47. this.venueList = res.data
  48. }).catch(error => {
  49. this.$refs.uTips.show({
  50. title: error.message,
  51. type: 'warning',
  52. })
  53. setTimeout(() => {
  54. uni.navigateBack()
  55. },1000)
  56. })
  57. },
  58. // 跳转场馆详情
  59. goToVenueDetail(item) {
  60. uni.navigateTo({
  61. url: '/pagesMember/venueDetail?id=' + item.id
  62. });
  63. },
  64. setFilterText() {
  65. if(this.filterText) {
  66. let arr = []
  67. this.venueList.forEach(item => {
  68. if(item.name.indexOf(this.filterText) >= 0) {
  69. arr.push(item)
  70. }
  71. })
  72. this.venueList = arr
  73. } else {
  74. this.getAllVenue()
  75. }
  76. }
  77. }
  78. }
  79. </script>
  80. <style lang="scss" scoped>
  81. @import "@/static/css/themes.scss";
  82. .content {
  83. width: 100%;
  84. float: left;
  85. .filter-box {
  86. height: 48px;
  87. padding: 10px 15px;
  88. background-color: #FFFFFF;
  89. }
  90. .venue-box {
  91. width: 100vw;
  92. float: left;
  93. /deep/.u-card--border:after {
  94. border-color: #cccccc;
  95. border-radius: 15px;
  96. }
  97. .venue-card {
  98. min-width: 100vw;
  99. display: inline-block;
  100. .venue-content {
  101. padding: 0px 15px 10px 15px;
  102. .venue-name {
  103. height: 20px;
  104. font-weight: bold;
  105. font-size: 15px;
  106. line-height: 20px;
  107. }
  108. .info-text {
  109. color: #999999;
  110. line-height: 18px;
  111. /deep/.u-icon {
  112. margin-right: 5px;
  113. font-size: 14px;
  114. }
  115. }
  116. }
  117. }
  118. }
  119. }
  120. </style>