@@ -130,6 +130,8 @@
findIndex
} from 'lodash';
import config from '@/utils/config';
+ import {onShow} from "@dcloudio/uni-app";
+ import * as map from "@/utils/usermap.js";
const imgPath = config.imgPath;
@@ -146,7 +148,7 @@
let oMap = null;
const showTools=ref(true);
- const oUser = uni.getStorageSync("wechat_user");
+ let oUser = null;
const showMess = ref(uni.getStorageSync("kbike-mess"));
const hasOrder = ref(false); //是否有订单
const showOrder = ref(false);
@@ -213,7 +215,7 @@
latitude
});
index = index == -1 ? arrData.length : index;
- arrData[index] = addMarker(index, longitude, latitude, "mapbike.png",
+ arrData[index] = map.addMarker(index, longitude, latitude, "mapbike.png",
true);
})
markers.value = arrData;
@@ -247,9 +249,15 @@
})
}
- //站点
- function getSite() {
- showModelMessage("该功能暂未实现!");
+ //申请站点
+ function applySite() {
+ if (!oUser) {
+ tologin();
+ return;
+ }
+ uni.navigateTo({
+ url:"/pages/user/scan/applysite"
+ })
}
//个人中心
@@ -258,7 +266,7 @@
tologin();
return;
}
- uni.navigateTo({
+ uni.switchTab({
url: "/pages/user/mine/MePage"
})
}
@@ -279,28 +287,8 @@
}
- //添加点
- function addMarker(id, longitude, latitude, icon, joinCluster) {
- return {
- id: id,
- latitude,
- longitude,
- width: 30,
- height: 30,
- zIndex: "100",
- iconPath: imgPath+"static/userui/home/" + icon,
- joinCluster: joinCluster ? true : false
- };
- }
-
- //添加线
- function addLine(scolor, arrPoints) {
- return {
- points: arrPoints,
- color: scolor,
- width: 3
- }
- }
+
+
//显示订单
function openOrderPay() {
showTools.value=false;
@@ -336,7 +324,8 @@
orderId,
tempLock,
ridePoint,
- returnPoint
+ returnPoint,
+ endTime
} = data;
//0-进行中 1-已取消 2-待支付 3-已支付 4-退款中 5-已退款
orderState.value = tempLock ? 1 : 0;
@@ -363,12 +352,16 @@
bikeCode,
createdAt,
ridePoint,
- returnPoint
+ returnPoint,
+ endTime
} = orderData;
- const params = {
+ let params = {
ebikeCode: bikeCode,
startTime: createdAt
}
+ if(endTime) params={...params,endTime}
+
+ console.log("7777777777777",params);
callOperateApi("ebikeTracking/query", params, "post").then(res => {
const {
code,
@@ -378,6 +371,8 @@
if (code != 200) {
return;
}
+
+
const arrPoints = !data ? [] : data.map(item => {
const {
lngGCJ02,
@@ -388,6 +383,8 @@
latitude: latGCJ02
}
})
+ let {lngGCJ02:endlng,latGCJ02:endlat}=data[data.length-1];
+ const startPoint=ridePoint.split(",");
const lng = startPoint[0];
const lat = startPoint[1];
const start = {
@@ -407,9 +404,10 @@
id
});
index = index == -1 ? arrMakers.length : index;
- arrMakers[index] = addMarker(id, lng, lat, "mapstart.png");
- markers.value = arrMakers[index];
- polylines.value = [addLine("#168DED", arrPoints)];
+ arrMakers[index] = map.addMarker(id, lng, lat, "start.png");
+ arrMakers[index+1] = map.addMarker(id, endlng, endlat, "start.png");
+ markers.value =arrMakers;
+ polylines.value = [map.addLine("#168DED", arrPoints)];
})
}
@@ -490,7 +488,8 @@
getLoalcationData();
- onMounted(() => {
+ onShow(() => {
+ oUser=uni.getStorageSync("wechat_user");
console.log("7777777777777777777777",oUser)
const instance = getCurrentInstance();
oMap = uni.createMapContext("mapRef", {
diff --git a/ebike-maintenance/pages/user/scan/applysite.vue b/ebike-maintenance/pages/user/scan/applysite.vue
new file mode 100644
index 0000000..7f59efe
--- /dev/null
+++ b/ebike-maintenance/pages/user/scan/applysite.vue
@@ -0,0 +1,181 @@
+
+
+
+
申请位置
+
+
+
+
原因
+
+
+
+
+ 提交
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ebike-maintenance/utils/map.js b/ebike-maintenance/utils/map.js
index f95206b..c77dbb3 100644
--- a/ebike-maintenance/utils/map.js
+++ b/ebike-maintenance/utils/map.js
@@ -1,6 +1,8 @@
import { showModelMessage } from "./tools.js";
import * as api from "./api.js";
+import config from "./config.js";
+const imgPath=config.imgPath;
export const sdkKey = 'BECBZ-EJIEQ-LUU5N-B5ISQ-3TLMZ-BXFLG';
export const getMap = (mapid, instance) => {
@@ -64,7 +66,7 @@ export const addMarker = (id, longitude, latitude, icon) => {
width: 30,
height: 30,
zIndex: "100",
- iconPath: "/static/map/" + icon
+ iconPath: imgPath+"static/map/" + icon
}
}
diff --git a/ebike-maintenance/utils/usermap.js b/ebike-maintenance/utils/usermap.js
new file mode 100644
index 0000000..7819172
--- /dev/null
+++ b/ebike-maintenance/utils/usermap.js
@@ -0,0 +1,65 @@
+import config from "./config.js";
+
+const imgPath=config.imgPath;
+
+export const sdkKey = 'BECBZ-EJIEQ-LUU5N-B5ISQ-3TLMZ-BXFLG';
+
+//获取当前定位
+export function getLoalcation ( success, fail) {
+ uni.getLocation({
+ type: 'gcj02', // 返回可以用于 wx.openLocation 的经纬度
+ geocode: true,
+ success(res) {
+ const {
+ latitude,
+ longitude
+ } = res;
+ if (success) success({
+ latitude,
+ longitude
+ });
+ },
+ fail(res) {
+ if (fail) fail(res);
+ }
+ });
+}
+
+//逆解析地址
+export function reverseGeocoder (qqmapsdk, longitude, latitude, success, fail) {
+ qqmapsdk.reverseGeocoder({
+ location: {
+ latitude: latitude,
+ longitude: longitude
+ },
+ success: (res) => {
+ if (success) success(res.result);
+ },
+ fail: (res) => {
+ if (fail) success(fail);
+ }
+ })
+}
+
+//添加点
+export function addMarker(id, longitude, latitude, icon, joinCluster) {
+ return {
+ id: id,
+ latitude,
+ longitude,
+ width: 30,
+ height: 30,
+ zIndex: "100",
+ iconPath: imgPath+"static/userui/home/" + icon,
+ joinCluster: joinCluster ? true : false
+ };
+ }
+
+//添加线
+export function addLine(scolor, arrPoints) {
+ return {
+ points: arrPoints,
+ color: scolor,
+ width: 3
+ }
+ }
\ No newline at end of file