2025-04-14 10:57:27 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<map id="mapRef" ref="mapRef" style="width: 100%;height: 100vh;" show-location :longitude="location.longitude"
|
|
|
|
|
|
:latitude="location.latitude" :markers="markers" :scale="scale" :polygons="polygons" :polyline="polylines"
|
2025-04-15 10:19:23 +08:00
|
|
|
|
:circles="circles" @markertap="fnshowBikeInfo" />
|
2025-04-14 18:51:04 +08:00
|
|
|
|
<div v-if="!showBikeInfo" class="divMapTools" style="left: 10px;">
|
2025-04-14 10:57:27 +08:00
|
|
|
|
<div>
|
2025-04-15 10:19:23 +08:00
|
|
|
|
<image class="divImg" :src='imgPath+"static/userui/home/localtion.png"' @click="refresh" />
|
2025-04-14 10:57:27 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
2025-04-15 10:19:23 +08:00
|
|
|
|
<image class="divImg" :src='imgPath+"static/userui/home/fault.png"' @click="reportFault" />
|
2025-04-14 10:57:27 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2025-04-15 10:19:23 +08:00
|
|
|
|
<div v-if="!showBikeInfo" class="divMapTools" style="right: 10px;">
|
2025-04-14 10:57:27 +08:00
|
|
|
|
<div>
|
2025-04-15 10:19:23 +08:00
|
|
|
|
<image class="divImg" :src='imgPath+"static/userui/home/packing.png"' @click="getSite" />
|
2025-04-14 10:57:27 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
2025-04-15 10:19:23 +08:00
|
|
|
|
<image class="divImg" :src='imgPath+"static/userui/home/mine.png"' @click="getMine" />
|
2025-04-14 10:57:27 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-if="hasOrder" class="divMapOrder" @click="showOrderInfo">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<image style="width: 15px;height: 15px;margin-left: 15px;margin-right: 10px;"
|
2025-04-15 10:19:23 +08:00
|
|
|
|
:src='imgPath+"static/userui/home/speaker.png"' />
|
2025-04-14 10:57:27 +08:00
|
|
|
|
<label>有骑行订单未支付,请查看</label>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div style="margin-right: 15px;">
|
|
|
|
|
|
<label>查看 <label>></label></label>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="divMapBottom">
|
|
|
|
|
|
<div :class="(hasOrder?'divScanBtnDis ':'')+'divScanBtn'" @click="scanBike">
|
|
|
|
|
|
<uni-icons type="scan" color="white" :size="25"></uni-icons>
|
|
|
|
|
|
<label style="margin-left: 5px;">扫码用车</label>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-if="showOrder" class="divOrder">
|
|
|
|
|
|
<div class="divOrderRow">
|
|
|
|
|
|
<div class="divOrderCell">
|
2025-04-15 10:19:23 +08:00
|
|
|
|
<image class="divOrderImg" :src='imgPath+"static/userui/home/money.png"' />
|
2025-04-14 10:57:27 +08:00
|
|
|
|
<label>费用:</label>
|
|
|
|
|
|
<label>{{order.money}}元</label>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="divOrderCell2">
|
|
|
|
|
|
<label>{{order.bikecode}}</label>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="divOrderRow" style="font-size: 12px;">
|
|
|
|
|
|
<div class="divOrderCell">
|
2025-04-15 10:19:23 +08:00
|
|
|
|
<image class="divOrderImg" :src='imgPath+"static/userui/home/timer.png"' />
|
2025-04-14 10:57:27 +08:00
|
|
|
|
<label>计时:</label>
|
|
|
|
|
|
<label style="color: #61D246;">{{order.time}}</label>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="divOrderCell2">
|
2025-04-15 10:19:23 +08:00
|
|
|
|
<image class="divOrderImg" :src='imgPath+"static/userui/home/bike.png"' />
|
2025-04-14 10:57:27 +08:00
|
|
|
|
<label>骑行:</label>
|
|
|
|
|
|
<label style="color: #61D246;">{{order.mileage}}</label>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="divOderBtn">
|
2025-04-15 10:19:23 +08:00
|
|
|
|
<image v-if="orderState==0" style="width: 120px;height: 40px;" :src='imgPath+"static/userui/home/lock.png"'
|
2025-04-14 10:57:27 +08:00
|
|
|
|
@click="lockRiding" />
|
2025-04-15 10:19:23 +08:00
|
|
|
|
<image v-if="orderState==1" style="width: 120px;height: 40px;" :src=' imgPath+"static/userui/home/run.png"'
|
2025-04-14 10:57:27 +08:00
|
|
|
|
@click="continueRiding" />
|
2025-04-15 10:19:23 +08:00
|
|
|
|
<image style="width: 160px;height: 40px;" :src='imgPath+"static/userui/home/end.png"' @click="endRiding" />
|
2025-04-14 10:57:27 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-if="showMess!=1" class="divMess">
|
|
|
|
|
|
<uni-card>
|
|
|
|
|
|
<uni-list border>
|
|
|
|
|
|
<uni-list-item thumb="/static/userui/home/map1.png" thumb-size="lg">
|
|
|
|
|
|
<template v-slot:body>
|
|
|
|
|
|
<div class="divMessTitle1">服务区域</div>
|
|
|
|
|
|
<div class="divMessTitle2">请在服务区域内骑行</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</uni-list-item>
|
|
|
|
|
|
<uni-list-item thumb="/static/userui/home/map2.png" thumb-size="lg">
|
|
|
|
|
|
<template v-slot:body>
|
|
|
|
|
|
<div class="divMessTitle1">换车区域</div>
|
|
|
|
|
|
<div class="divMessTitle2">还车时确保车辆已经到达还车区域或者距你最近的停车网点</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</uni-list-item>
|
|
|
|
|
|
<uni-list-item thumb="/static/userui/home/map3.png" thumb-size="lg">
|
|
|
|
|
|
<template v-slot:body>
|
|
|
|
|
|
<div class="divMessTitle1">停车网点</div>
|
|
|
|
|
|
<div class="divMessTitle2">还车至停车网点,时长费最多可半价优惠</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</uni-list-item>
|
|
|
|
|
|
</uni-list>
|
|
|
|
|
|
<div class="divMessWorn">
|
|
|
|
|
|
<div class="divMessWornTitle">
|
|
|
|
|
|
·注意事项
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="divMessWornContent">禁止私自加锁或破坏车辆</div>
|
|
|
|
|
|
<div class="divMessWornContent">未满12岁禁止骑行</div>
|
|
|
|
|
|
<div class="divMessWornContent">如车辆故障,及时通过app保修</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="divMessBtn">
|
|
|
|
|
|
<label
|
|
|
|
|
|
style="color: #61D145;border: 1px solid #0000000f;padding: 5px 15px;border-radius: 5px;box-shadow: 2px 2px #0000000a;"
|
|
|
|
|
|
@click="clickMess">已知晓</label>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</uni-card>
|
|
|
|
|
|
</div>
|
2025-04-14 18:51:04 +08:00
|
|
|
|
<div v-if="showBikeInfo" style="position: absolute;z-index: 2000;bottom: 0;width: 100vw;">
|
2025-04-15 10:19:23 +08:00
|
|
|
|
<bike-info bikecode="123456" />
|
2025-04-14 18:51:04 +08:00
|
|
|
|
</div>
|
2025-04-14 10:57:27 +08:00
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
|
import {
|
|
|
|
|
|
ref,
|
|
|
|
|
|
onMounted,
|
|
|
|
|
|
getCurrentInstance
|
|
|
|
|
|
} from 'vue';
|
|
|
|
|
|
import {
|
|
|
|
|
|
showModelMessage,
|
|
|
|
|
|
getUrlParams
|
|
|
|
|
|
} from "@/utils/tools.js";
|
|
|
|
|
|
import {
|
|
|
|
|
|
callOrdereApi,
|
|
|
|
|
|
callOperateApi
|
|
|
|
|
|
} from "@/utils/api.js";
|
2025-04-15 10:19:23 +08:00
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
|
findIndex
|
|
|
|
|
|
} from 'lodash';
|
|
|
|
|
|
import config from '@/utils/config';
|
|
|
|
|
|
|
|
|
|
|
|
const imgPath = config.imgPath;
|
2025-04-14 10:57:27 +08:00
|
|
|
|
|
|
|
|
|
|
const location = ref({
|
|
|
|
|
|
longitude: "",
|
|
|
|
|
|
latitude: ""
|
|
|
|
|
|
});
|
|
|
|
|
|
const scale = ref(15);
|
|
|
|
|
|
const markers = ref([]);
|
|
|
|
|
|
const polygons = ref([]); //面
|
|
|
|
|
|
const polylines = ref([]); //线
|
|
|
|
|
|
const circles = ref([]); //圆
|
|
|
|
|
|
|
|
|
|
|
|
let oMap = null;
|
|
|
|
|
|
|
|
|
|
|
|
const oUser = uni.getStorageSync("wechat_user");
|
|
|
|
|
|
const showMess = ref(uni.getStorageSync("kbike-mess"));
|
|
|
|
|
|
const hasOrder = ref(false); //是否有订单
|
|
|
|
|
|
const showOrder = ref(false);
|
|
|
|
|
|
const order = ref({
|
|
|
|
|
|
bikecode: "123456",
|
|
|
|
|
|
money: "2.5",
|
|
|
|
|
|
time: "22.58min",
|
|
|
|
|
|
mileage: "5.6km"
|
|
|
|
|
|
});
|
|
|
|
|
|
//订单信息
|
|
|
|
|
|
let orderData = {
|
|
|
|
|
|
bikeCode: null,
|
|
|
|
|
|
status: null,
|
|
|
|
|
|
createdAt: null,
|
|
|
|
|
|
orderId: null
|
|
|
|
|
|
};
|
|
|
|
|
|
let orderTimer = null;
|
|
|
|
|
|
const orderState = ref(0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//车辆
|
|
|
|
|
|
let arrBikeData = [];
|
2025-04-15 10:19:23 +08:00
|
|
|
|
const showBikeInfo = ref(false);
|
2025-04-14 10:57:27 +08:00
|
|
|
|
|
|
|
|
|
|
//加载数据
|
2025-04-15 10:19:23 +08:00
|
|
|
|
function getLoalcationData() {
|
2025-04-14 10:57:27 +08:00
|
|
|
|
uni.getLocation({
|
|
|
|
|
|
type: 'gcj02',
|
|
|
|
|
|
geocode: true,
|
|
|
|
|
|
success(res) {
|
|
|
|
|
|
const {
|
|
|
|
|
|
latitude,
|
|
|
|
|
|
longitude
|
|
|
|
|
|
} = res;
|
|
|
|
|
|
location.value = {
|
2025-04-15 10:19:23 +08:00
|
|
|
|
longitude: 103.975457,
|
|
|
|
|
|
latitude: 30.633199
|
|
|
|
|
|
};
|
|
|
|
|
|
const params = {
|
|
|
|
|
|
longitude: 103.975457,
|
|
|
|
|
|
latitude: 30.633199
|
2025-04-14 10:57:27 +08:00
|
|
|
|
};
|
2025-04-15 10:19:23 +08:00
|
|
|
|
callOrdereApi("userOrders/bikeList", params, "post").then(res => {
|
|
|
|
|
|
console.log("11111111111111111", "userOrders/bikeList", res);
|
|
|
|
|
|
const {
|
|
|
|
|
|
code,
|
|
|
|
|
|
data,
|
|
|
|
|
|
message
|
|
|
|
|
|
} = res;
|
|
|
|
|
|
if (code != 200) {
|
2025-04-14 10:57:27 +08:00
|
|
|
|
showModelMessage(message);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-04-15 10:19:23 +08:00
|
|
|
|
arrBikeData = data || [];
|
|
|
|
|
|
const arrData = markers.value || [];
|
2025-04-14 10:57:27 +08:00
|
|
|
|
arrBikeData.map((item) => {
|
2025-04-15 10:19:23 +08:00
|
|
|
|
const {
|
|
|
|
|
|
longitude,
|
|
|
|
|
|
latitude
|
|
|
|
|
|
} = item;
|
|
|
|
|
|
let index = findIndex(arrData, {
|
|
|
|
|
|
longitude,
|
|
|
|
|
|
latitude
|
|
|
|
|
|
});
|
|
|
|
|
|
index = index == -1 ? arrData.length : index;
|
|
|
|
|
|
arrData[index] = addMarker(index, longitude, latitude, "mapbike.png",
|
|
|
|
|
|
true);
|
2025-04-14 10:57:27 +08:00
|
|
|
|
})
|
2025-04-15 10:19:23 +08:00
|
|
|
|
markers.value = arrData;
|
|
|
|
|
|
|
2025-04-14 10:57:27 +08:00
|
|
|
|
})
|
2025-04-15 10:19:23 +08:00
|
|
|
|
|
2025-04-14 10:57:27 +08:00
|
|
|
|
},
|
|
|
|
|
|
fail(res) {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-15 10:19:23 +08:00
|
|
|
|
function clickMess() {
|
2025-04-14 10:57:27 +08:00
|
|
|
|
uni.setStorageSync("kbike-mess", 1);
|
|
|
|
|
|
showMess.value = 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//刷新
|
2025-04-15 10:19:23 +08:00
|
|
|
|
function refresh() {
|
2025-04-14 10:57:27 +08:00
|
|
|
|
getLoalcationData();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//故障上报
|
2025-04-15 10:19:23 +08:00
|
|
|
|
function reportFault() {
|
2025-04-14 10:57:27 +08:00
|
|
|
|
if (!oUser) {
|
|
|
|
|
|
tologin();
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-04-15 10:19:23 +08:00
|
|
|
|
uni.navigateTo({
|
|
|
|
|
|
url: "/pages/user/login/TroubleReportUser"
|
|
|
|
|
|
})
|
2025-04-14 10:57:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//站点
|
2025-04-15 10:19:23 +08:00
|
|
|
|
function getSite() {
|
2025-04-14 10:57:27 +08:00
|
|
|
|
showModelMessage("该功能暂未实现!");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//个人中心
|
2025-04-15 10:19:23 +08:00
|
|
|
|
function getMine() {
|
2025-04-14 10:57:27 +08:00
|
|
|
|
if (!oUser) {
|
|
|
|
|
|
tologin();
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-04-15 10:19:23 +08:00
|
|
|
|
uni.navigateTo({
|
|
|
|
|
|
url: "/pages/user/mine/MePage"
|
|
|
|
|
|
})
|
2025-04-14 10:57:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//扫描
|
2025-04-15 10:19:23 +08:00
|
|
|
|
function scanBike() {
|
2025-04-14 10:57:27 +08:00
|
|
|
|
if (!oUser) {
|
|
|
|
|
|
tologin();
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
const {
|
|
|
|
|
|
userId
|
|
|
|
|
|
} = oUser;
|
|
|
|
|
|
uni.navigateTo({
|
2025-04-15 10:19:23 +08:00
|
|
|
|
url: "/pages/user/scan/scancode?type=ride"
|
2025-04-14 10:57:27 +08:00
|
|
|
|
})
|
2025-04-15 10:19:23 +08:00
|
|
|
|
|
2025-04-14 10:57:27 +08:00
|
|
|
|
}
|
2025-04-15 10:19:23 +08:00
|
|
|
|
|
2025-04-14 10:57:27 +08:00
|
|
|
|
|
|
|
|
|
|
//添加点
|
2025-04-15 10:19:23 +08:00
|
|
|
|
function addMarker(id, longitude, latitude, icon, joinCluster) {
|
2025-04-14 10:57:27 +08:00
|
|
|
|
return {
|
|
|
|
|
|
id: id,
|
|
|
|
|
|
latitude,
|
|
|
|
|
|
longitude,
|
|
|
|
|
|
width: 30,
|
|
|
|
|
|
height: 30,
|
|
|
|
|
|
zIndex: "100",
|
|
|
|
|
|
iconPath: "/static/userui/home/" + icon,
|
2025-04-15 10:19:23 +08:00
|
|
|
|
joinCluster: joinCluster ? true : false
|
2025-04-14 10:57:27 +08:00
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//添加线
|
2025-04-15 10:19:23 +08:00
|
|
|
|
function addLine(scolor, arrPoints) {
|
2025-04-14 10:57:27 +08:00
|
|
|
|
return {
|
|
|
|
|
|
points: arrPoints,
|
|
|
|
|
|
color: scolor,
|
|
|
|
|
|
width: 3
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//显示订单
|
2025-04-15 10:19:23 +08:00
|
|
|
|
function showOrderInfo() {
|
2025-04-14 10:57:27 +08:00
|
|
|
|
showOrder.value = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//获取订单
|
|
|
|
|
|
function getOrder() {
|
|
|
|
|
|
const {
|
|
|
|
|
|
userId
|
|
|
|
|
|
} = oUser;
|
|
|
|
|
|
callOrdereApi("userOrders/checkHistoryOrder", {
|
|
|
|
|
|
userId
|
|
|
|
|
|
}, "get").then(res => {
|
|
|
|
|
|
console.log("111111111111111", "getOrder", res);
|
|
|
|
|
|
const {
|
|
|
|
|
|
code,
|
|
|
|
|
|
data,
|
|
|
|
|
|
message
|
|
|
|
|
|
} = res;
|
|
|
|
|
|
if (code != 200) {
|
|
|
|
|
|
showModelMessage(message);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!data) { //订单完成
|
|
|
|
|
|
completeRiding();
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
const {
|
|
|
|
|
|
bikeCode,
|
|
|
|
|
|
status,
|
|
|
|
|
|
createdAt,
|
|
|
|
|
|
orderId,
|
|
|
|
|
|
tempLock,
|
|
|
|
|
|
ridePoint,
|
|
|
|
|
|
returnPoint
|
|
|
|
|
|
} = data;
|
|
|
|
|
|
//0-进行中 1-已取消 2-待支付 3-已支付 4-退款中 5-已退款
|
|
|
|
|
|
orderState.value = tempLock ? 1 : 0;
|
|
|
|
|
|
orderData = data;
|
2025-04-15 10:19:23 +08:00
|
|
|
|
if (status == 2) {
|
2025-04-14 10:57:27 +08:00
|
|
|
|
completeRiding();
|
2025-04-15 10:19:23 +08:00
|
|
|
|
hasOrder.value = true;
|
2025-04-14 10:57:27 +08:00
|
|
|
|
return;
|
2025-04-15 10:19:23 +08:00
|
|
|
|
} else if (status != 0) {
|
2025-04-14 10:57:27 +08:00
|
|
|
|
completeRiding();
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
showOrder.value = true;
|
|
|
|
|
|
if (!orderTimer) {
|
|
|
|
|
|
console.log("5555555555555555555555555555555");
|
|
|
|
|
|
orderTimer = setInterval(getTracking, 10000);
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2025-04-15 10:19:23 +08:00
|
|
|
|
|
2025-04-14 10:57:27 +08:00
|
|
|
|
//轨迹
|
|
|
|
|
|
function getTracking() {
|
|
|
|
|
|
const {
|
|
|
|
|
|
bikeCode,
|
2025-04-15 10:19:23 +08:00
|
|
|
|
createdAt,
|
|
|
|
|
|
ridePoint,
|
|
|
|
|
|
returnPoint
|
2025-04-14 10:57:27 +08:00
|
|
|
|
} = orderData;
|
|
|
|
|
|
const params = {
|
|
|
|
|
|
ebikeCode: bikeCode,
|
|
|
|
|
|
//startTime: createdAt
|
|
|
|
|
|
startTime: '2025-04-02 09:00:00'
|
|
|
|
|
|
}
|
|
|
|
|
|
callOperateApi("ebikeTracking/query", params, "post").then(res => {
|
|
|
|
|
|
const {
|
|
|
|
|
|
code,
|
|
|
|
|
|
data,
|
|
|
|
|
|
message
|
|
|
|
|
|
} = res;
|
|
|
|
|
|
if (code != 200) {
|
|
|
|
|
|
return;
|
2025-04-15 10:19:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
const arrPoints = !data ? [] : data.map(item => {
|
2025-04-14 10:57:27 +08:00
|
|
|
|
const {
|
|
|
|
|
|
lngGCJ02,
|
|
|
|
|
|
latGCJ02
|
|
|
|
|
|
} = item;
|
|
|
|
|
|
return {
|
|
|
|
|
|
longitude: lngGCJ02,
|
|
|
|
|
|
latitude: latGCJ02
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2025-04-15 10:19:23 +08:00
|
|
|
|
const lng = startPoint[0];
|
|
|
|
|
|
const lat = startPoint[1];
|
|
|
|
|
|
const start = {
|
|
|
|
|
|
longitude: lng,
|
|
|
|
|
|
latitude: lat
|
|
|
|
|
|
}
|
2025-04-14 10:57:27 +08:00
|
|
|
|
// const end={
|
|
|
|
|
|
// longitude: endPoint[0],
|
|
|
|
|
|
// latitude: endPoint[1]
|
|
|
|
|
|
// }
|
2025-04-15 10:19:23 +08:00
|
|
|
|
arrPoints.splice(0, 0, start);
|
2025-04-14 10:57:27 +08:00
|
|
|
|
// arrPoints.push(end);
|
2025-04-15 10:19:23 +08:00
|
|
|
|
|
|
|
|
|
|
const arrMakers = markers.value || [];
|
|
|
|
|
|
const id = 10000000;
|
|
|
|
|
|
let index = findIndex(arrMakers, {
|
|
|
|
|
|
id
|
|
|
|
|
|
});
|
|
|
|
|
|
index = index == -1 ? arrMakers.length : index;
|
|
|
|
|
|
arrMakers[index] = addMarker(id, lng, lat, "mapstart.png");
|
|
|
|
|
|
markers.value = arrMakers[index];
|
|
|
|
|
|
polylines.value = [addLine("#168DED", arrPoints)];
|
2025-04-14 10:57:27 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
2025-04-15 10:19:23 +08:00
|
|
|
|
|
2025-04-14 10:57:27 +08:00
|
|
|
|
//完成骑行
|
2025-04-15 10:19:23 +08:00
|
|
|
|
function completeRiding() {
|
|
|
|
|
|
if (!orderTimer) return;
|
2025-04-14 10:57:27 +08:00
|
|
|
|
clearInterval(orderTimer);
|
2025-04-15 10:19:23 +08:00
|
|
|
|
orderTimer = null;
|
2025-04-14 10:57:27 +08:00
|
|
|
|
showOrder.value = false;
|
|
|
|
|
|
hasOrder.value = false;
|
2025-04-15 10:19:23 +08:00
|
|
|
|
orderState.value = 0;
|
2025-04-14 10:57:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function tologin() {
|
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
|
url: "/pages/user/login/wx_login"
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//临时锁车
|
|
|
|
|
|
function lockRiding() {
|
|
|
|
|
|
showModelMessage("该功能暂未实现!");
|
|
|
|
|
|
orderState.value = 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//结束用车
|
|
|
|
|
|
function endRiding() {
|
|
|
|
|
|
showModelMessage("该功能暂未实现!");
|
2025-04-15 10:19:23 +08:00
|
|
|
|
const {
|
|
|
|
|
|
userId
|
|
|
|
|
|
} = oUser;
|
2025-04-14 10:57:27 +08:00
|
|
|
|
const {
|
|
|
|
|
|
bikeCode
|
|
|
|
|
|
} = orderData;
|
2025-04-15 10:19:23 +08:00
|
|
|
|
const params = {
|
|
|
|
|
|
userId,
|
|
|
|
|
|
bikeCode
|
|
|
|
|
|
}
|
|
|
|
|
|
callOrdereApi("userOrders/doneRide", params, "post").then(res => {
|
|
|
|
|
|
const {
|
|
|
|
|
|
code,
|
|
|
|
|
|
data,
|
|
|
|
|
|
message
|
|
|
|
|
|
} = res;
|
|
|
|
|
|
console.log("111111111111111111111111", "endRiding", res);
|
|
|
|
|
|
if (code != 200) {
|
2025-04-14 10:57:27 +08:00
|
|
|
|
showModelMessage(message);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
completeRiding();
|
|
|
|
|
|
})
|
2025-04-15 10:19:23 +08:00
|
|
|
|
|
2025-04-14 10:57:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//继续骑行 需要开锁
|
|
|
|
|
|
function continueRiding() {
|
|
|
|
|
|
showModelMessage("该功能暂未实现!");
|
|
|
|
|
|
orderState.value = 0;
|
|
|
|
|
|
//getOrder();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-15 10:19:23 +08:00
|
|
|
|
//查看车辆信息
|
|
|
|
|
|
function fnshowBikeInfo() {
|
|
|
|
|
|
showModelMessage("该功能暂未实现!");
|
|
|
|
|
|
showBikeInfo.value = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-14 10:57:27 +08:00
|
|
|
|
getLoalcationData();
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
|
const instance = getCurrentInstance();
|
|
|
|
|
|
oMap = uni.createMapContext("mapRef", {
|
|
|
|
|
|
this: instance.proxy
|
|
|
|
|
|
});
|
|
|
|
|
|
const {
|
|
|
|
|
|
userId
|
|
|
|
|
|
} = oUser;
|
|
|
|
|
|
if (userId) {
|
|
|
|
|
|
getOrder();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
@import url("home.css");
|
|
|
|
|
|
</style>
|