This commit is contained in:
parent
21111c21b8
commit
677be5d3eb
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<view style="width: 100%;" class="refresh-body" @touchmove.stop.prevent>
|
||||
<scroll-view scroll-y @scroll="scroll" @touchstart="touchstart" @scrolltolower="loadMore" @touchmove="touchmove" @touchend="touchend" class="refresh-scroll">
|
||||
<scroll-view @touchmove.stop scroll-y @scroll="scroll" @touchstart="touchstart" @scrolltolower="loadMore" @touchmove="touchmove" @touchend="touchend" class="refresh-scroll">
|
||||
<view class="content">
|
||||
<slot name="content"></slot>
|
||||
<view class="t-loading-box" v-if="loadingType!=3&&openLoadMore" @click="loadMore">
|
||||
|
|
|
@ -1,15 +1,9 @@
|
|||
<template>
|
||||
<view style="height: 100vh;width: 100%;overflow: scroll;">
|
||||
<!-- <view class="flex align-center justify-between you-nav">
|
||||
<view v-for="(item,index) in tab" :key="index" class="text-center box"
|
||||
:class="tabIndex == index?'tanColor':''" @click="bindTab(item.state)">
|
||||
<view style="z-index: 9;">{{item.name}}</view>
|
||||
<view class="" :class="tabIndex == index?'line':''"></view>
|
||||
</view>
|
||||
</view> -->
|
||||
<t-refresh ref="refresh" v-if="hongbao.length>0" @refresh="refresh" @loadMore="loadMore" :loadingType="loadingType" :tPadding="0">
|
||||
<view class="hb-view">
|
||||
<t-refresh ref="refresh" v-if="hongbao.length>0" @refresh="refresh" @loadMore="loadMore"
|
||||
:loadingType="loadingType" :tPadding="0">
|
||||
<template slot="content">
|
||||
<checkbox-group @change="checkboxChange" >
|
||||
<checkbox-group @change="checkboxChange">
|
||||
<view>
|
||||
<view class="youhui-weiyong youhui-list" v-for="(item,index) in hongbao" :key="index">
|
||||
<view class="youhui-view-left">
|
||||
|
@ -24,7 +18,6 @@
|
|||
<view class="youhui-view-right">
|
||||
<view class="youhui-view-right-top">
|
||||
<view class="youhui-view-right-title">{{item.couponName}}</view>
|
||||
<!-- <view class="youhui-view-right-time">{{item.endDate}}</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -36,9 +29,9 @@
|
|||
<view class="push-button" @tap="shiYong()" v-if="isCoupon==null">
|
||||
<span class="que-btn">立即领取</span>
|
||||
</view>
|
||||
<view class="push-button" v-else>
|
||||
<span class="que-btn2">已经领取</span>
|
||||
</view>
|
||||
<view class="push-button" v-else>
|
||||
<span class="que-btn2">已经领取</span>
|
||||
</view>
|
||||
<empty v-if="hongbao.length==0"></empty>
|
||||
</view>
|
||||
</template>
|
||||
|
@ -47,23 +40,12 @@
|
|||
import tRefresh from "@/components/t-refresh/t-refresh.vue"
|
||||
import empty from '@/components/empty.vue'
|
||||
export default {
|
||||
components:{
|
||||
components: {
|
||||
empty,
|
||||
tRefresh
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tab: [{
|
||||
name: '可使用',
|
||||
state: 0
|
||||
}, {
|
||||
name: '已使用',
|
||||
state: 1
|
||||
}, {
|
||||
name: '已失效',
|
||||
state: 2
|
||||
}],
|
||||
tabIndex: 0,
|
||||
hongbao: [],
|
||||
page: 1,
|
||||
size: 10,
|
||||
|
@ -74,79 +56,75 @@
|
|||
contentrefresh: '正在加载...',
|
||||
contentnomore: '没有更多数据了'
|
||||
},
|
||||
isCoupon: 0
|
||||
isCoupon: 0
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getMyList();
|
||||
this.getUserInfo();
|
||||
this.getUserInfo();
|
||||
},
|
||||
methods: {
|
||||
shiYong(){
|
||||
var that=this;
|
||||
shiYong() {
|
||||
var that = this;
|
||||
that.$Request.get('/app/coupon/insertNewUserCoupon').then(res => {
|
||||
if (res.code == 0) {
|
||||
uni.showToast({
|
||||
// title:'领取成功!'
|
||||
icon:'success',
|
||||
title:"领取成功"
|
||||
icon: 'success',
|
||||
title: "领取成功"
|
||||
})
|
||||
setTimeout(()=>{this.goHome()},1500)
|
||||
}else{
|
||||
setTimeout(() => {
|
||||
this.goHome()
|
||||
}, 1500)
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon:'error',
|
||||
title:res.msg
|
||||
icon: 'error',
|
||||
title: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
goHome(){
|
||||
uni.switchTab({
|
||||
url:'/pages/index/index'
|
||||
})
|
||||
},
|
||||
goHome() {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
},
|
||||
// 加载更多
|
||||
loadMore: async function() {
|
||||
//loadingType: 0.数据未加载完 1.数据全部加载完了 2.数据加载中
|
||||
if(this.loadingType==0){
|
||||
this.loadingType=2
|
||||
if (this.loadingType == 0) {
|
||||
this.loadingType = 2
|
||||
//模拟数据请求
|
||||
setTimeout(()=>{
|
||||
setTimeout(() => {
|
||||
this.page++;
|
||||
this.loadingType=0;
|
||||
this.loadingType = 0;
|
||||
this.getData()
|
||||
},1000)
|
||||
}, 1000)
|
||||
}
|
||||
},
|
||||
getUserInfo() {
|
||||
this.$Request.getT('/app/user/selectUserById').then(res => {
|
||||
if (res.code == 0) {
|
||||
this.isCoupon = res.data.isCoupon;
|
||||
console.log(this.isCoupon);
|
||||
}
|
||||
})
|
||||
},
|
||||
getUserInfo() {
|
||||
this.$Request.getT('/app/user/selectUserById').then(res => {
|
||||
if (res.code == 0) {
|
||||
this.isCoupon = res.data.isCoupon;
|
||||
console.log(this.isCoupon);
|
||||
}
|
||||
})
|
||||
},
|
||||
getMyList() {
|
||||
this.loadingType = 1;
|
||||
uni.showLoading({
|
||||
title: '加载中...'
|
||||
});
|
||||
this.$Request.getT('/app/coupon/selectNewUserCoupon?page='+this.page+'&limit='+this.size).then(res => {
|
||||
this.$Request.getT('/app/coupon/selectNewUserCoupon?page=' + this.page + '&limit=' + this.size).then(
|
||||
res => {
|
||||
if (res.code == 0) {
|
||||
if (this.page == 1) this.hongbao = []; //如果是第一页需手动制空列表
|
||||
this.hongbao = [...this.hongbao, ...res.data.list]; //追加新数据
|
||||
} else {
|
||||
this.loadingType = 2;
|
||||
}
|
||||
}
|
||||
uni.hideLoading();
|
||||
});
|
||||
},
|
||||
bindTab(index) {
|
||||
this.tabIndex = index
|
||||
this.hongbao = [];
|
||||
this.page = 1;
|
||||
this.getMyList();
|
||||
}
|
||||
|
||||
},
|
||||
onPageScroll: function(e) {
|
||||
this.scrollTop = e.scrollTop > 200;
|
||||
|
@ -163,21 +141,28 @@
|
|||
</script>
|
||||
|
||||
<style scoped>
|
||||
/deep/.refresh-body{
|
||||
.hb-view{
|
||||
width: 100%;
|
||||
/* height: 100vh;
|
||||
overflow: scroll; */
|
||||
}
|
||||
/deep/.refresh-body {
|
||||
height: 870px !important;
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
.push-button{
|
||||
width: 100%;
|
||||
height: 48px;
|
||||
position: fixed;
|
||||
bottom: 0px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin: 0 auto;
|
||||
|
||||
.push-button {
|
||||
width: 100%;
|
||||
height: 48px;
|
||||
position: fixed;
|
||||
bottom: 0px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.que-btn{
|
||||
|
||||
.que-btn {
|
||||
display: inline-block;
|
||||
width: 90%;
|
||||
text-align: center;
|
||||
|
@ -190,44 +175,48 @@
|
|||
font-size: 34rpx;
|
||||
}
|
||||
|
||||
.que-btn2{
|
||||
display: inline-block;
|
||||
width: 90%;
|
||||
text-align: center;
|
||||
background: linear-gradient(90deg, #949494, #b4b4b4, #c5c5c5);
|
||||
height: 40px;
|
||||
border-radius: 28px;
|
||||
color: #ffffff;
|
||||
line-height: 40px;
|
||||
margin-top: 4px;
|
||||
font-size: 34rpx;
|
||||
}
|
||||
.que-btn2 {
|
||||
display: inline-block;
|
||||
width: 90%;
|
||||
text-align: center;
|
||||
background: linear-gradient(90deg, #949494, #b4b4b4, #c5c5c5);
|
||||
height: 40px;
|
||||
border-radius: 28px;
|
||||
color: #ffffff;
|
||||
line-height: 40px;
|
||||
margin-top: 4px;
|
||||
font-size: 34rpx;
|
||||
}
|
||||
|
||||
/deep/.page-box{
|
||||
/deep/.page-box {
|
||||
width: 100%;
|
||||
}
|
||||
.youhui-img{
|
||||
|
||||
.youhui-img {
|
||||
width: 111.81rpx;
|
||||
height: 111.81rpx;
|
||||
}
|
||||
|
||||
.youhui-view-right-time{
|
||||
.youhui-view-right-time {
|
||||
font-weight: 400;
|
||||
font-size: 22rpx;
|
||||
color: #999999;
|
||||
}
|
||||
.youhui-view-right-title{
|
||||
|
||||
.youhui-view-right-title {
|
||||
width: 260rpx;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.youhui-view-right-top{
|
||||
|
||||
.youhui-view-right-top {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.youhui-view-right{
|
||||
|
||||
.youhui-view-right {
|
||||
width: 502.08rpx;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
|
@ -235,40 +224,48 @@
|
|||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.youhui-view-left-bottom{
|
||||
|
||||
.youhui-view-left-bottom {
|
||||
font-weight: 400;
|
||||
font-size: 22rpx;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
.youhui-view-left-yuan{
|
||||
|
||||
.youhui-view-left-yuan {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: baseline;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
.youhui-view-left-num{
|
||||
|
||||
.youhui-view-left-num {
|
||||
font-weight: bold;
|
||||
font-size: 89rpx;
|
||||
}
|
||||
.youhui-view-left-text{
|
||||
|
||||
.youhui-view-left-text {
|
||||
font-weight: bold;
|
||||
font-size:24.31rpx;
|
||||
font-size: 24.31rpx;
|
||||
}
|
||||
.youhui-view-left{
|
||||
|
||||
.youhui-view-left {
|
||||
width: 199rpx;
|
||||
height: 242rpx;
|
||||
display: flex;
|
||||
flex-direction:column;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.youhui-yiyong{
|
||||
|
||||
.youhui-yiyong {
|
||||
background-image: url('../../static/youhuijuan/coupons7.png');
|
||||
}
|
||||
.youhui-weiyong{
|
||||
|
||||
.youhui-weiyong {
|
||||
background-image: url('../../static/youhuijuan/coupons1.png');
|
||||
}
|
||||
.youhui-list{
|
||||
|
||||
.youhui-list {
|
||||
width: 95%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
@ -278,10 +275,12 @@
|
|||
margin: 10px auto;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.you-nav{
|
||||
|
||||
.you-nav {
|
||||
background: #FFFFFF;
|
||||
padding: 14px 25px 0px 25px;
|
||||
}
|
||||
|
||||
page {
|
||||
background: #F5F5F5;
|
||||
}
|
||||
|
@ -328,4 +327,4 @@
|
|||
color: #FF130A;
|
||||
font-size: 24upx;
|
||||
}
|
||||
</style>
|
||||
</style>
|
|
@ -430,7 +430,7 @@
|
|||
let that = this
|
||||
that.getBannerList()
|
||||
that.remen()
|
||||
that.getKTCityList();
|
||||
// that.getKTCityList();
|
||||
// 获取邀请码保存到本地
|
||||
if (e.invitation) {
|
||||
that.$queue.setData('inviterCode', e.invitation);
|
||||
|
@ -512,7 +512,7 @@
|
|||
// #endif
|
||||
// this.city = uni.getStorageSync('city')//测试用的 测试结束关闭
|
||||
that.getIsVip()
|
||||
that.getKTCityList();
|
||||
// that.getKTCityList();
|
||||
that.getHomeArtificerList();
|
||||
that.getHomeNearbyList();
|
||||
}else{
|
||||
|
@ -627,9 +627,8 @@
|
|||
let streetNumber = response.data.regeocode.addressComponent.streetNumber.street;
|
||||
let number = response.data.regeocode.addressComponent.streetNumber.number;
|
||||
that.city = address.replace(province,'').replace(city,'').replace(district,'').replace(streetNumber,'').replace(number,'').replace(township,'')
|
||||
// that.city=that.latadd
|
||||
that.page = 1
|
||||
that.getKTCityList();
|
||||
that.page = 1;
|
||||
that.getTpCount();
|
||||
} else {
|
||||
console.log('逆地理编码失败', response.data);
|
||||
}
|
||||
|
@ -932,11 +931,11 @@
|
|||
},
|
||||
|
||||
getCity(e) {
|
||||
this.city = e[0].label;
|
||||
uni.setStorageSync('city', this.city)
|
||||
this.getKTCityList();
|
||||
this.getHomeArtificerList();
|
||||
this.getHomeNearbyList();
|
||||
// this.city = e[0].label;
|
||||
// uni.setStorageSync('city', this.city)
|
||||
// this.getKTCityList();
|
||||
// this.getHomeArtificerList();
|
||||
// this.getHomeNearbyList();
|
||||
// this.page = 1
|
||||
// this.getlist()
|
||||
},
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<view class="bg margin-top padding-lr" style="border-radius: 20rpx; padding: 20rpx 35rpx;">
|
||||
<view>
|
||||
<view v-for="(item,index) in openLists" :key='index'>
|
||||
<view class="align-center justify-between"
|
||||
<!-- <view class="align-center justify-between"
|
||||
style="display: flex;height: 100upx;padding: 20upx 0;"
|
||||
v-if="item.text === '微信' && wxTxSel != '否'">
|
||||
<view class="flex align-center">
|
||||
|
@ -39,7 +39,7 @@
|
|||
<radio color="#029d88" :checked="openWay === item.id ? true : false" />
|
||||
</label>
|
||||
</radio-group>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="align-center justify-between"
|
||||
style="display: flex;height: 100upx;padding: 20upx 0;"
|
||||
v-if="item.text === '银联' && ylTxSel != '否'">
|
||||
|
@ -75,9 +75,7 @@
|
|||
v-if="XCXIsSelect != '否'">
|
||||
<view class="flex align-center justify-between" @click="goNav('/my/wallet/zhifubao')">
|
||||
<view class="flex align-center">
|
||||
<!-- <image
|
||||
src="https://admin.sjajk.com/file/uploadPath/2023/01/03/da75d52b95a64fc349d0353ab16cb719.png"
|
||||
style="width: 44rpx;height: 44rpx;"></image> -->
|
||||
|
||||
<view>提现账号</view>
|
||||
</view>
|
||||
<image src="../../../static/img/you.png" style="width: 16rpx;height: 28rpx;"></image>
|
||||
|
@ -85,9 +83,7 @@
|
|||
<view class="flex align-center justify-between margin-top-xl"
|
||||
@click="goNav('/my/wallet/mymoneydetail?navName='+navName)">
|
||||
<view class="flex align-center">
|
||||
<!-- <image
|
||||
src="https://admin.sjajk.com/file/uploadPath/2023/01/03/ba45c8489a14029c1782ac0a28fd8a49.png"
|
||||
style="width: 48rpx;height: 34rpx;"></image> -->
|
||||
|
||||
<view>钱包明细</view>
|
||||
</view>
|
||||
<image src="../../../static/img/you.png" style="width: 16rpx;height: 28rpx;"></image>
|
||||
|
@ -95,9 +91,7 @@
|
|||
|
||||
<view class="flex align-center justify-between margin-top-xl" @click="goNav('/pages/my/applyBroker/withdrawalRecord?navName='+navName)">
|
||||
<view class="flex align-center">
|
||||
<!-- <image
|
||||
src="https://admin.sjajk.com/file/uploadPath/2023/01/03/e90eb8a74548dc3b11c3c856e24e6fbc.png"
|
||||
style="width: 40rpx;height: 52rpx;"></image> -->
|
||||
|
||||
<view>提现记录</view>
|
||||
</view>
|
||||
<image src="../../../static/img/you.png" style="width: 16rpx;height: 28rpx;"></image>
|
||||
|
@ -105,9 +99,7 @@
|
|||
<view class="flex align-center justify-between margin-top-xl" @click="goNav('/my/wallet/yinhangka')"
|
||||
v-if="ylTxSel != '否'">
|
||||
<view class="flex align-center">
|
||||
<!-- <image
|
||||
src="https://admin.sjajk.com/file/uploadPath/2023/01/03/ba45c8489a14029c1782ac0a28fd8a49.png"
|
||||
style="width: 48rpx;height: 34rpx;"></image> -->
|
||||
|
||||
<view>银行卡账号</view>
|
||||
</view>
|
||||
<image src="../../../static/img/you.png" style="width: 16rpx;height: 28rpx;"></image>
|
||||
|
|
|
@ -215,7 +215,7 @@
|
|||
</view>
|
||||
</view>
|
||||
<!-- 经验筛选 -->
|
||||
<u-select v-model="Cityshow" :list="cityList" @confirm="getCity"></u-select>
|
||||
<!-- <u-select v-model="Cityshow" :list="cityList" @confirm="getCity"></u-select> -->
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
|
@ -352,9 +352,11 @@ import permision from "@/components/permission.js";
|
|||
that.infoWindow.setPosition(new TMap.LatLng(res.latitude, res.longitude));
|
||||
}
|
||||
that.page = 1;
|
||||
console.log(333333)
|
||||
that.selectCity(that.longitude,that.latitude)
|
||||
},
|
||||
fail: function(e) {
|
||||
that.getlist()
|
||||
console.log('获取地址失败1', e)
|
||||
// #ifdef APP-PLUS
|
||||
that.checkPermission();
|
||||
|
@ -396,9 +398,9 @@ import permision from "@/components/permission.js";
|
|||
that.latitude = location[1]
|
||||
that.componentKey++
|
||||
that.initMap();
|
||||
console.log("location========>",add)
|
||||
console.log("location========>location",add)
|
||||
}
|
||||
that.getKTCityList();
|
||||
// that.getKTCityList();
|
||||
that.getTpCount();
|
||||
that.getTpMy();
|
||||
that.userId = uni.getStorageSync('userId')
|
||||
|
@ -413,20 +415,24 @@ import permision from "@/components/permission.js";
|
|||
that.page = 1
|
||||
// that.selectCity(that.latitude,that.longitude)
|
||||
that.getlist()
|
||||
console.log(11111111)
|
||||
} else {
|
||||
console.log(22222222)
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
highAccuracyExpireTime: 500,
|
||||
geocode: true, //设置该参数为true可直接获取经纬度及城市信息
|
||||
success: function(res) {
|
||||
console.log(res, '地理位置onShow')
|
||||
that.latitude = res.latitude
|
||||
that.longitude = res.longitude
|
||||
that.page = 1
|
||||
that.getTypeList();
|
||||
that.latitude = res.latitude;
|
||||
that.longitude = res.longitude;
|
||||
that.page = 1;
|
||||
that.selectCity(that.longitude,that.latitude)
|
||||
// that.getTypeList();
|
||||
// that.getlist()
|
||||
},
|
||||
fail: function() {
|
||||
that.getlist()
|
||||
console.log('获取地址失败2')
|
||||
}
|
||||
})
|
||||
|
@ -452,6 +458,39 @@ import permision from "@/components/permission.js";
|
|||
//this.closeSocket();
|
||||
},
|
||||
methods: {
|
||||
selectCity(longitude, latitude) {
|
||||
var that=this;
|
||||
var longitude = that.longitude;
|
||||
var latitude = that.latitude;
|
||||
let amapKey = that.Key2; // 替换为你的高德地图API Key
|
||||
let url = `https://restapi.amap.com/v3/geocode/regeo?key=${amapKey}&location=${longitude},${latitude}&radius=1000`;
|
||||
uni.request({
|
||||
url: url,
|
||||
success: (response) => {
|
||||
if(response.data && response.data.regeocode) {
|
||||
let address = response.data.regeocode.formatted_address;
|
||||
let province = response.data.regeocode.addressComponent.province;
|
||||
let city = response.data.regeocode.addressComponent.city;
|
||||
let district = response.data.regeocode.addressComponent.district;
|
||||
let township = response.data.regeocode.addressComponent.township;
|
||||
let streetNumber = response.data.regeocode.addressComponent.streetNumber.street;
|
||||
let number = response.data.regeocode.addressComponent.streetNumber.number;
|
||||
that.cityname = address.replace(province,'').replace(city,'').replace(district,'').replace(streetNumber,'').replace(number,'').replace(township,'')
|
||||
that.city=city
|
||||
that.page = 1
|
||||
that.getlist()
|
||||
// that.getKTCityList();
|
||||
var add=uni.getStorageSync('cityTherapist');
|
||||
console.log('getStorageSync===========', add);
|
||||
} else {
|
||||
console.log('逆地理编码失败', response.data);
|
||||
}
|
||||
},
|
||||
fail: (error) => {
|
||||
console.log('网络请求失败', error);
|
||||
}
|
||||
});
|
||||
},
|
||||
changeClick(index,item){
|
||||
this.artificerName='';
|
||||
this.technicianType=item.id;
|
||||
|
@ -679,12 +718,12 @@ import permision from "@/components/permission.js";
|
|||
});
|
||||
},
|
||||
getCity(e) {
|
||||
console.log("得到的城市-------------》",e[0].label);
|
||||
this.city = e[0].label;
|
||||
uni.setStorageSync('city', this.city)
|
||||
this.getKTCityList();
|
||||
this.page = 1
|
||||
this.getlist()
|
||||
// console.log("得到的城市-------------》",e[0].label);
|
||||
// this.city = e[0].label;
|
||||
// uni.setStorageSync('city', this.city)
|
||||
// this.getKTCityList();
|
||||
// this.page = 1
|
||||
// this.getlist()
|
||||
},
|
||||
getKTCityList() {
|
||||
let cityName;
|
||||
|
@ -737,37 +776,7 @@ import permision from "@/components/permission.js";
|
|||
}
|
||||
});
|
||||
},
|
||||
selectCity(longitude, latitude) {
|
||||
var that=this;
|
||||
var longitude = that.longitude;
|
||||
var latitude = that.latitude;
|
||||
let amapKey = that.Key2; // 替换为你的高德地图API Key
|
||||
let url = `https://restapi.amap.com/v3/geocode/regeo?key=${amapKey}&location=${longitude},${latitude}&radius=1000`;
|
||||
uni.request({
|
||||
url: url,
|
||||
success: (response) => {
|
||||
if(response.data && response.data.regeocode) {
|
||||
let address = response.data.regeocode.formatted_address;
|
||||
let province = response.data.regeocode.addressComponent.province;
|
||||
let city = response.data.regeocode.addressComponent.city;
|
||||
let district = response.data.regeocode.addressComponent.district;
|
||||
let township = response.data.regeocode.addressComponent.township;
|
||||
let streetNumber = response.data.regeocode.addressComponent.streetNumber.street;
|
||||
let number = response.data.regeocode.addressComponent.streetNumber.number;
|
||||
that.cityname = address.replace(province,'').replace(city,'').replace(district,'').replace(streetNumber,'').replace(number,'').replace(township,'')
|
||||
that.city=city
|
||||
that.page = 1
|
||||
that.getlist()
|
||||
that.getKTCityList();
|
||||
} else {
|
||||
console.log('逆地理编码失败', response.data);
|
||||
}
|
||||
},
|
||||
fail: (error) => {
|
||||
console.log('网络请求失败', error);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
tanChange(index, item) {
|
||||
this.orderIndex = index
|
||||
this.tabIndex = item.id
|
||||
|
|
Loading…
Reference in New Issue