feat:对接换电页面数据 && 地图找车修改
This commit is contained in:
parent
b4590b35f5
commit
4cd943bb07
@ -32,7 +32,7 @@
|
||||
<uni-icons custom-prefix="iconfont" type="icon-ebikeyinlianglabashengyin" color="#0084FF"
|
||||
size="16" />
|
||||
</label>
|
||||
<label style="color: #0084FF;" @click="checkecu('findEbike')">寻车铃</label>
|
||||
<label style="color: #0084FF;" @click="checkecu()">寻车铃</label>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-top:15px;display:flex;justify-content:space-between;">
|
||||
@ -48,10 +48,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import * as api from "@/utils/api.js";
|
||||
import {
|
||||
ref
|
||||
} from 'vue';
|
||||
import {checkEcuBells} from "@/utils/commonApi";
|
||||
|
||||
const props = defineProps(["data"]);
|
||||
|
||||
//查看车辆信息
|
||||
@ -81,25 +79,8 @@
|
||||
}
|
||||
|
||||
//中控操作
|
||||
function checkecu (url) {
|
||||
const {
|
||||
ecuId,
|
||||
bikeId
|
||||
} = props.data;
|
||||
if (!ecuId) {
|
||||
showModelMessage("请先扫码车辆编号!");
|
||||
return;
|
||||
}
|
||||
api.callCoreApi(url, {
|
||||
ecuId,
|
||||
bikeId
|
||||
}, 'get').then(res => {
|
||||
const {
|
||||
code,
|
||||
message
|
||||
} = res;
|
||||
showModelMessage(message);
|
||||
})
|
||||
function checkecu () {
|
||||
checkEcuBells(props.data)
|
||||
}
|
||||
|
||||
//完成换电
|
||||
|
||||
@ -11,13 +11,19 @@
|
||||
<text class="label">车辆编号</text>
|
||||
<view class="value">
|
||||
<text style="margin-right: 30rpx;">{{ it?.bikeCode || '-' }}</text>
|
||||
<uni-icons type="sound" size="25" style="position: relative;top: 6rpx;" color="blue"></uni-icons>
|
||||
<uni-icons custom-prefix="iconfont"
|
||||
type="icon-ebikeyinlianglabashengyin"
|
||||
style="position: relative;top:5rpx"
|
||||
color="#0084FF"
|
||||
size="25"
|
||||
@click="checkEcu(it)"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 最新电量 -->
|
||||
<view class="row">
|
||||
<text class="label">最新电量</text>
|
||||
<text class="value">{{ it?.soc || '-' }}</text>
|
||||
<text class="value">{{ it?.soc }}%</text>
|
||||
</view>
|
||||
<!-- 最后骑行时间 -->
|
||||
<view class="row">
|
||||
@ -32,14 +38,18 @@
|
||||
<!-- 设备位置 -->
|
||||
<view class="row">
|
||||
<text class="label">设备位置</text>
|
||||
<view>
|
||||
<view
|
||||
class="value"
|
||||
@click="navigator.to('/pages/map/map-findbike',{
|
||||
longitude:it.longitude,
|
||||
latitude:it.latitude
|
||||
})"
|
||||
>
|
||||
<view>查看地图</view>
|
||||
<view style="color: darkgrey;font-size: 28rpx;">{{ (it?.longitude || '-') + ',' + (it?.latitude || '-')}}</view>
|
||||
<view style="color: darkgrey;font-size: 26rpx;">{{ (it?.longitude || '-') + ',' + (it?.latitude || '-')}}</view>
|
||||
</view>
|
||||
<uni-icons type="right" size="20" class="arrows" color="grey"></uni-icons>
|
||||
</view>
|
||||
<!-- 删除 -->
|
||||
<uni-icons type="trash" size="25" class="deleteBtn" color="orange"></uni-icons>
|
||||
</view>
|
||||
<view style="width: 100%;height: 100rpx;"></view>
|
||||
<!-- 确认接单按钮 -->
|
||||
@ -56,6 +66,7 @@ import { ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import navigator from '@/utils/navigator.js';
|
||||
import EmptyComponent from '@/components/empty-component/empty-component.vue';
|
||||
import {checkEcuBells} from "@/utils/commonApi";
|
||||
|
||||
const orderList = ref([]);
|
||||
|
||||
@ -64,6 +75,11 @@ onLoad((options) => {
|
||||
orderList.value = changeBatteryArr
|
||||
});
|
||||
|
||||
const checkEcu = (it) => {
|
||||
checkEcuBells(it)
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@ -25,9 +25,7 @@
|
||||
border-radius: 15px;
|
||||
background-color: #35374dc2;
|
||||
color: white;"
|
||||
@click="navigator.to('/pages/devops/takeOrders/takeOrders',{
|
||||
changeBatteryArr,
|
||||
})"
|
||||
@click="navigatePageByOrder"
|
||||
>
|
||||
当前范围内可接单车辆
|
||||
<label style="margin-left: 5px;">{{orderCount}}</label>
|
||||
@ -888,7 +886,6 @@
|
||||
markers.value=oData.arrPoints;
|
||||
}
|
||||
const {icnt_2,icnt_0,icnt_1,changeBattery}=oData;
|
||||
console.log(changeBattery);
|
||||
changeBatteryArr.value=changeBattery;
|
||||
return {icnt_2,icnt_0,icnt_1};
|
||||
}
|
||||
@ -980,6 +977,25 @@
|
||||
url:"/pages/warehouse/vehicledispatch/vehicledispatch"
|
||||
})
|
||||
}
|
||||
|
||||
//接单类型页面跳转
|
||||
const navigatePageByOrder = () => {
|
||||
const {
|
||||
lx
|
||||
} = selRight.value;
|
||||
switch(lx){
|
||||
case "hd":
|
||||
navigator.to('/pages/devops/takeOrders/takeOrders',{
|
||||
changeBatteryArr:changeBatteryArr.value,
|
||||
})
|
||||
break;
|
||||
case "dd":
|
||||
break;
|
||||
case "wx":
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<map id="mapRef" ref="mapRef" show-location style="width: 100%;height: 100vh;" :scale="scale" :markers="markers"
|
||||
:longitude="mapcenter.longitude" :latitude="mapcenter.latitude"/>
|
||||
:longitude="mapcenter.longitude" :latitude="mapcenter.latitude" :polyline="polylines"/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
@ -27,9 +27,16 @@
|
||||
onLoad
|
||||
} from "@dcloudio/uni-app";
|
||||
import {
|
||||
ref,onMounted,getCurrentInstance
|
||||
ref,
|
||||
onMounted,
|
||||
getCurrentInstance,
|
||||
nextTick
|
||||
} from "vue";
|
||||
import * as map from "@/utils/map.js";
|
||||
import AMapWX from "@/utils/amap-wx.130";
|
||||
var amapsdk = new AMapWX({
|
||||
key: map.sdkKey
|
||||
});
|
||||
|
||||
const mapRef=ref("mapRef");
|
||||
let oMap=null;
|
||||
@ -38,9 +45,11 @@
|
||||
const mapcenter=ref({
|
||||
longitude:"",latitude:""
|
||||
})
|
||||
const polylines = ref([]);
|
||||
|
||||
onMounted(()=>{
|
||||
oMap= map.getMap("mapRef",getCurrentInstance());
|
||||
pathPlanning()
|
||||
});
|
||||
|
||||
onLoad((option) => {
|
||||
@ -72,6 +81,49 @@
|
||||
} = res;
|
||||
})
|
||||
}
|
||||
|
||||
//路线规划
|
||||
const pathPlanning = () => {
|
||||
|
||||
map.getLoalcation(oMap, (res) => {
|
||||
const {
|
||||
latitude: slat,
|
||||
longitude: slng
|
||||
} = res;
|
||||
|
||||
const options = {
|
||||
mapsdk:amapsdk,
|
||||
slng,
|
||||
slat,
|
||||
elng:mapcenter.value.longitude,
|
||||
elat:mapcenter.value.latitude,
|
||||
success: (res) => {
|
||||
let {
|
||||
arrPoint,
|
||||
distance
|
||||
} = res;
|
||||
|
||||
oMap.includePoints({
|
||||
points: arrPoint,
|
||||
padding: [50, 50, 50, 50], // 视野边缘与点的间距
|
||||
success: () => {
|
||||
polylines.value = [map.addLine("#1082FF", arrPoint)]
|
||||
console.log(oMap)
|
||||
}
|
||||
});
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log("fail", res);
|
||||
}
|
||||
}
|
||||
|
||||
map.direction(options)
|
||||
|
||||
},null, true)
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
25
ebike-maintenance/utils/commonApi.js
Normal file
25
ebike-maintenance/utils/commonApi.js
Normal file
@ -0,0 +1,25 @@
|
||||
import * as api from "./api";
|
||||
import {showModelMessage,showMessage} from "./tools";
|
||||
|
||||
//寻车铃声启动
|
||||
export function checkEcuBells (item) {
|
||||
const {ecuId,bikeId} = item;
|
||||
if (!ecuId) {
|
||||
showModelMessage("请先扫码车辆编号!");
|
||||
return;
|
||||
}
|
||||
uni.showLoading({
|
||||
title:'正在操作'
|
||||
});
|
||||
api.callCoreApi('findEbike', {
|
||||
ecuId,
|
||||
bikeId
|
||||
}, 'get').then(res => {
|
||||
const {
|
||||
code,
|
||||
message
|
||||
} = res;
|
||||
uni.hideLoading();
|
||||
showMessage('指令已下达','success',2000)
|
||||
})
|
||||
}
|
||||
@ -6,7 +6,7 @@ import config from "./config.js";
|
||||
|
||||
const imgPath = config.imgPath;
|
||||
|
||||
export const sdkKey = '1f8f159583f28dfba6eb06deb55e3b56';
|
||||
export const sdkKey = '1f8f159583f28dfba6eb06deb55e3b56';//高德key
|
||||
|
||||
export const getMap = (mapid, instance) => {
|
||||
return uni.createMapContext(mapid, {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user