From 96bde81921a97909094e9b7e5693cb46a771851c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=B1=E5=85=AE?= <3208053815@qq.com> Date: Fri, 12 Apr 2024 13:33:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=80=E5=B8=88=E9=A1=B5=E9=9D=A2=20=20?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/modules/service.js | 4 +++ api/modules/technician.js | 2 +- pages/technician.vue | 48 ++++++++++++++++++++++++++---- user/pages/distribution/income.vue | 4 +-- 4 files changed, 50 insertions(+), 8 deletions(-) diff --git a/api/modules/service.js b/api/modules/service.js index 90468e0..c3fb61b 100644 --- a/api/modules/service.js +++ b/api/modules/service.js @@ -62,4 +62,8 @@ export default { getUpOrderGoods(param) { return req.get("massage/app/IndexOrder/getUpOrderGoods", param) }, + // 获取定位 + getAddress(param) { + return req.get("index/getLocaltion", param) + }, } diff --git a/api/modules/technician.js b/api/modules/technician.js index b46d7e7..31d4533 100644 --- a/api/modules/technician.js +++ b/api/modules/technician.js @@ -181,5 +181,5 @@ export default { // 修改技师白天夜间免费出行距离 updateCoachRidingForfree(param) { return req.post("massage/app/IndexCoach/updateCoachRidingForfree", param) - }, + } } \ No newline at end of file diff --git a/pages/technician.vue b/pages/technician.vue index 07ccbf4..47e5507 100644 --- a/pages/technician.vue +++ b/pages/technician.vue @@ -6,8 +6,9 @@ - - {{location&&location.name ?location.name : isLoad ? '定位失败' : '定位中...'}} + + + {{location&&location.address ?location.address : isLoad ? '定位失败' : '定位中...'}} @@ -108,6 +109,7 @@ import tabbar from "@/components/tabbar.vue" import technicianListItem from "@/components/technician-list-item.vue" import technicianListPopup from "@/components/technician-list-popup.vue" + import getaddress from "../api/modules/service.js" export default { components: { tabbar, @@ -142,6 +144,7 @@ haveShieldOper: state => state.user.haveShieldOper, }), async onLoad(options) { + this.init(); this.options = options let { pid = 0, @@ -226,10 +229,44 @@ title: '', imageUrl: '', path, + lng:'', + lat:'' } }, methods: { - ...mapActions(['getConfigInfo', 'getUserInfo', 'getCityList', 'getServiceCoachList']), + // 获取当前定位 + init(){ + uni.getLocation({ + type: 'wgs84', + success: function (res) { + this.lng = res.longitude; + this.lat = res.latitude; + console.log(111,res); + const data = { + lng:res.longitude, + lat:res.latitude, + key:"ac07017e-6409-4aa4-88eb-6e252556d392" + } + uni.request({ + url: `https://tianjin.tianjinhualong.cn/index.php?s=index/getLocaltion&latitude=`+res.latitude+`&longitude=`+res.longitude, + data: { + text: 'uni.request' + }, + header: { + 'custom-header': 'hello' //自定义请求头信息 + }, + success: (res) => { + console.log(res.data.result.address); + const index = res.data.result.address.indexOf("区") + console.log(222,index); + this.location.address = res.data.result.address.slice(index+1) + console.log("测试一下",res.data.result.address.slice(index+1)); + } + }); + } + }); + }, + ...mapActions(['getConfigInfo', 'getUserInfo', 'getCityList', 'getServiceCoachList','getAddressList']), ...mapMutations(['updateUserItem', 'updateTechnicianItem']), async initIndex(refresh = false) { // #ifdef H5 @@ -493,7 +530,7 @@ activeIndex, cityList, cityIndex, - cityId: city_id + cityId: city_id, } = this let param = this.$util.deepCopy(this.param) @@ -530,12 +567,13 @@ key: 'cityId', val: city_id }) - + console.log(333,param); param = Object.assign({}, param, { lng, lat, city_id }) + console.log(222,param); let { coach_format = 1 diff --git a/user/pages/distribution/income.vue b/user/pages/distribution/income.vue index aa51810..f2deb41 100644 --- a/user/pages/distribution/income.vue +++ b/user/pages/distribution/income.vue @@ -48,7 +48,7 @@ - @@ -65,7 +65,7 @@ background: linear-gradient(90deg, #FFE9E9 0%, #FFFFFF 100%);"> - + -->