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

137 lines
3.0 KiB

1 month ago
1 month 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" :key="index" :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" :key="index" :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(options) {
  35. if(options.businessScope) {
  36. this.driverTypeArr = options.businessScope.split(',')
  37. }
  38. if(options.districts) {
  39. this.areTypeArr = options.districts.split(',').map(item=>item*1)
  40. }
  41. this.licenseTypeFn()
  42. this.nachangListFn()
  43. },
  44. methods: {
  45. async licenseTypeFn() {
  46. const {data: res} = await licenseType()
  47. this.driverList = res
  48. },
  49. async nachangListFn() {
  50. const {data: res} = await nachangList()
  51. this.areList = res
  52. },
  53. driverTypeClick(item) {
  54. let index = this.driverTypeArr.indexOf(item.label)
  55. if( index==-1) {
  56. this.driverTypeArr.push(item.label)
  57. }else {
  58. this.driverTypeArr.splice(index,1)
  59. }
  60. },
  61. areTypeClick(item) {
  62. let index = this.areTypeArr.indexOf(item.areaCode)
  63. if( index==-1) {
  64. this.areTypeArr.push(item.areaCode)
  65. }else {
  66. this.areTypeArr.splice(index,1)
  67. }
  68. },
  69. reSetFn() {
  70. this.areTypeArr = []
  71. this.driverTypeArr = []
  72. },
  73. screenConfirm() {
  74. let obj = {
  75. businessScope: this.driverTypeArr.join(','),
  76. districts: this.areTypeArr.join(',')
  77. }
  78. uni.$emit('screenConfirm', obj)
  79. uni.navigateBack()
  80. }
  81. }
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. .h1 {
  86. line-height: 100rpx;
  87. }
  88. .btn_row {
  89. position: fixed;
  90. bottom: 50rpx;
  91. left: 0;
  92. display: flex;
  93. justify-content: space-between;
  94. width: 100%;
  95. padding: 0 28rpx;
  96. .btn {
  97. width: 48.8%;
  98. height: 72rpx;
  99. background: #1989FA;
  100. border-radius: 8rpx;
  101. font-size: 28rpx;
  102. color: #fff;
  103. text-align: center;
  104. line-height: 72rpx;
  105. &.border {
  106. background: rgba(25,137,250,0.1);
  107. border: 2rpx solid #1989FA;
  108. color: $themC;
  109. }
  110. }
  111. }
  112. .tagFlex {
  113. display: flex;
  114. flex-wrap: wrap;
  115. .tab {
  116. padding: 10rpx 24rpx;
  117. margin: 12rpx 20rpx;
  118. height: 60rpx;
  119. background: #FFFFFF;
  120. border-radius: 8rpx;
  121. font-size: 28rpx;
  122. color: #686B73;
  123. &.active {
  124. background: rgba(25,137,250,0.1);
  125. border-radius: 8rpx;
  126. border: 2rpx solid #1989FA;
  127. font-size: 28rpx;
  128. color: $themC;
  129. }
  130. }
  131. }
  132. </style>