申请换车点
This commit is contained in:
parent
cabe086516
commit
ed2c906bd9
@ -333,6 +333,11 @@
|
||||
"style": {
|
||||
"navigationBarTitleText": "手动输入编码"
|
||||
}
|
||||
},{
|
||||
"path": "applysite",
|
||||
"style": {
|
||||
"navigationBarTitleText": "申请还车点"
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
</div>
|
||||
<div v-if="showTools" class="divMapTools" style="right: 10px;">
|
||||
<div>
|
||||
<image class="divImg" :src='imgPath+"static/userui/home/packing.png"' @click="getSite" />
|
||||
<image class="divImg" :src='imgPath+"static/userui/home/packing.png"' @click="applySite" />
|
||||
</div>
|
||||
<div>
|
||||
<image class="divImg" :src='imgPath+"static/userui/home/mine.png"' @click="getMine" />
|
||||
@ -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", {
|
||||
|
||||
181
ebike-maintenance/pages/user/scan/applysite.vue
Normal file
181
ebike-maintenance/pages/user/scan/applysite.vue
Normal file
@ -0,0 +1,181 @@
|
||||
<template>
|
||||
<map :style="{width: '100vw',height: scrollHeight+'px'}" :scale="scale" :longitude="mapcenter.longitude"
|
||||
:latitude="mapcenter.latitude" :markers="markers" @tap="mapTap" />
|
||||
<div class="divInfo">
|
||||
<div class="divTitle">申请位置</div>
|
||||
<div>
|
||||
<uni-easyinput v-model="data.site" placeholder="所在定位 点击地图修改地址" disabled="true" />
|
||||
</div>
|
||||
<div class="divTitle">原因</div>
|
||||
<div>
|
||||
<uni-easyinput v-model="data.reason" placeholder="输入原因" maxlength="100" type="textarea" />
|
||||
</div>
|
||||
<div class="divBtn" @click="submit">
|
||||
提交
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref
|
||||
} from 'vue';
|
||||
import QQMapWX from "qqmap-wx-jssdk";
|
||||
import {
|
||||
onShow
|
||||
} from "@dcloudio/uni-app";
|
||||
import * as map from "@/utils/usermap.js";
|
||||
import {
|
||||
callOrdereApi
|
||||
} from '@/utils/api.js';
|
||||
import {
|
||||
showModelMessage
|
||||
} from "@/utils/tools.js";
|
||||
|
||||
var qqmapsdk = new QQMapWX({
|
||||
key: map.sdkKey
|
||||
});
|
||||
|
||||
const scale = 15;
|
||||
const mapcenter = ref({
|
||||
longitude: null,
|
||||
latitude: null
|
||||
});
|
||||
const markers = ref([]);
|
||||
|
||||
const data = ref({
|
||||
site: "",
|
||||
reason: ""
|
||||
});
|
||||
let oUser = null;
|
||||
|
||||
// 获取设备信息
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
// 获取屏幕高度和状态栏高度
|
||||
const screenHeight = systemInfo.screenHeight;
|
||||
let scrollHeight = screenHeight - 330;
|
||||
|
||||
onShow(() => {
|
||||
oUser = uni.getStorageSync("wechat_user");
|
||||
map.getLoalcation((res) => {
|
||||
const {
|
||||
latitude,
|
||||
longitude
|
||||
} = res;
|
||||
mapcenter.value = {
|
||||
latitude,
|
||||
longitude
|
||||
}
|
||||
getPoint(longitude, latitude);
|
||||
})
|
||||
})
|
||||
|
||||
function getPoint(longitude, latitude) {
|
||||
map.reverseGeocoder(qqmapsdk, longitude, latitude, (res) => {
|
||||
const {
|
||||
address,
|
||||
location: {
|
||||
lat,
|
||||
lng
|
||||
}
|
||||
} = res;
|
||||
data.value = {
|
||||
...data.value,
|
||||
site: address,
|
||||
lat,
|
||||
lng
|
||||
};
|
||||
markers.value = [map.addMarker(0, lng, lat, "point.png")];
|
||||
})
|
||||
}
|
||||
|
||||
function mapTap(e) {
|
||||
const {
|
||||
detail: {
|
||||
latitude,
|
||||
longitude
|
||||
}
|
||||
} = e;
|
||||
getPoint(longitude, latitude);
|
||||
}
|
||||
|
||||
function submit() {
|
||||
const {
|
||||
site,
|
||||
reason,
|
||||
lat,
|
||||
lng
|
||||
} = data.value;
|
||||
if(!reason){
|
||||
showModelMessage("请填写原因!");
|
||||
return;
|
||||
}
|
||||
showModelMessage("确认提交?", "", true).then(
|
||||
() => {
|
||||
const {
|
||||
nickname,
|
||||
mobile
|
||||
} = oUser;
|
||||
|
||||
const params = {
|
||||
applySource: "微信小程序",
|
||||
applyPosition: site,
|
||||
applyLng: lng,
|
||||
applyLat: lat,
|
||||
applyNickname: nickname,
|
||||
applyPhone: mobile,
|
||||
applyReason: reason
|
||||
}
|
||||
uni.showLoading({
|
||||
title:"提交中"
|
||||
})
|
||||
callOrdereApi("ebikeUserBacksite/save", params, "post").then(res => {
|
||||
uni.hideLoading();
|
||||
const {
|
||||
code,
|
||||
data,
|
||||
message
|
||||
} = res;
|
||||
if(code==200){
|
||||
showModelMessage("提交成功!");
|
||||
setTimeout(()=>{
|
||||
uni.switchTab({
|
||||
url:"/pages/user/home/home"
|
||||
})
|
||||
},2000);
|
||||
}
|
||||
else{
|
||||
showModelMessage(message);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.divInfo {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
background: white;
|
||||
padding: 15px;
|
||||
height: 330px;
|
||||
}
|
||||
|
||||
.divTitle {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #000;
|
||||
line-height: 35px;
|
||||
}
|
||||
|
||||
.divBtn {
|
||||
background-color: #61D145;
|
||||
color: white;
|
||||
line-height: 40px;
|
||||
text-align: center;
|
||||
border-radius: 5px;
|
||||
margin-top: 40px;
|
||||
width: 100vw;
|
||||
}
|
||||
</style>
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
65
ebike-maintenance/utils/usermap.js
Normal file
65
ebike-maintenance/utils/usermap.js
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user