洛阳学员端
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.

198 lines
4.3 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. <template>
  2. <view class="pageBg">
  3. <view class="topBg">
  4. <topNavbar title="找驾校"></topNavbar>
  5. <view class="searchCon pad">
  6. <searchRow placeholder="搜索驾校名称" @searchFn="$goPage('/pages/indexEntry/findShcool/searchShcool/searchShcool')" :disable="true"></searchRow>
  7. </view>
  8. </view>
  9. <view class="pad">
  10. <view class="navBox">
  11. <view class="tab" v-for="(item,index) in tabData" :key="index" :class="{active: (params.sercheType==item.id&&!(params.businessScope||params.district))}" @click="tabClick(item)">
  12. {{ item.text }}</view>
  13. <view class="screen" @click="goScreen" :class="{active: (params.businessScope||params.district)}">
  14. <view class="txt">筛选</view>
  15. <view class="screenIcon">
  16. <image src="@/static/images/carIcon/screeIcon.png" mode=""></image>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="ul">
  21. <view class="li" v-for="(item,index) in listData" :key="index" >
  22. <schoolItme :item="item" @click.native="goPage(item)"/>
  23. </view>
  24. </view>
  25. </view>
  26. <view style="padding-bottom: 20rpx;" v-if="listData.length">
  27. <u-loadmore :status="status" />
  28. </view>
  29. <nodata v-if="!listData.length&&status=='nomore'"></nodata>
  30. </view>
  31. </template>
  32. <script>
  33. import schoolItme from '@/pages/tabbar/index/comp/schoolItem.vue'
  34. import { schoolPage } from '@/config/api.js'
  35. export default {
  36. components: { schoolItme },
  37. data() {
  38. return {
  39. currentTab: 0,
  40. tabData: [{
  41. text: '全部',
  42. id: 1
  43. },
  44. {
  45. text: '场地优先',
  46. id: 2
  47. },
  48. {
  49. text: '距离优先',
  50. id: 3
  51. },
  52. {
  53. text: '好评优先',
  54. id: 4
  55. },
  56. ],
  57. params: {
  58. pageNo: 1,
  59. pageSize: 20,
  60. lat: '',
  61. lng: '',
  62. sercheType: 1,
  63. businessScope: '',
  64. district: '',
  65. name: ''
  66. },
  67. total: 20,
  68. listData: [],
  69. status: 'loading'
  70. }
  71. },
  72. onLoad() {
  73. let vuex_cityInfo = this.$store.state.user.vuex_cityInfo
  74. if(!vuex_cityInfo.lat) {
  75. this.$store.dispatch('getCity')
  76. }else {
  77. this.params.lat = vuex_cityInfo.lat
  78. this.params.lng = vuex_cityInfo.lng
  79. }
  80. this.schoolPageFn()
  81. uni.$on('screenConfirm',(obj)=>{
  82. this.params = Object.assign(this.params, obj)
  83. this.listInit()
  84. })
  85. },
  86. onPullDownRefresh() {
  87. this.listInit()
  88. },
  89. onReachBottom() {
  90. if(this.total>this.listData.length) {
  91. this.schoolPageFn()
  92. }
  93. },
  94. methods: {
  95. searchFn(val) {
  96. this.params.name = val
  97. this.listInit()
  98. },
  99. goScreen() {
  100. let url = `/pages/indexEntry/findShcool/screen/screen?businessScope=${this.params.businessScope}&district=${this.params.district}`
  101. this.$goPage(url)
  102. },
  103. goPage(item) {
  104. this.$goPage('/pages/indexEntry/findShcool/shcoolDetail/shcoolDetail?schoolId='+ item.id)
  105. },
  106. tabClick(item) {
  107. this.params.sercheType = item.id
  108. this.params.businessScope = ''
  109. this.params.district = ''
  110. this.listInit()
  111. },
  112. async listInit() {
  113. this.listData = []
  114. this.params.pageNo = 1
  115. await this.schoolPageFn()
  116. uni.stopPullDownRefresh()
  117. },
  118. // 获取驾校列表
  119. async schoolPageFn() {
  120. let obj = {}
  121. for(let key in this.params) {
  122. if(this.params[key]) {
  123. obj[key] = this.params[key]
  124. }
  125. }
  126. const {data: res} = await schoolPage(obj)
  127. this.params.pageNo ++
  128. this.listData.push(...res.list)
  129. this.total = res.total
  130. if(this.listData.length>=this.total) this.status = 'nomore'
  131. console.log(res)
  132. }
  133. }
  134. }
  135. </script>
  136. <style lang="scss" scoped>
  137. .pageBg {
  138. width: 100%;
  139. .navBox {
  140. display: flex;
  141. justify-content: space-between;
  142. padding: 20rpx 0;
  143. .tab {
  144. font-size: 28rpx;
  145. color: #999;
  146. line-height: 50rpx;
  147. border-radius: 10rpx;
  148. background: #fff;
  149. text-align: center;
  150. height: 50rpx;
  151. width: 126rpx;
  152. &.active {
  153. background: $themC;
  154. color: #fff;
  155. }
  156. }
  157. .screen {
  158. width: 150rpx;
  159. display: flex;
  160. justify-content: center;
  161. align-items: center;
  162. position: relative;
  163. background: #fff;
  164. color: #999;
  165. border-radius: 10rpx;
  166. &.active {
  167. background: $themC;
  168. color: #fff;
  169. }
  170. .txt {
  171. font-size: 28rpx;
  172. margin-right: 10rpx;
  173. }
  174. .screenIcon {
  175. width: 18rpx;
  176. height: 12rpx;
  177. }
  178. }
  179. }
  180. .ul {
  181. width: 100%;
  182. .li {
  183. }
  184. }
  185. }
  186. .topBg {
  187. padding-bottom: 20rpx;
  188. }
  189. </style>