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

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