This commit is contained in:
3321822538@qq.com 2024-06-17 13:57:53 +08:00
parent cb037e4e5e
commit 2ada89629c
9 changed files with 276 additions and 302 deletions

View File

@ -73,15 +73,12 @@
chartday: [], chartday: [],
loging: true, loging: true,
deviceId: '', deviceId: '',
userType: '' userType: '',
dateday:'',
monthdui:''
} }
}, },
onLoad(e) { onLoad(e) {
// setTimeout(() => {
// this.initChart()
// }, 300);
// this.initChart()
setTimeout(() => { setTimeout(() => {
// console.log(this.$refs) // console.log(this.$refs)
this.$refs.canvas.init(this.initChart) this.$refs.canvas.init(this.initChart)
@ -91,6 +88,8 @@
const now = new Date(); const now = new Date();
this.yeartime.year = now.getFullYear() this.yeartime.year = now.getFullYear()
this.yeartime.month = now.getMonth() + 1 this.yeartime.month = now.getMonth() + 1
this.monthdui = this.yeartime.month
this.dateday = String(now.getDate()).padStart(2, '0')
this.gettimes() this.gettimes()
}, },
methods: { methods: {
@ -114,12 +113,23 @@
this.$u.get('/app/device/electric/count', data).then((res) => { this.$u.get('/app/device/electric/count', data).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.timelist = res.data this.timelist = res.data
// this.chartData = this.timelist.map(item => item.usedElectriQuantity);
// this.chartday = this.timelist.map(item => item.createDay + '');
if(this.monthdui != this.yeartime.month){
this.timelist = this.timelist
this.totalRecharge = res.totalRecharge
this.chartData = this.timelist.map(item => item.usedElectriQuantity); this.chartData = this.timelist.map(item => item.usedElectriQuantity);
this.chartday = this.timelist.map(item => item.createDay + '日'); this.chartday = this.timelist.map(item => item.createDay + '日');
}else{
this.timelist = this.timelist.slice(0, 14)
this.timelist.reverse()
this.totalRecharge = res.totalRecharge
this.chartData = this.timelist.slice(0, this.dateday).map(item => item.usedElectriQuantity)
this.chartday = this.timelist.slice(0, this.dateday).map(item => item.createDay + '日');
}
// console.log('', this.chartData, '', this.chartday);
this.loging=true this.loging=true
//
this.quantity = 0 this.quantity = 0
for (let i = 0; i < this.timelist.length; i++) { for (let i = 0; i < this.timelist.length; i++) {
this.quantity += this.timelist[i].usedElectriQuantity this.quantity += this.timelist[i].usedElectriQuantity
@ -138,103 +148,6 @@
} }
return data; return data;
}, },
// async initChart() {
// console.log('111111');
// let that =this
// // let _this = this
// const option = {
// grid: {
// left: 60,
// right: 10,
// top: 10,
// bottom: 30,
// },
// xAxis: {
// type: 'category',
// boundaryGap: false,
// axisLine: {
// show: false,
// },
// axisTick: {
// show: false,
// },
// axisLabel: {
// show: true,
// color: '#fff',
// fontSize: 11,
// rotate: 0,
// },
// splitLine: {
// show: false,
// },
// data:that.chartday,
// },
// yAxis: {
// show: true,
// axisLine: {
// show: false,
// },
// axisTick: {
// show: false,
// },
// axisLabel: {
// show: true,
// color: '#fff',
// fontSize: 11,
// formatter: function(value) {
// // 00
// return value + ''
// },
// },
// splitLine: {
// show: false,
// },
// },
// visualMap: {
// type: 'piecewise',
// show: false,
// dimension: 0,
// seriesIndex: 0,
// pieces: [{
// gt: 1,
// lt: 3,
// color: 'rgba(0, 0, 180, 0.4)',
// },
// {
// gt: 5,
// lt: 7,
// color: 'rgba(0, 0, 180, 0.4)',
// },
// ],
// },
// series: [{
// type: 'line',
// smooth: 0.6,
// symbol: 'none',
// lineStyle: {
// color: '#E0DBFF',
// width: 4,
// },
// areaStyle: {
// normal: {
// color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
// offset: 0,
// color: '#B4B0F7'
// }, ]),
// },
// },
// data:that.chartData,
// }],
// };
// const chart = await that.$refs.chart.init(echarts)
// console.log(option,'111');
// // 线
// // option.series[0].data = that.chartData
// option.xAxis.data = that.chartday
// chart.setOption(option)
// return chart
// },
// },
initChart(canvas, width, height, canvasDpr) { initChart(canvas, width, height, canvasDpr) {
let that = this let that = this
console.log(canvas, width, height, canvasDpr) console.log(canvas, width, height, canvasDpr)

View File

@ -5,7 +5,7 @@
<view class="title"> <view class="title">
{{deviceobj.deviceName}} {{deviceobj.deviceName}}
<view class="wz"> <view class="wz">
该设备还剩余时长{{expireTimeStr + 1}}分钟 该设备还剩余时长{{expireTimeStr}}分钟
</view> </view>
<view class="wz" v-if="deviceobj.storeContactMobile == null"> <view class="wz" v-if="deviceobj.storeContactMobile == null">
联系客服<text @click="call">{{deviceobj.userMobile}}</text> 联系客服<text @click="call">{{deviceobj.userMobile}}</text>
@ -228,14 +228,23 @@
this.deviceobj = res.data; this.deviceobj = res.data;
this.indexactive = res.data.suitList[0].suitId; this.indexactive = res.data.suitList[0].suitId;
this.zfobj = res.data.suitList[0] this.zfobj = res.data.suitList[0]
let targetDateStr = this.deviceobj.expireTime // let targetDateStr = this.deviceobj.expireTime
// let targetParts = targetDateStr.split(/[- :]/);
// let targetDate = new Date(targetParts[0], targetParts[1] - 1, targetParts[2], targetParts[3], targetParts[4], targetParts[5]);
// let now = new Date();
// let differenceInMs = targetDate - now;
// let differenceInMinutes = Math.floor(differenceInMs / (1000 * 60));
// this.expireTimeStr = parseInt(differenceInMinutes) <= 0 ? '0' : differenceInMinutes
let targetDateStr = this.deviceobj.expireTime;
let targetParts = targetDateStr.split(/[- :]/); let targetParts = targetDateStr.split(/[- :]/);
let targetDate = new Date(targetParts[0], targetParts[1] - 1, targetParts[2], targetParts[ let targetDate = new Date(targetParts[0], targetParts[1] - 1, targetParts[2], targetParts[3], targetParts[4], targetParts[5]);
3], targetParts[4], targetParts[5]);
let now = new Date(); let now = new Date();
let differenceInMs = targetDate - now; let differenceInMs = targetDate - now;
let differenceInMinutes = Math.floor(differenceInMs / (1000 * 60)); if (differenceInMs <= 0) {
this.expireTimeStr = parseInt(differenceInMinutes) <= 0 ? '0' : differenceInMinutes this.expireTimeStr = '0';
} else {
this.expireTimeStr = '1'
}
} }
}) })
}, },

View File

@ -184,7 +184,6 @@
let id = getQueryParam(decodedValue, 's') let id = getQueryParam(decodedValue, 's')
this.$u.get(`/app/device/${id}/bySn`).then((res) => { this.$u.get(`/app/device/${id}/bySn`).then((res) => {
if (res.code == 200) { if (res.code == 200) {
console.log(res,'resres');
this.macs = res.data.mac this.macs = res.data.mac
this.qrResult = 'CTKG-' + res.data.mac this.qrResult = 'CTKG-' + res.data.mac
xBlufi.initXBlufi(1); xBlufi.initXBlufi(1);

View File

@ -8,7 +8,7 @@
</view> </view>
<view class="listbox"> <view class="listbox">
<view class="moshi"> <view class="moshi">
<image src="https://api.ccttiot.com/smartmeter/img/static/uWpZzKBmhjKwSEkO3vcH" mode="" <image src="https://api.ccttiot.com/smartmeter/img/static/uWpZzKBmhjKwSEkO3vcH" mode="" style="height: 80rpx;"
@click="btndt(1)" class="img"></image> @click="btndt(1)" class="img"></image>
<image @click="onControltap" style="width: 76rpx;height: 76rpx;position: absolute;right: 50rpx;" <image @click="onControltap" style="width: 76rpx;height: 76rpx;position: absolute;right: 50rpx;"
src="https://api.ccttiot.com/smartmeter/img/static/uOS9p7Sy1K9WpVQgD3b9" mode=""></image> src="https://api.ccttiot.com/smartmeter/img/static/uOS9p7Sy1K9WpVQgD3b9" mode=""></image>
@ -35,6 +35,10 @@
<text>{{String(item.distance).split('.')[0]}}m</text> <text>{{String(item.distance).split('.')[0]}}m</text>
</view> </view>
</view> </view>
<view class="" v-if="gxlist.length == 0" style="width: 100%;height: 200rpx;margin: auto;margin-top: 230rpx;text-align: center;">
<image style="width: 200rpx;height: 200rpx;" src="https://api.ccttiot.com/smartmeter/img/static/uZFUpcz0YZZ4f4RjvGg2" mode=""></image>
<view class="" style="font-size: 28rpx;color: #808080;margin-top: 30rpx;">该区域暂无店铺...</view>
</view>
</view> </view>
</view> </view>
@ -95,6 +99,7 @@
}, },
addMarkersWithoutLabels() { addMarkersWithoutLabels() {
this.listmap.forEach((item) => { this.listmap.forEach((item) => {
if (item.deviceCount !== null && item.deviceCount > 0) {
const shopCover = { const shopCover = {
id: parseFloat(item.storeId), id: parseFloat(item.storeId),
latitude: item.lat, latitude: item.lat,
@ -102,12 +107,15 @@
width: 25, width: 25,
height: 30, height: 30,
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uZXgsJE6hXbRSwbKILB4', iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uZXgsJE6hXbRSwbKILB4',
}; }
this.covers.push(shopCover); this.covers.push(shopCover);
}); }
})
}, },
addMarkersWithLabels() { addMarkersWithLabels() {
this.listmap.forEach((item) => { this.listmap.forEach((item) => {
if (item.deviceCount !== null && item.deviceCount > 0) {
const shopCover = { const shopCover = {
id: parseFloat(item.storeId), id: parseFloat(item.storeId),
latitude: item.lat, latitude: item.lat,
@ -124,7 +132,9 @@
} }
} }
this.covers.push(shopCover); this.covers.push(shopCover);
}); }
})
}, },
calculateAnchorX(name) { calculateAnchorX(name) {
let chineseLength = 0 let chineseLength = 0
@ -199,10 +209,12 @@
response => { response => {
if (response.code == 200) { if (response.code == 200) {
this.listmap = response.data this.listmap = response.data
this.gxlist = response.data; let gxlist = response.data;
this.gxlist.forEach(item => { gxlist.forEach(item => {
if (item.deviceCount !== null && item.deviceCount > 0) {
// //
const distance = this.getDistance(this.latitude, this.longitude, item.lat, item.lng); const distance = this.getDistance(this.latitude, this
.longitude, item.lat, item.lng);
// //
item.distance = distance; item.distance = distance;
// //
@ -219,31 +231,39 @@
anchorX: (() => { anchorX: (() => {
if (item.name.length <= 2) { if (item.name.length <= 2) {
return -12 return -12
} else if (item.name.length <= 3) { } else if (item.name.length <=
3) {
return -20 return -20
} else if (item.name.length <= 4) { } else if (item.name.length <=
4) {
return -25 return -25
} else if (item.name.length <= 5) { } else if (item.name.length <=
5) {
return -30 return -30
} else if (item.name.length <= 6) { } else if (item.name.length <=
6) {
return -35 return -35
} else if (item.name.length <= 8) { } else if (item.name.length <=
8) {
return -40 return -40
} else if (item.name.length <= } else if (item.name.length <=
10) { 10) {
return -45 return -45
} else { } else {
return -item.name.length * 5 return -item.name.length *
5
} }
})(), })(),
fontWeight: 700, fontWeight: 700,
color: '#8883F0', color: '#8883F0',
textShadow: '2px 2px 0px white, -2px -2px 0px white, 2px -2px 0px white, -2px 2px 0px white', textShadow: '2px 2px 0px white, -2px -2px 0px white, 2px -2px 0px white, -2px 2px 0px white',
} }
}; }
// console.log(this.gxlist) this.covers.push(shopCover)
this.covers.push(shopCover) // this.gxlist.push(item)
}); }
})
} }
}).catch(error => { }).catch(error => {
console.error('请求店铺列表失败:', error) console.error('请求店铺列表失败:', error)
@ -261,7 +281,8 @@
const phi2 = lat2 * Math.PI / 180 const phi2 = lat2 * Math.PI / 180
const deltaPhi = (lat2 - lat1) * Math.PI / 180 const deltaPhi = (lat2 - lat1) * Math.PI / 180
const deltaLambda = (lon2 - lon1) * Math.PI / 180 const deltaLambda = (lon2 - lon1) * Math.PI / 180
const a = Math.sin(deltaPhi / 2) * Math.sin(deltaPhi / 2) + Math.cos(phi1) * Math.cos(phi2) * Math.sin(deltaLambda / 2) * Math.sin(deltaLambda / 2) const a = Math.sin(deltaPhi / 2) * Math.sin(deltaPhi / 2) + Math.cos(phi1) * Math.cos(phi2) * Math.sin(
deltaLambda / 2) * Math.sin(deltaLambda / 2)
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)) const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))
const distance = R * c const distance = R * c
return distance return distance
@ -358,7 +379,7 @@
image { image {
width: 230rpx; width: 230rpx;
height: 80rpx !important; // height: 80rpx !important;
} }
.img { .img {

View File

@ -124,6 +124,7 @@
}, },
addMarkersWithoutLabels() { addMarkersWithoutLabels() {
this.listmap.forEach((item) => { this.listmap.forEach((item) => {
if (item.deviceCount !== null && item.deviceCount > 0){
const shopCover = { const shopCover = {
id: parseFloat(item.storeId), id: parseFloat(item.storeId),
latitude: item.lat, latitude: item.lat,
@ -133,10 +134,12 @@
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uZXgsJE6hXbRSwbKILB4', iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uZXgsJE6hXbRSwbKILB4',
}; };
this.covers.push(shopCover); this.covers.push(shopCover);
}
}); });
}, },
addMarkersWithLabels() { addMarkersWithLabels() {
this.listmap.forEach((item) => { this.listmap.forEach((item) => {
if (item.deviceCount !== null && item.deviceCount > 0){
const shopCover = { const shopCover = {
id: parseFloat(item.storeId), id: parseFloat(item.storeId),
latitude: item.lat, latitude: item.lat,
@ -153,6 +156,8 @@
} }
} }
this.covers.push(shopCover); this.covers.push(shopCover);
}
}); });
}, },
calculateAnchorX(name) { calculateAnchorX(name) {
@ -227,8 +232,8 @@
mapFun() { mapFun() {
uni.openLocation({ uni.openLocation({
latitude: this.listobj.lat,// - / latitude: this.listobj.lat, // - /
longitude: this.listobj.lng,// - / longitude: this.listobj.lng, // - /
name: this.mapname, // name: this.mapname, //
address: this.mapaddress // address: this.mapaddress //
}); });
@ -273,6 +278,7 @@
this.listmap = res.data this.listmap = res.data
// res.rowslatitudelongitude // res.rowslatitudelongitude
res.data.forEach(item => { res.data.forEach(item => {
if (item.deviceCount !== null && item.deviceCount > 0) {
const shopCover = { const shopCover = {
id: parseFloat(item.storeId), id: parseFloat(item.storeId),
latitude: item.lat, latitude: item.lat,
@ -285,21 +291,27 @@
anchorX: (() => { anchorX: (() => {
if (item.name.length <= 2) { if (item.name.length <= 2) {
return -12 return -12
} else if (item.name.length <= 3) { } else if (item.name.length <=
3) {
return -20 return -20
} else if (item.name.length <= 4) { } else if (item.name.length <=
4) {
return -25 return -25
} else if (item.name.length <= 5) { } else if (item.name.length <=
5) {
return -30 return -30
} else if (item.name.length <= 6) { } else if (item.name.length <=
6) {
return -35 return -35
} else if (item.name.length <= 8) { } else if (item.name.length <=
8) {
return -40 return -40
} else if (item.name.length <= } else if (item.name.length <=
10) { 10) {
return -45 return -45
} else { } else {
return -item.name.length * 5 return -item.name.length *
5
} }
})(), })(),
fontWeight: 700, fontWeight: 700,
@ -308,6 +320,8 @@
} }
}; };
this.covers.push(shopCover); this.covers.push(shopCover);
}
}); });
} }
}); });
@ -436,6 +450,7 @@
width: 150rpx; width: 150rpx;
height: 150rpx; height: 150rpx;
border-radius: 20rpx; border-radius: 20rpx;
image { image {
width: 150rpx; width: 150rpx;
height: 150rpx; height: 150rpx;

View File

@ -28,7 +28,7 @@
<view class="mid_top"> <view class="mid_top">
{{ deviceInfo.deviceName == null ? '' : deviceInfo.deviceName }} {{ deviceInfo.deviceName == null ? '' : deviceInfo.deviceName }}
<view class="" style="font-size: 26rpx;margin-top: 8rpx;"> <view class="" style="font-size: 26rpx;margin-top: 8rpx;">
更新时间{{deviceInfo.lastPullTime}}</view> 更新时间{{deviceInfo.lastPullTime == null ? '--' : deviceInfo.lastPullTime}}</view>
</view> </view>
<view class="mid_bot"> <view class="mid_bot">
<view class="txt" v-if="deviceInfo"> <view class="txt" v-if="deviceInfo">
@ -149,16 +149,23 @@
</view> </view>
<view class="bot">异常</view> <view class="bot">异常</view>
</view> </view>
<view class="cont" style="width: 120rpx;" @click="toydfx()"> <!-- <view class="cont" style="width: 120rpx;" @click="toydfx()">
<view class="top"> <view class="top">
<image src="https://api.ccttiot.com/smartmeter/img/static/uDVSE5BFHQnjG2JTVE62" mode=""> <image src="https://api.ccttiot.com/smartmeter/img/static/uDVSE5BFHQnjG2JTVE62" mode="">
</image> </image>
</view> </view>
<view class="bot">用电分析</view> <view class="bot">用电分析</view>
</view> -->
<view class="cont" style="width: 120rpx;" @click="topage(6)">
<view class="top">
<image src="https://api.ccttiot.com/smartmeter/img/static/uAnBmmayp3tVGwXntdaM" mode="">
</image>
</view>
<view class="bot">电量充值</view>
</view> </view>
</view> </view>
<view class="" style="display: flex;margin-top: 20rpx;"> <view class="" style="display: flex;margin-top: 20rpx;">
<view class="cont" style="width: 120rpx;margin-right: 56rpx;" @click="topage(3)"> <view class="cont" style="width: 120rpx;margin-right: 50rpx;" @click="topage(3)">
<view class="top"> <view class="top">
<image src="https://api.ccttiot.com/smartmeter/img/static/umjPUc8nDKf1JwVqRAeb" mode="" <image src="https://api.ccttiot.com/smartmeter/img/static/umjPUc8nDKf1JwVqRAeb" mode=""
style="width: 58rpx;height: 60rpx;"></image> style="width: 58rpx;height: 60rpx;"></image>
@ -172,20 +179,14 @@
</view> </view>
<view class="bot">设置</view> <view class="bot">设置</view>
</view> </view>
<view class="cont" style="width: 60rpx;margin-right: 100rpx;" @click="topage(5)"> <view class="cont" style="width: 60rpx;" @click="topage(5)">
<view class="top"> <view class="top">
<image src="https://api.ccttiot.com/smartmeter/img/static/uXdBHA7pzOv2LYL7stJp" mode=""> <image src="https://api.ccttiot.com/smartmeter/img/static/uXdBHA7pzOv2LYL7stJp" mode="">
</image> </image>
</view> </view>
<view class="bot">配网</view> <view class="bot">配网</view>
</view> </view>
<view class="cont" style="width: 60rpx;" @click="topage(6)">
<view class="top">
<image src="https://api.ccttiot.com/smartmeter/img/static/uAnBmmayp3tVGwXntdaM" mode="">
</image>
</view>
<view class="bot">充值</view>
</view>
</view> </view>
</view> </view>

View File

@ -31,7 +31,7 @@
</view> </view>
<view class="info"> <view class="info">
<view class="txt"> <view class="txt">
{{listobj.storeName}} {{listobj.storeName == null ? '' : listobj.storeName}}
</view> </view>
<view class="iconfont icon-xiangyou1"></view> <view class="iconfont icon-xiangyou1"></view>
</view> </view>
@ -63,7 +63,7 @@
</view> </view>
<view class="info"> <view class="info">
<view class="txt"> <view class="txt">
{{listobj.wifi}} {{listobj.wifi == null ? '' : listobj.wifi}}
</view> </view>
</view> </view>
</view> </view>

View File

@ -13,7 +13,7 @@
{{userinfo.nickName == null ? '' : userinfo.nickName}} {{userinfo.nickName == null ? '' : userinfo.nickName}}
</view> </view>
<view class="num"> <view class="num">
{{userinfo.storeCount == null ? '' : userinfo.storeCount}}间店铺 {{userinfo.storeCount == null ? 0 : userinfo.storeCount}}间店铺
</view> </view>
</view> </view>
</view> </view>
@ -26,7 +26,7 @@
<view class="txt" style="font-size: 24rpx;"> <view class="txt" style="font-size: 24rpx;">
</view> </view>
{{userinfo.balance == null ? '' : userinfo.balance}} {{userinfo.balance == null ? 0 : userinfo.balance}}
</view> </view>
<view class="bot"> <view class="bot">
钱包余额 钱包余额
@ -51,10 +51,14 @@
</view> </view>
</view> </view>
<view class="bot_box"> <view class="bot_box">
<view class="botcard" @click="topage(0)"> <view class="botcard" @click="topage(0)" v-if="userinfo.deviceCount != 0">
<image src="https://api.ccttiot.com/smartmeter/img/static/uATEvHAKIB0tdXk0embn" mode=""></image> <image src="https://api.ccttiot.com/smartmeter/img/static/uATEvHAKIB0tdXk0embn" mode=""></image>
<view class="txt">我的店铺</view> <view class="txt">我的店铺</view>
</view> </view>
<view class="botcard" @click="topage(9)" v-else>
<image src="https://api.ccttiot.com/smartmeter/img/static/uYOquvGtfb1sm5F60NgJ" mode=""></image>
<view class="txt">提交申请后可创建店铺</view>
</view>
<view class="botcard" @click="topage(1)"> <view class="botcard" @click="topage(1)">
<image src="https://api.ccttiot.com/smartmeter/img/static/ujXfMLJmerXRSRGZfGFV" mode=""></image> <image src="https://api.ccttiot.com/smartmeter/img/static/ujXfMLJmerXRSRGZfGFV" mode=""></image>
<view class="txt">订单记录</view> <view class="txt">订单记录</view>
@ -149,6 +153,10 @@
uni.navigateTo({ uni.navigateTo({
url:'/page_user/yetx' url:'/page_user/yetx'
}) })
}else if(num == 9){
uni.navigateTo({
url:'/page_fenbao/statulist/merchant/index'
})
} }
}, },
topages(num){ topages(num){

View File

@ -122,19 +122,20 @@
} }
that.$u.put("/app/device/bind", data).then(res => { that.$u.put("/app/device/bind", data).then(res => {
if (res.code == 200) { if (res.code == 200) {
uni.showModal({
title: '提示',
content: '绑定成功,需前去设置吗?',
success: function(res) {
if (res.confirm) {
uni.navigateTo({ uni.navigateTo({
url: '/page_user/sbdetail?id=' +that.deviceobj.deviceId url: '/page_user/sbdetail?id=' +that.deviceobj.deviceId
}) })
} else if (res.cancel) { // uni.showModal({
// title: '',
// content: '',
// success: function(res) {
// if (res.confirm) {
} // } else if (res.cancel) {
}
}) // }
// }
// })
} else { } else {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
@ -202,6 +203,7 @@
}, },
addMarkersWithoutLabels() { addMarkersWithoutLabels() {
this.listmap.forEach((item) => { this.listmap.forEach((item) => {
if (item.deviceCount !== null && item.deviceCount > 0){
const shopCover = { const shopCover = {
id: parseFloat(item.storeId), id: parseFloat(item.storeId),
latitude: item.lat, latitude: item.lat,
@ -211,10 +213,13 @@
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uZXgsJE6hXbRSwbKILB4', iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uZXgsJE6hXbRSwbKILB4',
}; };
this.covers.push(shopCover) this.covers.push(shopCover)
}
}); });
}, },
addMarkersWithLabels() { addMarkersWithLabels() {
this.listmap.forEach((item) => { this.listmap.forEach((item) => {
if (item.deviceCount !== null && item.deviceCount > 0){
const shopCover = { const shopCover = {
id: parseFloat(item.storeId), id: parseFloat(item.storeId),
latitude: item.lat, latitude: item.lat,
@ -232,6 +237,8 @@
} }
} }
this.covers.push(shopCover) this.covers.push(shopCover)
}
}); });
}, },
calculateAnchorX(name) { calculateAnchorX(name) {
@ -361,11 +368,11 @@
this.longitude = Number(res.longitude.toFixed(5)) + 0.005 this.longitude = Number(res.longitude.toFixed(5)) + 0.005
this.setMapScale() this.setMapScale()
// //
this.$u.get("/app/store/listNearBy?center=" + this.jinweidu + '&radius=' + 1000).then( this.$u.get("/app/store/listNearBy?center=" + this.jinweidu + '&radius=' + 1000).then(res => {
res => {
if (res.code == 200) { if (res.code == 200) {
this.listmap = res.data this.listmap = res.data
res.data.forEach(item => { res.data.forEach(item => {
if (item.deviceCount !== null && item.deviceCount > 0){
const shopCover = { const shopCover = {
id: parseFloat(item.storeId), id: parseFloat(item.storeId),
latitude: item.lat, latitude: item.lat,
@ -402,11 +409,12 @@
}, },
} }
};
this.covers.push(shopCover)
});
} }
}); this.covers.push(shopCover)
}
})
}
})
}, },
fail: (err) => { fail: (err) => {
console.error('获取位置失败:', err); console.error('获取位置失败:', err);