venueList.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <view class="content">
  3. <scroll-view scroll-y class="scroll-box" :refresher-enabled="true" :refresher-triggered="triggered"
  4. :refresher-threshold="100" refresher-background="white" @refresherrefresh="onRefresh" @refresherrestore="onRestore">
  5. <u-card :head-border-bottom="false" :foot-border-top="false" padding="0px" margin="10px" borderRadius="40" v-for="(item, index) in tableList"
  6. :key="index" class="class-card" @click="goToOrderDetail(item)">
  7. <view class="class-content" slot="head" style="padding-top: 10px;">
  8. <view class="class-name">{{item.name}}</view>
  9. </view>
  10. <view class="class-content" slot="body">
  11. <view class="class-info-text">
  12. <u-icon name="car"></u-icon>
  13. 距您:{{item.distance}}
  14. </view>
  15. <view class="class-info-text">
  16. <u-icon name="map"></u-icon>
  17. {{item.address}}
  18. </view>
  19. </view>
  20. </u-card>
  21. <u-divider v-if="isOver" bg-color="transparent">没有更多了</u-divider>
  22. </scroll-view>
  23. <u-top-tips ref="uTips"></u-top-tips>
  24. </view>
  25. </template>
  26. <script>
  27. import {
  28. mapGetters
  29. } from 'vuex'
  30. const NET = require('@/utils/request')
  31. const API = require('@/config/api')
  32. export default {
  33. computed: {
  34. ...mapGetters([])
  35. },
  36. data() {
  37. return {
  38. id: '',
  39. triggered: false,
  40. isOver: false,
  41. tableList: [],
  42. }
  43. },
  44. onLoad(options) {
  45. this.id = options.id
  46. this.getTableList()
  47. },
  48. onReady() {},
  49. methods: {
  50. // 下拉刷新
  51. onRefresh() {
  52. this.triggered = true
  53. this.isOver = false
  54. this.getTableList()
  55. },
  56. // 重置下拉刷新状态
  57. onRestore() {
  58. this.triggered = 'restore'
  59. this.triggered = false
  60. },
  61. // 获取列表数据
  62. getTableList() {
  63. NET.request(API.getVenueList, uni.getStorageSync('locationData'), 'POST').then(res => {
  64. this.tableList = res.data
  65. }).catch(error => {
  66. this.$refs.uTips.show({
  67. title: error.message,
  68. type: 'warning',
  69. })
  70. })
  71. },
  72. // 跳转订单详情
  73. goToOrderDetail(item) {
  74. uni.navigateTo({
  75. url: '/pagesMain/venueDetail?id=' + item.id + '&userId=' + this.id
  76. });
  77. }
  78. },
  79. }
  80. </script>
  81. <style>
  82. page {
  83. width: 100%;
  84. height: 100%;
  85. background-color: #f7f7f7;
  86. }
  87. </style>
  88. <style lang="scss" scoped>
  89. @import "@/static/css/themes.scss";
  90. .content {
  91. width: 100%;
  92. float: left;
  93. .scroll-box {
  94. width: 100%;
  95. height: 100vh;
  96. padding-bottom: 10px;
  97. box-sizing: border-box;
  98. .class-card {
  99. .class-content {
  100. padding: 5px 15px;
  101. }
  102. .class-name {
  103. height: 20px;
  104. display: inline-block;
  105. font-weight: bold;
  106. font-size: 14px;
  107. line-height: 20px;
  108. }
  109. .class-info-text {
  110. color: #999999;
  111. margin-bottom: 5px;
  112. /deep/.u-icon {
  113. margin-right: 5px;
  114. font-size: 14px;
  115. color: #000000;
  116. }
  117. }
  118. }
  119. }
  120. }
  121. </style>