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

100 lines
2.2 KiB

  1. <template>
  2. <view class="carBox">
  3. <view class="carh1">学驾车型</view>
  4. <view v-for="(item,index) in carTypeArr" :key="index" class="carLi">
  5. <view class="carType">{{item.lab}}</view>
  6. <view class="carName_row">
  7. <view class="carName" v-for="(item2,index2) in item.arr" :key="index2" @click="pickerCarClick(item2)" :class="{active: pickerCarArr.indexOf(item2) > -1}">{{item2}}</view>
  8. </view>
  9. </view>
  10. <view class="payBtn_row">
  11. <view class="btnBorder btn" @click="pickerCar()">重置</view>
  12. <view class="btnBg btn" @click="pickerCar(1)">完成</view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. data() {
  19. return {
  20. carTypeArr: [
  21. {lab: '小车',arr: ['C1','C2','C3']},
  22. {lab: '货车',arr: ['A2','B2',]},
  23. {lab: '客车',arr: ['A1','A3','B1']},
  24. {lab: '摩托车',arr: ['D','E','F']},
  25. {lab: '其它',arr: ['C4','C5','C6']},
  26. ],
  27. pickerCarArr: [],
  28. }
  29. },
  30. methods: {
  31. pickerCar(num) {
  32. if(num==1) {
  33. if(!this.pickerCarArr.length) return this.$u.toast('请选择学驾车型')
  34. let oldDriveModel = this.pickerCarArr.join(',')
  35. this.$emit('pickerOldDrive', oldDriveModel)
  36. }else {
  37. this.pickerCarArr = []
  38. this.form.oldDriveModel = ''
  39. }
  40. },
  41. pickerCarClick(item) {
  42. let index = this.pickerCarArr.indexOf(item)
  43. if(index>-1) {
  44. this.pickerCarArr.splice(index, 1);
  45. }else {
  46. this.pickerCarArr.push(item)
  47. }
  48. }
  49. }
  50. }
  51. </script>
  52. <style lang="scss" scoped>
  53. .carBox {
  54. width: 100%;
  55. .carh1 {
  56. font-size: 26rpx;
  57. font-weight: 700;
  58. text-align: center;
  59. padding: 30rpx 0 0 0;
  60. }
  61. .carLi {
  62. width: 100%;
  63. margin-bottom: 30rpx;
  64. padding: 0 32rpx;
  65. }
  66. .carType {
  67. font-size: 26rpx;
  68. font-weight: 500;
  69. line-height: 40rpx;
  70. padding: 28rpx 12rpx 12rpx 0;
  71. }
  72. .carName_row {
  73. display: flex;
  74. .carName {
  75. margin-right: 40rpx;
  76. width: 88rpx;
  77. height: 56rpx;
  78. background: #F6F7F8;
  79. border-radius: 28rpx;
  80. line-height: 56rpx;
  81. text-align: center;
  82. color: #686B73;
  83. &.active {
  84. background: #ECF7FE;
  85. border: 1px solid #3593FB;
  86. color: #1989FA;
  87. }
  88. }
  89. }
  90. }
  91. .payBtn_row {
  92. display: flex;
  93. justify-content: space-between;
  94. padding: 30rpx;
  95. .btn {
  96. width: 48%;
  97. }
  98. }
  99. </style>