parent
0fe1631877
commit
ddf5a75413
@ -1,93 +1,177 @@ |
|||||||
<template> |
<template> |
||||||
<view> |
<view> |
||||||
<view class="width100 backcorfff"> |
<!-- <view class="width100 backcorfff"> |
||||||
<!-- <uSearchBar @confirm="search" @input="input"></uSearchBar> |
<view class="width90 mart20 font15 fcor333">当前定位</view> |
||||||
<view class="line1 mart10"></view> --> |
<view class="posacname actives mart20">{{posName}}</view> |
||||||
<view class="width90 mart20 font15 fcor333">当前定位</view> |
<view class="width90 mart20 font14 fcor333">其他地区</view> |
||||||
<view class="posacname actives mart20">{{posName}}</view> |
<view class="posheadname mart20 flleft font14" :class="{'actives':posId===item.regionId}" |
||||||
<view class="width90 mart20 font14 fcor333">其他地区</view> |
v-for="(item,index) in posList" :key="index" @click="change(item)"> |
||||||
<view class="posheadname mart20 flleft font14" :class="{'actives':posId===item.regionId}" |
{{item.regionName}} |
||||||
v-for="(item,index) in posList" :key="index" @click="change(item)"> |
</view> |
||||||
{{item.regionName}} |
</view> --> |
||||||
</view> |
|
||||||
</view> |
<city-select @cityClick="cityClick" :formatName="formatName" :activeCity="activeCity" :hotCity="hotCity" |
||||||
</view> |
:obtainCitys="obtainCitys" :isSearch="true" ref="citys"></city-select> |
||||||
</template> |
</view> |
||||||
|
</template> |
||||||
<script> |
|
||||||
import uSearchBar from '../../../components/uni-search-bar/components/uni-search-bar/uni-search-bar.vue'; |
<script> |
||||||
import { |
// import uSearchBar from '../../../components/uni-search-bar/components/uni-search-bar/uni-search-bar.vue'; |
||||||
getDredgeProvince |
// import { |
||||||
} from '../../../Utils/Api.js'; |
// getDredgeProvince |
||||||
let app = getApp(); |
// } from '../../../Utils/Api.js'; |
||||||
export default { |
import { |
||||||
components: { |
getAllCity, |
||||||
uSearchBar |
findCompanyByCityName |
||||||
}, |
} from '../../../Utils/Api.js'; |
||||||
data() { |
import citySelect from '@/components/city-select/city-select.vue'; |
||||||
return { |
let app = getApp(); |
||||||
posList: [], |
export default { |
||||||
posId: '', |
components: { |
||||||
posName: '' |
// uSearchBar, |
||||||
} |
citySelect |
||||||
}, |
}, |
||||||
onLoad() { |
data() { |
||||||
this.getDredgeProvince(); |
return { |
||||||
this.posName = app.globalData.cityName; |
// posList: [], |
||||||
}, |
// posId: '', |
||||||
methods: { |
// posName: '' |
||||||
|
|
||||||
getDredgeProvince() { |
//需要构建索引参数的名称(注意:传递的对象里面必须要有这个名称的参数) |
||||||
uni.showLoading({ |
formatName: 'cityName', |
||||||
title: '加载中' |
//当前城市 |
||||||
}) |
activeCity: {}, |
||||||
getDredgeProvince().then(res => { |
//热门城市 |
||||||
uni.hideLoading() |
hotCity: [{ |
||||||
if (res.return_code == '000000') { |
id: 0, |
||||||
this.posList = res.return_data; |
cityName: '南京市' |
||||||
} |
}, |
||||||
}); |
{ |
||||||
}, |
id: 1, |
||||||
change(item) { |
cityName: '南京市' |
||||||
this.posId = item.regionId; |
} |
||||||
this.posName = item.regionName; |
], |
||||||
app.globalData.cityId = item.regionId; |
//显示的城市数据 |
||||||
app.globalData.cityName = item.regionName; |
obtainCitys: [] |
||||||
uni.navigateBack({ |
} |
||||||
}) |
}, |
||||||
} |
onLoad() { |
||||||
} |
// this.getDredgeProvince(); |
||||||
} |
// this.posName = app.globalData.cityName; |
||||||
</script> |
this.getAllCity(); |
||||||
|
this.activeCity = { |
||||||
<style lang="less"> |
id: 1, |
||||||
.posheadname { |
cityName: app.globalData.qianzhuCityName |
||||||
background-color: #f5f5f5; |
} |
||||||
color: #666666; |
//热门城市 |
||||||
padding-left: 10px; |
this.hotCity = [{ |
||||||
padding-right: 10px; |
id: 0, |
||||||
height: 30px; |
cityName: '南京市', |
||||||
margin-left: 4%; |
cityCode: 110100 |
||||||
line-height: 30px; |
}, |
||||||
text-align: center; |
{ |
||||||
border-radius: 5px; |
id: 1, |
||||||
} |
cityName: '北京市', |
||||||
.posacname { |
cityCode: 110102 |
||||||
background-color: #f5f5f5; |
} |
||||||
color: #666666; |
] |
||||||
display: inline-block; |
}, |
||||||
padding-left: 10px; |
methods: { |
||||||
padding-right: 10px; |
//选择城市 |
||||||
height: 30px; |
cityClick(item) { |
||||||
margin-left: 4%; |
// app.globalData.qianzhuCityName = item.cityName; |
||||||
line-height: 30px; |
|
||||||
text-align: center; |
this.findCompanyByCityName(item); |
||||||
border-radius: 5px; |
}, |
||||||
} |
//查询城市名字 |
||||||
|
getAllCity() { |
||||||
.actives { |
uni.showLoading({ |
||||||
color: #089bf5; |
title: '加载中...' |
||||||
background-color: #f4faff; |
}) |
||||||
border: 1px solid #089bf5; |
|
||||||
} |
getAllCity().then(res => { |
||||||
|
uni.hideLoading(); |
||||||
|
if (res.return_code == '000000') { |
||||||
|
this.obtainCitys = res.return_data; |
||||||
|
} |
||||||
|
}) |
||||||
|
}, |
||||||
|
//根据市查询 |
||||||
|
findCompanyByCityName(item) { |
||||||
|
uni.showLoading({ |
||||||
|
title: '加载中...' |
||||||
|
}) |
||||||
|
let datas = { |
||||||
|
cityName: item.cityName |
||||||
|
} |
||||||
|
findCompanyByCityName(datas).then(res => { |
||||||
|
uni.hideLoading(); |
||||||
|
if (res.return_code == '000000') { |
||||||
|
app.globalData.cityName = res.return_data.provinceName; |
||||||
|
app.globalData.qianzhuCityName = res.return_data.cityName; |
||||||
|
app.globalData.cityId = res.return_data.regionId; |
||||||
|
uni.navigateBack({}) |
||||||
|
} else { |
||||||
|
uni.showToast({ |
||||||
|
title: res.return_msg, |
||||||
|
icon: 'none', |
||||||
|
duration: 2000 |
||||||
|
}) |
||||||
|
} |
||||||
|
}) |
||||||
|
} |
||||||
|
// getDredgeProvince() { |
||||||
|
// uni.showLoading({ |
||||||
|
// title: '加载中' |
||||||
|
// }) |
||||||
|
// getDredgeProvince().then(res => { |
||||||
|
// uni.hideLoading() |
||||||
|
// if (res.return_code == '000000') { |
||||||
|
// this.posList = res.return_data; |
||||||
|
// } |
||||||
|
// }); |
||||||
|
// }, |
||||||
|
// change(item) { |
||||||
|
// this.posId = item.regionId; |
||||||
|
// this.posName = item.regionName; |
||||||
|
// app.globalData.cityId = item.regionId; |
||||||
|
// app.globalData.cityName = item.regionName; |
||||||
|
// uni.navigateBack({ |
||||||
|
// }) |
||||||
|
// } |
||||||
|
} |
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style lang="less"> |
||||||
|
.posheadname { |
||||||
|
background-color: #f5f5f5; |
||||||
|
color: #666666; |
||||||
|
padding-left: 10px; |
||||||
|
padding-right: 10px; |
||||||
|
height: 30px; |
||||||
|
margin-left: 4%; |
||||||
|
line-height: 30px; |
||||||
|
text-align: center; |
||||||
|
border-radius: 5px; |
||||||
|
} |
||||||
|
|
||||||
|
.posacname { |
||||||
|
background-color: #f5f5f5; |
||||||
|
color: #666666; |
||||||
|
display: inline-block; |
||||||
|
padding-left: 10px; |
||||||
|
padding-right: 10px; |
||||||
|
height: 30px; |
||||||
|
margin-left: 4%; |
||||||
|
line-height: 30px; |
||||||
|
text-align: center; |
||||||
|
border-radius: 5px; |
||||||
|
} |
||||||
|
|
||||||
|
.actives { |
||||||
|
color: #089bf5; |
||||||
|
background-color: #f4faff; |
||||||
|
border: 1px solid #089bf5; |
||||||
|
} |
||||||
</style> |
</style> |
||||||
|
Loading…
Reference in new issue