更新版本
This commit is contained in:
parent
9ac27fc4aa
commit
494427d94c
@ -2,8 +2,8 @@
|
||||
"name" : "惠农生活",
|
||||
"appid" : "__UNI__3A527D1",
|
||||
"description" : "",
|
||||
"versionName" : "1.6.0",
|
||||
"versionCode" : 160,
|
||||
"versionName" : "1.6.1",
|
||||
"versionCode" : 161,
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
|
9
package-lock.json
generated
9
package-lock.json
generated
@ -1,6 +1,8 @@
|
||||
{
|
||||
"requires": true,
|
||||
"name": "e-select下拉选择器",
|
||||
"version": "1.0.7",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"ansi-regex": {
|
||||
"version": "2.1.1",
|
||||
@ -424,6 +426,11 @@
|
||||
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
|
||||
"dev": true
|
||||
},
|
||||
"tiny-pinyin": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmmirror.com/tiny-pinyin/-/tiny-pinyin-1.3.2.tgz",
|
||||
"integrity": "sha512-uHNGu4evFt/8eNLldazeAM1M8JrMc1jshhJJfVRARTN3yT8HEEibofeQ7QETWQ5ISBjd6fKtTVBCC/+mGS6FpA=="
|
||||
},
|
||||
"to-fast-properties": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz",
|
||||
|
@ -12,5 +12,8 @@
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"tiny-pinyin": "^1.3.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,14 +4,8 @@
|
||||
<view class="head_top">
|
||||
<u-search placeholder="搜索小区、办公楼等" :showAction="false"></u-search>
|
||||
<view style="height: 20rpx;"></view>
|
||||
<u-tabs
|
||||
:list="tabsList" itemStyle="font-size: 32rpx;height: 74rpx;"
|
||||
:current="current"
|
||||
@change="changeCurrent"
|
||||
lineColor="#FF6D20"
|
||||
lineWidth="105rpx"
|
||||
height="7rpx"
|
||||
></u-tabs>
|
||||
<u-tabs :list="tabsList" itemStyle="font-size: 32rpx;height: 74rpx;" :current="current" @change="changeCurrent"
|
||||
lineColor="#FF6D20" lineWidth="105rpx" height="7rpx"></u-tabs>
|
||||
</u-tabs>
|
||||
</view>
|
||||
</u-sticky>
|
||||
@ -22,7 +16,9 @@
|
||||
<view class="re-title">当前位置: </view>
|
||||
<view>{{street}}</view>
|
||||
</view>
|
||||
<view class="re-btn" @click="reGetLocation"><image class="re-address-img" src="@/static/images/re_address.png"></image>重新定位</view>
|
||||
<view class="re-btn" @click="reGetLocation">
|
||||
<image class="re-address-img" src="@/static/images/re_address.png"></image>重新定位
|
||||
</view>
|
||||
</view>
|
||||
<view class="head_item_tips">
|
||||
<view>附近地址</view>
|
||||
@ -36,12 +32,8 @@
|
||||
<view>泸州区县</view>
|
||||
</view>
|
||||
<view class="area">
|
||||
<view class="area-item"
|
||||
:class="{'area-item-on': item.code==area_change}"
|
||||
v-for="(item, index) in areaList"
|
||||
:key="index"
|
||||
@click="changeArea(item)"
|
||||
>
|
||||
<view class="area-item" :class="{'area-item-on': item.code==area_change}" v-for="(item, index) in areaList"
|
||||
:key="index" @click="changeArea(item)">
|
||||
{{item.name}}
|
||||
</view>
|
||||
</view>
|
||||
@ -49,26 +41,10 @@
|
||||
<view>选择街道/镇</view>
|
||||
</view>
|
||||
<view class="street">
|
||||
<view class="letter-item">
|
||||
<view class="letter">A</view>
|
||||
<view class="letter-item" v-for="key in mapKey" :key="key">
|
||||
<view class="letter">{{key}}</view>
|
||||
<view class="item-box">
|
||||
<view class="street-item" v-for="item in streetList.slice(0, 3)">
|
||||
{{item.name}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="letter-item">
|
||||
<view class="letter">B</view>
|
||||
<view class="item-box">
|
||||
<view class="street-item" v-for="item in streetList.slice(3,5)">
|
||||
{{item.name}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="letter-item">
|
||||
<view class="letter">D</view>
|
||||
<view class="item-box">
|
||||
<view class="street-item" v-for="item in streetList.slice(5,10)">
|
||||
<view class="street-item" v-for="item in mapList[key]" :key="item.code" @click="changeStreet(item)">
|
||||
{{item.name}}
|
||||
</view>
|
||||
</view>
|
||||
@ -80,14 +56,15 @@
|
||||
|
||||
<script>
|
||||
import {
|
||||
getGeocoder,
|
||||
merClassifly,
|
||||
getGeocoder,
|
||||
merClassifly,
|
||||
getProductslist
|
||||
} from '@/api/store.js';
|
||||
import {
|
||||
getArea,
|
||||
getStreet
|
||||
} from "@/api/article.js";
|
||||
import pinyin from "tiny-pinyin";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -104,6 +81,7 @@
|
||||
street: '',
|
||||
areaList: [],
|
||||
streetList: [],
|
||||
mapList: {},
|
||||
area_change: '',
|
||||
street_change: '',
|
||||
}
|
||||
@ -113,78 +91,111 @@
|
||||
this.loadArea();
|
||||
},
|
||||
onShow() {},
|
||||
computed: {
|
||||
mapKey() {
|
||||
return Object.keys(this.mapList).sort()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeCurrent(e){
|
||||
changeCurrent(e) {
|
||||
this.current = e.index;
|
||||
},
|
||||
getLoaction(){
|
||||
getLoaction() {
|
||||
this.street = '定位中'
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
timeout: '10',
|
||||
success: (res) => {
|
||||
let latitude, longitude;
|
||||
latitude = res.latitude.toString();
|
||||
longitude = res.longitude.toString();
|
||||
this.latitude = res.latitude.toFixed(6);
|
||||
this.longitude = res.longitude.toFixed(6);
|
||||
type: 'wgs84',
|
||||
timeout: '10',
|
||||
success: (res) => {
|
||||
let latitude, longitude;
|
||||
latitude = res.latitude.toString();
|
||||
longitude = res.longitude.toString();
|
||||
this.latitude = res.latitude.toFixed(6);
|
||||
this.longitude = res.longitude.toFixed(6);
|
||||
this.$store.commit('setLocation', {
|
||||
lat: res.latitude.toFixed(6),
|
||||
lat: res.latitude.toFixed(6),
|
||||
long: res.longitude.toFixed(6),
|
||||
});
|
||||
getGeocoder({
|
||||
lat: latitude,
|
||||
long: longitude
|
||||
}).then(res => {
|
||||
this.town = res.data.address_reference.town.title
|
||||
this.street_id = res.data.address_reference.town.id
|
||||
this.street = res.data.address_reference.town.title;
|
||||
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err,
|
||||
icon: 'none'
|
||||
})
|
||||
getGeocoder({
|
||||
lat: latitude,
|
||||
long: longitude
|
||||
}).then(res => {
|
||||
this.town = res.data.address_reference.town.title
|
||||
this.street_id = res.data.address_reference.town.id
|
||||
this.street = res.data.address_reference.town.title;
|
||||
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err,
|
||||
icon: 'none'
|
||||
})
|
||||
this.street = '定位失败'
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log('定位失败');
|
||||
this.isshow = false
|
||||
this.isshow = false
|
||||
uni.setStorageSync("RejectTarget", true)
|
||||
Toast('定位失败,请检查定位权限是否开启')
|
||||
this.street = '定位失败'
|
||||
|
||||
// uni.showToast({
|
||||
// title: "获取定位超时",
|
||||
// icon: 'none',
|
||||
// duration: 2000
|
||||
// });
|
||||
}
|
||||
|
||||
// uni.showToast({
|
||||
// title: "获取定位超时",
|
||||
// icon: 'none',
|
||||
// duration: 2000
|
||||
// });
|
||||
}
|
||||
});
|
||||
},
|
||||
reGetLocation(){
|
||||
reGetLocation() {
|
||||
this.getLoaction()
|
||||
},
|
||||
loadArea(){
|
||||
loadArea() {
|
||||
getArea({
|
||||
city_code: 510500
|
||||
}).then((res)=>{
|
||||
}).then((res) => {
|
||||
this.areaList = res.data;
|
||||
this.changeArea(this.areaList[0]);
|
||||
})
|
||||
},
|
||||
loadStreet(area_code){
|
||||
loadStreet(area_code) {
|
||||
this.street_change = '';
|
||||
getStreet({
|
||||
area_code
|
||||
}).then((res)=>{
|
||||
}).then((res) => {
|
||||
this.streetList = res.data;
|
||||
this.initPinyin();
|
||||
})
|
||||
},
|
||||
changeArea(item){
|
||||
initPinyin() {
|
||||
this.mapList = {};
|
||||
if (pinyin.isSupported()) {
|
||||
this.streetList.forEach((item) => {
|
||||
let str = pinyin.convertToPinyin(item.name[0]);
|
||||
str = str[0] ? str[0] : '#';
|
||||
if (this.mapList[str]) {
|
||||
this.mapList[str].push(item);
|
||||
} else {
|
||||
this.mapList[str] = [];
|
||||
this.mapList[str].push(item)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.mapList['#'] = this.streetList;
|
||||
}
|
||||
},
|
||||
changeArea(item) {
|
||||
this.area_change = item.code;
|
||||
this.loadStreet(this.area_change);
|
||||
},
|
||||
changeStreet(item){
|
||||
uni.navigateBack({
|
||||
success: () => {
|
||||
uni.$emit('changeAddress', {
|
||||
area: this.area_change,
|
||||
street: item
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
@ -194,18 +205,21 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page{
|
||||
page {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.head_top {
|
||||
background-color: #fff;
|
||||
padding: 28rpx;
|
||||
}
|
||||
.address-box{
|
||||
|
||||
.address-box {
|
||||
// background-color: red;
|
||||
border-radius: 21rpx 21rpx 0rpx 0rpx;
|
||||
padding: 30rpx 28rpx;
|
||||
.head_item{
|
||||
|
||||
.head_item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
@ -214,47 +228,54 @@
|
||||
font-family: PingFang SC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #333333;
|
||||
.re-location{
|
||||
|
||||
.re-location {
|
||||
display: flex;
|
||||
.re-title{
|
||||
|
||||
.re-title {
|
||||
flex-shrink: 0;
|
||||
padding-right: 14rpx;
|
||||
}
|
||||
}
|
||||
.re-address-img{
|
||||
|
||||
.re-address-img {
|
||||
width: 38.55rpx;
|
||||
height: 38.55rpx;
|
||||
margin-right: 14rpx;
|
||||
}
|
||||
.re-btn{
|
||||
|
||||
.re-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
padding-left: 14rpx;
|
||||
}
|
||||
}
|
||||
.head_item_tips{
|
||||
|
||||
.head_item_tips {
|
||||
height: 44rpx;
|
||||
font-size: 32rpx;
|
||||
font-family: PingFang SC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #737373;
|
||||
}
|
||||
.address-list{
|
||||
|
||||
.address-list {
|
||||
font-size: 28rpx;
|
||||
font-family: PingFang SC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #333333;
|
||||
height: 80rpx;
|
||||
line-height: 75rpx;
|
||||
border-bottom: 1rpx solid rgba(0,0,0,0.1);
|
||||
border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.area{
|
||||
|
||||
.area {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding-top: 30rpx;
|
||||
.area-item{
|
||||
|
||||
.area-item {
|
||||
// width: 158rpx;
|
||||
height: 64rpx;
|
||||
// background: #F4F4F4;
|
||||
@ -272,32 +293,43 @@
|
||||
margin-bottom: 22rpx;
|
||||
margin-right: 22rpx;
|
||||
}
|
||||
.area-item-on{
|
||||
|
||||
.area-item-on {
|
||||
// background-color: #F4F4F4;
|
||||
color: #ff6d20;
|
||||
// font-weight: bold;
|
||||
border: 2rpx solid #ff6d20;
|
||||
}
|
||||
}
|
||||
|
||||
.street{
|
||||
|
||||
.street {
|
||||
padding-top: 28rpx;
|
||||
.letter-item{
|
||||
|
||||
.letter-item {
|
||||
display: flex;
|
||||
.letter{
|
||||
|
||||
.letter {
|
||||
flex-shrink: 0;
|
||||
margin-right: 28rpx;
|
||||
font-size: 25rpx;
|
||||
font-family: PingFang SC, PingFang SC;
|
||||
font-weight: 400;
|
||||
width: 40rpx;
|
||||
text-align: center;
|
||||
color: #737373;
|
||||
}
|
||||
.street-item{
|
||||
padding-bottom: 28rpx;
|
||||
font-size: 28rpx;
|
||||
font-family: PingFang SC, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #333333;
|
||||
|
||||
.item-box {
|
||||
flex: 1;
|
||||
|
||||
.street-item {
|
||||
width: 100%;
|
||||
padding-bottom: 28rpx;
|
||||
font-size: 28rpx;
|
||||
font-family: PingFang SC, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -639,7 +639,6 @@
|
||||
that.filterMenus(item)
|
||||
that.personalMenu.push(item)
|
||||
})
|
||||
|
||||
that.imgUrls = res.data.banner
|
||||
});
|
||||
},
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 624 KiB After Width: | Height: | Size: 638 KiB |
Loading…
x
Reference in New Issue
Block a user