venueMore.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. import {
  31. mapGetters
  32. } from 'vuex'
  33. const NET = require('@/utils/request')
  34. const API = require('@/config/api')
  35. export default {
  36. data() {
  37. return {
  38. filterText: '',
  39. venueList: []
  40. }
  41. },
  42. computed: {
  43. ...mapGetters([
  44. 'handleCustomStyle',
  45. ])
  46. },
  47. onLoad() {
  48. this.getAllVenue()
  49. },
  50. methods: {
  51. // 获取全部场馆
  52. getAllVenue() {
  53. // 附件场馆
  54. NET.request(API.getSaleVenueList, {page:1,size:100}, 'POST').then(res => {
  55. this.venueList = res.data.row
  56. }).catch(error => {
  57. this.$refs.uTips.show({
  58. title: error.message,
  59. type: 'warning',
  60. })
  61. setTimeout(() => {
  62. uni.navigateBack()
  63. },1000)
  64. })
  65. },
  66. // 跳转场馆详情
  67. goToVenueDetail(item) {
  68. uni.navigateTo({
  69. url: '/pagesMain/venueDetail?id=' + item.id
  70. });
  71. },
  72. setFilterText() {
  73. if(this.filterText) {
  74. let arr = []
  75. this.venueList.forEach(item => {
  76. if(item.name.indexOf(this.filterText) >= 0) {
  77. arr.push(item)
  78. }
  79. })
  80. this.venueList = arr
  81. } else {
  82. this.getAllVenue()
  83. }
  84. }
  85. }
  86. }
  87. </script>
  88. <style lang="scss" scoped>
  89. @import "@/static/css/themes.scss";
  90. .content {
  91. width: 100%;
  92. float: left;
  93. .filter-box {
  94. height: 48px;
  95. padding: 10px 15px;
  96. background-color: #FFFFFF;
  97. }
  98. .venue-box {
  99. width: 100vw;
  100. float: left;
  101. /deep/.u-card--border:after {
  102. border-color: #cccccc;
  103. border-radius: 15px;
  104. }
  105. .venue-card {
  106. min-width: 100vw;
  107. display: inline-block;
  108. .venue-content {
  109. padding: 0px 15px 10px 15px;
  110. .venue-name {
  111. height: 20px;
  112. font-weight: bold;
  113. font-size: 15px;
  114. line-height: 20px;
  115. }
  116. .info-text {
  117. color: #999999;
  118. line-height: 18px;
  119. /deep/.u-icon {
  120. margin-right: 5px;
  121. font-size: 14px;
  122. }
  123. }
  124. }
  125. }
  126. }
  127. }
  128. </style>