学员端小程序
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.

134 lines
2.9 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <view class="pageBg">
  3. <view class="pad">
  4. <view class="type">
  5. <view class="h1">驾照类型</view>
  6. <view class="tagFlex">
  7. <view class="tab" v-for="(item,index) in driverList" :class="{active: driverTypeArr.indexOf(item.label)!=-1}" @click="driverTypeClick(item)">{{ item.label }}</view>
  8. </view>
  9. </view>
  10. <view class="region">
  11. <view class="h1">区域</view>
  12. <view class="tagFlex">
  13. <view class="tab" v-for="(item,index) in areList" :class="{active: areTypeArr.indexOf(item.areaCode)!=-1}" @click="areTypeClick(item)">{{ item.areaName }}</view>
  14. </view>
  15. </view>
  16. <view class="btn_row">
  17. <view class="btn border" @click="reSetFn">重置</view>
  18. <view class="btn" @click="screenConfirm">确定</view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import { licenseType, nachangList } from '@/config/api.js'
  25. export default {
  26. data() {
  27. return {
  28. driverList: [],//车型
  29. areList: [],//区域
  30. driverTypeArr: [],
  31. areTypeArr: []
  32. }
  33. },
  34. onLoad() {
  35. this.licenseTypeFn()
  36. this.nachangListFn()
  37. },
  38. methods: {
  39. async licenseTypeFn() {
  40. const {data: res} = await licenseType()
  41. this.driverList = res
  42. console.log(res)
  43. },
  44. async nachangListFn() {
  45. const {data: res} = await nachangList()
  46. this.areList = res
  47. console.log(res)
  48. },
  49. driverTypeClick(item) {
  50. let index = this.driverTypeArr.indexOf(item.label)
  51. if( index==-1) {
  52. this.driverTypeArr.push(item.label)
  53. }else {
  54. this.driverTypeArr.splice(index,1)
  55. }
  56. },
  57. areTypeClick(item) {
  58. let index = this.areTypeArr.indexOf(item.areaCode)
  59. if( index==-1) {
  60. this.areTypeArr.push(item.areaCode)
  61. }else {
  62. this.areTypeArr.splice(index,1)
  63. }
  64. },
  65. reSetFn() {
  66. this.areTypeArr = []
  67. this.driverTypeArr = []
  68. },
  69. screenConfirm() {
  70. console.log( this.driverTypeArr)
  71. let obj = {
  72. businessScope: this.driverTypeArr.join(','),
  73. district: this.areTypeArr.join(',')
  74. }
  75. uni.$emit('screenConfirm', obj)
  76. uni.navigateBack()
  77. }
  78. }
  79. }
  80. </script>
  81. <style lang="scss" scoped>
  82. .h1 {
  83. line-height: 100rpx;
  84. }
  85. .btn_row {
  86. position: fixed;
  87. bottom: 50rpx;
  88. left: 0;
  89. display: flex;
  90. justify-content: space-between;
  91. width: 100%;
  92. padding: 0 28rpx;
  93. .btn {
  94. width: 48.8%;
  95. height: 72rpx;
  96. background: #1989FA;
  97. border-radius: 8rpx;
  98. font-size: 28rpx;
  99. color: #fff;
  100. text-align: center;
  101. line-height: 72rpx;
  102. &.border {
  103. background: rgba(25,137,250,0.1);
  104. border: 2rpx solid #1989FA;
  105. color: $themC;
  106. }
  107. }
  108. }
  109. .tagFlex {
  110. display: flex;
  111. flex-wrap: wrap;
  112. .tab {
  113. padding: 10rpx 24rpx;
  114. margin: 12rpx 20rpx;
  115. height: 60rpx;
  116. background: #FFFFFF;
  117. border-radius: 8rpx;
  118. font-size: 28rpx;
  119. color: #686B73;
  120. &.active {
  121. background: rgba(25,137,250,0.1);
  122. border-radius: 8rpx;
  123. border: 2rpx solid #1989FA;
  124. font-size: 28rpx;
  125. color: $themC;
  126. }
  127. }
  128. }
  129. </style>