维基小程序
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
2.8 KiB

<template>
<view class="home-nav">
<view class="search-box">
<input class="home-ipt" @click="jumpSearch" placeholder="请输入您要搜索的政策" disabled=""/>
<icon class="iconfont icon-sousuo search" type=""></icon>
</view>
<!-- <view class="home-text" @tap="handleTap('picker2')">
<text>{{label2[2]}}</text>
<icon class="iconfont icon-jiantou-xia triangle" type=""></icon>
</view> -->
<!-- 地址选择 -->
<lb-picker ref="picker2"
v-model="value2"
mode="multiSelector"
:list="list"
:level="3"
@confirm="handleConfirm"
:props="props"
>
</lb-picker>
<!-- 地址选择结束 -->
</view>
</template>
<script>
import { mapState, mapMutations, mapActions } from 'vuex';
import { areaquery } from 'api/area'
export default {
data() {
return {
value2: [],
label2: ['山西','太原','小店区'],
city:[],
list:[],
props: {label:'areaName',value:'id',children:'city'}
}
},
async created(options) {
uni.showLoading({
icon:'none',
title:'加载中...'
})
try {
const params ={
"param": {
"areaParentId": 0,
"areaType": 0,
"deep": 3
},
}
const data = await areaquery(params);
this.list = data
uni.hideLoading()
} catch (err) {
uni.hideLoading()
console.log(err)
}
},
methods: {
...mapMutations('user', ['setCity','setCityList']),
jumpSearch(){
uni.navigateTo({
url:'../HomePages/SearchPage'
})
},
jumpLocation(){
uni.navigateTo({
url:'../HomePages/AddressPage'
})
},
handleTap (picker) {
this.$refs[picker].show()
// console.log(this.$refs[picker])
},
handleConfirm (item) {
this.label2 = [item.item[0].areaName,item.item[1].areaName,item.item[2].areaName]
this.setCity(item.item[1].id);
this.setCityList(item.item[1].city)
console.log(this.$store.state.user.cityId)
}
}
}
</script>
<style lang="scss" scoped>
.home-nav{
position: relative;
height: 88upx;
background-color: $red;
position: fixed;
width: 100%;
z-index: 10;
display: flex;
align-items: center;
justify-content: flex-start;
}
.home-ipt{
flex: 1;
background-color: white;
border-radius: 25px;
height: 48upx;
padding-left: 70upx;
font-size: 24upx;
}
.home-text{
padding-right: 20upx;
display: flex;
justify-content: flex-end;
color: $white;
font-size: 24upx;
vertical-align: middle;
}
.search-box{
position: relative;
height: 48upx;
margin-left: 20upx;
margin-right: 20upx;
flex: 1;
.search{
position: absolute;
left: 15upx;
top:50%;
transform: translate3d(0,-50%,0);
line-height: 50upx !important;
font-size: 40upx;
margin-top: 0 !important;
padding-top: 0 !important;
}
}
.triangle{
margin-left: 6upx;
display: inline-flex;
align-items: center;
font-size: 24upx;
}
</style>