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

142 lines
3.1 KiB

<template>
<view class="pageBg">
<view class="pad">
<view class="type">
<view class="h1">驾照类型</view>
<view class="tagFlex">
<view class="tab" v-for="(item,index) in driverList" :class="{active: driverTypeArr.indexOf(item.label)!=-1}" @click="driverTypeClick(item)">{{ item.label }}</view>
</view>
</view>
<view class="region">
<view class="h1">区域</view>
<view class="tagFlex">
<view class="tab" v-for="(item,index) in areList" :class="{active: areTypeArr.indexOf(item.areaCode)!=-1}" @click="areTypeClick(item)">{{ item.areaName }}</view>
</view>
</view>
<view class="btn_row">
<view class="btn border" @click="reSetFn">重置</view>
<view class="btn" @click="screenConfirm">确定</view>
</view>
</view>
</view>
</template>
<script>
import { licenseType, nachangList } from '@/config/api.js'
export default {
data() {
return {
driverList: [],//车型
areList: [],//区域
driverTypeArr: [],
areTypeArr: []
}
},
onLoad(options) {
if(options.businessScope) {
this.driverTypeArr = options.businessScope.split(',')
}
if(options.district) {
this.areTypeArr = options.district.split(',').map(item=>item*1)
console.log(this.areTypeArr)
}
this.licenseTypeFn()
this.nachangListFn()
},
methods: {
async licenseTypeFn() {
const {data: res} = await licenseType()
this.driverList = res
console.log(res)
},
async nachangListFn() {
const {data: res} = await nachangList()
this.areList = res
console.log(res)
},
driverTypeClick(item) {
let index = this.driverTypeArr.indexOf(item.label)
if( index==-1) {
this.driverTypeArr.push(item.label)
}else {
this.driverTypeArr.splice(index,1)
}
},
areTypeClick(item) {
let index = this.areTypeArr.indexOf(item.areaCode)
if( index==-1) {
this.areTypeArr.push(item.areaCode)
}else {
this.areTypeArr.splice(index,1)
}
},
reSetFn() {
this.areTypeArr = []
this.driverTypeArr = []
},
screenConfirm() {
console.log( this.driverTypeArr)
let obj = {
businessScope: this.driverTypeArr.join(','),
district: this.areTypeArr.join(',')
}
uni.$emit('screenConfirm', obj)
uni.navigateBack()
}
}
}
</script>
<style lang="scss" scoped>
.h1 {
line-height: 100rpx;
}
.btn_row {
position: fixed;
bottom: 50rpx;
left: 0;
display: flex;
justify-content: space-between;
width: 100%;
padding: 0 28rpx;
.btn {
width: 48.8%;
height: 72rpx;
background: #1989FA;
border-radius: 8rpx;
font-size: 28rpx;
color: #fff;
text-align: center;
line-height: 72rpx;
&.border {
background: rgba(25,137,250,0.1);
border: 2rpx solid #1989FA;
color: $themC;
}
}
}
.tagFlex {
display: flex;
flex-wrap: wrap;
.tab {
padding: 10rpx 24rpx;
margin: 12rpx 20rpx;
height: 60rpx;
background: #FFFFFF;
border-radius: 8rpx;
font-size: 28rpx;
color: #686B73;
&.active {
background: rgba(25,137,250,0.1);
border-radius: 8rpx;
border: 2rpx solid #1989FA;
font-size: 28rpx;
color: $themC;
}
}
}
</style>