From 50a612a61ff0c871e5ff033f85d6732e262831b8 Mon Sep 17 00:00:00 2001 From: "3321822538@qq.com" <3321822538@qq.com> Date: Mon, 6 Jan 2025 15:08:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- page_fenbao/statulist/nearby/index.vue | 556 +++++++++++++++++++------ page_user/mapditu/index.vue | 224 ++++++---- page_user/mapditu/orderxq.vue | 2 +- pages/shouye/index.vue | 58 +-- 4 files changed, 607 insertions(+), 233 deletions(-) diff --git a/page_fenbao/statulist/nearby/index.vue b/page_fenbao/statulist/nearby/index.vue index eb914ea..7b196c7 100644 --- a/page_fenbao/statulist/nearby/index.vue +++ b/page_fenbao/statulist/nearby/index.vue @@ -1,23 +1,64 @@ @@ -57,13 +112,16 @@ isMch: false, gxlist: [], bgc: { - backgroundColor: " #8883F0", + backgroundColor: " #fff", }, mapScale: 15, mapContext: null, mapScaleInterval: null, listmap: [], iconflag: false, + dtlbflag:true, + listobj:{}, + keyword:'' } }, onLoad() { @@ -100,6 +158,177 @@ } }, methods: { + confirmss(){ + this.covers = [] + this.gxlist = [] + this.$u.get("/app/store/listNearBy?center=" + this.jinweidu + '&radius=' + 20000 + '&keyword=' + this.keyword).then( + response => { + if (response.code == 200) { + this.listmap = response.data + let gxlist = response.data + gxlist.forEach(item => { + const distance = this.getDistance(this.latitude, this.longitude, item.lat, item.lng) + item.distance = distance + const shopCover = { + id: parseFloat(item.storeId), + latitude: item.lat, + longitude: item.lng, + width: 25, + height: 30, + iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uZXgsJE6hXbRSwbKILB4', + distance: distance, // 可以在这里也添加距离到覆盖物对象中,但通常只需要在店铺对象中 + label: { + content: item.name, + anchorX: (() => { + if (item.name.length <= 2) { + return -12 + } else if (item.name.length <= + 3) { + return -20 + } else if (item.name.length <= + 4) { + return -25 + } else if (item.name.length <= + 5) { + return -30 + } else if (item.name.length <= + 6) { + return -35 + } else if (item.name.length <= + 8) { + return -40 + } else if (item.name.length <= + 10) { + return -45 + } else { + return -item.name.length * + 5 + } + })(), + fontWeight: 700, + color: '#8883F0', + textShadow: '2px 2px 0px white, -2px -2px 0px white, 2px -2px 0px white, -2px 2px 0px white', + borderRadius:5, + bgColor: '#fff' + } + } + this.covers.push(shopCover) + this.gxlist.push(item) + }) + } + }) + }, + // 扫描二维码 + scanQRCode() { + uni.scanCode({ + onlyFromCamera: true, + scanType: ['qrCode'], + success: res => { + function getQueryParam(url, paramName) { + let regex = new RegExp(`[?&]${paramName}=([^&]*)`) + let results = regex.exec(url); + return results ? decodeURIComponent(results[1].replace(/\+/g, ' ')) : null + } + let sceneValue = res.result + let decodedValue = decodeURIComponent(sceneValue) + let id = getQueryParam(decodedValue, 's') + let that = this + let data = { + deviceNo: id + } + that.$u.get(`/app/device/isBind?deviceNo=${id}`).then(res => { + if (res.data == 2) { + that.$u.get(`/app/device/${id}/withSuitList`).then((res) => { + if (res.code == 200) { + uni.navigateTo({ + url: '/page_components/fuwu/index?id=' + id + }) + } + }) + } else if (res.data == 1) { + console.log(1); + if(that.phonenumber == ''){ + that.huoqutelflag = true + that.xuanzeflag = false + console.log(11); + }else{ + console.log(12); + that.xuanzeflag = false + uni.showModal({ + title: '提示', + content: '该设备未绑定,你需进行绑定吗?', + success: function(res) { + if (res.confirm) { + that.$u.put("/app/device/bind", data).then(res => { + if (res.code == 200) { + that.$u.get(`/app/device/${id}/bySn`).then((res) => { + if (res.code == 200) { + uni.navigateTo({ + url: '/page_components/bindsz?id=' + res.data.deviceId + }) + } + }) + } + }) + } + } + }) + } + } else if (res.data == 0) { + uni.showModal({ + title: '提示', + content: '该设备未录入,请先进行录入', + success: function(res) { + if (res.confirm) { + // uni.navigateTo({ + // url: '/page_fenbao/zhuce?sn=' + id + // }) + } else if (res.cancel) { + + } + } + }) + } + }) + }, + fail: err => { + console.error('扫描失败:', err) + uni.showToast({ + title: '扫描失败', + icon: 'none' + }) + } + }) + }, + // 点击列表显示地图 + btnlbtop(){ + this.dtlbflag = true + this.listobj = {} + }, + // 点击地图显示列表 + btndttop(){ + this.dtlbflag = false + this.listobj = {} + }, + // 点击拨打电话 + btntel(item){ + uni.makePhoneCall({ + phoneNumber: this.listobj.contactMobile, + success: function(res) { + console.log('拨打电话成功', res) + }, + fail: function(err) { + console.error('拨打电话失败', err) + uni.showToast({ + title: '取消拨打电话', + icon: 'none' + }) + } + }) + }, + + + // 查询拖动到指定为止的店铺 regionchange(e) { this.iconflag = true @@ -258,6 +487,14 @@ address: item.address }) }, + mapFuns() { + uni.openLocation({ + latitude: this.listobj.lat, + longitude: this.listobj.lng, + name: this.listobj.county, + address: this.listobj.address + }) + }, getshanghu() { this.$u.get("/app/user/userInfo").then((res) => { if (res.code == 200) { @@ -369,9 +606,15 @@ handleMarkerClick(event) { const markerId = event.markerId - uni.navigateTo({ - url: '/page_user/mapditu/index?markerId=' + markerId - }) + // uni.navigateTo({ + // url: '/page_user/mapditu/index?markerId=' + markerId + // }) + this.$u.get("/app/store/" + markerId).then(res => { + if(res.code == 200){ + const distance = this.getDistance(this.latitude, this.longitude, res.data.lat, res.data.lng) + this.listobj = { ...res.data, distance: distance } + } + }) }, btndts(item) { const markerId = item.storeId @@ -379,6 +622,12 @@ url: '/page_user/mapditu/index?markerId=' + markerId }) }, + // 点击进入详情 + btnxqstore(){ + uni.navigateTo({ + url: '/page_user/mapditu/index?markerId=' + this.listobj.storeId + }) + }, btntab(num) { this.index = num @@ -405,23 +654,79 @@