aaa
This commit is contained in:
parent
cb037e4e5e
commit
2ada89629c
|
@ -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.chartData = this.timelist.map(item => item.usedElectriQuantity);
|
||||||
this.chartday = this.timelist.map(item => item.createDay + '日');
|
// this.chartday = this.timelist.map(item => item.createDay + '日');
|
||||||
|
|
||||||
// console.log('用电', this.chartData, '时间', this.chartday);
|
if(this.monthdui != this.yeartime.month){
|
||||||
|
this.timelist = this.timelist
|
||||||
|
this.totalRecharge = res.totalRecharge
|
||||||
|
this.chartData = this.timelist.map(item => item.usedElectriQuantity);
|
||||||
|
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 + '日');
|
||||||
|
}
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
@ -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 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));
|
||||||
let differenceInMinutes = Math.floor(differenceInMs / (1000 * 60));
|
// this.expireTimeStr = parseInt(differenceInMinutes) <= 0 ? '0' : differenceInMinutes
|
||||||
this.expireTimeStr = parseInt(differenceInMinutes) <= 0 ? '0' : differenceInMinutes
|
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;
|
||||||
|
if (differenceInMs <= 0) {
|
||||||
|
this.expireTimeStr = '0';
|
||||||
|
} else {
|
||||||
|
this.expireTimeStr = '1'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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,36 +99,42 @@
|
||||||
},
|
},
|
||||||
addMarkersWithoutLabels() {
|
addMarkersWithoutLabels() {
|
||||||
this.listmap.forEach((item) => {
|
this.listmap.forEach((item) => {
|
||||||
const shopCover = {
|
if (item.deviceCount !== null && item.deviceCount > 0) {
|
||||||
id: parseFloat(item.storeId),
|
const shopCover = {
|
||||||
latitude: item.lat,
|
id: parseFloat(item.storeId),
|
||||||
longitude: item.lng,
|
latitude: item.lat,
|
||||||
width: 25,
|
longitude: item.lng,
|
||||||
height: 30,
|
width: 25,
|
||||||
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uZXgsJE6hXbRSwbKILB4',
|
height: 30,
|
||||||
};
|
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) => {
|
||||||
const shopCover = {
|
if (item.deviceCount !== null && item.deviceCount > 0) {
|
||||||
id: parseFloat(item.storeId),
|
const shopCover = {
|
||||||
latitude: item.lat,
|
id: parseFloat(item.storeId),
|
||||||
longitude: item.lng,
|
latitude: item.lat,
|
||||||
width: 25,
|
longitude: item.lng,
|
||||||
height: 30,
|
width: 25,
|
||||||
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uZXgsJE6hXbRSwbKILB4',
|
height: 30,
|
||||||
label: {
|
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uZXgsJE6hXbRSwbKILB4',
|
||||||
content: item.name,
|
label: {
|
||||||
anchorX: this.calculateAnchorX(item.name),
|
content: item.name,
|
||||||
fontWeight: 700,
|
anchorX: this.calculateAnchorX(item.name),
|
||||||
color: '#8883F0',
|
fontWeight: 700,
|
||||||
textShadow: '2px 2px 0px white, -2px -2px 0px white, 2px -2px 0px white, -2px 2px 0px white',
|
color: '#8883F0',
|
||||||
|
textShadow: '2px 2px 0px white, -2px -2px 0px white, 2px -2px 0px white, -2px 2px 0px white',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
this.covers.push(shopCover);
|
||||||
}
|
}
|
||||||
this.covers.push(shopCover);
|
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
calculateAnchorX(name) {
|
calculateAnchorX(name) {
|
||||||
let chineseLength = 0
|
let chineseLength = 0
|
||||||
|
@ -142,7 +152,7 @@
|
||||||
const totalLength = chineseLength + englishLength * 2; // 总长度(以中文字符为单位)
|
const totalLength = chineseLength + englishLength * 2; // 总长度(以中文字符为单位)
|
||||||
return -totalLength * 6.5 // 假设每个中文字符对应的 anchorX 偏移是 -6.5
|
return -totalLength * 6.5 // 假设每个中文字符对应的 anchorX 偏移是 -6.5
|
||||||
},
|
},
|
||||||
|
|
||||||
onControltap(control) {
|
onControltap(control) {
|
||||||
this.setMapScale()
|
this.setMapScale()
|
||||||
},
|
},
|
||||||
|
@ -199,51 +209,61 @@
|
||||||
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
|
||||||
item.distance = distance;
|
.longitude, item.lat, item.lng);
|
||||||
// 创建店铺覆盖物对象
|
// 将距离添加到店铺对象中
|
||||||
const shopCover = {
|
item.distance = distance;
|
||||||
id: parseFloat(item.storeId),
|
// 创建店铺覆盖物对象
|
||||||
latitude: item.lat,
|
const shopCover = {
|
||||||
longitude: item.lng,
|
id: parseFloat(item.storeId),
|
||||||
width: 25,
|
latitude: item.lat,
|
||||||
height: 30,
|
longitude: item.lng,
|
||||||
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uZXgsJE6hXbRSwbKILB4',
|
width: 25,
|
||||||
distance: distance, // 可以在这里也添加距离到覆盖物对象中,但通常只需要在店铺对象中
|
height: 30,
|
||||||
label: {
|
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uZXgsJE6hXbRSwbKILB4',
|
||||||
content: item.name,
|
distance: distance, // 可以在这里也添加距离到覆盖物对象中,但通常只需要在店铺对象中
|
||||||
anchorX: (() => {
|
label: {
|
||||||
if (item.name.length <= 2) {
|
content: item.name,
|
||||||
return -12
|
anchorX: (() => {
|
||||||
} else if (item.name.length <= 3) {
|
if (item.name.length <= 2) {
|
||||||
return -20
|
return -12
|
||||||
} else if (item.name.length <= 4) {
|
} else if (item.name.length <=
|
||||||
return -25
|
3) {
|
||||||
} else if (item.name.length <= 5) {
|
return -20
|
||||||
return -30
|
} else if (item.name.length <=
|
||||||
} else if (item.name.length <= 6) {
|
4) {
|
||||||
return -35
|
return -25
|
||||||
} else if (item.name.length <= 8) {
|
} else if (item.name.length <=
|
||||||
return -40
|
5) {
|
||||||
} else if (item.name.length <=
|
return -30
|
||||||
10) {
|
} else if (item.name.length <=
|
||||||
return -45
|
6) {
|
||||||
} else {
|
return -35
|
||||||
return -item.name.length * 5
|
} else if (item.name.length <=
|
||||||
}
|
8) {
|
||||||
})(),
|
return -40
|
||||||
fontWeight: 700,
|
} else if (item.name.length <=
|
||||||
color: '#8883F0',
|
10) {
|
||||||
textShadow: '2px 2px 0px white, -2px -2px 0px white, 2px -2px 0px white, -2px 2px 0px white',
|
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',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
this.covers.push(shopCover)
|
||||||
// console.log(this.gxlist)
|
this.gxlist.push(item)
|
||||||
this.covers.push(shopCover) // 将店铺覆盖物添加到数组中
|
}
|
||||||
});
|
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error('请求店铺列表失败:', error)
|
console.error('请求店铺列表失败:', error)
|
||||||
|
@ -254,14 +274,15 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 计算距离函数
|
// 计算距离函数
|
||||||
getDistance(lat1, lon1, lat2, lon2) {
|
getDistance(lat1, lon1, lat2, lon2) {
|
||||||
const R = 6371000 // 地球半径,单位:米
|
const R = 6371000 // 地球半径,单位:米
|
||||||
const phi1 = lat1 * Math.PI / 180 // 纬度转为弧度
|
const phi1 = lat1 * Math.PI / 180 // 纬度转为弧度
|
||||||
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 {
|
||||||
|
|
|
@ -124,7 +124,8 @@
|
||||||
},
|
},
|
||||||
addMarkersWithoutLabels() {
|
addMarkersWithoutLabels() {
|
||||||
this.listmap.forEach((item) => {
|
this.listmap.forEach((item) => {
|
||||||
const shopCover = {
|
if (item.deviceCount !== null && item.deviceCount > 0){
|
||||||
|
const shopCover = {
|
||||||
id: parseFloat(item.storeId),
|
id: parseFloat(item.storeId),
|
||||||
latitude: item.lat,
|
latitude: item.lat,
|
||||||
longitude: item.lng,
|
longitude: item.lng,
|
||||||
|
@ -133,11 +134,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) => {
|
||||||
const shopCover = {
|
if (item.deviceCount !== null && item.deviceCount > 0){
|
||||||
|
const shopCover = {
|
||||||
id: parseFloat(item.storeId),
|
id: parseFloat(item.storeId),
|
||||||
latitude: item.lat,
|
latitude: item.lat,
|
||||||
longitude: item.lng,
|
longitude: item.lng,
|
||||||
|
@ -153,6 +156,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.covers.push(shopCover);
|
this.covers.push(shopCover);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
calculateAnchorX(name) {
|
calculateAnchorX(name) {
|
||||||
|
@ -227,13 +232,13 @@
|
||||||
|
|
||||||
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 //详细地点名称
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// 地图回正
|
// 地图回正
|
||||||
async setMapScale(e, val) {
|
async setMapScale(e, val) {
|
||||||
let mapContext = uni.createMapContext('map', this);
|
let mapContext = uni.createMapContext('map', this);
|
||||||
|
@ -273,41 +278,50 @@
|
||||||
this.listmap = res.data
|
this.listmap = res.data
|
||||||
// 假设返回的店铺数据在res.rows中,并且每个店铺有latitude和longitude字段
|
// 假设返回的店铺数据在res.rows中,并且每个店铺有latitude和longitude字段
|
||||||
res.data.forEach(item => {
|
res.data.forEach(item => {
|
||||||
const shopCover = {
|
if (item.deviceCount !== null && item.deviceCount > 0) {
|
||||||
id: parseFloat(item.storeId),
|
const shopCover = {
|
||||||
latitude: item.lat,
|
id: parseFloat(item.storeId),
|
||||||
longitude: item.lng,
|
latitude: item.lat,
|
||||||
width: 25,
|
longitude: item.lng,
|
||||||
height: 30,
|
width: 25,
|
||||||
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uZXgsJE6hXbRSwbKILB4',
|
height: 30,
|
||||||
label: {
|
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uZXgsJE6hXbRSwbKILB4',
|
||||||
content: item.name,
|
label: {
|
||||||
anchorX: (() => {
|
content: item.name,
|
||||||
if (item.name.length <= 2) {
|
anchorX: (() => {
|
||||||
return -12
|
if (item.name.length <= 2) {
|
||||||
} else if (item.name.length <= 3) {
|
return -12
|
||||||
return -20
|
} else if (item.name.length <=
|
||||||
} else if (item.name.length <= 4) {
|
3) {
|
||||||
return -25
|
return -20
|
||||||
} else if (item.name.length <= 5) {
|
} else if (item.name.length <=
|
||||||
return -30
|
4) {
|
||||||
} else if (item.name.length <= 6) {
|
return -25
|
||||||
return -35
|
} else if (item.name.length <=
|
||||||
} else if (item.name.length <= 8) {
|
5) {
|
||||||
return -40
|
return -30
|
||||||
} else if (item.name.length <=
|
} else if (item.name.length <=
|
||||||
10) {
|
6) {
|
||||||
return -45
|
return -35
|
||||||
} else {
|
} else if (item.name.length <=
|
||||||
return -item.name.length * 5
|
8) {
|
||||||
}
|
return -40
|
||||||
})(),
|
} else if (item.name.length <=
|
||||||
fontWeight: 700,
|
10) {
|
||||||
color: '#8883F0',
|
return -45
|
||||||
textShadow: '2px 2px 0px white, -2px -2px 0px white, 2px -2px 0px white, -2px 2px 0px white',
|
} else {
|
||||||
}
|
return -item.name.length *
|
||||||
};
|
5
|
||||||
this.covers.push(shopCover);
|
}
|
||||||
|
})(),
|
||||||
|
fontWeight: 700,
|
||||||
|
color: '#8883F0',
|
||||||
|
textShadow: '2px 2px 0px white, -2px -2px 0px white, 2px -2px 0px white, -2px 2px 0px white',
|
||||||
|
}
|
||||||
|
};
|
||||||
|
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;
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
14
pages/my.vue
14
pages/my.vue
|
@ -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){
|
||||||
|
|
|
@ -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({
|
uni.navigateTo({
|
||||||
title: '提示',
|
url: '/page_user/sbdetail?id=' +that.deviceobj.deviceId
|
||||||
content: '绑定成功,需前去设置吗?',
|
|
||||||
success: function(res) {
|
|
||||||
if (res.confirm) {
|
|
||||||
uni.navigateTo({
|
|
||||||
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,7 +203,8 @@
|
||||||
},
|
},
|
||||||
addMarkersWithoutLabels() {
|
addMarkersWithoutLabels() {
|
||||||
this.listmap.forEach((item) => {
|
this.listmap.forEach((item) => {
|
||||||
const shopCover = {
|
if (item.deviceCount !== null && item.deviceCount > 0){
|
||||||
|
const shopCover = {
|
||||||
id: parseFloat(item.storeId),
|
id: parseFloat(item.storeId),
|
||||||
latitude: item.lat,
|
latitude: item.lat,
|
||||||
longitude: item.lng,
|
longitude: item.lng,
|
||||||
|
@ -211,11 +213,14 @@
|
||||||
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) => {
|
||||||
const shopCover = {
|
if (item.deviceCount !== null && item.deviceCount > 0){
|
||||||
|
const shopCover = {
|
||||||
id: parseFloat(item.storeId),
|
id: parseFloat(item.storeId),
|
||||||
latitude: item.lat,
|
latitude: item.lat,
|
||||||
longitude: item.lng,
|
longitude: item.lng,
|
||||||
|
@ -232,6 +237,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.covers.push(shopCover)
|
this.covers.push(shopCover)
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
calculateAnchorX(name) {
|
calculateAnchorX(name) {
|
||||||
|
@ -361,52 +368,53 @@
|
||||||
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 => {
|
||||||
const shopCover = {
|
if (item.deviceCount !== null && item.deviceCount > 0){
|
||||||
id: parseFloat(item.storeId),
|
const shopCover = {
|
||||||
latitude: item.lat,
|
id: parseFloat(item.storeId),
|
||||||
longitude: item.lng,
|
latitude: item.lat,
|
||||||
width: 25,
|
longitude: item.lng,
|
||||||
height: 30,
|
width: 25,
|
||||||
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uZXgsJE6hXbRSwbKILB4',
|
height: 30,
|
||||||
label: {
|
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uZXgsJE6hXbRSwbKILB4',
|
||||||
content: item.name,
|
label: {
|
||||||
anchorX: (() => {
|
content: item.name,
|
||||||
if (item.name.length <= 2) {
|
anchorX: (() => {
|
||||||
return -12
|
if (item.name.length <= 2) {
|
||||||
} else if (item.name.length <= 3) {
|
return -12
|
||||||
return -20
|
} else if (item.name.length <= 3) {
|
||||||
} else if (item.name.length <= 4) {
|
return -20
|
||||||
return -25
|
} else if (item.name.length <= 4) {
|
||||||
} else if (item.name.length <= 5) {
|
return -25
|
||||||
return -30
|
} else if (item.name.length <= 5) {
|
||||||
} else if (item.name.length <= 6) {
|
return -30
|
||||||
return -35
|
} else if (item.name.length <= 6) {
|
||||||
} else if (item.name.length <= 8) {
|
return -35
|
||||||
return -40
|
} else if (item.name.length <= 8) {
|
||||||
} else if (item.name.length <=
|
return -40
|
||||||
10) {
|
} else if (item.name.length <=
|
||||||
return -45
|
10) {
|
||||||
} else {
|
return -45
|
||||||
return -item.name.length * 6
|
} else {
|
||||||
}
|
return -item.name.length * 6
|
||||||
})(),
|
}
|
||||||
fontWeight: 700,
|
})(),
|
||||||
color: '#8883F0',
|
fontWeight: 700,
|
||||||
textShadow: '2px 2px 0px white, -2px -2px 0px white, 2px -2px 0px white, -2px 2px 0px white',
|
color: '#8883F0',
|
||||||
style: {
|
textShadow: '2px 2px 0px white, -2px -2px 0px white, 2px -2px 0px white, -2px 2px 0px white',
|
||||||
|
style: {
|
||||||
},
|
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
this.covers.push(shopCover)
|
||||||
this.covers.push(shopCover)
|
}
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
console.error('获取位置失败:', err);
|
console.error('获取位置失败:', err);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user