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

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