洛阳学员端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

124 lines
2.4 KiB

  1. <template>
  2. <!-- 选择驾校弹出框 -->
  3. <view class="box">
  4. <view class="schoolTit">
  5. 选择驾校
  6. </view>
  7. <view class="searchBox">
  8. <u-search placeholder="请输入驾校名称" v-model.trim="keyword" @search="searchSchool" @custom="searchSchool">
  9. </u-search>
  10. </view>
  11. <scroll-view scroll-y="true" style="height: 700rpx" @scrolltolower="loadMore">
  12. <view class="ul">
  13. <view class="li" v-for="(item,index) in listData" :key="index" @click="chooseSchool(item)">
  14. <view class="name">
  15. {{ $u.utils.truncateText(item.name, 18) }}
  16. </view>
  17. <view class="starText">
  18. {{item.stars}}
  19. </view>
  20. <!-- <view class="distance">
  21. {{ $u.utils.distanceFn(item.distance)}}
  22. </view> -->
  23. </view>
  24. </view>
  25. <u-loadmore :status="status" icon-type="circle" />
  26. </scroll-view>
  27. </view>
  28. </template>
  29. <script>
  30. import { schoolPage } from '@/config/api.js'
  31. export default {
  32. data() {
  33. return {
  34. keyword: '',
  35. status: 'loadmore',
  36. listData: [],
  37. total: 10,
  38. params: {
  39. pageNo: 1,
  40. pageSize: 20,
  41. lat: 30.27419537786047,
  42. lng: 120.20633397715788,
  43. sercheType: '1'
  44. }
  45. }
  46. },
  47. created() {
  48. if(this.vuex_cityInfo.lat) {
  49. this.params.lat = this.vuex_cityInfo.lat
  50. this.params.lng = this.vuex_cityInfo.lng
  51. }
  52. this.schoolPageFn()
  53. },
  54. methods: {
  55. // 选择驾校
  56. chooseSchool(item) {
  57. this.$emit('chooseSchool', item)
  58. },
  59. // 获取驾校列表
  60. async schoolPageFn() {
  61. const {data: res} = await schoolPage(this.params)
  62. this.params.pageNo ++
  63. this.listData.push(...res.list)
  64. this.total = res.total
  65. if(this.listData.length>=this.total) this.status = 'nomore'
  66. console.log(res)
  67. }
  68. }
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. .schoolTit {
  73. line-height: 90rpx;
  74. text-align: center;
  75. font-size: 28rpx;
  76. }
  77. .searchBox {
  78. width: 100%;
  79. padding: 0 20rpx 20rpx 20rpx;
  80. border-bottom: 1rpx solid #ededed;
  81. }
  82. .ul {
  83. width: 100%;
  84. padding: 0 20rpx;
  85. .li {
  86. width: 100%;
  87. display: flex;
  88. align-items: center;
  89. height: 90rpx;
  90. font-size: 24rpx;
  91. border-bottom: 1rpx solid #ededed;
  92. &:last-child {
  93. border: none;
  94. }
  95. .name {
  96. width: 0;
  97. flex: 1;
  98. font-size: 28rpx;
  99. }
  100. .starText {
  101. color: red;
  102. width: 100rpx;
  103. text-align: right;
  104. flex-shrink: 0;
  105. white-space: nowrap;
  106. }
  107. .distance {
  108. width: 120rpx;
  109. text-align: right;
  110. flex-shrink: 0;
  111. white-space: nowrap;
  112. }
  113. }
  114. }
  115. </style>