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

218 lines
4.9 KiB

10 months ago
10 months ago
3 weeks ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
3 weeks ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
3 weeks ago
10 months ago
3 weeks ago
10 months ago
3 weeks 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" key="1"></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.districts))}" @click="tabClick(item)">
  12. {{ item.text }}</view>
  13. <view class="screen" @click="goScreen" :class="{active: (params.businessScope||params.districts)}">
  14. <view class="txt">筛选</view>
  15. <u-icon name="arrow-down-fill" :color="(params.businessScope||params.districts)?'#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" style="height: 176rpx;">
  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. districts: '',
  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}&districts=${this.params.districts}`
  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.districts = ''
  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. uni.showLoading({
  119. title: '正在加载...'
  120. })
  121. let obj = {}
  122. for(let key in this.params) {
  123. if(this.params[key]) {
  124. obj[key] = this.params[key]
  125. }
  126. }
  127. const {data: res} = await schoolPage(obj)
  128. this.params.pageNo ++
  129. // let arr = res.list.map(item=>{
  130. // if(!item.schoolIntroduceDO) item.schoolIntroduceDO = {}
  131. // let obj = {
  132. // iconPath: item.schoolIntroduceDO.iconPath,
  133. // name: item.name,
  134. // stars: item.stars,
  135. // reviewTotal: item.reviewTotal,
  136. // phone: item.phone,
  137. // id: item.id,
  138. // distance: item.distance,
  139. // districtName: item.districtName
  140. // }
  141. // return obj
  142. // })
  143. this.listData.push(...res.list)
  144. this.total = res.total
  145. if(this.listData.length>=this.total) this.status = 'nomore'
  146. console.log(res)
  147. this.$nextTick(()=>{
  148. uni.hideLoading()
  149. })
  150. }
  151. }
  152. }
  153. </script>
  154. <style lang="scss" scoped>
  155. /deep/ .itemBox {
  156. padding: 20rpx !important;
  157. }
  158. .pageBg {
  159. width: 100%;
  160. .navBox {
  161. display: flex;
  162. justify-content: space-between;
  163. padding: 20rpx 0;
  164. .tab {
  165. font-size: 24rpx;
  166. color: #999;
  167. line-height: 50rpx;
  168. border-radius: 10rpx;
  169. background: #fff;
  170. text-align: center;
  171. height: 50rpx;
  172. width: 126rpx;
  173. &.active {
  174. background: $themC;
  175. color: #fff;
  176. }
  177. }
  178. .screen {
  179. width: 150rpx;
  180. display: flex;
  181. justify-content: center;
  182. align-items: center;
  183. position: relative;
  184. background: #fff;
  185. color: #999;
  186. border-radius: 10rpx;
  187. &.active {
  188. background: $themC;
  189. color: #fff;
  190. }
  191. .txt {
  192. font-size: 24rpx;
  193. margin-right: 10rpx;
  194. }
  195. .screenIcon {
  196. width: 18rpx;
  197. height: 12rpx;
  198. }
  199. }
  200. }
  201. .ul {
  202. width: 100%;
  203. .li {
  204. margin-bottom: 20rpx;
  205. }
  206. }
  207. }
  208. .topBg {
  209. padding-bottom: 20rpx;
  210. }
  211. </style>